token-import: move debug states out of fragment
This commit is contained in:
@@ -5,6 +5,9 @@ import android.os.Parcelable;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import org.bouncycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
|
||||
|
||||
@AutoValue
|
||||
@@ -45,4 +48,23 @@ public abstract class SecurityTokenInfo implements Parcelable {
|
||||
public static SecurityTokenInfo createBlank(byte[] aid) {
|
||||
return new AutoValue_SecurityTokenInfo(null, null, null, aid, null, null, 0, 0);
|
||||
}
|
||||
|
||||
public static SecurityTokenInfo newInstanceDebugKeyserver() {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
throw new UnsupportedOperationException("This operation is only available in debug builds!");
|
||||
}
|
||||
return SecurityTokenInfo.create(
|
||||
KeyFormattingUtils.convertFingerprintHexFingerprint("1efdb4845ca242ca6977fddb1f788094fd3b430a"),
|
||||
new byte[20], new byte[20], Hex.decode("010203040506"), "yubinu2@mugenguild.com", null, 3, 3);
|
||||
}
|
||||
|
||||
public static SecurityTokenInfo newInstanceDebugUri() {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
throw new UnsupportedOperationException("This operation is only available in debug builds!");
|
||||
}
|
||||
return SecurityTokenInfo.create(
|
||||
KeyFormattingUtils.convertFingerprintHexFingerprint("4700BA1AC417ABEF3CC7765AD686905837779C3E"),
|
||||
new byte[20], new byte[20], Hex.decode("010203040506"),
|
||||
"yubinu2@mugenguild.com", "http://valodim.stratum0.net/mryubinu2.asc", 3, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -30,13 +30,12 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
|
||||
import org.bouncycastle.util.encoders.Hex;
|
||||
import org.sufficientlysecure.keychain.BuildConfig;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity;
|
||||
import org.sufficientlysecure.keychain.ui.token.ManageSecurityTokenFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
|
||||
|
||||
public class CreateSecurityTokenWaitFragment extends Fragment {
|
||||
@@ -66,12 +65,13 @@ public class CreateSecurityTokenWaitFragment extends Fragment {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_token_debug_uri:
|
||||
mCreateKeyActivity.loadFragment(
|
||||
ManageSecurityTokenFragment.newInstanceDebugUri(), FragAction.TO_RIGHT);
|
||||
mCreateKeyActivity.loadFragment(ManageSecurityTokenFragment.newInstance(
|
||||
SecurityTokenInfo.newInstanceDebugUri()), FragAction.TO_RIGHT);
|
||||
break;
|
||||
case R.id.menu_token_debug_keyserver:
|
||||
mCreateKeyActivity.loadFragment(
|
||||
ManageSecurityTokenFragment.newInstanceDebugKeyserver(), FragAction.TO_RIGHT);
|
||||
mCreateKeyActivity.loadFragment(ManageSecurityTokenFragment.newInstance(
|
||||
SecurityTokenInfo.newInstanceDebugKeyserver()), FragAction.TO_RIGHT);
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@@ -91,28 +91,6 @@ public class ManageSecurityTokenFragment extends Fragment implements ManageSecur
|
||||
private LayoutInflater layoutInflater;
|
||||
private StatusIndicator latestStatusIndicator;
|
||||
|
||||
public static Fragment newInstanceDebugKeyserver() {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
throw new UnsupportedOperationException("This operation is only available in debug builds!");
|
||||
}
|
||||
SecurityTokenInfo securityTokenInfo = SecurityTokenInfo.create(
|
||||
KeyFormattingUtils.convertFingerprintHexFingerprint("1efdb4845ca242ca6977fddb1f788094fd3b430a"),
|
||||
new byte[20], new byte[20], Hex.decode("010203040506"),
|
||||
"yubinu2@mugenguild.com", "http://valodim.stratum0.net/mryubinu2.asc", 3, 3);
|
||||
return newInstance(securityTokenInfo);
|
||||
}
|
||||
|
||||
public static Fragment newInstanceDebugUri() {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
throw new UnsupportedOperationException("This operation is only available in debug builds!");
|
||||
}
|
||||
SecurityTokenInfo securityTokenInfo = SecurityTokenInfo.create(
|
||||
KeyFormattingUtils.convertFingerprintHexFingerprint("4700BA1AC417ABEF3CC7765AD686905837779C3E"),
|
||||
new byte[20], new byte[20], Hex.decode("010203040506"),
|
||||
"yubinu2@mugenguild.com", "http://valodim.stratum0.net/mryubinu2.asc", 3, 3);
|
||||
return newInstance(securityTokenInfo);
|
||||
}
|
||||
|
||||
public static Fragment newInstance(SecurityTokenInfo tokenInfo) {
|
||||
ManageSecurityTokenFragment frag = new ManageSecurityTokenFragment();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user