]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/res/layout/import_export_coordinatorlayout.xml
Fix downloads consuming massive CPU and locking the UI on slower CPUs. https://redmin...
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / import_export_coordinatorlayout.xml
index 3ecc1aec9d99b589b1aab0652998028ba8164f7c..14ed65558c65a0906fa2826caa5a808a2c2f9e34 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2018 Soren Stoutner <soren@stoutner.com>.
+  Copyright © 2018-2021 Soren Stoutner <soren@stoutner.com>.
 
   This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
 
   You should have received a copy of the GNU General Public License
   along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
 
-<!-- `android:fitsSystemWindows="true"` moves the AppBar below the status bar.
-    When it is specified the theme should include `<item name="android:windowTranslucentStatus">true</item>` to make the status bar a transparent, darkened overlay. -->
-<android.support.design.widget.CoordinatorLayout
+<androidx.coordinatorlayout.widget.CoordinatorLayout
     android:id="@+id/import_export_coordinatorlayout"
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_height="match_parent"
-    android:layout_width="match_parent"
-    android:fitsSystemWindows="true" >
+    android:layout_width="match_parent" >
 
-    <!-- the `LinearLayout` with `orientation="vertical"` moves the content below the `AppBarLayout`. -->
+    <!-- the linear layout with `orientation="vertical"` moves the content below the app bar layout. -->
     <LinearLayout
         android:layout_height="match_parent"
         android:layout_width="match_parent"
         android:orientation="vertical" >
 
-        <android.support.design.widget.AppBarLayout
+        <!-- The app bar theme must be specified here because the activity uses a `NoActionBar` theme. -->
+        <com.google.android.material.appbar.AppBarLayout
             android:id="@+id/import_export_appbarlayout"
             android:layout_height="wrap_content"
-            android:layout_width="match_parent" >
+            android:layout_width="match_parent"
+            android:background="?android:attr/colorBackground"
+            android:theme="@style/PrivacyBrowserAppBar" >
 
-            <android.support.v7.widget.Toolbar
+            <androidx.appcompat.widget.Toolbar
                 android:id="@+id/import_export_toolbar"
                 android:layout_height="wrap_content"
-                android:layout_width="match_parent"
-                android:background="?attr/colorPrimaryDark"
-                android:theme="?attr/appBarTextTheme"
-                app:popupTheme="?attr/popupsTheme" />
-        </android.support.design.widget.AppBarLayout>
+                android:layout_width="match_parent" />
+        </com.google.android.material.appbar.AppBarLayout>
 
         <ScrollView
             android:layout_height="match_parent"
@@ -58,8 +55,8 @@
                 android:layout_width="match_parent"
                 android:orientation="vertical" >
 
-                <!-- The export card. -->
-                <android.support.v7.widget.CardView
+                <!-- The encryption card. -->
+                <androidx.cardview.widget.CardView
                     android:layout_height="wrap_content"
                     android:layout_width="match_parent"
                     android:layout_marginTop="10dp"
                         android:layout_height="match_parent"
                         android:layout_width="match_parent"
                         android:orientation="vertical"
-                        android:layout_margin="10dp" >
+                        android:layout_marginTop="10dp"
+                        android:layout_marginBottom="20dp"
+                        android:layout_marginStart="10dp"
+                        android:layout_marginEnd="10dp" >
 
                         <TextView
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_gravity="center_horizontal"
                             android:layout_marginBottom="6dp"
-                            android:text="@string/export_settings"
+                            android:text="@string/encryption"
                             android:textSize="25sp"
                             android:textStyle="bold"
-                            android:textColor="?android:textColorPrimary" />
+                            android:textColor="?colorAccent" />
 
-                        <!-- Align the export EditText and the select file button horizontally. -->
-                        <LinearLayout
+                        <Spinner
+                            android:id="@+id/encryption_spinner"
+                            android:layout_height="wrap_content"
+                            android:layout_width="wrap_content"
+                            android:layout_gravity="center_horizontal" />
+
+                        <!-- The encryption password. -->
+                        <com.google.android.material.textfield.TextInputLayout
+                            android:id="@+id/encryption_password_textinputlayout"
                             android:layout_height="wrap_content"
                             android:layout_width="match_parent"
