From 9bcae3f893eed01f02275db64fc7c6e632e6ebeb Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 2 Apr 2023 20:00:15 -0300 Subject: [PATCH] Revert "fix: actually fixing the crash on change of themes on nightly builds" This reverts commit 6d094af6d5d90274cbe15348877e9ae966acd144. --- .../android/fragments/SettingsFragment.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 54e775d9f..bcf90d4f9 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -590,22 +590,22 @@ public class SettingsFragment extends MastodonToolbarFragment{ // Calling activity.recreate() causes a black screen for like half a second. // So, let's take a screenshot and overlay it on top to create the illusion of a smoother transition. // As a bonus, we can fade it out to make it even smoother. -// if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N){ -// View activityDecorView=getActivity().getWindow().getDecorView(); -// Bitmap bitmap=Bitmap.createBitmap(activityDecorView.getWidth(), activityDecorView.getHeight(), Bitmap.Config.ARGB_8888); -// activityDecorView.draw(new Canvas(bitmap)); -// themeTransitionWindowView=new ImageView(MastodonApp.context); -// themeTransitionWindowView.setImageBitmap(bitmap); -// WindowManager.LayoutParams lp=new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_APPLICATION); -// lp.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | -// WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; -// lp.systemUiVisibility=View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; -// lp.systemUiVisibility|=(activityDecorView.getWindowSystemUiVisibility() & (View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)); -// lp.width=lp.height=WindowManager.LayoutParams.MATCH_PARENT; -// lp.token=getActivity().getWindow().getAttributes().token; -// lp.windowAnimations=R.style.window_fade_out; -// MastodonApp.context.getSystemService(WindowManager.class).addView(themeTransitionWindowView, lp); -// } + if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N){ + View activityDecorView=getActivity().getWindow().getDecorView(); + Bitmap bitmap=Bitmap.createBitmap(activityDecorView.getWidth(), activityDecorView.getHeight(), Bitmap.Config.ARGB_8888); + activityDecorView.draw(new Canvas(bitmap)); + themeTransitionWindowView=new ImageView(MastodonApp.context); + themeTransitionWindowView.setImageBitmap(bitmap); + WindowManager.LayoutParams lp=new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_APPLICATION); + lp.flags=WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | + WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; + lp.systemUiVisibility=View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; + lp.systemUiVisibility|=(activityDecorView.getWindowSystemUiVisibility() & (View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)); + lp.width=lp.height=WindowManager.LayoutParams.MATCH_PARENT; + lp.token=getActivity().getWindow().getAttributes().token; + lp.windowAnimations=R.style.window_fade_out; + MastodonApp.context.getSystemService(WindowManager.class).addView(themeTransitionWindowView, lp); + } getActivity().recreate(); }