Add an activity for launching a restore from backup

Change-Id: Ibd73f8549bb3ec9e829ad9082399dbbf0a6ca4f5
This commit is contained in:
Torsten Grote
2019-09-04 15:58:07 -03:00
committed by Michael Bestas
parent a96ccce7b3
commit fc026fcadc
7 changed files with 168 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ public class SetupWizardApp extends Application {
public static final String ACTION_SETUP_WIFI = "android.net.wifi.PICK_WIFI_NETWORK";
public static final String ACTION_SETUP_FINGERPRINT = "android.settings.FINGERPRINT_SETUP";
public static final String ACTION_SETUP_LOCKSCREEN = "com.android.settings.SETUP_LOCK_SCREEN";
public static final String ACTION_RESTORE_FROM_BACKUP = "com.stevesoltys.seedvault.RESTORE_BACKUP";
public static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
public static final String ACTION_NEXT = "com.android.wizard.NEXT";
public static final String ACTION_LOAD = "com.android.wizard.LOAD";
@@ -69,6 +70,7 @@ public class SetupWizardApp extends Application {
public static final int REQUEST_CODE_SETUP_BLUETOOTH= 5;
public static final int REQUEST_CODE_SETUP_FINGERPRINT = 7;
public static final int REQUEST_CODE_SETUP_LOCKSCREEN = 9;
public static final int REQUEST_CODE_RESTORE = 10;
public static final int RADIO_READY_TIMEOUT = 10 * 1000;

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2019-2020 The Calyx Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package org.lineageos.setupwizard.backup;
import android.content.Intent;
import org.lineageos.setupwizard.R;
import org.lineageos.setupwizard.SubBaseActivity;
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_RESTORE_FROM_BACKUP;
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_RESTORE;
public class RestoreIntroActivity extends SubBaseActivity {
@Override
protected void onStartSubactivity() {
setNextAllowed(true);
findViewById(R.id.intro_restore_button).setOnClickListener(v -> launchRestore());
}
@Override
protected int getLayoutResId() {
return R.layout.intro_restore_activity;
}
@Override
protected int getTitleResId() {
return R.string.intro_restore_title;
}
@Override
protected int getIconResId() {
return R.drawable.ic_restore;
}
@Override
protected int getSubactivityNextTransition() {
return TRANSITION_ID_SLIDE;
}
private void launchRestore() {
Intent intent = new Intent(ACTION_RESTORE_FROM_BACKUP);
startSubactivity(intent, REQUEST_CODE_RESTORE);
}
}