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()) {
|
||||
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 {
|
||||
Fragment frag = CreateSecurityTokenBlankFragment.newInstance();
|
||||
loadFragment(frag, FragAction.TO_RIGHT);
|
||||
@@ -195,7 +199,8 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
||||
public enum FragAction {
|
||||
START,
|
||||
TO_RIGHT,
|
||||
TO_LEFT
|
||||
TO_LEFT,
|
||||
REPLACE
|
||||
}
|
||||
|
||||
public void loadFragment(Fragment fragment, FragAction action) {
|
||||
@@ -213,6 +218,10 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
||||
case TO_LEFT:
|
||||
getSupportFragmentManager().popBackStackImmediate();
|
||||
break;
|
||||
case REPLACE:
|
||||
transaction.replace(R.id.create_key_fragment_container, fragment, FRAGMENT_TAG)
|
||||
.commit();
|
||||
break;
|
||||
case TO_RIGHT:
|
||||
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);
|
||||
|
||||
@@ -73,8 +73,7 @@ import org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator;
|
||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||
|
||||
|
||||
public class ManageSecurityTokenFragment extends Fragment implements ManageSecurityTokenMvpView,
|
||||
OnClickListener {
|
||||
public class ManageSecurityTokenFragment extends Fragment implements ManageSecurityTokenMvpView, OnClickListener {
|
||||
private static final String ARG_TOKEN_INFO = "token_info";
|
||||
public static final int REQUEST_CODE_OPEN_FILE = 0;
|
||||
public static final int REQUEST_CODE_RESET = 1;
|
||||
|
||||
Reference in New Issue
Block a user