-                            android:orientation="horizontal" >
+                            app:passwordToggleEnabled="true" >
 
-                            <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
-                            <android.support.design.widget.TextInputLayout
+                            <com.google.android.material.textfield.TextInputEditText
+                                android:id="@+id/encryption_password_edittext"
                                 android:layout_height="wrap_content"
-                                android:layout_width="0dp"
-                                android:layout_weight="1" >
-
-                                <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
-                                <android.support.design.widget.TextInputEditText
-                                    android:id="@+id/export_file_edittext"
-                                    android:layout_height="wrap_content"
-                                    android:layout_width="match_parent"
-                                    android:hint="@string/export_file_name"
-                                    android:inputType="textMultiLine|textUri" />
-                            </android.support.design.widget.TextInputLayout>
+                                android:layout_width="match_parent"
+                                android:hint="@string/password"
+                                android:inputType="textPassword"/>
+                        </com.google.android.material.textfield.TextInputLayout>
 
-                            <Button
-                                android:id="@+id/select_export_file"
-                                android:layout_height="wrap_content"
-                                android:layout_width="wrap_content"
-                                android:layout_gravity="center_vertical"
-                                android:text="@string/browse"
-                                android:onClick="exportBrowse" />
-                        </LinearLayout>
+                        <!-- KitKat password encryption message. -->
+                        <TextView
+                            android:id="@+id/kitkat_password_encryption_textview"
+                            android:layout_height="wrap_content"
+                            android:layout_width="wrap_content"
+                            android:layout_gravity="center_horizontal"
+                            android:layout_marginTop="10dp"
+                            android:text="@string/kitkat_password_encryption_message"
+                            android:textAlignment="center" />
 
-                        <Button
-                            android:id="@+id/export_button"
+                        <!-- OpenKeychain required message. -->
+                        <TextView
+                            android:id="@+id/openkeychain_required_textview"
                             android:layout_height="wrap_content"
                             android:layout_width="wrap_content"
                             android:layout_gravity="center_horizontal"
-                            android:text="@string/export"
-                            android:textSize="18sp"
-                            android:onClick="onClickExport" />
+                            android:layout_marginTop="10dp"
+                            android:text="@string/openkeychain_required"
+                            android:textAlignment="center" />
                     </LinearLayout>
-                </android.support.v7.widget.CardView>
+                </androidx.cardview.widget.CardView>
 
-                <!-- The import card. -->
-                <android.support.v7.widget.CardView
+                <!-- The file location card. -->
+                <androidx.cardview.widget.CardView
+                    android:id="@+id/file_location_cardview"
                     android:layout_height="wrap_content"
                     android:layout_width="match_parent"
                     android:layout_marginTop="5dp"
-                    android:layout_marginBottom="10dp"
+                    android:layout_marginBottom="5dp"
                     android:layout_marginStart="10dp"
                     android:layout_marginEnd="10dp" >
 
                         android:layout_height="match_parent"
                         android:layout_width="match_parent"
                         android:orientation="vertical"
-                        android:layout_margin="10dp" >
+                        android:layout_marginTop="10dp"
+                        android:layout_marginBottom="20dp"
+                        android:layout_marginStart="10dp"
+                        android:layout_marginEnd="10dp" >
 
                         <TextView
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_gravity="center_horizontal"
                             android:layout_marginBottom="6dp"
-                            android:text="@string/import_settings"
+                            android:text="@string/file_location"
                             android:textSize="25sp"
                             android:textStyle="bold"
