daily: ui adjustment

This commit is contained in:
hyb1996
2018-01-25 17:10:41 +08:00
parent b860c9ee5b
commit 7908190ab6
4 changed files with 6 additions and 4 deletions

View File

@@ -59,14 +59,16 @@ public class FloatyWindowManger {
return sCircularMenu != null && sCircularMenu.get() != null; return sCircularMenu != null && sCircularMenu.get() != null;
} }
public static void showCircularMenu() { public static boolean showCircularMenu() {
if (!SettingsCompat.canDrawOverlays(App.getApp())) { if (!SettingsCompat.canDrawOverlays(App.getApp())) {
Toast.makeText(App.getApp(), R.string.text_no_floating_window_permission, Toast.LENGTH_SHORT).show(); Toast.makeText(App.getApp(), R.string.text_no_floating_window_permission, Toast.LENGTH_SHORT).show();
manageDrawOverlays(App.getApp()); manageDrawOverlays(App.getApp());
return false;
} else { } else {
App.getApp().startService(new Intent(App.getApp(), FloatyService.class)); App.getApp().startService(new Intent(App.getApp(), FloatyService.class));
CircularMenu menu = new CircularMenu(App.getApp()); CircularMenu menu = new CircularMenu(App.getApp());
sCircularMenu = new WeakReference<>(menu); sCircularMenu = new WeakReference<>(menu);
return true;
} }
} }

View File

@@ -203,7 +203,7 @@ public class DrawerFragment extends android.support.v4.app.Fragment {
Pref.setFloatingMenuShown(checked); Pref.setFloatingMenuShown(checked);
} }
if (checked && !isFloatingWindowShowing) { if (checked && !isFloatingWindowShowing) {
FloatyWindowManger.showCircularMenu(); setChecked(mFloatingWindowItem, FloatyWindowManger.showCircularMenu());
enableAccessibilityServiceByRootIfNeeded(); enableAccessibilityServiceByRootIfNeeded();
} else if (!checked && isFloatingWindowShowing) { } else if (!checked && isFloatingWindowShowing) {
FloatyWindowManger.hideCircularMenu(); FloatyWindowManger.hideCircularMenu();

View File

@@ -77,10 +77,10 @@ public class DrawerMenuItemViewHolder extends BindableViewHolder<DrawerMenuItem>
} else { } else {
mSwitchCompat.setPrefKey(itemView.getResources().getString(prefKey)); mSwitchCompat.setPrefKey(itemView.getResources().getString(prefKey));
} }
mSwitchCompat.setOnCheckedChangeListener((buttonView, isChecked) -> mDrawerMenuItem.setChecked(isChecked));
} }
private void onClick() { private void onClick() {
mDrawerMenuItem.setChecked(mSwitchCompat.isChecked());
if (mAntiShake && (System.currentTimeMillis() - mLastClickMillis < CLICK_TIMEOUT)) { if (mAntiShake && (System.currentTimeMillis() - mLastClickMillis < CLICK_TIMEOUT)) {
Toast.makeText(itemView.getContext(), R.string.text_click_too_frequently, Toast.LENGTH_SHORT).show(); Toast.makeText(itemView.getContext(), R.string.text_click_too_frequently, Toast.LENGTH_SHORT).show();
mSwitchCompat.setChecked(!mSwitchCompat.isChecked(), false); mSwitchCompat.setChecked(!mSwitchCompat.isChecked(), false);

View File

@@ -338,5 +338,5 @@
<string name="nodebb_error_change_password_error_match">两次输入的密码不一致</string> <string name="nodebb_error_change_password_error_match">两次输入的密码不一致</string>
<string name="text_logout">退出登录</string> <string name="text_logout">退出登录</string>
<string name="nodebb_error_forbidden">操作失败,请稍后重试</string> <string name="nodebb_error_forbidden">操作失败,请稍后重试</string>
<string name="description_stable_mode">稳定模式通过省略布局细节使脚本抓取布局时更稳定,但同时获取到的屏幕上的控件可能会减少。</string> <string name="description_stable_mode">稳定模式通过省略布局细节使脚本抓取布局时更稳定,但同时获取到的屏幕上的控件可能会减少。\n\n重新启动无障碍服务才能生效。</string>
</resources> </resources>