Add an activity for launching a restore from backup
Change-Id: Ibd73f8549bb3ec9e829ad9082399dbbf0a6ca4f5
This commit is contained in:
committed by
Michael Bestas
parent
a96ccce7b3
commit
fc026fcadc
@@ -257,6 +257,19 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".backup.RestoreIntroActivity"
|
||||
android:label="@string/activity_label_empty"
|
||||
android:excludeFromRecents="true"
|
||||
android:configChanges="mcc|mnc"
|
||||
android:immersive="true"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
<intent-filter>
|
||||
<action android:name="org.lineageos.setupwizard.LINEAGE_RESTORE_BACKUP"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".FinishActivity"
|
||||
android:label="@string/activity_label_empty"
|
||||
android:excludeFromRecents="true"
|
||||
|
8
res/drawable/ic_restore.xml
Normal file
8
res/drawable/ic_restore.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#000"
|
||||
android:pathData="M17,13L12,18L7,13H10V9H14V13M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z"/>
|
||||
</vector>
|
76
res/layout/intro_restore_activity.xml
Normal file
76
res/layout/intro_restore_activity.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The CyanogenMod Project
|
||||
Copyright (C) 2017 The LineageOS Project
|
||||
|
||||
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.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/primary">
|
||||
|
||||
<include layout="@layout/header_condensed" />
|
||||
|
||||
<FrameLayout android:id="@+id/page"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ScrollView android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/content_margin_left"
|
||||
android:paddingEnd="@dimen/content_margin_left"
|
||||
style="@style/PageContent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/PageSummaryText"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="@dimen/summary_margin_bottom"
|
||||
android:paddingRight="@dimen/location_text_margin_right"
|
||||
android:text="@string/intro_restore_subtitle" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/intro_restore_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/content_margin_left"
|
||||
android:paddingRight="@dimen/location_text_margin_right"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/white"
|
||||
android:background="@color/accent"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/intro_restore_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
|
||||
<com.google.android.setupdesign.view.NavigationBar
|
||||
android:id="@+id/navigation_bar"
|
||||
style="@style/SudNavBarTheme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/sud_navbar_height" />
|
||||
</LinearLayout>
|
@@ -66,6 +66,10 @@
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end" id="lockscreen_settings">
|
||||
<result wizard:action="restore" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_RESTORE_BACKUP;end" id="restore">
|
||||
<result wizard:action="finish" />
|
||||
</WizardAction>
|
||||
|
||||
|
@@ -98,4 +98,9 @@
|
||||
<string name="lockscreen_setup_summary"><b>Protect this device</b> and require a PIN, pattern, or password to unlock the screen</string>
|
||||
<string name="lockscreen_setup_screen_lock_setup">Set up</string>
|
||||
|
||||
<!-- Backup Restore -->
|
||||
<string name="intro_restore_title">Restore apps and data</string>
|
||||
<string name="intro_restore_subtitle" product="tablet">If you have a backup from your last LineageOS tablet, you can restore it here.</string>
|
||||
<string name="intro_restore_subtitle" product="default">If you have a backup from your last LineageOS phone, you can restore it here.</string>
|
||||
<string name="intro_restore_button">Restore from backup</string>
|
||||
</resources>
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user