token-import: don't load fragment multiple times
This commit is contained in:
@@ -166,7 +166,11 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
|||||||
|
|
||||||
if (!tokenInfo.isEmpty()) {
|
if (!tokenInfo.isEmpty()) {
|
||||||
Fragment frag = ManageSecurityTokenFragment.newInstance(tokenInfo);
|
Fragment frag = ManageSecurityTokenFragment.newInstance(tokenInfo);
|
||||||
loadFragment(frag, FragAction.TO_RIGHT);
|
if (mCurrentFragment instanceof ManageSecurityTokenFragment) {
|
||||||
|
loadFragment(frag, FragAction.REPLACE);
|
||||||
|
} else {
|
||||||
|
loadFragment(frag, FragAction.TO_RIGHT);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Fragment frag = CreateSecurityTokenBlankFragment.newInstance();
|
Fragment frag = CreateSecurityTokenBlankFragment.newInstance();
|
||||||
loadFragment(frag, FragAction.TO_RIGHT);
|
loadFragment(frag, FragAction.TO_RIGHT);
|
||||||
@@ -195,7 +199,8 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
|||||||
public enum FragAction {
|
public enum FragAction {
|
||||||
START,
|
START,
|
||||||
TO_RIGHT,
|
TO_RIGHT,
|
||||||
TO_LEFT
|
TO_LEFT,
|
||||||
|
REPLACE
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadFragment(Fragment fragment, FragAction action) {
|
public void loadFragment(Fragment fragment, FragAction action) {
|
||||||
@@ -213,6 +218,10 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
|||||||
case TO_LEFT:
|
case TO_LEFT:
|
||||||
getSupportFragmentManager().popBackStackImmediate();
|
getSupportFragmentManager().popBackStackImmediate();
|
||||||
break;
|
break;
|
||||||
|
case REPLACE:
|
||||||
|
transaction.replace(R.id.create_key_fragment_container, fragment, FRAGMENT_TAG)
|
||||||
|
.commit();
|
||||||
|
break;
|
||||||
case TO_RIGHT:
|
case TO_RIGHT:
|
||||||
transaction.setCustomAnimations(R.anim.frag_slide_in_from_right, R.anim.frag_slide_out_to_left,
|
transaction.setCustomAnimations(R.anim.frag_slide_in_from_right, R.anim.frag_slide_out_to_left,
|
||||||
R.anim.frag_slide_in_from_left, R.anim.frag_slide_out_to_right);
|
R.anim.frag_slide_in_from_left, R.anim.frag_slide_out_to_right);
|
||||||
|
|||||||
@@ -73,8 +73,7 @@ import org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator;
|
|||||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||||
|
|
||||||
|
|
||||||
public class ManageSecurityTokenFragment extends Fragment implements ManageSecurityTokenMvpView,
|
public class ManageSecurityTokenFragment extends Fragment implements ManageSecurityTokenMvpView, OnClickListener {
|
||||||
OnClickListener {
|
|
||||||
private static final String ARG_TOKEN_INFO = "token_info";
|
private static final String ARG_TOKEN_INFO = "token_info";
|
||||||
public static final int REQUEST_CODE_OPEN_FILE = 0;
|
public static final int REQUEST_CODE_OPEN_FILE = 0;
|
||||||
public static final int REQUEST_CODE_RESET = 1;
|
public static final int REQUEST_CODE_RESET = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user