Support for full backup/restore to sdcard

This commit is contained in:
Moxie Marlinspike
2018-02-26 09:58:18 -08:00
parent 9f6b761d98
commit 24e573e537
41 changed files with 5884 additions and 269 deletions

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingLeft="23dp"
android:paddingRight="23dp">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="@string/backup_enable_dialog__backups_will_be_saved_to_external_storage_and_encrypted_with_the_passphrase_below_you_must_have_this_passphrase_in_order_to_restore_a_backup"/>
<TableLayout android:id="@+id/number_table"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:focusable="true">
<TableRow android:gravity="center_horizontal"
android:clickable="false"
android:focusable="false">
<TextView android:id="@+id/code_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/BackupPassphrase"
tools:text="22934"/>
<TextView android:id="@+id/code_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
style="@style/BackupPassphrase"
tools:text="56944"
android:layout_marginStart="20dp"/>
<TextView android:id="@+id/code_third"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
style="@style/BackupPassphrase"
tools:text="42738"
android:layout_marginStart="20dp"/>
</TableRow>
<TableRow android:gravity="center_horizontal">
<TextView android:id="@+id/code_fourth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/BackupPassphrase"
tools:text="34431"/>
<TextView android:id="@+id/code_fifth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
style="@style/BackupPassphrase"
tools:text="24922"
android:layout_marginStart="20dp"/>
<TextView android:id="@+id/code_sixth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
style="@style/BackupPassphrase"
tools:text="58594"
android:layout_marginStart="20dp"/>
</TableRow>
</TableLayout>
<LinearLayout android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<CheckBox android:id="@+id/confirmation_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"/>
<TextView android:id="@+id/confirmation_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="@string/backup_enable_dialog__i_have_written_down_this_passphrase"/>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/restore_passphrase_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_backup_passphrase_dialog__backup_passphrase"
android:imeOptions="actionDone"
android:inputType="textVisiblePassword" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>

View File

@@ -109,68 +109,5 @@
</LinearLayout>
</LinearLayout>
<include layout="@layout/preference_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:gravity="center_vertical"
android:text="@string/ImportExportActivity_export"
android:textSize="14sp"
android:fontFamily="sans-serif-medium"
android:textColor="@color/signal_primary_dark"/>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout android:id="@+id/export_plaintext_backup"
android:clickable="true"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:gravity="center_vertical"
android:background="?selectableItemBackground">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="32dp"
android:layout_marginEnd="32dp"
android:src="@drawable/ic_content_copy_white_24dp"
android:tint="?attr/pref_icon_tint"/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
style="@style/Registration.Description"
android:text="@string/export_fragment__export_plaintext_backup"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/export_fragment__export_a_plaintext_backup_compatible_with"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:gravity="bottom">
<ProgressBar android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"/>
<TextView android:id="@+id/progress_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
tools:text="1345 messages so far"/>
</LinearLayout>

View File

@@ -55,6 +55,64 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="-32dp"/>
<LinearLayout android:id="@+id/restore_container"
android:padding="16dp"
android:paddingBottom="0dp"
android:layout_marginTop="30dp"
android:layout_below="@id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="visible">
<TextView android:id="@+id/backup_created_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="Backup created: 1 min ago"/>
<TextView android:id="@+id/backup_size_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
tools:text="Backup size: 899 KB"/>
<TextView android:id="@+id/backup_progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
tools:text="100 messages so far..."/>
<com.dd.CircularProgressButton
android:id="@+id/restore_button"
app:cpb_textIdle="@string/registration_activity__restore_backup"
app:cpb_selectorIdle="@drawable/progress_button_state"
app:cpb_colorIndicator="@color/white"
app:cpb_colorProgress="@color/textsecure_primary"
app:cpb_cornerRadius="50dp"
android:background="@color/signal_primary"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"/>
<TextView android:id="@+id/skip_restore_button"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:textColor="@color/gray50"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="@string/registration_activity__skip"/>
</LinearLayout>
<LinearLayout android:id="@+id/registration_container"
android:padding="16dp"
android:paddingBottom="0dp"
@@ -104,7 +162,7 @@
<com.dd.CircularProgressButton
android:id="@+id/registerButton"
app:cpb_textIdle="Register"
app:cpb_textIdle="@string/registration_activity__register"
app:cpb_selectorIdle="@drawable/progress_button_state"
app:cpb_colorIndicator="@color/white"
app:cpb_colorProgress="@color/textsecure_primary"
@@ -168,7 +226,7 @@
android:layout_below="@id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:visibility="visible">
tools:visibility="invisible">
<org.thoughtcrime.securesms.components.registration.VerificationCodeView
android:id="@+id/code"