optimize: util.format

This commit is contained in:
hyb1996
2017-11-29 20:04:50 +08:00
parent 6dfd35683a
commit 92f296cc19
5 changed files with 69 additions and 8 deletions

View File

@@ -19,7 +19,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:name=".App"
android:allowBackup="false"
android:icon="@drawable/ic_android_eat_js"
android:icon="@drawable/autojs_material"
android:label="@string/_app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
@@ -134,7 +134,7 @@
<activity
android:name=".external.open.EditIntentActivity"
android:icon="@drawable/autojs_logo"
android:icon="@drawable/autojs_material"
android:label="@string/text_edit_script">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
@@ -151,7 +151,7 @@
</activity>
<activity
android:name=".external.open.RunIntentActivity"
android:icon="@drawable/autojs_logo"
android:icon="@drawable/autojs_material"
android:label="@string/text_run_script"
android:taskAffinity="com.stardust.scriptdroid.external.open.RunIntentActivity"
android:theme="@android:style/Theme.NoDisplay">
@@ -170,7 +170,7 @@
</activity>
<activity
android:name=".external.open.ImportIntentActivity"
android:icon="@drawable/autojs_logo"
android:icon="@drawable/autojs_material"
android:label="@string/text_import_script"
android:theme="@style/AppTheme.Transparent">
<intent-filter>

View File

@@ -0,0 +1,54 @@
"ui";
ui.layout(
<vertical>
<text textSize="18sp" textColor="#000000" margin="20" textStyle="bold">
关于Auto.js的用户调查
</text>
<ScrollView>
<vertical>
<text textSize="16sp" margin="8">1. 您的年龄是?</text>
<input text="18" inputType="number" margin="0 16"/>
<text textSize="16sp" margin="8">2. 您用过其他类似软件(脚本精灵按键精灵等)?</text>
<RadioGroup margin="0 16">
<RadioButton text="没有用过"/>
<RadioButton text="用过"/>
<RadioButton text="用过,感觉不好用"/>
<RadioButton text="没有Root权限无法使用"/>
</RadioGroup>
<text textSize="16sp" margin="8">3. 您使用Auto.js通常用于做什么?(多选)</text>
<CheckBox text="游戏辅助" marginLeft="16"/>
<CheckBox text="点赞" marginLeft="16"/>
<CheckBox text="日常生活工作辅助" marginLeft="16"/>
<CheckBox text="练习编程" marginLeft="16"/>
<CheckBox text="自动化测试" marginLeft="16"/>
<linear>
<CheckBox text="其他" marginLeft="16"/>
<input w="*" margin="0 16"/>
</linear>
<text textSize="16sp" margin="8">4. 您更喜欢以下哪个图标?</text>
<RadioGroup margin="0 16">
<RadioButton/>
<img w="100" h="100" margin="0 16" src="http://www.autojs.org/assets/uploads/profile/3-profileavatar.png"/>
<RadioButton/>
<img w="100" h="100" margin="0 16" src="http://www.autojs.org/assets/uploads/files/1511945512596-autojs_logo.png"/>
</RadioGroup>
<text textSize="16sp" margin="8">5. 您是什么时候开始使用Auto.js的呢?</text>
<DatePicker margin="4 16"/>
<text textSize="16sp" margin="8">6. 您用过下面这个Auto.js的论坛吗?</text>
<com.stardust.scriptdroid.ui.widget.EWebView id="webview" h="300" margin="0 16"/>
<RadioGroup marginLeft="16" marginTop="16">
<RadioButton text="没有用过"/>
<RadioButton text="用过"/>
<RadioButton text="用过,感觉不好用"/>
</RadioGroup>
<linear gravity="center">
<button margin="16">提交</button>
<button margin="16">放弃</button>
</linear>
</vertical>
</ScrollView>
</vertical>
)
ui.webview.getWebView().loadUrl("http://www.autojs.org");

View File

@@ -118,6 +118,7 @@ module.exports = function(__runtime__, scope){
}
mode = mode || 0;
__runtime__.accessibilityBridge.setMode(mode);
__runtime__.accessibilityBridge.ensureServiceEnabled();
}
scope.__asGlobal__(__runtime__.automator, ['back', 'home', 'powerDialog', 'notifications', 'quickSettings', 'recents', 'splitScreen']);

View File

@@ -24,7 +24,7 @@ exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
var v = (arguments[i] && isJavaObject(arguments[i])) ? arguments[i].toString() :
var v = //(arguments[i] && isJavaObject(arguments[i])) ? arguments[i].toString() :
arguments[i];
objects.push(inspect(v));
}
@@ -312,9 +312,13 @@ function formatValue(ctx, value, recurseTimes) {
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
try{
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}catch(err){
return value.toString();
}
}
ctx.seen.pop();

View File

@@ -38,6 +38,8 @@ import com.stardust.util.UiHandler;
import com.stardust.view.accessibility.AccessibilityInfoProvider;
import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import java.io.File;
import java.io.IOException;