From 863352d62122c64374cd4f63fa8e9eab4c446fbe Mon Sep 17 00:00:00 2001 From: uykek Date: Thu, 9 Jul 2020 08:25:31 +0200 Subject: [PATCH] Fix problem that occured when starting a DialogFragment from the MainActivity's navigation bar --- .../org/secuso/privacyfriendlysudoku/ui/MainActivity.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index 82370d9..280254f 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -28,6 +28,7 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.RatingBar; @@ -280,7 +281,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. - final int id = item.getItemId(); + int id = item.getItemId(); drawer.closeDrawer(GravityCompat.START); @@ -299,7 +300,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig // fade out the active activity View mainContent = findViewById(R.id.main_content); - if (mainContent != null) { + if (mainContent != null && id != R.id.nav_import_sudoku) { mainContent.animate().alpha(0).setDuration(MAIN_CONTENT_FADEOUT_DURATION); } @@ -410,7 +411,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_Dialog); - LayoutInflater inflater = getActivity().getLayoutInflater(); DialogFragmentImportBoardBinding binding = DialogFragmentImportBoardBinding.inflate(inflater); builder.setView(binding.getRoot()); @@ -429,6 +429,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig }); return builder.create(); } + } /**