add up navigation in ViewCertActivity

Fixes #567
This commit is contained in:
Vincent Breitmoser 2014-04-17 15:29:46 +02:00
parent fda9bd1386
commit 2a34d0e0e4
4 changed files with 13 additions and 1 deletions

View File

@ -90,7 +90,7 @@
<activity
android:name=".ui.ViewCertActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="View Certificate Details"
android:label="@string/title_view_cert"
android:parentActivityName=".ui.ViewKeyActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"

View File

@ -127,6 +127,10 @@ public class KeychainContract {
return CONTENT_URI.buildUpon().appendPath(masterKeyId).build();
}
public static Uri buildGenericKeyRingUri(Uri uri) {
return CONTENT_URI.buildUpon().appendPath(uri.getPathSegments().get(1)).build();
}
public static Uri buildUnifiedKeyRingUri(String masterKeyId) {
return CONTENT_URI.buildUpon().appendPath(masterKeyId).appendPath(PATH_UNIFIED).build();
}

View File

@ -22,6 +22,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.app.NavUtils;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.app.ActionBar;
@ -226,6 +227,12 @@ public class ViewCertActivity extends ActionBarActivity
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home: {
Intent viewIntent = NavUtils.getParentActivityIntent(this);
viewIntent.setData(KeyRings.buildGenericKeyRingUri(mDataUri));
NavUtils.navigateUpTo(this, viewIntent);
return true;
}
case R.id.menu_view_cert_view_signer:
// can't do this before the data is initialized
Intent viewIntent = new Intent(this, ViewKeyActivity.class);

View File

@ -538,5 +538,6 @@
<string name="no_subkey">subkey unavailable</string>
<string name="key_stripped">stripped</string>
<string name="secret_cannot_multiple">Secret keys can only be deleted individually!</string>
<string name="title_view_cert">View Certificate Details</string>
</resources>