linked: fix "navigate up" in LinkedIdWizard (imperfect)
This commit is contained in:
@@ -113,7 +113,9 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.linked.LinkedIdWizard"
|
android:name=".ui.linked.LinkedIdWizard"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||||
android:label="@string/title_linked_create">
|
android:label="@string/title_linked_create"
|
||||||
|
android:parentActivityName=".ui.ViewKeyActivity"
|
||||||
|
>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.QrCodeViewActivity"
|
android:name=".ui.QrCodeViewActivity"
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
|||||||
Intent intent = new Intent(this, LinkedIdWizard.class);
|
Intent intent = new Intent(this, LinkedIdWizard.class);
|
||||||
intent.setData(mDataUri);
|
intent.setData(mDataUri);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case R.id.menu_key_view_edit: {
|
case R.id.menu_key_view_edit: {
|
||||||
@@ -427,7 +428,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
|
|||||||
|
|
||||||
private void certifyImmediate() {
|
private void certifyImmediate() {
|
||||||
Intent intent = new Intent(this, CertifyKeyActivity.class);
|
Intent intent = new Intent(this, CertifyKeyActivity.class);
|
||||||
intent.putExtra(CertifyKeyActivity.EXTRA_KEY_IDS, new long[]{mMasterKeyId});
|
intent.putExtra(CertifyKeyActivity.EXTRA_KEY_IDS, new long[] { mMasterKeyId });
|
||||||
|
|
||||||
startActivityForResult(intent, REQUEST_CERTIFY);
|
startActivityForResult(intent, REQUEST_CERTIFY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,14 @@ package org.sufficientlysecure.keychain.ui.linked;
|
|||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import android.support.v4.app.NavUtils;
|
||||||
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
@@ -31,6 +35,7 @@ import org.sufficientlysecure.keychain.R;
|
|||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
|
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
@@ -126,4 +131,34 @@ public class LinkedIdWizard extends BaseActivity {
|
|||||||
inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (!getFragmentManager().popBackStackImmediate()) {
|
||||||
|
navigateBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
// Respond to the action bar's Up/Home button
|
||||||
|
case android.R.id.home:
|
||||||
|
navigateBack();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void navigateBack() {
|
||||||
|
Intent upIntent = NavUtils.getParentActivityIntent(this);
|
||||||
|
upIntent.setData(KeyRings.buildGenericKeyRingUri(mMasterKeyId));
|
||||||
|
// This activity is NOT part of this app's task, so create a new task
|
||||||
|
// when navigating up, with a synthesized back stack.
|
||||||
|
TaskStackBuilder.create(this)
|
||||||
|
// Add all of this activity's parents to the back stack
|
||||||
|
.addNextIntentWithParentStack(upIntent)
|
||||||
|
// Navigate up to the closest parent
|
||||||
|
.startActivities();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,8 +119,7 @@ public abstract class KeySpinner extends AppCompatSpinner implements
|
|||||||
if (getContext() instanceof FragmentActivity) {
|
if (getContext() instanceof FragmentActivity) {
|
||||||
((FragmentActivity) getContext()).getSupportLoaderManager().restartLoader(LOADER_ID, null, this);
|
((FragmentActivity) getContext()).getSupportLoaderManager().restartLoader(LOADER_ID, null, this);
|
||||||
} else {
|
} else {
|
||||||
throw new AssertionError("KeySpinner must be attached to FragmentActivity, this is "
|
// ignore, this happens during preview! we use fragmentactivities everywhere either way
|
||||||
+ getContext().getClass());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user