fix hyb1996-guest//AutoJsIssueReport#4781, hyb1996-guest//AutoJsIssueReport#4793

This commit is contained in:
hyb1996
2017-07-05 18:55:27 +08:00
parent ee4c818007
commit d72d9c0413
10 changed files with 106 additions and 209 deletions

View File

@@ -5,7 +5,10 @@ import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;
import com.stardust.autojs.runtime.ScriptRuntime;
import com.stardust.scriptdroid.Pref;
import com.stardust.scriptdroid.autojs.AutoJs;
import com.stardust.util.UiHandler;
import com.stardust.view.accessibility.AccessibilityService;
import com.stardust.scriptdroid.App;
import com.stardust.scriptdroid.R;
@@ -33,12 +36,12 @@ public class AccessibilityServiceTool {
public static void goToAccessibilitySetting() {
Context context = App.getApp();
if (Pref.isFirstGoToAccessibilitySetting()) {
Toast.makeText(context, context.getString(R.string.text_please_choose) + context.getString(R.string._app_name), Toast.LENGTH_LONG).show();
App.getApp().getUiHandler().toast(context.getString(R.string.text_please_choose) + context.getString(R.string._app_name));
}
try {
AccessibilityServiceUtils.goToAccessibilitySetting(context);
} catch (ActivityNotFoundException e) {
Toast.makeText(context, context.getString(R.string.go_to_accessibility_settings) + context.getString(R.string._app_name), Toast.LENGTH_LONG).show();
App.getApp().getUiHandler().toast(context.getString(R.string.go_to_accessibility_settings) + context.getString(R.string._app_name));
}
}

View File

@@ -242,10 +242,15 @@ public class ScriptAndFolderListRecyclerView extends RecyclerView {
}
private void init() {
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
setLayoutManager(layoutManager);//new WrapContentLinearLayoutManager(getContext()));
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
mAdapter = new Adapter(mDefaultViewHolderSupplier);
setAdapter(mAdapter);
addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
.color(0xffd9d9d9)
.size(2)
.marginResId(R.dimen.script_and_folder_list_divider_left_margin, R.dimen.script_and_folder_list_divider_right_margin)
.showLastDivider()
.build());
}

View File

@@ -1,115 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:padding="8dp"
android:gravity="bottom">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:foreground="?selectableItemBackground"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:rotation="8"
app:cardBackgroundColor="#ffffff"
app:cardCornerRadius="4dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true"/>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:foreground="?selectableItemBackground"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:rotation="4"
app:cardBackgroundColor="#ffffff"
app:cardCornerRadius="4dp"
app:cardElevation="4dp"
app:cardUseCompatPadding="true"/>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:paddingLeft="2dp"
android:paddingRight="2dp"
app:cardBackgroundColor="#ffffff"
app:cardCornerRadius="4dp"
app:cardElevation="6dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/name"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="10dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="10dp"
android:textColor="#99000000"
android:textSize="14sp"
tools:text="正在运行的服务"/>
android:layout_height="wrap_content"
android:foreground="?android:selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="34dp"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:gravity="right"
android:orientation="horizontal"
android:weightSum="4">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/ic_rename_gray"
android:tint="#767886"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/ic_more_vert_black_24dp"
android:tint="#767886"/>
<ImageView
android:id="@+id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:contentDescription="@string/_app_name"
android:scaleType="fitCenter"
android:src="@drawable/ic_folder_yellow_100px"/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="80dp"
android:layout_toRightOf="@id/icon"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@android:color/secondary_text_light"
android:textSize="16sp"
tools:text="示例脚本"/>
</android.support.v7.widget.CardView>
</FrameLayout>
</RelativeLayout>

View File

@@ -1,94 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?selectableItemBackground"
android:paddingLeft="2dp"
android:paddingRight="2dp"
app:cardBackgroundColor="#ffffff"
app:cardCornerRadius="4dp"
app:cardElevation="1.5dp"
app:cardUseCompatPadding="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?android:selectableItemBackground">
<ImageView
android:id="@+id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:contentDescription="@string/_app_name"
android:scaleType="fitCenter"
android:src="@drawable/ic_node_js_black"/>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="80dp"
android:layout_toRightOf="@id/icon"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@android:color/secondary_text_light"
android:textSize="16sp"
tools:text="正在运行的服务"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/run"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:contentDescription="@string/_app_name"
android:src="@drawable/ic_ali_run"/>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="10dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="10dp"
android:textColor="#99000000"
android:textSize="14sp"
tools:text="正在运行的服务"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="34dp"
android:layout_gravity="right"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/run"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/ic_run_gray"
android:tint="#767886"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/ic_mode_edit_black_24dp"
android:tint="#767886"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/ic_share_black_24dp"
android:tint="#767886"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:src="@drawable/ic_more_vert_black_24dp"
android:tint="#767886"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>

View File

@@ -11,10 +11,7 @@
<com.stardust.scriptdroid.ui.main.script_list.ScriptAndFolderListRecyclerView
android:id="@+id/script_list_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="8dp"/>
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>