Add first time wizard for sync settings
This commit is contained in:
@@ -104,6 +104,17 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.FirstTimeActivity"
|
||||||
|
android:allowTaskReparenting="true"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:parentActivityName=".ui.MainActivity"
|
||||||
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value=".ui.MainActivity" />
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.CreateKeyActivity"
|
android:name=".ui.CreateKeyActivity"
|
||||||
android:allowTaskReparenting="true"
|
android:allowTaskReparenting="true"
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||||
|
|
||||||
|
public class FirstTimeActivity extends BaseActivity {
|
||||||
|
|
||||||
|
public static final String FRAGMENT_TAG = "currentFragment";
|
||||||
|
|
||||||
|
Fragment mCurrentFragment;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Check whether we're recreating a previously destroyed instance
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
// Restore value of members from saved state
|
||||||
|
|
||||||
|
mCurrentFragment = getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Add the sync fragment
|
||||||
|
SettingsActivity.SyncPrefsFragment frag = new SettingsActivity.SyncPrefsFragment();
|
||||||
|
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||||
|
transaction.setCustomAnimations(0, 0);
|
||||||
|
transaction.replace(R.id.first_time_fragment_container, frag, FRAGMENT_TAG)
|
||||||
|
.commit();
|
||||||
|
getSupportFragmentManager().executePendingTransactions();
|
||||||
|
}
|
||||||
|
|
||||||
|
setTitle(R.string.app_name);
|
||||||
|
mToolbar.setNavigationIcon(null);
|
||||||
|
mToolbar.setNavigationOnClickListener(null);
|
||||||
|
|
||||||
|
View nextButton = findViewById(R.id.first_time_next_button);
|
||||||
|
nextButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(FirstTimeActivity.this,
|
||||||
|
CreateKeyActivity.class);
|
||||||
|
intent.putExtra(CreateKeyActivity.EXTRA_FIRST_TIME, true);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initLayout() {
|
||||||
|
setContentView(R.layout.first_time_activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -492,8 +492,7 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
case R.id.menu_key_list_debug_first_time:
|
case R.id.menu_key_list_debug_first_time:
|
||||||
Preferences prefs = Preferences.getPreferences(getActivity());
|
Preferences prefs = Preferences.getPreferences(getActivity());
|
||||||
prefs.setFirstTime(true);
|
prefs.setFirstTime(true);
|
||||||
Intent intent = new Intent(getActivity(), CreateKeyActivity.class);
|
Intent intent = new Intent(getActivity(), FirstTimeActivity.class);
|
||||||
intent.putExtra(CreateKeyActivity.EXTRA_FIRST_TIME, true);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ public class MainActivity extends BaseNfcActivity implements FabContainer, OnBac
|
|||||||
// if this is the first time show first time activity
|
// if this is the first time show first time activity
|
||||||
Preferences prefs = Preferences.getPreferences(this);
|
Preferences prefs = Preferences.getPreferences(this);
|
||||||
if (!getIntent().getBooleanExtra(EXTRA_SKIP_FIRST_TIME, false) && prefs.isFirstTime()) {
|
if (!getIntent().getBooleanExtra(EXTRA_SKIP_FIRST_TIME, false) && prefs.isFirstTime()) {
|
||||||
Intent intent = new Intent(this, CreateKeyActivity.class);
|
Intent intent = new Intent(this, FirstTimeActivity.class);
|
||||||
intent.putExtra(CreateKeyActivity.EXTRA_FIRST_TIME, true);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
|
|||||||
85
OpenKeychain/src/main/res/layout/first_time_activity.xml
Normal file
85
OpenKeychain/src/main/res/layout/first_time_activity.xml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar_include"
|
||||||
|
layout="@layout/toolbar_standalone" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
fitsSystemWindows and layout_marginTop from
|
||||||
|
https://medium.com/@ngdelamo/using-drawerlayout-the-material-way-i-716bba2b5705
|
||||||
|
-->
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@id/toolbar_include"
|
||||||
|
android:layout_marginTop="@dimen/minus_statusbar_height"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_above="@+id/first_time_buttons"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:text="@string/first_time_start"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/first_time_fragment_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/first_time_buttons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:background="?attr/colorButtonRow"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/first_time_next_button"
|
||||||
|
style="?android:attr/borderlessButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clickable="true"
|
||||||
|
android:drawablePadding="8dp"
|
||||||
|
android:drawableRight="@drawable/ic_chevron_right_grey_24dp"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:text="@string/btn_next"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -1450,13 +1450,13 @@
|
|||||||
<string name="keyserver_sync_orbot_notif_ignore">"Direct"</string>
|
<string name="keyserver_sync_orbot_notif_ignore">"Direct"</string>
|
||||||
|
|
||||||
<!-- First Time -->
|
<!-- First Time -->
|
||||||
<string name="first_time_text1">"Take back your privacy with OpenKeychain!"</string>
|
|
||||||
<string name="first_time_create_key">"Create my key"</string>
|
<string name="first_time_create_key">"Create my key"</string>
|
||||||
<string name="first_time_import_key">"Import key from file"</string>
|
<string name="first_time_import_key">"Import key from file"</string>
|
||||||
<string name="first_time_yubikey">"Use YubiKey NEO"</string>
|
<string name="first_time_yubikey">"Use YubiKey NEO"</string>
|
||||||
<string name="first_time_skip">"Skip Setup"</string>
|
<string name="first_time_skip">"Skip Setup"</string>
|
||||||
<string name="first_time_blank_yubikey">"Would you like to use this blank YubiKey NEO with OpenKeychain?\n\nPlease take away the YubiKey now, you will be prompted when it is needed again!"</string>
|
<string name="first_time_blank_yubikey">"Would you like to use this blank YubiKey NEO with OpenKeychain?\n\nPlease take away the YubiKey now, you will be prompted when it is needed again!"</string>
|
||||||
<string name="first_time_blank_yubikey_yes">"Use this YubiKey"</string>
|
<string name="first_time_blank_yubikey_yes">"Use this YubiKey"</string>
|
||||||
|
<string name="first_time_start">"Welcome to OpenKeychain, please select your synchronization preferences.\n\nLinking keys to contacts allows you to view keys directly from Android contacts. This happens completly offline based on names and email addresses."</string>
|
||||||
|
|
||||||
<string name="backup_text">"Backups that include your own keys must never be shared with other people!"</string>
|
<string name="backup_text">"Backups that include your own keys must never be shared with other people!"</string>
|
||||||
<string name="backup_all">"All keys + your own keys"</string>
|
<string name="backup_all">"All keys + your own keys"</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user