Fix problem that occured when starting a DialogFragment from the MainActivity's navigation bar

This commit is contained in:
uykek 2020-07-09 08:25:31 +02:00
parent f53b4ba3fa
commit 863352d621

View file

@ -28,6 +28,7 @@ import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RatingBar; import android.widget.RatingBar;
@ -280,7 +281,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
@Override @Override
public boolean onNavigationItemSelected(MenuItem item) { public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here. // Handle navigation view item clicks here.
final int id = item.getItemId(); int id = item.getItemId();
drawer.closeDrawer(GravityCompat.START); drawer.closeDrawer(GravityCompat.START);
@ -299,7 +300,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
// fade out the active activity // fade out the active activity
View mainContent = findViewById(R.id.main_content); 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); mainContent.animate().alpha(0).setDuration(MAIN_CONTENT_FADEOUT_DURATION);
} }
@ -410,7 +411,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_Dialog); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_Dialog);
LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater();
DialogFragmentImportBoardBinding binding = DialogFragmentImportBoardBinding.inflate(inflater); DialogFragmentImportBoardBinding binding = DialogFragmentImportBoardBinding.inflate(inflater);
builder.setView(binding.getRoot()); builder.setView(binding.getRoot());
@ -429,6 +429,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
}); });
return builder.create(); return builder.create();
} }
} }
/** /**