aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-11-02 21:29:53 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-12-27 14:58:18 +0100
commit50248bd570f1de019b18a467e5181c4d14a772f6 (patch)
tree3edfbe47fa156d77a6ecd3fe55d055959d94500e /OpenKeychain/src/main/java/org/sufficientlysecure
parent6f74ba2f2d135f60fa926b6e4a8749d01373dc09 (diff)
downloadopen-keychain-50248bd570f1de019b18a467e5181c4d14a772f6.tar.gz
open-keychain-50248bd570f1de019b18a467e5181c4d14a772f6.tar.bz2
open-keychain-50248bd570f1de019b18a467e5181c4d14a772f6.zip
extended: init tabs with loader info
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java20
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java5
2 files changed, 14 insertions, 11 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java
index 94a171f14..e676b441f 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java
@@ -78,9 +78,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements
mViewPager = (ViewPager) findViewById(R.id.pager);
mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tab_layout);
- Intent intent = getIntent();
- int switchToTab = intent.getIntExtra(EXTRA_SELECTED_TAB, TAB_SHARE);
-
mDataUri = getIntent().getData();
if (mDataUri == null) {
Log.e(Constants.TAG, "Data missing. Should be uri of key!");
@@ -101,10 +98,6 @@ public class ViewKeyAdvActivity extends BaseActivity implements
// or start new ones.
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
- initTabs(mDataUri);
-
- // switch to tab selected by extra
- mViewPager.setCurrentItem(switchToTab);
}
@Override
@@ -112,17 +105,18 @@ public class ViewKeyAdvActivity extends BaseActivity implements
setContentView(R.layout.view_key_adv_activity);
}
- private void initTabs(Uri dataUri) {
+ private void initTabs(Uri dataUri, boolean hasSecret) {
PagerTabStripAdapter adapter = new PagerTabStripAdapter(this);
mViewPager.setAdapter(adapter);
Bundle shareBundle = new Bundle();
- shareBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri);
+ shareBundle.putParcelable(ViewKeyAdvShareFragment.ARG_DATA_URI, dataUri);
adapter.addTab(ViewKeyAdvShareFragment.class,
shareBundle, getString(R.string.key_view_tab_share));
Bundle userIdsBundle = new Bundle();
userIdsBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri);
+ userIdsBundle.putBoolean(ViewKeyAdvUserIdsFragment.ARG_HAS_SECRET, hasSecret);
adapter.addTab(ViewKeyAdvUserIdsFragment.class,
userIdsBundle, getString(R.string.section_user_ids));
@@ -138,6 +132,12 @@ public class ViewKeyAdvActivity extends BaseActivity implements
// update layout after operations
mSlidingTabLayout.setViewPager(mViewPager);
+
+ // switch to tab selected by extra
+ Intent intent = getIntent();
+ int switchToTab = intent.getIntExtra(EXTRA_SELECTED_TAB, TAB_SHARE);
+ mViewPager.setCurrentItem(switchToTab);
+
}
// These are the rows that we will retrieve.
@@ -216,6 +216,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements
mStatusBar.setBackgroundColor(ViewKeyActivity.getStatusBarBackgroundColor(color));
mSlidingTabLayout.setBackgroundColor(color);
+ initTabs(mDataUri, isSecret);
+
break;
}
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java
index ad437f924..386a26ae2 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvUserIdsFragment.java
@@ -43,15 +43,16 @@ public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
LoaderManager.LoaderCallbacks<Cursor> {
public static final String ARG_DATA_URI = "uri";
+ public static final String ARG_HAS_SECRET = "has_secret";
private ListView mUserIds;
- private static final int LOADER_ID_UNIFIED = 0;
- private static final int LOADER_ID_USER_IDS = 1;
+ private static final int LOADER_ID_USER_IDS = 0;
private UserIdsAdapter mUserIdsAdapter;
private Uri mDataUri;
+ private boolean mHasSecret;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {