api: colors.isSimilar, colors.equals

fix: circular menu icon is not circular when recording
feat: splash ui for built apk
docs: update to latest docs
fix: floating menu not showing automatically
This commit is contained in:
hyb1996
2018-02-02 18:30:08 +08:00
parent d1221d530e
commit c75337a767
25 changed files with 343 additions and 146 deletions

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Images | Auto.js 3.0.0 文档</title>
<title>colors | Auto.js 3.0.0 文档</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
@@ -72,6 +72,19 @@
<div id="toc">
<h2>目录</h2>
<ul>
<li><span class="stability_2"><a href="#images_colors">colors</a></span><ul>
<li><span class="stability_undefined"><a href="#images_colors_tostring_color">colors.toString(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_red_color">colors.red(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_green_color">colors.green(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_blue_color">colors.blue(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_alpha_color">colors.alpha(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_rgb_red_green_blue">colors.rgb(red, green, blue)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_argb_alpha_red_green_blue">colors.argb(alpha, red, green, blue)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_parsecolor_colorstr">colors.parseColor(colorStr)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_issimilar_color2_color2_threshold_algorithm">colors.isSimilar(color2, color2[, threshold, algorithm])</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_equals_color1_color2">colors.equals(color1, color2)</a></span></li>
</ul>
</li>
<li><span class="stability_2"><a href="#images_images">Images</a></span><ul>
<li><span class="stability_undefined"><a href="#images_images_requestscreencapture_landscape">images.requestScreenCapture([landscape])</a></span></li>
<li><span class="stability_undefined"><a href="#images_images_capturescreen">images.captureScreen()</a></span></li>
@@ -90,16 +103,6 @@
<li><span class="stability_undefined"><a href="#images_images_findimageinregion_img_template_x_y_width_height_threshold">images.findImageInRegion(img, template, x, y[, width, height, threshold])</a></span></li>
</ul>
</li>
<li><span class="stability_2"><a href="#images_colors">colors</a></span><ul>
<li><span class="stability_undefined"><a href="#images_colors_tostring_color">colors.toString(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_red_color">colors.red(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_green_color">colors.green(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_blue_color">colors.blue(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_alpha_color">colors.alpha(color)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_rgb_red_green_blue">colors.rgb(red, green, blue)</a></span></li>
<li><span class="stability_undefined"><a href="#images_colors_argb_alpha_red_green_blue">colors.argb(alpha, red, green, blue)</a></span></li>
</ul>
</li>
<li><span class="stability_undefined"><a href="#images_image">Image</a></span><ul>
<li><span class="stability_undefined"><a href="#images_image_getwidth">Image.getWidth()</a></span></li>
<li><span class="stability_undefined"><a href="#images_image_getheight">Image.getHeight()</a></span></li>
@@ -117,7 +120,89 @@
</div>
<div id="apicontent">
<h1>Images<span><a class="mark" href="#images_images" id="images_images">#</a></span></h1>
<h1>colors<span><a class="mark" href="#images_colors" id="images_colors">#</a></span></h1>
<div class="api_stability api_stability_2"><a href="documentation.html#documentation_stability_index">Stability: 2</a> - Stable</div><p>在Auto.js有两种方式表示一个颜色。</p>
<p>一种是使用一个字符串&quot;#AARRGGBB&quot;&quot;#RRGGBB&quot;,其中 AA 是Alpha通道(透明度)的值RR 是R通道(红色)的值GG 是G通道(绿色)的值BB是B通道(蓝色)的值。例如&quot;#ffffff&quot;表示白色, &quot;#7F000000&quot;表示半透明的黑色。</p>
<p>另一种是使用一个16进制的&quot;32位整数&quot; 0xAARRGGBB 来表示一个颜色,例如 <code>0xFF112233</code>表示颜色&quot;#112233&quot;, <code>0x11223344</code>表示颜色&quot;#11223344&quot;</p>
<p>可以通过<code>colors.toString()</code>把颜色整数转换为字符串,通过<code>colors.parseColor()</code>把颜色字符串解析为颜色整数。</p>
<h2>colors.toString(color)<span><a class="mark" href="#images_colors_tostring_color" id="images_colors_tostring_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 整数RGB颜色值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a></li>
</ul>
</div><p>返回颜色值的字符串,格式为 &quot;#AARRGGBB&quot;</p>
<h2>colors.red(color)<span><a class="mark" href="#images_colors_red_color" id="images_colors_red_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回颜色color的R通道的值范围0~255.</p>
<h2>colors.green(color)<span><a class="mark" href="#images_colors_green_color" id="images_colors_green_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回颜色color的G通道的值范围0~255.</p>
<h2>colors.blue(color)<span><a class="mark" href="#images_colors_blue_color" id="images_colors_blue_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回颜色color的B通道的值范围0~255.</p>
<h2>colors.alpha(color)<span><a class="mark" href="#images_colors_alpha_color" id="images_colors_alpha_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回颜色color的Alpha通道的值范围0~255.</p>
<h2>colors.rgb(red, green, blue)<span><a class="mark" href="#images_colors_rgb_red_green_blue" id="images_colors_rgb_red_green_blue">#</a></span></h2>
<div class="signature"><ul>
<li>red <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的R通道的值</li>
<li>blue <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的G通道的值</li>
<li>green <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的B通道的值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回这些颜色通道构成的整数颜色值。Alpha通道将是255不透明</p>
<h2>colors.argb(alpha, red, green, blue)<span><a class="mark" href="#images_colors_argb_alpha_red_green_blue" id="images_colors_argb_alpha_red_green_blue">#</a></span></h2>
<div class="signature"><ul>
<li><code>alpha</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的Alpha通道的值</li>
<li><code>red</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的R通道的值</li>
<li><code>green</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的G通道的值</li>
<li><code>blue</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的B通道的值</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回这些颜色通道构成的整数颜色值。</p>
<h2>colors.parseColor(colorStr)<span><a class="mark" href="#images_colors_parsecolor_colorstr" id="images_colors_parsecolor_colorstr">#</a></span></h2>
<div class="signature"><ul>
<li><code>colorStr</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 表示颜色的字符串,例如&quot;#112233&quot;</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a></li>
</ul>
</div><p>返回颜色的整数值。</p>
<h2>colors.isSimilar(color2, color2[, threshold, algorithm])<span><a class="mark" href="#images_colors_issimilar_color2_color2_threshold_algorithm" id="images_colors_issimilar_color2_color2_threshold_algorithm">#</a></span></h2>
<div class="signature"><ul>
<li><code>color1</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值1</li>
<li><code>color1</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值2</li>
<li><code>threshold</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色相似度临界值默认为4。取值范围为0~255。这个值越大表示允许的相似程度越小如果这个值为0则两个颜色相等时该函数才会返回true。</li>
<li><code>algorithm</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色匹配算法,默认为&quot;diff&quot;, 包括:<ul>
<li>&quot;diff&quot;: 差值匹配。与给定颜色的R、G、B差的绝对值之和小于threshold时匹配。</li>
<li>&quot;rgb&quot;: rgb欧拉距离相似度。与给定颜色color的rgb欧拉距离小于等于threshold时匹配。</li>
<li>&quot;rgb+&quot;: 加权rgb欧拉距离匹配(<a href="https://en.wikipedia.org/wiki/Color_difference">LAB Delta E</a>)。</li>
<li>&quot;hs&quot;: hs欧拉距离匹配。hs为HSV空间的色调值。</li>
</ul>
</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&lt;Boolean&gt;</a></li>
</ul>
</div><p>返回两个颜色是否相似。</p>
<h2>colors.equals(color1, color2)<span><a class="mark" href="#images_colors_equals_color1_color2" id="images_colors_equals_color1_color2">#</a></span></h2>
<div class="signature"><ul>
<li><code>color1</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值1</li>
<li><code>color1</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&lt;string&gt;</a> 颜色值2</li>
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&lt;Boolean&gt;</a></li>
</ul>
</div><p>返回两个颜色是否相等。<em>*注意该函数会忽略Alpha通道的值进行比较</em></p>
<pre><code>log(colors.equals(&quot;#112233&quot;, &quot;#112234&quot;));
log(colors.equals(0xFF112233, 0xFF223344));
</code></pre><h1>Images<span><a class="mark" href="#images_images" id="images_images">#</a></span></h1>
<div class="api_stability api_stability_2"><a href="documentation.html#documentation_stability_index">Stability: 2</a> - Stable</div><p>images模块提供了一些手机设备中常见的图片处理函数包括截图、读写图片、图片剪裁、找色、找图等。</p>
<h2>images.requestScreenCapture([landscape])<span><a class="mark" href="#images_images_requestscreencapture_landscape" id="images_images_requestscreencapture_landscape">#</a></span></h2>
<div class="signature"><ul>
@@ -125,8 +210,8 @@
</ul>
</div><p>向系统申请屏幕截图权限,返回是否请求成功。</p>
<p>第一次使用该函数会弹出截图权限请求,建议选择“总是允许”。</p>
<p>这个函数只是申请截图权限,并不会真正执行截图,真正的截图函数是[captureScreen][]</p>
<p>该函数在截图脚本中只需执行一次,而无需每次调用[captureScreen][]都调用一次。</p>
<p>这个函数只是申请截图权限,并不会真正执行截图,真正的截图函数是<code>captureScreen()</code></p>
<p>该函数在截图脚本中只需执行一次,而无需每次调用<code>captureScreen()</code>都调用一次。</p>
<p><strong>如果不指定landscape值则截图方向由当前设备屏幕方向决定</strong>,因此务必注意执行该函数时的屏幕方向。</p>
<p>建议在本软件界面运行该函数,在其他软件界面运行时容易出现一闪而过的黑屏现象。 </p>
<p>示例:</p>
@@ -379,48 +464,6 @@ if(p){
threshold: threshold
})
</code></pre><p>该函数也可以作为全局函数使用。</p>
<h1>colors<span><a class="mark" href="#images_colors" id="images_colors">#</a></span></h1>
<div class="api_stability api_stability_2"><a href="documentation.html#documentation_stability_index">Stability: 2</a> - Stable</div><p>colors是颜色处理的工具对象。包含一些常用方法包括android.graphics.Color的所有方法以及toString方法。</p>
<h2>colors.toString(color)<span><a class="mark" href="#images_colors_tostring_color" id="images_colors_tostring_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 整数RGB颜色值</li>
</ul>
</div><p>返回颜色值的字符串,格式为 #AARRGGBB。</p>
<h2>colors.red(color)<span><a class="mark" href="#images_colors_red_color" id="images_colors_red_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 整数RGB颜色值</li>
</ul>
</div><p>返回颜色color的R通道的值范围0~255.</p>
<h2>colors.green(color)<span><a class="mark" href="#images_colors_green_color" id="images_colors_green_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 整数RGB颜色值</li>
</ul>
</div><p>返回颜色color的G通道的值范围0~255.</p>
<h2>colors.blue(color)<span><a class="mark" href="#images_colors_blue_color" id="images_colors_blue_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 整数RGB颜色值</li>
</ul>
</div><p>返回颜色color的B通道的值范围0~255.</p>
<h2>colors.alpha(color)<span><a class="mark" href="#images_colors_alpha_color" id="images_colors_alpha_color">#</a></span></h2>
<div class="signature"><ul>
<li><code>color</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 整数RGB颜色值</li>
</ul>
</div><p>返回颜色color的Alpha通道的值范围0~255.</p>
<h2>colors.rgb(red, green, blue)<span><a class="mark" href="#images_colors_rgb_red_green_blue" id="images_colors_rgb_red_green_blue">#</a></span></h2>
<div class="signature"><ul>
<li>red <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的R通道的值</li>
<li>blue <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的G通道的值</li>
<li>green <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的B通道的值</li>
</ul>
</div><p>返回这些颜色通道构成的整数颜色值。Alpha通道将是255不透明</p>
<h2>colors.argb(alpha, red, green, blue)<span><a class="mark" href="#images_colors_argb_alpha_red_green_blue" id="images_colors_argb_alpha_red_green_blue">#</a></span></h2>
<div class="signature"><ul>
<li><code>alpha</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的Alpha通道的值</li>
<li><code>red</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的R通道的值</li>
<li><code>green</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的G通道的值</li>
<li><code>blue</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&lt;number&gt;</a> 颜色的B通道的值</li>
</ul>
</div><p>返回这些颜色通道构成的整数颜色值。</p>
<h1>Image<span><a class="mark" href="#images_image" id="images_image">#</a></span></h1>
<p>表示一张图片,可以是截图的图片,或者本地读取的图片,或者从网络获取的图片。</p>
<h2>Image.getWidth()<span><a class="mark" href="#images_image_getwidth" id="images_image_getwidth">#</a></span></h2>

View File

@@ -103,6 +103,7 @@
<li>threads: 多线程支持。</li>
<li>ui: UI界面。用于显示自定义的UI界面和用户交互。</li>
</ul>
<p>除此之外Auto.js内置了对<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a></p>
</div>
</div>

View File

@@ -53,28 +53,28 @@
},
{
"key": "openAppSetting",
"url": "globals.html#globals_getappname_packagename",
"url": "app.html#app_app_openappsetting_packagename",
"summary": "应用设置页"
},
{
"key": "sendEmail",
"url": "globals.html#globals_getappname_packagename",
"summary": "应用设置页"
"url": "app.html#app_app_sendemail_options",
"summary": "发送邮件"
},
{
"key": "intent",
"url": "globals.html#globals_getpackagename_appname",
"summary": "获取包名"
"url": "app.html#app_app_intent_options",
"summary": "意图"
},
{
"key": "startActivity",
"url": "globals.html#globals_getpackagename_appname",
"summary": "获取包名"
"url": "app.html#app_app_startactivity_options",
"summary": "启动活动"
},
{
"key": "sendBroadcast",
"url": "globals.html#globals_getpackagename_appname",
"summary": "获取包名"
"url": "app.html#app_app_sendbroadcast_options",
"summary": "发送广播"
}
]
},
@@ -206,6 +206,26 @@
"key": "assert",
"url": "console.html#console_console_assert_value_message",
"summary": "断言"
},
{
"key": "input",
"url": "console.html#console_console_input_data_args",
"summary": "输入"
},
{
"key": "rawInput",
"url": "console.html#console_console_rawinput_data_args",
"summary": "输入字符串"
},
{
"key": "setSize",
"url": "console.html#console_console_setsize_w_h",
"summary": "输入字符串"
},
{
"key": "setPosition",
"url": "console.html#console_console_setposition_x_y",
"summary": "设置位置"
}
]
},
@@ -216,42 +236,42 @@
"properties": [
{
"key": "select",
"url": "",
"url": "dialogs.html#dialogs_dialogs_select_title_items_callback",
"summary": "选择"
},
{
"key": "singleChoice",
"url": "",
"url": "dialogs.html#dialogs_dialogs_singlechoice_title_items_index_callback",
"summary": "单选"
},
{
"key": "multiChoice",
"url": "",
"url": "dialogs.html#dialogs_dialogs_multichoice_title_items_indices_callback",
"summary": "多选"
},
{
"key": "rawInput",
"url": "",
"url": "dialogs.html#dialogs_dialogs_rawinput_title_prefill_callback",
"summary": "输入字符串"
},
{
"key": "input",
"url": "",
"url": "dialogs.html#dialogs_dialogs_input_title_prefill_callback",
"summary": "输入"
},
{
"key": "alert",
"url": "",
"url": "dialogs.html#dialogs_dialogs_alert_title_content_callback",
"summary": "消息框"
},
{
"key": "confirm",
"url": "",
"url": "dialogs.html#dialogs_dialogs_confirm_title_content_callback",
"summary": "确认框"
},
{
"key": "prompt",
"url": "",
"url": "dialogs.html#dialogs_dialogs_prompt_title_prefill_callback",
"summary": "输入字符串"
}
]
@@ -262,8 +282,8 @@
"summary": "图色",
"properties": [
{
"key": "saveImage",
"url": "images.html#images_images_saveimage_image_path",
"key": "save",
"url": "images.html#images_images_save_image_path",
"summary": "保存图片"
},
{
@@ -273,12 +293,22 @@
},
{
"key": "read",
"url": "",
"url": "images.html#images_images_read_path",
"summary": "读取图片"
},
{
"key": "load",
"url": "images.html#images_images_load_url",
"summary": "加载图片"
},
{
"key": "clip",
"url": "images.html#images_images_clip_img_x_y_w_h",
"summary": "剪切图片"
},
{
"key": "requestScreenCapture",
"url": "images.html#images_requestscreencapture_width_height",
"url": "images.html#images_images_requestscreencapture_landscape",
"summary": "请求截屏",
"global": true
},
@@ -305,6 +335,29 @@
"url": "images.html#images_images_findcolorequals_img_color_x_y_width_height_threads",
"summary": "精确找色",
"global": true
},
{
"key": "findMultiColors",
"url": "images.html#images_images_clip_img_x_y_w_h",
"summary": "多点找色",
"global": true
},
{
"key": "detectsColor",
"url": "images.html#images_images_detectscolor_image_color_x_y_threshold_16_algorithm_diff",
"summary": "颜色检测"
},
{
"key": "findImage",
"url":"images.html#images_images_findimage_img_template_options",
"summary": "找图",
"global": true
},
{
"key": "findImageInRegion",
"url":"images.html#images_images_findimageinregion_img_template_x_y_width_height_threshold",
"summary": "区域找图",
"global": true
}
]
},
@@ -341,12 +394,27 @@
{
"key": "rgb",
"url": "images.html#images_colors_rgb_red_green_blue",
"summary": ""
"summary": "RGB"
},
{
"key": "argb",
"url": "images.html#images_colors_argb_alpha_red_green_blue",
"summary": ""
"summary": "ARGB"
},
{
"key": "parseColor",
"url": "images.html#images_colors_parsecolor_colorstr",
"summary": "字符串转颜色"
},
{
"key": "isSimilar",
"url": "images.html#images_colors_issimilar_color2_color2_threshold_algorithm",
"summary": "颜色相似"
},
{
"key": "equals",
"url": "images.html#images_colors_equals_color1_color2",
"summary": "颜色相等"
}
]
},
@@ -549,8 +617,8 @@
"summary": "创建文件"
},
{
"key": "createIfNotExists",
"url": "files.html#files_files_createifnotexists_path",
"key": "createWithDirs",
"url": "files.html#files_files_createwithdirs_path",
"summary": "创建文件"
},
{

View File

@@ -85,12 +85,7 @@ public abstract class BaseActivity extends AppCompatActivity {
toolbar.setTitle(title);
activity.setSupportActionBar(toolbar);
if (activity.getSupportActionBar() != null) {
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.finish();
}
});
toolbar.setNavigationOnClickListener(v -> activity.finish());
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}

View File

@@ -5,14 +5,13 @@ import android.content.Intent;
import android.text.TextUtils;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog;
import com.makeramen.roundedimageview.RoundedImageView;
import com.stardust.app.DialogUtils;
import com.stardust.app.OperationDialogBuilder;
import com.stardust.autojs.core.record.Recorder;
import com.stardust.autojs.runtime.api.Dialogs;
import com.stardust.enhancedfloaty.FloatyService;
import com.stardust.floatingcircularactionmenu.CircularActionMenu;
import com.stardust.floatingcircularactionmenu.CircularActionMenuFloatingWindow;
@@ -34,7 +33,6 @@ import com.stardust.theme.dialog.ThemeColorMaterialDialogBuilder;
import com.stardust.util.ClipboardUtil;
import com.stardust.view.accessibility.LayoutInspector;
import com.stardust.view.accessibility.NodeInfo;
import com.stericson.RootShell.RootShell;
import org.greenrobot.eventbus.EventBus;
import org.jdeferred.Deferred;
@@ -77,7 +75,7 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
CircularActionMenuFloatingWindow mWindow;
private int mState;
private ImageView mActionViewIcon;
private RoundedImageView mActionViewIcon;
private Context mContext;
private GlobalActionRecorder mRecorder;
private MaterialDialog mSettingsDialog;
@@ -113,7 +111,7 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
@Override
public View inflateActionView(FloatyService service, CircularActionMenuFloatingWindow window) {
View actionView = View.inflate(service, R.layout.circular_action_view, null);
mActionViewIcon = (ImageView) actionView.findViewById(R.id.icon);
mActionViewIcon = (RoundedImageView) actionView.findViewById(R.id.icon);
return actionView;
}
@@ -169,13 +167,13 @@ public class CircularMenu implements Recorder.OnStateChangedListener, LayoutInsp
mState = state;
mActionViewIcon.setImageResource(mState == STATE_RECORDING ? R.drawable.ic_ali_record :
IC_ACTION_VIEW);
// mActionViewIcon.setBackgroundColor(mState == STATE_RECORDING ? mContext.getResources().getColor(R.color.color_red) :
// Color.WHITE);
mActionViewIcon.setBackgroundResource(mState == STATE_RECORDING ? R.drawable.circle_red :
0);
if (state == STATE_RECORDING) {
mActionViewIcon.setPadding(28, 28, 28, 28);
} else {
mActionViewIcon.setPadding(0, 0, 0, 0);
}
R.drawable.circle_white);
int padding = (int) mContext.getResources().getDimension(mState == STATE_RECORDING ?
R.dimen.padding_circular_menu_recording : R.dimen.padding_circular_menu_normal);
mActionViewIcon.setPadding(padding, padding, padding, padding);
EventBus.getDefault().post(new StateChangeEvent(mState, previousState));
}

View File

@@ -131,6 +131,7 @@ public class DrawerFragment extends android.support.v4.app.Fragment {
ThemeColorManager.addViewBackground(mHeaderView);
initMenuItems();
if (Pref.isFloatingMenuShown()) {
FloatyWindowManger.showCircularMenu();
setChecked(mFloatingWindowItem, true);
}
setChecked(mConnectionItem, DevPluginService.getInstance().isConnected());

View File

@@ -10,8 +10,9 @@
android:layout_width="42dp"
android:layout_height="42dp"
android:background="@drawable/circle_white"
android:padding="5dp"
android:padding="@dimen/padding_circular_menu_normal"
android:src="@drawable/ic_android_eat_js"
app:riv_corner_radius="16dp"
app:riv_mutate_background="true"
app:riv_oval="true"/>
</LinearLayout>

View File

@@ -10,4 +10,5 @@
<color name="prefTextColorSecondary">#9DA0A2</color>
<color name="prefTextColorPrimary">#282C2F</color>
<color name="divider_functions_keyboard">#f0f0f0</color>
<color name="color_red">#ef5350</color>
</resources>

View File

@@ -9,4 +9,6 @@
<dimen name="fab_margin">16dp</dimen>
<dimen name="textSize_item_property">14sp</dimen>
<dimen name="divider_drawer_menu_group">6dp</dimen>
<dimen name="padding_circular_menu_recording">8dp</dimen>
<dimen name="padding_circular_menu_normal">5dp</dimen>
</resources>

View File

@@ -15,6 +15,7 @@
android:name=".execution.ScriptExecuteActivity"
android:theme="@style/AppTheme"/>
<activity
android:name="com.stardust.autojs.core.image.ScreenCaptureRequestActivity"
android:excludeFromRecents="true"

View File

@@ -5,17 +5,31 @@ module.exports = function(__runtime__, scope){
var images = {};
var colors = Object.create(__runtime__.colors);
colors.alpha = function(color){
color = parseColor(color);
return color >>> 24;
}
colors.red = function(color){
color = parseColor(color);
return (color >> 16) & 0xFF;
}
colors.green = function(color){
color = parseColor(color);
return (color >> 8) & 0xFF;
}
colors.blue = function(color){
color = parseColor(color);
return color & 0xFF;
}
colors.isSimilar = function(c1, c2, threshold, algorithm){
c1 = parseColor(c1);
c2 = parseColor(c2);
threshold = threshold == undefined ? 4 : threshold;
algorithm = algorithm == undefined ? "diff" : algorithm;
var colorDetector = getColorDetector(c1, algorithm, threshold);
return colorDetector.detectsColor(colors.red(c2), colors.green(c2), colors.blue(c2));
}
if(android.os.Build.VERSION.SDK_INT < 19){
return images;
}
@@ -167,12 +181,8 @@ module.exports = function(__runtime__, scope){
function parseColor(color){
if(typeof(color) == 'string'){
if(color.startsWith('#')){
return parseInt('0x' + color.substring(1));
}else{
return parseInt('0x' + color);
}
}
color = colors.parseColor(color);
}
return color;
}

View File

@@ -1,29 +0,0 @@
/**
* @license
* Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core -o ./dist/lodash.core.js`
*/
;(function(){function n(n){return K(n)&&pn.call(n,"callee")&&!bn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?nn:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");
return setTimeout(function(){n.apply(nn,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===nn?i===i:r(i,c)))var c=i,f=o}return f}function l(n,t){var r=[];return mn(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function p(n,r,e,u,o){var i=-1,c=n.length;for(e||(e=D),o||(o=[]);++i<c;){var f=n[i];0<r&&e(f)?1<r?p(f,r-1,e,u,o):t(o,f):u||(o[o.length]=f)}return o}function s(n,t){return n&&On(n,t,In);
}function h(n,t){return l(t,function(t){return V(n[t])})}function v(n,t){return n>t}function y(n,t,r,e,u){return n===t||(null==n||null==t||!K(n)&&!K(t)?n!==n&&t!==t:b(n,t,r,e,y,u))}function b(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){
return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=B(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=M(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=R(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t,
r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?Y:(typeof n=="object"?d:r)(n)}function _(n,t){return n<t}function j(n,t){var r=-1,e=U(n)?Array(n.length):[];return mn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function d(n){var t=_n(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];if(!(u in r&&y(n[u],r[u],3)))return false}return true}}function m(n,t){return n=Object(n),G(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function O(n){return xn(q(n,void 0,Y),n+"");
}function x(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function A(n){return x(n,0,n.length)}function E(n,t){var r;return mn(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function w(n,r){return G(r,function(n,r){return r.func.apply(r.thisArg,t([n],r.args))},n)}function k(n,t,r,e){var u=!r;r||(r={});for(var o=-1,i=t.length;++o<i;){var c=t[o],f=e?e(r[c],n[c],c,r,n):nn;if(f===nn&&(f=n[c]),u)r[c]=f;else{var a=r,l=a[c];
pn.call(a,c)&&M(l,f)&&(f!==nn||c in a)||(a[c]=f)}}return r}function N(n){return O(function(t,r){var e=-1,u=r.length,o=1<u?r[u-1]:nn,o=3<n.length&&typeof o=="function"?(u--,o):nn;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function F(n){return function(){var t=arguments,r=dn(n.prototype),t=n.apply(r,t);return H(t)?t:r}}function S(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==on&&this instanceof e?u:n;++c<f;)a[c]=r[c];for(;i--;)a[c++]=arguments[++o];
return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=F(n);return e}function T(n,t,r,e){return n===nn||M(n,ln[r])&&!pn.call(e,r)?t:n}function B(n,t,r,e,u,o){var i=n.length,c=t.length;if(i!=c&&!(1&r&&c>i))return false;for(var c=-1,f=true,a=2&r?[]:nn;++c<i;){var l=n[c],p=t[c];if(void 0!==nn){f=false;break}if(a){if(!E(t,function(n,t){if(!z(a,t)&&(l===n||u(l,n,r,e,o)))return a.push(t)})){f=false;break}}else if(l!==p&&!u(l,p,r,e,o)){f=false;break}}return f}function R(n,t,r,e,u,o){
var i=1&r,c=In(n),f=c.length,a=In(t).length;if(f!=a&&!i)return false;for(var l=f;l--;){var p=c[l];if(!(i?p in t:pn.call(t,p)))return false}for(a=true;++l<f;){var p=c[l],s=n[p],h=t[p];if(void 0!==nn||s!==h&&!u(s,h,r,e,o)){a=false;break}i||(i="constructor"==p)}return a&&!i&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(a=false)),a}function D(t){return Nn(t)||n(t)}function I(n){var t=[];if(null!=n)for(var r in Object(n))t.push(r);
return t}function q(n,t,r){return t=jn(t===nn?n.length-1:t,0),function(){for(var e=arguments,u=-1,o=jn(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];for(u=-1,o=Array(t+1);++u<t;)o[u]=e[u];return o[t]=r(i),n.apply(this,o)}}function $(n){return(null==n?0:n.length)?p(n,1):[]}function P(n){return n&&n.length?n[0]:nn}function z(n,t,r){var e=null==n?0:n.length;r=typeof r=="number"?0>r?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1}function C(n,t){return mn(n,g(t));
}function G(n,t,r){return e(n,g(t),r,3>arguments.length,mn)}function J(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=nn),r}}function M(n,t){return n===t||n!==n&&t!==t}function U(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1<t&&0==t%1&&9007199254740991>=t),t&&!V(n)}function V(n){return!!H(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n);
}function H(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function K(n){return null!=n&&typeof n=="object"}function L(n){return typeof n=="number"||K(n)&&"[object Number]"==hn.call(n)}function Q(n){return typeof n=="string"||!Nn(n)&&K(n)&&"[object String]"==hn.call(n)}function W(n){return typeof n=="string"?n:null==n?"":n+""}function X(n){return null==n?[]:u(n,In(n))}function Y(n){return n}function Z(n,r,e){var u=In(r),o=h(r,u);null!=e||H(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,In(r)));
var i=!(H(e)&&"chain"in e&&!e.chain),c=V(n);return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var nn,tn=1/0,rn=/[&<>"']/g,en=RegExp(rn.source),un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){
return function(t){return null==n?nn:n[t]}}({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,yn=Object.create,bn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return H(t)?yn?yn(t):(n.prototype=t,t=new n,n.prototype=nn,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i;
var mn=function(n,t){return function(r,e){if(null==r)return r;if(!U(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(s),On=function(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var c=e[n?i:++u];if(false===r(o[c],c,o))break}return t}}(),xn=Y,An=function(n){return function(t,r,e){var u=Object(t);if(!U(t)){var o=g(r);t=In(t),r=function(n){return o(u[n],n,u)}}return r=n(t,r,e),-1<r?u[o?t[r]:r]:nn}}(function(n,t,r){var e=null==n?0:n.length;
if(!e)return-1;r=null==r?0:Fn(r),0>r&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++r<e;)if(t(n[r],r,n)){n=r;break n}n=-1}return n}),En=O(function(n,t,r){return S(n,t,r)}),wn=O(function(n,t){return c(n,1,t)}),kn=O(function(n,t,r){return c(n,Sn(t)||0,r)}),Nn=Array.isArray,Fn=Number,Sn=Number,Tn=N(function(n,t){k(t,_n(t),n)}),Bn=N(function(n,t){k(t,I(t),n)}),Rn=N(function(n,t,r,e){k(t,qn(t),n,e)}),Dn=O(function(n){return n.push(nn,T),Rn.apply(nn,n)}),In=_n,qn=I,$n=function(n){return xn(q(n,nn,$),n+"");
}(function(n,t){return null==n?{}:m(n,t)});o.assignIn=Bn,o.before=J,o.bind=En,o.chain=function(n){return n=o(n),n.__chain__=true,n},o.compact=function(n){return l(n,Boolean)},o.concat=function(){var n=arguments.length;if(!n)return[];for(var r=Array(n-1),e=arguments[0];n--;)r[n-1]=arguments[n];return t(Nn(e)?A(e):[e],p(r,1))},o.create=function(n,t){var r=dn(n);return null==t?r:Tn(r,t)},o.defaults=Dn,o.defer=wn,o.delay=kn,o.filter=function(n,t){return l(n,g(t))},o.flatten=$,o.flattenDeep=function(n){
return(null==n?0:n.length)?p(n,tn):[]},o.iteratee=g,o.keys=In,o.map=function(n,t){return j(n,g(t))},o.matches=function(n){return d(Tn({},n))},o.mixin=Z,o.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},o.once=function(n){return J(2,n)},o.pick=$n,o.slice=function(n,t,r){var e=null==n?0:n.length;return r=r===nn?e:+r,e?x(n,null==t?0:+t,r):[]},o.sortBy=function(n,t){var e=0;return t=g(t),j(j(n,function(n,r,u){return{
value:n,index:e++,criteria:t(n,r,u)}}).sort(function(n,t){var r;n:{r=n.criteria;var e=t.criteria;if(r!==e){var u=r!==nn,o=null===r,i=r===r,c=e!==nn,f=null===e,a=e===e;if(!f&&r>e||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r<e||f&&u&&i||!c&&i||!a){r=-1;break n}}r=0}return r||n.index-t.index}),r("value"))},o.tap=function(n,t){return t(n),n},o.thru=function(n,t){return t(n)},o.toArray=function(n){return U(n)?n.length?A(n):[]:X(n)},o.values=X,o.extend=Bn,Z(o,o),o.clone=function(n){return H(n)?Nn(n)?A(n):k(n,_n(n)):n;
},o.escape=function(n){return(n=W(n))&&en.test(n)?n.replace(rn,fn):n},o.every=function(n,t,r){return t=r?nn:t,f(n,g(t))},o.find=An,o.forEach=C,o.has=function(n,t){return null!=n&&pn.call(n,t)},o.head=P,o.identity=Y,o.indexOf=z,o.isArguments=n,o.isArray=Nn,o.isBoolean=function(n){return true===n||false===n||K(n)&&"[object Boolean]"==hn.call(n)},o.isDate=function(n){return K(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return U(t)&&(Nn(t)||Q(t)||V(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){
return y(n,t)},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=V,o.isNaN=function(n){return L(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=L,o.isObject=H,o.isRegExp=function(n){return K(n)&&"[object RegExp]"==hn.call(n)},o.isString=Q,o.isUndefined=function(n){return n===nn},o.last=function(n){var t=null==n?0:n.length;return t?n[t-1]:nn},o.max=function(n){return n&&n.length?a(n,Y,v):nn},o.min=function(n){return n&&n.length?a(n,Y,_):nn},o.noConflict=function(){return on._===this&&(on._=vn),
this},o.noop=function(){},o.reduce=G,o.result=function(n,t,r){return t=null==n?nn:n[t],t===nn&&(t=r),V(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=U(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?nn:t,E(n,g(t))},o.uniqueId=function(n){var t=++sn;return W(n)+t},o.each=C,o.first=P,Z(o,function(){var n={};return s(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.17.4",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){
var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Nn(u)?u:[],n)}return this[r](function(r){return t.apply(Nn(r)?r:[],n)})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o,
define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this);

View File

@@ -50,6 +50,28 @@ public class Colors {
}
public String toString(int color) {
return "#" + Integer.toHexString(color);
StringBuilder c = new StringBuilder(Integer.toHexString(color));
while (c.length() < 6) {
c.insert(0, "0");
}
return "#" + c;
}
public boolean equals(int c1, int c2) {
return (c1 & 0xffffff) == (c2 & 0xffffff);
}
public boolean equals(int c1, String c2) {
return equals(c1, parseColor(c2));
}
public boolean equals(String c1, int c2) {
return equals(parseColor(c1), c2);
}
public boolean equals(String c1, String c2) {
return equals(parseColor(c1), parseColor(c2));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@@ -18,6 +18,12 @@
android:theme="@style/AppTheme"
tools:replace="android:label, android:allowBackup">
<activity android:name=".MainActivity">
</activity>
<activity
android:name=".SplashActivity"
android:theme="@style/AppTheme.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Binary file not shown.

View File

@@ -9,6 +9,7 @@ import android.preference.PreferenceManager;
public class Pref {
private static final String KEY_FIRST_USING = "key_first_using";
private static SharedPreferences sPreferences;
public static SharedPreferences getPreferences() {
@@ -36,4 +37,12 @@ public class Pref {
public static boolean shouldStopAllScriptsWhenVolumeUp() {
return getPreferences().getBoolean(getString(R.string.key_use_volume_control_running), true);
}
public static boolean isFirstUsing() {
boolean firstUsing = getPreferences().getBoolean(KEY_FIRST_USING, true);
if (firstUsing) {
getPreferences().edit().putBoolean(KEY_FIRST_USING, false).apply();
}
return firstUsing;
}
}

View File

@@ -28,8 +28,8 @@ public class SettingsActivity extends AppCompatActivity {
getFragmentManager().beginTransaction().replace(R.id.fragment_setting, new PreferenceFragment()).commit();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(R.string.text_settings);
toolbar.setNavigationOnClickListener(v -> finish());
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(v -> finish());
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

View File

@@ -0,0 +1,36 @@
package com.stardust.auojs.inrt;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
/**
* Created by Stardust on 2018/2/2.
*/
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!Pref.isFirstUsing()) {
main();
return;
}
setContentView(R.layout.activity_splash);
TextView slug = (TextView) findViewById(R.id.slug);
slug.setTypeface(Typeface.createFromAsset(getAssets(), "roboto_medium.ttf"));
new Handler().postDelayed(this::main, 2500);
}
private void main() {
startActivity(new Intent(this, MainActivity.class));
finish();
}
}

View File

@@ -10,12 +10,14 @@
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>

View File

@@ -10,12 +10,14 @@
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:src="@drawable/autojs_material"/>
<TextView
android:id="@+id/slug"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="12dp"
android:text="@string/powered_by_autojs"
android:textColor="#dd000000"
android:textSize="14sp"/>
</FrameLayout>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@@ -19,4 +19,5 @@
<string name="key_dont_show_main_activity">key_dont_show_main_activity</string>
<string name="summary_dont_show_main_activity">打开应用后直接运行脚本</string>
<string name="text_others">其他</string>
<string name="powered_by_autojs">Powered by Auto.js</string>
</resources>

View File

@@ -8,4 +8,15 @@
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Splash" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
</resources>