-                            android:textColor="?android:textColorPrimary" />
+                            android:textColor="?colorAccent" />
+
+                        <RadioGroup
+                            android:layout_height="wrap_content"
+                            android:layout_width="wrap_content"
+                            android:layout_gravity="center_horizontal"
+                            android:orientation="horizontal" >
+
+                            <RadioButton
+                                android:id="@+id/import_radiobutton"
+                                android:layout_height="wrap_content"
+                                android:layout_width="wrap_content"
+                                android:text="@string/import_button"
+                                android:layout_marginEnd="10dp"
+                                android:onClick="onClickRadioButton" />
 
-                        <!-- Align the import EditText and the select file button horizontally. -->
+                            <RadioButton
+                                android:id="@+id/export_radiobutton"
+                                android:layout_height="wrap_content"
+                                android:layout_width="wrap_content"
+                                android:text="@string/export"
+                                android:onClick="onClickRadioButton" />
+                        </RadioGroup>
+
+                        <!-- Align the edit text and the select file button horizontally. -->
                         <LinearLayout
+                            android:id="@+id/file_name_linearlayout"
                             android:layout_height="wrap_content"
                             android:layout_width="match_parent"
-                            android:orientation="horizontal" >
+                            android:orientation="horizontal"
+                            android:layout_marginTop="10dp">
 
-                            <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
-                            <android.support.design.widget.TextInputLayout
+                            <!-- The text input layout makes the hint float above the edit text. -->
+                            <com.google.android.material.textfield.TextInputLayout
                                 android:layout_height="wrap_content"
                                 android:layout_width="0dp"
                                 android:layout_weight="1" >
 
                                 <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
-                                <android.support.design.widget.TextInputEditText
-                                    android:id="@+id/import_file_edittext"
+                                <com.google.android.material.textfield.TextInputEditText
+                                    android:id="@+id/file_name_edittext"
                                     android:layout_height="wrap_content"
                                     android:layout_width="match_parent"
-                                    android:hint="@string/import_file_name"
+                                    android:hint="@string/file_name"
                                     android:inputType="textMultiLine|textUri" />
-                            </android.support.design.widget.TextInputLayout>
+                            </com.google.android.material.textfield.TextInputLayout>
 
                             <Button
-                                android:id="@+id/select_import_file"
+                                android:id="@+id/browse_button"
                                 android:layout_height="wrap_content"
                                 android:layout_width="wrap_content"
                                 android:layout_gravity="center_vertical"
                                 android:text="@string/browse"
-                                android:onClick="importBrowse" />
+                                android:onClick="browse" />
                         </LinearLayout>
 
-                        <!-- `import` is a reserved word and cannot be used for the `onClick` name. -->
+                        <!-- OpenKeychain import instructions -->
+                        <TextView
+                            android:id="@+id/openkeychain_import_instructions_textview"
+                            android:layout_height="wrap_content"
+                            android:layout_width="wrap_content"
+                            android:layout_gravity="center_horizontal"
+                            android:layout_margin="5dp"
+                            android:text="@string/openkeychain_import_instructions"
+                            android:textAlignment="center" />
+
                         <Button
-                            android:id="@+id/import_button"
+                            android:id="@+id/import_export_button"
                             android:layout_height="wrap_content"
                             android:layout_width="wrap_content"
                             android:layout_gravity="center_horizontal"
+                            android:layout_marginTop="10dp"
                             android:text="@string/import_button"
                             android:textSize="18sp"
-                            android:onClick="onClickImport" />
+                            android:onClick="importExport"
+                            app:backgroundTint="?attr/buttonBackgroundColorSelector"
+                            android:textColor="?attr/buttonTextColorSelector" />
                     </LinearLayout>
-                </android.support.v7.widget.CardView>
-
-                <TextView
-                    android:id="@+id/import_export_storage_permission_textview"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginBottom="10dp"
-                    android:layout_marginStart="15dp"
-                    android:layout_marginEnd="15dp"
-                    android:text="@string/storage_permission_explanation"
-                    android:textColor="?android:textColorPrimary"
-                    android:textAlignment="center" />
+                </androidx.cardview.widget.CardView>
             </LinearLayout>
         </ScrollView>
     </LinearLayout>
-</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file