Prevent nfc dialog from closing when touching outside of it, add cancel button
This commit is contained in:
@@ -238,7 +238,7 @@ public class CreateKeyEmailFragment extends Fragment {
|
|||||||
if (createKeyActivity.mCreateYubiKey) {
|
if (createKeyActivity.mCreateYubiKey) {
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
|
|
||||||
CreateYubiKeyPinRepeatFragment frag = CreateYubiKeyPinRepeatFragment.newInstance();
|
CreateYubiKeyPinFragment frag = CreateYubiKeyPinFragment.newInstance();
|
||||||
mCreateKeyActivity.loadFragment(frag, FragAction.TO_RIGHT);
|
mCreateKeyActivity.loadFragment(frag, FragAction.TO_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreateKeyPassphraseFragment frag = CreateKeyPassphraseFragment.newInstance();
|
CreateKeyPassphraseFragment frag = CreateKeyPassphraseFragment.newInstance();
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import java.security.SecureRandom;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class CreateYubiKeyPinRepeatFragment extends Fragment {
|
public class CreateYubiKeyPinFragment extends Fragment {
|
||||||
|
|
||||||
// view
|
// view
|
||||||
CreateKeyActivity mCreateKeyActivity;
|
CreateKeyActivity mCreateKeyActivity;
|
||||||
@@ -65,8 +65,8 @@ public class CreateYubiKeyPinRepeatFragment extends Fragment {
|
|||||||
/**
|
/**
|
||||||
* Creates new instance of this fragment
|
* Creates new instance of this fragment
|
||||||
*/
|
*/
|
||||||
public static CreateYubiKeyPinRepeatFragment newInstance() {
|
public static CreateYubiKeyPinFragment newInstance() {
|
||||||
CreateYubiKeyPinRepeatFragment frag = new CreateYubiKeyPinRepeatFragment();
|
CreateYubiKeyPinFragment frag = new CreateYubiKeyPinFragment();
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
frag.setArguments(args);
|
frag.setArguments(args);
|
||||||
@@ -101,7 +101,7 @@ public class CreateYubiKeyPinRepeatFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.create_yubi_key_pin_repeat_fragment, container, false);
|
View view = inflater.inflate(R.layout.create_yubi_key_pin_fragment, container, false);
|
||||||
|
|
||||||
mPin = (EditText) view.findViewById(R.id.create_yubi_key_pin);
|
mPin = (EditText) view.findViewById(R.id.create_yubi_key_pin);
|
||||||
mPinRepeat = (EditText) view.findViewById(R.id.create_yubi_key_pin_repeat);
|
mPinRepeat = (EditText) view.findViewById(R.id.create_yubi_key_pin_repeat);
|
||||||
@@ -92,7 +92,9 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
|||||||
|
|
||||||
// prevent annoying orientation changes while fumbling with the device
|
// prevent annoying orientation changes while fumbling with the device
|
||||||
OrientationUtils.lockOrientation(this);
|
OrientationUtils.lockOrientation(this);
|
||||||
|
// prevent close when touching outside of the dialog (happens easily when fumbling with the device)
|
||||||
|
setFinishOnTouchOutside(false);
|
||||||
|
// keep screen on
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
|
||||||
mInputParcel = getIntent().getParcelableExtra(EXTRA_CRYPTO_INPUT);
|
mInputParcel = getIntent().getParcelableExtra(EXTRA_CRYPTO_INPUT);
|
||||||
@@ -115,6 +117,14 @@ public class NfcOperationActivity extends BaseNfcActivity {
|
|||||||
vAnimator.setDisplayedChild(0);
|
vAnimator.setDisplayedChild(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Button vCancel = (Button) findViewById(R.id.nfc_activity_0_cancel);
|
||||||
|
vCancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
setResult(RESULT_CANCELED);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
Bundle data = intent.getExtras();
|
Bundle data = intent.getExtras();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
android:measureAllChildren="false"
|
android:measureAllChildren="false"
|
||||||
android:minHeight="?listPreferredItemHeightSmall"
|
android:minHeight="?listPreferredItemHeightSmall"
|
||||||
android:outAnimation="@anim/fade_out"
|
android:outAnimation="@anim/fade_out"
|
||||||
custom:initialView="3">
|
custom:initialView="0">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -41,6 +41,16 @@
|
|||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:src="@drawable/yubikey_phone" />
|
android:src="@drawable/yubikey_phone" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/nfc_activity_0_cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_below="@+id/nfc_activity_0_image"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:text="@string/progress_cancel" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|||||||
Reference in New Issue
Block a user