]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.java
Fix a crash when opening a drawer while restarting. https://redmine.stoutner.com...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / ImportExportActivity.java
index de4ec4779fb45350bbb5a971260a376fa07acdb8..7fe893275d8397d8a1a36d354cf8518a7d42d119 100644 (file)
@@ -47,11 +47,11 @@ import androidx.appcompat.app.AppCompatActivity;
 import androidx.appcompat.widget.Toolbar;
 import androidx.cardview.widget.CardView;
 import androidx.core.content.FileProvider;
-import androidx.multidex.BuildConfig;
 
 import com.google.android.material.snackbar.Snackbar;
 import com.google.android.material.textfield.TextInputLayout;
 
+import com.stoutner.privacybrowser.BuildConfig;
 import com.stoutner.privacybrowser.R;
 import com.stoutner.privacybrowser.helpers.ImportExportDatabaseHelper;
 
@@ -117,8 +117,9 @@ public class ImportExportActivity extends AppCompatActivity {
         // Get a handle for the shared preferences.
         SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
 
-        // Get the screenshot preference.
-        boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+        // Get the preferences.
+        boolean allowScreenshots = sharedPreferences.getBoolean(getString(R.string.allow_screenshots_key), false);
+        boolean bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false);
 
         // Disable screenshots if not allowed.
         if (!allowScreenshots) {
@@ -132,10 +133,16 @@ public class ImportExportActivity extends AppCompatActivity {
         super.onCreate(savedInstanceState);
 
         // Set the content view.
-        setContentView(R.layout.import_export_coordinatorlayout);
+        if (bottomAppBar) {
+            setContentView(R.layout.import_export_bottom_appbar);
+        } else {
+            setContentView(R.layout.import_export_top_appbar);
+        }
 
-        // Set the support action bar.
+        // Get a handle for the toolbar.
         Toolbar toolbar = findViewById(R.id.import_export_toolbar);
+
+        // Set the support action bar.
         setSupportActionBar(toolbar);
 
         // Get a handle for the action bar.
@@ -698,8 +705,7 @@ public class ImportExportActivity extends AppCompatActivity {
 
                         // Close the streams.
                         inputStream.close();
-                        temporaryPgpEncryptedImportFileOutputStream.flush();
-
+                        temporaryPgpEncryptedImportFileOutputStream.close();
 
                         // Create an decryption intent for OpenKeychain.
                         Intent openKeychainDecryptIntent = new Intent("org.sufficientlysecure.keychain.action.DECRYPT_DATA");