From d327d3d2fc1ab854b5e90207af97fe7e0990af39 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 21 Aug 2021 19:16:07 +0300 Subject: [PATCH] offer to restore from backup when starting the app with no profiles --- .../net/ktnx/mobileledger/BackupsActivity.java | 6 ++++++ app/src/main/res/layout/activity_main.xml | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/BackupsActivity.java b/app/src/main/java/net/ktnx/mobileledger/BackupsActivity.java index 65ab5446..2f81c6e4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/BackupsActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/BackupsActivity.java @@ -17,6 +17,8 @@ package net.ktnx.mobileledger; +import android.content.Context; +import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.MenuItem; @@ -45,6 +47,10 @@ public class BackupsActivity extends AppCompatActivity { private FragmentBackupsBinding b; private ActivityResultLauncher backupChooserLauncher; private ActivityResultLauncher restoreChooserLauncher; + public static void start(Context context) { + Intent starter = new Intent(context, BackupsActivity.class); + context.startActivity(starter); + } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 819f9f24..5818e307 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -91,11 +91,25 @@ android:drawablePadding="16dp" android:text="@string/create_profile_label" android:textColor="@color/design_default_color_on_primary" - app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintBottom_toTopOf="@id/btn_restore" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView3" /> +