Advanced screen, warning fragment
This commit is contained in:
@@ -61,10 +61,11 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
protected Uri mDataUri;
|
||||
|
||||
public static final String EXTRA_SELECTED_TAB = "selected_tab";
|
||||
public static final int TAB_SHARE = 0;
|
||||
public static final int TAB_IDENTITIES = 1;
|
||||
public static final int TAB_SUBKEYS = 2;
|
||||
public static final int TAB_CERTS = 3;
|
||||
public static final int TAB_START = 0;
|
||||
public static final int TAB_SHARE = 1;
|
||||
public static final int TAB_IDENTITIES = 2;
|
||||
public static final int TAB_SUBKEYS = 3;
|
||||
public static final int TAB_CERTS = 4;
|
||||
|
||||
// view
|
||||
private ViewPager mViewPager;
|
||||
@@ -126,31 +127,35 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
mViewPager.setAdapter(mTabAdapter);
|
||||
|
||||
// keep track which of these are action mode enabled!
|
||||
mTabsWithActionMode = new boolean[4];
|
||||
mTabsWithActionMode = new boolean[5];
|
||||
|
||||
mTabAdapter.addTab(ViewKeyAdvStartFragment.class,
|
||||
null, getString(R.string.key_view_tab_start));
|
||||
mTabsWithActionMode[0] = false;
|
||||
|
||||
Bundle shareBundle = new Bundle();
|
||||
shareBundle.putParcelable(ViewKeyAdvShareFragment.ARG_DATA_URI, dataUri);
|
||||
mTabAdapter.addTab(ViewKeyAdvShareFragment.class,
|
||||
shareBundle, getString(R.string.key_view_tab_share));
|
||||
mTabsWithActionMode[0] = false;
|
||||
mTabsWithActionMode[1] = false;
|
||||
|
||||
Bundle userIdsBundle = new Bundle();
|
||||
userIdsBundle.putParcelable(ViewKeyAdvUserIdsFragment.ARG_DATA_URI, dataUri);
|
||||
mTabAdapter.addTab(ViewKeyAdvUserIdsFragment.class,
|
||||
userIdsBundle, getString(R.string.section_user_ids));
|
||||
mTabsWithActionMode[1] = true;
|
||||
mTabsWithActionMode[2] = true;
|
||||
|
||||
Bundle keysBundle = new Bundle();
|
||||
keysBundle.putParcelable(ViewKeyAdvSubkeysFragment.ARG_DATA_URI, dataUri);
|
||||
mTabAdapter.addTab(ViewKeyAdvSubkeysFragment.class,
|
||||
keysBundle, getString(R.string.key_view_tab_keys));
|
||||
mTabsWithActionMode[2] = true;
|
||||
mTabsWithActionMode[3] = true;
|
||||
|
||||
Bundle certsBundle = new Bundle();
|
||||
certsBundle.putParcelable(ViewKeyAdvCertsFragment.ARG_DATA_URI, dataUri);
|
||||
mTabAdapter.addTab(ViewKeyAdvCertsFragment.class,
|
||||
certsBundle, getString(R.string.key_view_tab_certs));
|
||||
mTabsWithActionMode[3] = false;
|
||||
mTabsWithActionMode[4] = false;
|
||||
|
||||
// update layout after operations
|
||||
mSlidingTabLayout.setViewPager(mViewPager);
|
||||
@@ -158,7 +163,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
|
||||
// switch to tab selected by extra
|
||||
Intent intent = getIntent();
|
||||
int switchToTab = intent.getIntExtra(EXTRA_SELECTED_TAB, TAB_SHARE);
|
||||
int switchToTab = intent.getIntExtra(EXTRA_SELECTED_TAB, TAB_START);
|
||||
mViewPager.setCurrentItem(switchToTab);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.markdown4j.Markdown4jProcessor;
|
||||
import org.sufficientlysecure.htmltextview.HtmlTextView;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ViewKeyAdvStartFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.view_key_adv_start_fragment, container, false);
|
||||
|
||||
HtmlTextView textView = (HtmlTextView)
|
||||
view.findViewById(R.id.view_key_adv_start_text);
|
||||
|
||||
// load markdown from raw resource
|
||||
try {
|
||||
String html = new Markdown4jProcessor().process(
|
||||
getActivity().getResources().openRawResource(R.raw.advanced));
|
||||
textView.setHtmlFromString(html, new HtmlTextView.LocalImageGetter());
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "IOException", e);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user