tls-psk: add secure device setup to first time dialog
This commit is contained in:
parent
b58e30914c
commit
c04e716a27
|
@ -17,23 +17,31 @@
|
|||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.ui.transfer.view.TransferFragment;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
public class CreateKeyStartFragment extends Fragment {
|
||||
public static final int REQUEST_CODE_IMPORT_KEY = 0x00007012;
|
||||
|
||||
|
||||
CreateKeyActivity mCreateKeyActivity;
|
||||
|
||||
|
@ -41,7 +49,8 @@ public class CreateKeyStartFragment extends Fragment {
|
|||
View mImportKey;
|
||||
View mSecurityToken;
|
||||
TextView mSkipOrCancel;
|
||||
public static final int REQUEST_CODE_IMPORT_KEY = 0x00007012;
|
||||
View mSecureDeviceSetup;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new instance of this fragment
|
||||
|
@ -64,6 +73,7 @@ public class CreateKeyStartFragment extends Fragment {
|
|||
mImportKey = view.findViewById(R.id.create_key_import_button);
|
||||
mSecurityToken = view.findViewById(R.id.create_key_security_token_button);
|
||||
mSkipOrCancel = (TextView) view.findViewById(R.id.create_key_cancel);
|
||||
mSecureDeviceSetup = view.findViewById(R.id.create_key_secure_device_setup);
|
||||
|
||||
if (mCreateKeyActivity.mFirstTime) {
|
||||
mSkipOrCancel.setText(R.string.first_time_skip);
|
||||
|
@ -96,6 +106,19 @@ public class CreateKeyStartFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||
mSecureDeviceSetup.setOnClickListener(new OnClickListener() {
|
||||
@TargetApi(VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TransferFragment frag = new TransferFragment();
|
||||
mCreateKeyActivity.loadFragment(frag, FragAction.TO_RIGHT);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mSecureDeviceSetup.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mSkipOrCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -115,6 +115,24 @@
|
|||
android:clickable="true"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_key_secure_device_setup"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/first_time_secure_device_setup"
|
||||
android:textAllCaps="true"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:drawableRight="@drawable/ic_chevron_right_grey_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:clickable="true"
|
||||
style="?android:attr/borderlessButtonStyle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_key_cancel"
|
||||
android:paddingLeft="16dp"
|
||||
|
|
4
OpenKeychain/src/main/res/menu/transfer_menu.xml
Normal file
4
OpenKeychain/src/main/res/menu/transfer_menu.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</menu>
|
|
@ -1906,5 +1906,6 @@
|
|||
<string name="transfer_not_available">"Sorry, this feature can only be used on Android 5 or newer :("</string>
|
||||
<string name="transfer_list_empty">No keys on this device that could be sent. Waiting for incoming keys…</string>
|
||||
<string name="transfer_connecting">Connecting…</string>
|
||||
<string name="first_time_secure_device_setup">Secure Device Setup</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue