OTG: Skip TokenWaitFragmen when otg device is connected
This commit is contained in:
parent
263799ec96
commit
db57cf3e7e
|
@ -144,8 +144,8 @@ public class CreateKeyActivity extends BaseSecurityTokenNfcActivity {
|
|||
|
||||
@Override
|
||||
protected void doSecurityTokenInBackground() throws IOException {
|
||||
if (mCurrentFragment instanceof NfcListenerFragment) {
|
||||
((NfcListenerFragment) mCurrentFragment).doNfcInBackground();
|
||||
if (mCurrentFragment instanceof SecurityTokenListenerFragment) {
|
||||
((SecurityTokenListenerFragment) mCurrentFragment).doSecurityTokenInBackground();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -156,11 +156,16 @@ public class CreateKeyActivity extends BaseSecurityTokenNfcActivity {
|
|||
|
||||
@Override
|
||||
protected void onSecurityTokenPostExecute() {
|
||||
if (mCurrentFragment instanceof NfcListenerFragment) {
|
||||
((NfcListenerFragment) mCurrentFragment).onNfcPostExecute();
|
||||
if (mCurrentFragment instanceof SecurityTokenListenerFragment) {
|
||||
((SecurityTokenListenerFragment) mCurrentFragment).onSecurityTokenPostExecute();
|
||||
return;
|
||||
}
|
||||
|
||||
// We don't want get back to wait activity mainly because it looks weird with otg token
|
||||
if (mCurrentFragment instanceof CreateSecurityTokenWaitFragment) {
|
||||
getSupportFragmentManager().popBackStackImmediate();
|
||||
}
|
||||
|
||||
if (containsKeys(mScannedFingerprints)) {
|
||||
try {
|
||||
long masterKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(mScannedFingerprints);
|
||||
|
@ -255,9 +260,9 @@ public class CreateKeyActivity extends BaseSecurityTokenNfcActivity {
|
|||
|
||||
}
|
||||
|
||||
interface NfcListenerFragment {
|
||||
void doNfcInBackground() throws IOException;
|
||||
void onNfcPostExecute();
|
||||
interface SecurityTokenListenerFragment {
|
||||
void doSecurityTokenInBackground() throws IOException;
|
||||
void onSecurityTokenPostExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
|||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.NfcListenerFragment;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.SecurityTokenListenerFragment;
|
||||
import org.sufficientlysecure.keychain.ui.base.QueueingCryptoOperationFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
@ -50,7 +50,7 @@ import org.sufficientlysecure.keychain.util.Preferences;
|
|||
|
||||
public class CreateSecurityTokenImportResetFragment
|
||||
extends QueueingCryptoOperationFragment<ImportKeyringParcel, ImportKeyResult>
|
||||
implements NfcListenerFragment {
|
||||
implements SecurityTokenListenerFragment {
|
||||
|
||||
private static final int REQUEST_CODE_RESET = 0x00005001;
|
||||
|
||||
|
@ -247,7 +247,7 @@ public class CreateSecurityTokenImportResetFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doNfcInBackground() throws IOException {
|
||||
public void doSecurityTokenInBackground() throws IOException {
|
||||
|
||||
mTokenFingerprints = mCreateKeyActivity.getSecurityTokenHelper().getFingerprints();
|
||||
mTokenAid = mCreateKeyActivity.getSecurityTokenHelper().getAid();
|
||||
|
@ -259,7 +259,7 @@ public class CreateSecurityTokenImportResetFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNfcPostExecute() {
|
||||
public void onSecurityTokenPostExecute() {
|
||||
|
||||
setData();
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -26,6 +27,7 @@ import android.view.ViewGroup;
|
|||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenNfcActivity;
|
||||
|
||||
|
||||
public class CreateSecurityTokenWaitFragment extends Fragment {
|
||||
|
@ -33,6 +35,15 @@ public class CreateSecurityTokenWaitFragment extends Fragment {
|
|||
CreateKeyActivity mCreateKeyActivity;
|
||||
View mBackButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (this.getActivity() instanceof BaseSecurityTokenNfcActivity) {
|
||||
((BaseSecurityTokenNfcActivity) this.getActivity()).checkDeviceConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.create_security_token_wait_fragment, container, false);
|
||||
|
|
Loading…
Reference in a new issue