From: Braden Farmer Date: Sun, 12 Aug 2018 22:29:51 +0000 (-0600) Subject: Moar fixes for animation and window size X-Git-Tag: android-x86-8.1-r1~26 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9fb56c9afd03b851fe0951cfa3371d98717303c3;p=android-x86%2Fpackages-apps-Taskbar.git Moar fixes for animation and window size --- diff --git a/app/src/main/java/com/farmerbb/taskbar/activity/DummyActivity.java b/app/src/main/java/com/farmerbb/taskbar/activity/DummyActivity.java index 66188785..d2640c5e 100644 --- a/app/src/main/java/com/farmerbb/taskbar/activity/DummyActivity.java +++ b/app/src/main/java/com/farmerbb/taskbar/activity/DummyActivity.java @@ -77,13 +77,19 @@ public class DummyActivity extends Activity { intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, new ComponentName(this, LockDeviceReceiver.class)); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, getString(R.string.device_admin_description)); - try { - startActivity(intent); - } catch (ActivityNotFoundException e) { - U.showToast(this, R.string.lock_device_not_supported); - - finish(); - } + SharedPreferences pref = U.getSharedPreferences(this); + if(pref.getBoolean("disable_animations", false)) + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + + U.launchApp(this, () -> { + try { + startActivity(intent, U.getActivityOptionsBundle(this, ApplicationType.APPLICATION)); + } catch (ActivityNotFoundException e) { + U.showToast(this, R.string.lock_device_not_supported); + + finish(); + } + }); }); AlertDialog dialog = builder.create(); @@ -96,16 +102,21 @@ public class DummyActivity extends Activity { .setNegativeButton(R.string.action_cancel, (dialog, which) -> new Handler().post(this::finish)) .setPositiveButton(R.string.action_activate, (dialog, which) -> { Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - try { - startActivity(intent, U.getActivityOptionsBundle(this, ApplicationType.APPLICATION)); - U.showToastLong(this, R.string.usage_stats_message); - } catch (ActivityNotFoundException e) { - U.showToast(this, R.string.lock_device_not_supported); + SharedPreferences pref = U.getSharedPreferences(this); + if(pref.getBoolean("disable_animations", false)) + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + + U.launchApp(this, () -> { + try { + startActivity(intent, U.getActivityOptionsBundle(this, ApplicationType.APPLICATION)); + U.showToastLong(this, R.string.usage_stats_message); + } catch (ActivityNotFoundException e) { + U.showToast(this, R.string.lock_device_not_supported); - finish(); - } + finish(); + } + }); }); AlertDialog dialog = builder.create();