add: new ui for drawer
@@ -36,6 +36,7 @@ import com.stardust.scriptdroid.script.StorageFileProvider;
|
||||
import com.stardust.scriptdroid.ui.common.ScriptOperations;
|
||||
import com.stardust.scriptdroid.ui.main.community.CommunityFragment;
|
||||
import com.stardust.scriptdroid.ui.main.doc.OnlineDocsFragment_;
|
||||
import com.stardust.scriptdroid.ui.main.drawer.DrawerFragment;
|
||||
import com.stardust.scriptdroid.ui.main.script_list.MyScriptListFragment_;
|
||||
import com.stardust.scriptdroid.ui.main.task.TaskManagerFragment_;
|
||||
import com.stardust.util.DeveloperUtils;
|
||||
@@ -61,8 +62,6 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
@EActivity(R.layout.activity_main)
|
||||
public class MainActivity extends BaseActivity implements OnActivityResultDelegate.DelegateHost {
|
||||
|
||||
public static final String MESSAGE_CLEAR_BACKGROUND_SETTINGS = "MESSAGE_CLEAR_BACKGROUND_SETTINGS";
|
||||
|
||||
private static final String LOG_TAG = "MainActivity";
|
||||
|
||||
@ViewById(R.id.drawer_layout)
|
||||
@@ -76,7 +75,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
|
||||
private FragmentPagerAdapterBuilder.StoredFragmentPagerAdapter mPagerAdapter;
|
||||
private OnActivityResultDelegate.Mediator mActivityResultMediator = new OnActivityResultDelegate.Mediator();
|
||||
private DrawableSaver mDrawerHeaderBackgroundSaver;
|
||||
private VersionGuard mVersionGuard;
|
||||
|
||||
|
||||
@@ -84,20 +82,14 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
checkPermissions();
|
||||
EventBus.getDefault().register(this);
|
||||
mVersionGuard = new VersionGuard(this);
|
||||
showAnnunciationIfNeeded();
|
||||
//Stop download service of ad sdk
|
||||
// FIXME: 2017/8/1 Service not stopped!
|
||||
stopService(new Intent(this, DownloadService.class));
|
||||
}
|
||||
|
||||
@AfterViews
|
||||
void setUpViews() {
|
||||
setUpToolbar();
|
||||
setUpTabViewPager();
|
||||
setUpDrawerHeader();
|
||||
setUpFragment();
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
registerBackPressHandlers();
|
||||
}
|
||||
@@ -152,17 +144,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpFragment() {
|
||||
SideMenuFragment.setFragment(this, R.id.fragment_slide_menu);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void setUpDrawerHeader() {
|
||||
TextView version = $(R.id.version);
|
||||
version.setText("Version " + BuildConfig.VERSION_NAME);
|
||||
mDrawerHeaderBackgroundSaver = new DrawableSaver.ImageSaver(this, "drawer_header_background", (ImageView) $(R.id.drawer_header_img));
|
||||
}
|
||||
|
||||
private void setUpToolbar() {
|
||||
Toolbar toolbar = $(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
@@ -251,11 +232,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
finish();
|
||||
}
|
||||
|
||||
@Click(R.id.drawer_header_img)
|
||||
public void selectHeaderImage() {
|
||||
mDrawerHeaderBackgroundSaver.select(this, mActivityResultMediator);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
@@ -268,13 +244,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
mVersionGuard.checkDeprecateAndUpdate();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMessageEvent(MessageEvent event) {
|
||||
if (event.message.equals(MESSAGE_CLEAR_BACKGROUND_SETTINGS)) {
|
||||
mDrawerHeaderBackgroundSaver.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
mActivityResultMediator.onActivityResult(requestCode, resultCode, data);
|
||||
@@ -294,11 +263,6 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
package com.stardust.scriptdroid.ui.main;
|
||||
package com.stardust.scriptdroid.ui.main.drawer;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.qq.e.comm.DownloadService;
|
||||
import com.stardust.scriptdroid.App;
|
||||
import com.stardust.scriptdroid.Pref;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.scriptdroid.autojs.AutoJs;
|
||||
import com.stardust.scriptdroid.external.floatingwindow.HoverMenuManger;
|
||||
import com.stardust.scriptdroid.external.floatingwindow.menu.HoverMenuService;
|
||||
import com.stardust.scriptdroid.ui.common.ProgressDialog;
|
||||
@@ -25,8 +22,6 @@ import com.stardust.scriptdroid.sublime.SublimePluginClient;
|
||||
import com.stardust.scriptdroid.sublime.SublimePluginService;
|
||||
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||
import com.stardust.scriptdroid.tool.WifiTool;
|
||||
import com.stardust.scriptdroid.ui.console.LogActivity_;
|
||||
import com.stardust.scriptdroid.ui.help.HelpCatalogueActivity;
|
||||
import com.stardust.util.IntentUtil;
|
||||
import com.stardust.util.UnderuseExecutors;
|
||||
|
||||
@@ -44,19 +39,11 @@ import java.util.concurrent.Executor;
|
||||
/**
|
||||
* Created by Stardust on 2017/1/30.
|
||||
*/
|
||||
@EFragment(R.layout.fragment_side_menu)
|
||||
public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
@EFragment(R.layout.fragment_drawer)
|
||||
public class DrawerFragment extends android.support.v4.app.Fragment {
|
||||
|
||||
public static void setFragment(FragmentActivity activity, int viewId) {
|
||||
SideMenuFragment fragment = new SideMenuFragment_();
|
||||
activity.getSupportFragmentManager().beginTransaction().replace(viewId, fragment).commit();
|
||||
}
|
||||
|
||||
@ViewById(R.id.sw_accessibility_service)
|
||||
SwitchCompat mAccessibilityServiceSwitch;
|
||||
@ViewById(R.id.sw_floating_window)
|
||||
SwitchCompat mFloatingWindowSwitch;
|
||||
@ViewById(R.id.sw_debug)
|
||||
SwitchCompat mDebugSwitch;
|
||||
private Executor mExecutor = UnderuseExecutors.getExecutor();
|
||||
|
||||
@@ -69,7 +56,7 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
syncSwitchState();
|
||||
//syncSwitchState();
|
||||
}
|
||||
|
||||
|
||||
@@ -100,23 +87,6 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
mFloatingWindowSwitch.setChecked(HoverMenuManger.isHoverMenuShowing());
|
||||
}
|
||||
|
||||
|
||||
@Click(R.id.console)
|
||||
void startConsoleActivity() {
|
||||
startActivity(new Intent(getActivity(), LogActivity_.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
}
|
||||
|
||||
@Click(R.id.syntax_and_api)
|
||||
void startSyntaxHelpActivity() {
|
||||
HelpCatalogueActivity.showMainCatalogue(getActivity());
|
||||
}
|
||||
|
||||
@Click(R.id.auto_operate_service)
|
||||
void clickAutoOperateServiceSwitch() {
|
||||
mAccessibilityServiceSwitch.toggle();
|
||||
}
|
||||
|
||||
@CheckedChange(R.id.sw_accessibility_service)
|
||||
void setAutoOperateServiceEnable(CompoundButton button, boolean enable) {
|
||||
boolean isAccessibilityServiceEnabled = AccessibilityServiceTool.isAccessibilityServiceEnabled(App.getApp());
|
||||
if (enable && !isAccessibilityServiceEnabled) {
|
||||
@@ -157,7 +127,6 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
@CheckedChange(R.id.sw_floating_window)
|
||||
void setFloatingWindowEnable(CompoundButton button, boolean enable) {
|
||||
if (enable && !HoverMenuManger.isHoverMenuShowing()) {
|
||||
HoverMenuManger.showHoverMenu();
|
||||
@@ -169,17 +138,6 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Click(R.id.floating_window)
|
||||
void toggleAssistServiceSwitch() {
|
||||
mFloatingWindowSwitch.toggle();
|
||||
}
|
||||
|
||||
@Click(R.id.debug)
|
||||
void toggleDebugSwitch() {
|
||||
mDebugSwitch.toggle();
|
||||
}
|
||||
|
||||
@CheckedChange(R.id.sw_debug)
|
||||
void setDebugEnabled(CompoundButton button, boolean enabled) {
|
||||
if (enabled && !SublimePluginService.isConnected()) {
|
||||
new MaterialDialog.Builder(getActivity())
|
||||
@@ -208,15 +166,6 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
return Pref.getServerAddressOrDefault(WifiTool.getWifiAddress(getActivity()));
|
||||
}
|
||||
|
||||
@Click(R.id.stop_all_running_scripts)
|
||||
void stopAllRunningScripts() {
|
||||
int n = AutoJs.getInstance().getScriptEngineService().stopAll();
|
||||
if (n > 0)
|
||||
Snackbar.make(getView(), String.format(getString(R.string.text_already_stop_n_scripts), n), Snackbar.LENGTH_SHORT).show();
|
||||
else
|
||||
Snackbar.make(getView(), R.string.text_no_running_script, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.stardust.scriptdroid.ui.main.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.stardust.scriptdroid.R;
|
||||
|
||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/8/25.
|
||||
*/
|
||||
|
||||
public class DrawerMenuGroup extends LinearLayout {
|
||||
|
||||
private TextView mTitle;
|
||||
|
||||
public DrawerMenuGroup(Context context) {
|
||||
super(context);
|
||||
init(null);
|
||||
}
|
||||
|
||||
public DrawerMenuGroup(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
public DrawerMenuGroup(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public DrawerMenuGroup(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
private void init(AttributeSet attrs) {
|
||||
setOrientation(VERTICAL);
|
||||
addTitleView();
|
||||
if (attrs == null) {
|
||||
return;
|
||||
}
|
||||
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DrawerMenuItem);
|
||||
mTitle.setText(a.getString(R.styleable.DrawerMenuItem_title));
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
private void addTitleView() {
|
||||
mTitle = new TextView(getContext());
|
||||
int padding = (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
|
||||
mTitle.setPadding(padding, padding, padding, padding);
|
||||
mTitle.setTextColor(0xff999999);
|
||||
mTitle.setTextSize(12);
|
||||
addView(mTitle, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.stardust.scriptdroid.ui.main.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.stardust.scriptdroid.R;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/8/25.
|
||||
*/
|
||||
public class DrawerMenuItem extends FrameLayout {
|
||||
|
||||
private SwitchCompat mSwitchCompat;
|
||||
|
||||
public DrawerMenuItem(Context context) {
|
||||
super(context);
|
||||
init(null);
|
||||
}
|
||||
|
||||
public DrawerMenuItem(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
public DrawerMenuItem(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public DrawerMenuItem(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
private void init(AttributeSet attrs) {
|
||||
inflate(getContext(), R.layout.drawer_menu_item, this);
|
||||
ImageView icon = (ImageView) findViewById(R.id.icon);
|
||||
TextView title = (TextView) findViewById(R.id.title);
|
||||
mSwitchCompat = (SwitchCompat) findViewById(R.id.sw);
|
||||
if (attrs == null)
|
||||
return;
|
||||
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DrawerMenuItem);
|
||||
icon.setImageResource(a.getResourceId(R.styleable.DrawerMenuItem_icon, 0));
|
||||
title.setText(a.getString(R.styleable.DrawerMenuItem_title));
|
||||
if (a.getBoolean(R.styleable.DrawerMenuItem_with_switch, false)) {
|
||||
mSwitchCompat.setVisibility(VISIBLE);
|
||||
setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mSwitchCompat.toggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
public SwitchCompat getSwitchCompat() {
|
||||
return mSwitchCompat;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,16 +5,12 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.stardust.scriptdroid.Pref;
|
||||
import com.stardust.scriptdroid.tool.UpdateChecker;
|
||||
import com.stardust.scriptdroid.ui.BaseActivity;
|
||||
import com.stardust.scriptdroid.ui.error.IssueReporterActivity;
|
||||
import com.stardust.scriptdroid.ui.main.MainActivity;
|
||||
import com.stardust.scriptdroid.ui.splash.SplashActivity;
|
||||
import com.stardust.scriptdroid.ui.splash.SplashActivity_;
|
||||
import com.stardust.scriptdroid.ui.update.UpdateCheckDialog;
|
||||
@@ -23,11 +19,9 @@ import com.stardust.util.MapEntries;
|
||||
import com.stardust.scriptdroid.R;
|
||||
import com.stardust.theme.app.ColorSelectActivity;
|
||||
import com.stardust.theme.util.ListBuilder;
|
||||
import com.stardust.util.MessageEvent;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.EActivity;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -112,7 +106,7 @@ public class SettingsActivity extends BaseActivity {
|
||||
.entry(getString(R.string.text_reset_background), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventBus.getDefault().post(new MessageEvent(MainActivity.MESSAGE_CLEAR_BACKGROUND_SETTINGS));
|
||||
// EventBus.getDefault().post(new MessageEvent(MainActivity.MESSAGE_CLEAR_BACKGROUND_SETTINGS));
|
||||
Toast.makeText(getActivity(), R.string.text_already_reset, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
})
|
||||
@@ -125,7 +119,7 @@ public class SettingsActivity extends BaseActivity {
|
||||
.start();
|
||||
}
|
||||
})
|
||||
.entry(getString(R.string.text_check_update), new Runnable() {
|
||||
.entry(getString(R.string.text_check_for_updates), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new UpdateCheckDialog(getActivity()).show();
|
||||
|
||||
BIN
app/src/main/res/drawable/android_eating_half.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
9
app/src/main/res/drawable/drawer_menu_divider.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<size
|
||||
android:width="100dp"
|
||||
android:height="6dp"/>
|
||||
|
||||
<solid android:color="#f0f1f5"/>
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/ic_ali_exit.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable/ic_ali_settings.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable/ic_check_for_updates.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable/ic_personalize.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable/ic_stable.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable/ic_volume.png
Normal file
|
After Width: | Height: | Size: 401 B |
BIN
app/src/main/res/drawable/profile_avatar_placeholder.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable/profile_bg.png
Normal file
|
After Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
@@ -150,13 +150,12 @@
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/drawer"
|
||||
layout="@layout/drawer"
|
||||
android:layout_width="304dp"
|
||||
<fragment
|
||||
android:name="com.stardust.scriptdroid.ui.main.drawer.DrawerFragment_"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="false"
|
||||
/>
|
||||
android:fitsSystemWindows="false"/>
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
||||
|
||||
97
app/src/main/res/layout/drawer_menu.xml
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@drawable/drawer_menu_divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:title="@string/text_accessibility_service">
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/accessibility_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_service_green"
|
||||
app:title="@string/text_accessibility_service"
|
||||
app:with_switch="true"/>
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/stable_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_stable"
|
||||
app:title="@string/text_stable_mode"
|
||||
app:with_switch="true"/>
|
||||
|
||||
|
||||
</com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup>
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:title="@string/text_script_record">
|
||||
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/floating_window"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_robot_64"
|
||||
app:title="@string/text_floating_window"
|
||||
app:with_switch="true"/>
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/volume_down_control"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_volume"
|
||||
app:title="@string/text_volume_down_control"
|
||||
app:with_switch="true"/>
|
||||
|
||||
|
||||
</com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup>
|
||||
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:title="@string/text_others">
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/debug"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_debug"
|
||||
app:title="@string/debug"
|
||||
app:with_switch="true"/>
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/theme_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_personalize"
|
||||
app:title="@string/text_theme_color"/>
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/check_for_updates"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_check_for_updates"
|
||||
app:title="@string/text_check_for_updates"/>
|
||||
|
||||
</com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
35
app/src/main/res/layout/drawer_menu_item.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_margin="16dp"
|
||||
android:tint="#999999"
|
||||
tools:src="@drawable/ic_service_green"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#484C4F"
|
||||
android:textSize="14sp"
|
||||
tools:text="@string/text_auto_operate_service"/>
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorSwitch
|
||||
android:id="@+id/sw"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="16dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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="304dp"
|
||||
android:layout_height="match_parent"
|
||||
@@ -11,39 +12,45 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:layout_marginBottom="5dp">
|
||||
android:layout_height="170dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="#5cab7d">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/drawer_header_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_above="@+id/username"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/side_menu_bg"/>
|
||||
android:src="@drawable/profile_avatar_placeholder"
|
||||
app:riv_border_color="#77f2f3f5"
|
||||
app:riv_border_width="0.5dp"
|
||||
app:riv_corner_radius="40dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version"
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/not_login"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/version"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/_app_name"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="28sp"/>
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="118dp"
|
||||
android:layout_marginLeft="-12dp"
|
||||
android:layout_toRightOf="@+id/avatar"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/android_eating_half"
|
||||
android:alpha="0.08"
|
||||
android:tint="#000000"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -54,15 +61,20 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_slide_menu"
|
||||
<include
|
||||
layout="@layout/drawer_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#f2f3f5"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:baselineAligned="false">
|
||||
|
||||
@@ -75,15 +87,18 @@
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="6dp"
|
||||
android:src="@drawable/ic_settings"/>
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="12dp"
|
||||
android:src="@drawable/ic_ali_settings"
|
||||
android:tint="#666666"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_setting"
|
||||
android:textSize="15sp"/>
|
||||
@@ -98,15 +113,18 @@
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="6dp"
|
||||
android:src="@drawable/ic_exit"/>
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="12dp"
|
||||
android:src="@drawable/ic_ali_exit"
|
||||
android:tint="#666666"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_exit"
|
||||
android:textSize="15sp"/>
|
||||
@@ -1,181 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/console"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_console_green"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_log"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/syntax_and_api"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_speech_bubble"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_syntax_and_api"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/auto_operate_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:id="@+id/icon_service"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_service_green"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/icon_service"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_auto_operate_service"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorSwitch
|
||||
android:id="@+id/sw_accessibility_service"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/floating_window"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:id="@+id/icon_assist_service"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_robot_64"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/icon_assist_service"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_floating_window"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorSwitch
|
||||
android:id="@+id/sw_floating_window"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/debug"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:id="@+id/icon_debug"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_debug"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/icon_debug"
|
||||
android:gravity="center"
|
||||
android:text="@string/debug"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorSwitch
|
||||
android:id="@+id/sw_debug"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/stop_all_running_scripts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorImageViewCompat
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_close_green_48dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_close_all_running_scripts"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
38
app/src/main/res/layout/nav_header.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@drawable/profile_bg">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_above="@+id/username"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/profile_avatar_placeholder"
|
||||
app:riv_border_color="@android:color/white"
|
||||
app:riv_border_width="1dp"
|
||||
app:riv_corner_radius="32dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/not_login"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
16
app/src/main/res/menu/menu_drawer.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:title="@string/text_setting"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_debug"
|
||||
android:actionLayout="@layout/about_activity"
|
||||
android:title="@string/debug"/>
|
||||
|
||||
<item
|
||||
android:icon="@drawable/ic_service_green"
|
||||
android:title="@string/text_accessibility_service"/>
|
||||
</menu>
|
||||
@@ -150,7 +150,7 @@
|
||||
<string name="text_root_script_record"></string>
|
||||
<string name="text_processing">Processing</string>
|
||||
<string name="text_pre_execute_script">Pre-execute script</string>
|
||||
<string name="text_check_update">Check for updates</string>
|
||||
<string name="text_check_for_updates">Check for updates</string>
|
||||
<string name="text_new_directory">New Directory</string>
|
||||
<string name="text_already_reset">已重置</string>
|
||||
<string name="text_layout_inspector_is_dumping">布局分析中,请稍后点击</string>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<attr name="title" format="string|reference"/>
|
||||
<attr name="icon" format="reference"/>
|
||||
|
||||
<declare-styleable name="ToolbarMenuItem">
|
||||
<attr name="text" format="string|reference"/>
|
||||
<attr name="icon" format="reference"/>
|
||||
<attr name="icon"/>
|
||||
<attr name="icon_color" format="color|reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
@@ -12,6 +15,15 @@
|
||||
<attr name="defaultValue" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="DrawerMenuItem">
|
||||
<attr name="title"/>
|
||||
<attr name="icon"/>
|
||||
<attr name="with_switch" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="DrawerMenuGroup">
|
||||
<attr name="title"/>
|
||||
</declare-styleable>
|
||||
|
||||
|
||||
<declare-styleable name="MaterialEditText">
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
<string name="text_checking_update">正在检查更新</string>
|
||||
<string name="text_new_version">新版本</string>
|
||||
<string name="text_check_update_error">检查更新失败Orz</string>
|
||||
<string name="text_check_update">检查更新</string>
|
||||
<string name="text_check_for_updates">检查更新</string>
|
||||
<string name="text_is_latest_version">已经是最新版本</string>
|
||||
<string name="text_version_too_old">版本过低</string>
|
||||
<string name="warning_version_too_old">当然版本为公测版,显现和潜在的问题很多,不再适合继续使用,</string>
|
||||
@@ -233,6 +233,9 @@
|
||||
<string name="text_script">脚本</string>
|
||||
<string name="text_community">社区</string>
|
||||
<string name="text_manage">管理</string>
|
||||
<string name="not_login">未登录</string>
|
||||
<string name="text_volume_down_control">音量下键控制</string>
|
||||
<string name="text_others">其他</string>
|
||||
|
||||
|
||||
<string-array name="record_control_keys">
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
<com.stardust.theme.preference.ThemeColorPreferenceCategory android:title="@string/text_about">
|
||||
|
||||
<Preference android:title="@string/text_check_update"/>
|
||||
<Preference android:title="@string/text_check_for_updates"/>
|
||||
|
||||
<Preference android:title="@string/text_join_qq_group"/>
|
||||
|
||||
|
||||