diff --git a/org_apg/AndroidManifest.xml b/org_apg/AndroidManifest.xml index 4d91be1f0..64bb29ede 100644 --- a/org_apg/AndroidManifest.xml +++ b/org_apg/AndroidManifest.xml @@ -228,11 +228,6 @@ android:name=".ui.ImportFromQRCodeActivity" android:configChanges="keyboardHidden|orientation|keyboard" android:label="@string/title_importFromQRCode" /> - diff --git a/org_apg/res/layout/help_activity.xml b/org_apg/res/layout/help_activity.xml index 12ac366d7..fa233ac2c 100644 --- a/org_apg/res/layout/help_activity.xml +++ b/org_apg/res/layout/help_activity.xml @@ -1,14 +1,14 @@ - + + + android:layout_height="match_parent"> + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/org_apg/res/layout/about_activity.xml b/org_apg/res/layout/help_fragment_about.xml similarity index 55% rename from org_apg/res/layout/about_activity.xml rename to org_apg/res/layout/help_fragment_about.xml index c523f3e76..282926310 100644 --- a/org_apg/res/layout/about_activity.xml +++ b/org_apg/res/layout/help_fragment_about.xml @@ -8,7 +8,9 @@ android:layout_height="wrap_content" android:isScrollContainer="true" android:orientation="vertical" - android:padding="15dp" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingTop="16dp" android:scrollbars="vertical" > @@ -49,48 +52,11 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/org_apg/res/layout/info.xml b/org_apg/res/layout/info.xml deleted file mode 100644 index 2507029c4..000000000 --- a/org_apg/res/layout/info.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - diff --git a/org_apg/res/raw/help.html b/org_apg/res/raw/help.html deleted file mode 100644 index aff1b0179..000000000 --- a/org_apg/res/raw/help.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - -

Beta software

-

This is beta software. It contains many remaining bugs!

-

APG+

-

Android Privacy Guard (APG) is a OpenPGP implementation for Android. -
APG+ is a fork based on the original APG to introduce more features and a new user interface.

-

I found a bug in APG+!

-

Please report it in the issue tracker of APG+.

- - \ No newline at end of file diff --git a/org_apg/res/raw/help_about.html b/org_apg/res/raw/help_about.html new file mode 100644 index 000000000..72d9c4bf3 --- /dev/null +++ b/org_apg/res/raw/help_about.html @@ -0,0 +1,21 @@ + + + + + +

https://github.com/dschuermann/apg

+

Android Privacy Guard (APG) is a OpenPGP implementation for Android.

+

License: Apache License v2

+

Developer: Thialfihar (Main developer), Senecaso (QRCode, sign key, upload key), Markus Doits (AIDL), Oliver Runge, Dominik Schürmann (Version 2 and up)

+ +

Libraries

+

ActionBarSherlock (Apache License v2) +
ZXing QRCode Integration (Apache License v2) +
SpongyCastle (MIT X11 License) +
Tcpdump/Libpcap (BSD 3-Clause License) +
• Icons from RRZE Icon Set (Creative Commons Attribution Share-Alike licence 3.0) +
• Icons from Tango Icon Set (Public Domain)

+ + \ No newline at end of file diff --git a/org_apg/res/raw/help_changelog.html b/org_apg/res/raw/help_changelog.html new file mode 100644 index 000000000..7602fe151 --- /dev/null +++ b/org_apg/res/raw/help_changelog.html @@ -0,0 +1,23 @@ + + + + + +

2.0

+

* Complete redesign +
* Integration of different branches: +
* Share public keys via qr codes +
* Sign keys +
* Upload keys to server

+ +

1.08

+

* basic key server support +
* app2sd (untested, let me know if there are problems) +
* more choices for pass phrase cache: 1, 2, 4, 8, hours +
* translations: Norwegian (thanks, Sander Danielsen), Chinese (thanks, Zhang Fredrick) +
* bugfixes +
* optimizations

+ + \ No newline at end of file diff --git a/org_apg/res/raw/help_start.html b/org_apg/res/raw/help_start.html new file mode 100644 index 000000000..db7559632 --- /dev/null +++ b/org_apg/res/raw/help_start.html @@ -0,0 +1,27 @@ + + + + + +

Beta software

+

This is beta software. It contains many remaining bugs!

+ +

APG

+

Android Privacy Guard (APG) is a OpenPGP implementation for Android. +
This is a fork based on the original APG to introduce more features and a new user interface.

+ +

WARNING

+

Be careful editing your existing keys, as they WILL be stripped of certificates right now. +

Also: key cross-certification is NOT supported, so signing with those keys will get a warning when the signature is checked.

+ +

Getting started

+

Install K-9 Mail for the best integration, it supports APG for PGP/INLINE and lets you directly encrypt/decrypt emails. +
It is recommended that you install OI File Manager to be able to use the browse button for file selection in APG. +
First you need some keys. Either import them via the option menus in "Manage Keys" and "My Keys" or create them in "My Keys".

+ +

I found a bug in APG!

+

Please report it in the issue tracker of APG.

+ + \ No newline at end of file diff --git a/org_apg/res/values/strings.xml b/org_apg/res/values/strings.xml index 606e351b1..25cf6d190 100644 --- a/org_apg/res/values/strings.xml +++ b/org_apg/res/values/strings.xml @@ -1,5 +1,6 @@ - - Install K-9 Mail for the best integration, it supports APG for PGP/INLINE and lets you directly encrypt/decrypt emails. -\n\nIt is recommended that you install OI File Manager or ASTRO to be able to use the browse button for file selection in APG. -\n\nFirst you need some keys. Either import them via the option menus in \"Manage Public Keys\" and \"Manage Secret Keys\" or create them in \"Manage Secret Keys\". -\n\nYou can also add a GMail account in the main activity via \"Add Account\", which simplifies decrypting emails received there. -\n\nCheck out the option menus in the various activities to find more functions. + - - - - - Android Privacy Guard (APG) is a OpenPGP implementation for Android. - License: Apache License 2.0 - Version: - Developer: Thialfihar (Main developer), Senecaso (QRCode, sign key, upload key), Markus Doits (AIDL), Oliver Runge, Dominik Schürmann (New user interface) Manage Keys @@ -340,4 +327,10 @@ Help Scan QRCode + + Start + Changelog + About + Version: + \ No newline at end of file diff --git a/org_apg/src/org/thialfihar/android/apg/Preferences.java b/org_apg/src/org/thialfihar/android/apg/Preferences.java index a550fed77..d0b19b5d0 100644 --- a/org_apg/src/org/thialfihar/android/apg/Preferences.java +++ b/org_apg/src/org/thialfihar/android/apg/Preferences.java @@ -24,7 +24,7 @@ import java.util.Vector; /** * Singelton Implementation of a Preference Helper - * + * */ public class Preferences { private static Preferences mPreferences; @@ -135,26 +135,6 @@ public class Preferences { editor.commit(); } - public boolean hasSeenChangeLog(String version) { - return mSharedPreferences.getBoolean(Constants.pref.HAS_SEEN_CHANGE_LOG + version, false); - } - - public void setHasSeenChangeLog(String version, boolean value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Constants.pref.HAS_SEEN_CHANGE_LOG + version, value); - editor.commit(); - } - - public boolean hasSeenHelp() { - return mSharedPreferences.getBoolean(Constants.pref.HAS_SEEN_HELP, false); - } - - public void setHasSeenHelp(boolean value) { - SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Constants.pref.HAS_SEEN_HELP, value); - editor.commit(); - } - public String[] getKeyServers() { String rawData = mSharedPreferences.getString(Constants.pref.KEY_SERVERS, Constants.defaults.KEY_SERVERS); diff --git a/org_apg/src/org/thialfihar/android/apg/ui/AboutActivity.java b/org_apg/src/org/thialfihar/android/apg/ui/AboutActivity.java deleted file mode 100644 index 1988292ae..000000000 --- a/org_apg/src/org/thialfihar/android/apg/ui/AboutActivity.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.thialfihar.android.apg.ui; - -import org.thialfihar.android.apg.R; -import org.thialfihar.android.apg.Constants; - -import android.app.Activity; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.os.Bundle; -import android.util.Log; -import android.widget.TextView; - -public class AboutActivity extends Activity { - Activity mActivity; - - /** - * Instantiate View for this Activity - */ - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.about_activity); - - mActivity = this; - - TextView versionText = (TextView) findViewById(R.id.about_version); - versionText.setText(getString(R.string.about_version) + " " + getVersion()); - } - - /** - * Get the current package version. - * - * @return The current version. - */ - private String getVersion() { - String result = ""; - try { - PackageManager manager = mActivity.getPackageManager(); - PackageInfo info = manager.getPackageInfo(mActivity.getPackageName(), 0); - - result = String.format("%s (%s)", info.versionName, info.versionCode); - } catch (NameNotFoundException e) { - Log.w(Constants.TAG, "Unable to get application version: " + e.getMessage()); - result = "Unable to get application version."; - } - - return result; - } -} diff --git a/org_apg/src/org/thialfihar/android/apg/ui/HelpActivity.java b/org_apg/src/org/thialfihar/android/apg/ui/HelpActivity.java index dda4cbf36..bd9d68ce7 100644 --- a/org_apg/src/org/thialfihar/android/apg/ui/HelpActivity.java +++ b/org_apg/src/org/thialfihar/android/apg/ui/HelpActivity.java @@ -17,63 +17,146 @@ package org.thialfihar.android.apg.ui; import org.thialfihar.android.apg.R; -import org.thialfihar.android.apg.util.Utils; -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.MenuItem; - -import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.text.Html; -import android.text.method.LinkMovementMethod; +import android.support.v4.app.FragmentTransaction; import android.widget.TextView; -public class HelpActivity extends SherlockActivity { - Activity mActivity; - TextView mHelpText; +import com.actionbarsherlock.app.ActionBar; +import com.actionbarsherlock.app.ActionBar.Tab; +import com.actionbarsherlock.view.MenuItem; +import java.util.ArrayList; + +import android.content.Context; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentPagerAdapter; +import android.support.v4.view.ViewPager; + +import com.actionbarsherlock.app.SherlockFragmentActivity; + +public class HelpActivity extends SherlockFragmentActivity { + ViewPager mViewPager; + TabsAdapter mTabsAdapter; + TextView tabCenter; + TextView tabText; + + /** + * Menu Items + */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case android.R.id.home: - startActivity(new Intent(this, MainActivity.class)); + // app icon in Action Bar clicked; go home + Intent intent = new Intent(this, MainActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(intent); return true; - default: - break; - + return super.onOptionsItemSelected(item); } - return false; } - /** - * Instantiate View for this Activity - */ @Override - protected void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.help_activity); + mViewPager = new ViewPager(this); + mViewPager.setId(R.id.pager); - final ActionBar actionBar = getSupportActionBar(); - actionBar.setDisplayShowTitleEnabled(true); - actionBar.setDisplayHomeAsUpEnabled(true); + setContentView(mViewPager); + ActionBar bar = getSupportActionBar(); + bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); + bar.setDisplayShowTitleEnabled(true); + bar.setDisplayHomeAsUpEnabled(true); - mActivity = this; + mTabsAdapter = new TabsAdapter(this, mViewPager); - mHelpText = (TextView) findViewById(R.id.help_text); + Bundle startBundle = new Bundle(); + startBundle.putInt(HelpFragmentHtml.ARG_HTML_FILE, R.raw.help_start); + mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_start)), + HelpFragmentHtml.class, startBundle); - // load html from html file from /res/raw - String helpText = Utils.readContentFromResource(mActivity, R.raw.help); - - // set text from resources with html markup - mHelpText.setText(Html.fromHtml(helpText)); - // make links work - mHelpText.setMovementMethod(LinkMovementMethod.getInstance()); + Bundle changelogBundle = new Bundle(); + changelogBundle.putInt(HelpFragmentHtml.ARG_HTML_FILE, R.raw.help_changelog); + mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_changelog)), + HelpFragmentHtml.class, changelogBundle); + mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.help_tab_about)), + HelpFragmentAbout.class, null); } -} + public static class TabsAdapter extends FragmentPagerAdapter implements ActionBar.TabListener, + ViewPager.OnPageChangeListener { + private final Context mContext; + private final ActionBar mActionBar; + private final ViewPager mViewPager; + private final ArrayList mTabs = new ArrayList(); + + static final class TabInfo { + private final Class clss; + private final Bundle args; + + TabInfo(Class _class, Bundle _args) { + clss = _class; + args = _args; + } + } + + public TabsAdapter(SherlockFragmentActivity activity, ViewPager pager) { + super(activity.getSupportFragmentManager()); + mContext = activity; + mActionBar = activity.getSupportActionBar(); + mViewPager = pager; + mViewPager.setAdapter(this); + mViewPager.setOnPageChangeListener(this); + } + + public void addTab(ActionBar.Tab tab, Class clss, Bundle args) { + TabInfo info = new TabInfo(clss, args); + tab.setTag(info); + tab.setTabListener(this); + mTabs.add(info); + mActionBar.addTab(tab); + notifyDataSetChanged(); + } + + @Override + public int getCount() { + return mTabs.size(); + } + + @Override + public Fragment getItem(int position) { + TabInfo info = mTabs.get(position); + return Fragment.instantiate(mContext, info.clss.getName(), info.args); + } + + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + } + + public void onPageSelected(int position) { + mActionBar.setSelectedNavigationItem(position); + } + + public void onPageScrollStateChanged(int state) { + } + + public void onTabSelected(Tab tab, FragmentTransaction ft) { + Object tag = tab.getTag(); + for (int i = 0; i < mTabs.size(); i++) { + if (mTabs.get(i) == tag) { + mViewPager.setCurrentItem(i); + } + } + } + + public void onTabUnselected(Tab tab, FragmentTransaction ft) { + } + + public void onTabReselected(Tab tab, FragmentTransaction ft) { + } + } +} \ No newline at end of file diff --git a/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java new file mode 100644 index 000000000..3dec32446 --- /dev/null +++ b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2012 Dominik Schürmann + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.thialfihar.android.apg.ui; + +import org.thialfihar.android.apg.Constants; +import org.thialfihar.android.apg.R; +import org.thialfihar.android.apg.util.Utils; + +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Bundle; +import android.text.Html; +import android.text.method.LinkMovementMethod; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import com.actionbarsherlock.app.SherlockFragment; + +public class HelpFragmentAbout extends SherlockFragment { + + /** + * Workaround for Android Bug. See + * http://stackoverflow.com/questions/8748064/starting-activity-from + * -fragment-causes-nullpointerexception + */ + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + setUserVisibleHint(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.help_fragment_about, container, false); + + // load html from html file from /res/raw + String aboutText = Utils.readContentFromResource(this.getActivity(), R.raw.help_about); + + TextView versionText = (TextView) view.findViewById(R.id.help_about_version); + versionText.setText(getString(R.string.help_about_version) + " " + getVersion()); + + TextView aboutTextView = (TextView) view.findViewById(R.id.help_about_text); + + // load html into textview + aboutTextView.setText(Html.fromHtml(aboutText)); + + // make links work + aboutTextView.setMovementMethod(LinkMovementMethod.getInstance()); + + // no flickering when clicking textview for Android < 4 + aboutTextView.setTextColor(getResources().getColor(android.R.color.black)); + + return view; + } + + /** + * Get the current package version. + * + * @return The current version. + */ + private String getVersion() { + String result = ""; + try { + PackageManager manager = getActivity().getPackageManager(); + PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0); + + result = String.format("%s (%s)", info.versionName, info.versionCode); + } catch (NameNotFoundException e) { + Log.w(Constants.TAG, "Unable to get application version: " + e.getMessage()); + result = "Unable to get application version."; + } + + return result; + } + +} \ No newline at end of file diff --git a/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java new file mode 100644 index 000000000..35f6fb3e6 --- /dev/null +++ b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2012 Dominik Schürmann + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.thialfihar.android.apg.ui; + +import org.thialfihar.android.apg.util.Utils; + +import android.app.Activity; +import android.os.Bundle; +import android.text.Html; +import android.text.method.LinkMovementMethod; +import android.util.TypedValue; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ScrollView; +import android.widget.TextView; + +import com.actionbarsherlock.app.SherlockFragment; + +public class HelpFragmentHtml extends SherlockFragment { + private Activity mActivity; + + private int htmlFile; + + public static final String ARG_HTML_FILE = "htmlFile"; + + /** + * Create a new instance of HelpFragmentHtml, providing "htmlFile" as an argument. + */ + static HelpFragmentHtml newInstance(int htmlFile) { + HelpFragmentHtml f = new HelpFragmentHtml(); + + // Supply html raw file input as an argument. + Bundle args = new Bundle(); + args.putInt(ARG_HTML_FILE, htmlFile); + f.setArguments(args); + + return f; + } + + /** + * Workaround for Android Bug. See + * http://stackoverflow.com/questions/8748064/starting-activity-from + * -fragment-causes-nullpointerexception + */ + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + setUserVisibleHint(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + htmlFile = getArguments().getInt(ARG_HTML_FILE); + + // load html from html file from /res/raw + String helpText = Utils.readContentFromResource(this.getActivity(), htmlFile); + + mActivity = getActivity(); + + ScrollView scroller = new ScrollView(mActivity); + TextView text = new TextView(mActivity); + + // padding + int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, mActivity + .getResources().getDisplayMetrics()); + text.setPadding(padding, padding, padding, 0); + + scroller.addView(text); + + // load html into textview + text.setText(Html.fromHtml(helpText)); + + // make links work + text.setMovementMethod(LinkMovementMethod.getInstance()); + + // no flickering when clicking textview for Android < 4 + text.setTextColor(getResources().getColor(android.R.color.black)); + + return scroller; + } +} \ No newline at end of file diff --git a/org_apg/src/org/thialfihar/android/apg/ui/MainActivity.java b/org_apg/src/org/thialfihar/android/apg/ui/MainActivity.java index 51cba35db..dbcdfcdcb 100644 --- a/org_apg/src/org/thialfihar/android/apg/ui/MainActivity.java +++ b/org_apg/src/org/thialfihar/android/apg/ui/MainActivity.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2012 Dominik Schürmann * Copyright (C) 2010 Thialfihar * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,13 +29,9 @@ import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; -import android.app.Dialog; import android.content.Intent; import android.os.Bundle; -import android.view.ContextMenu; -import android.view.ContextMenu.ContextMenuInfo; import android.view.View; -import android.widget.TextView; public class MainActivity extends SherlockActivity { static { @@ -80,94 +77,6 @@ public class MainActivity extends SherlockActivity { actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setHomeButtonEnabled(false); - - // if (!mPreferences.hasSeenHelp()) { - // showDialog(Id.dialog.help); - // } - // - // if (Apg.isReleaseVersion(this) && !mPreferences.hasSeenChangeLog(Apg.getVersion(this))) { - // showDialog(Id.dialog.change_log); - // } - } - - @Override - protected Dialog onCreateDialog(int id) { - switch (id) { - - // case Id.dialog.change_log: { - // AlertDialog.Builder alert = new AlertDialog.Builder(this); - // - // alert.setTitle("Changes " + Apg.getFullVersion(this)); - // LayoutInflater inflater = (LayoutInflater) this - // .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - // View layout = inflater.inflate(R.layout.info, null); - // TextView message = (TextView) layout.findViewById(R.id.message); - // - // message.setText("Changes:\n" + "* \n" + "\n" - // + "WARNING: be careful editing your existing keys, as they " - // + "WILL be stripped of certificates right now.\n" + "\n" - // + "Also: key cross-certification is NOT supported, so signing " - // + "with those keys will get a warning when the signature is " + "checked.\n" - // + "\n" + "I hope APG continues to be useful to you, please send " - // + "bug reports, feature wishes, feedback."); - // alert.setView(layout); - // - // alert.setCancelable(false); - // alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - // public void onClick(DialogInterface dialog, int id) { - // MainActivity.this.removeDialog(Id.dialog.change_log); - // mPreferences.setHasSeenChangeLog(Apg.getVersion(MainActivity.this), true); - // } - // }); - // - // return alert.create(); - // } - - // case Id.dialog.help: { - // AlertDialog.Builder alert = new AlertDialog.Builder(this); - // - // alert.setTitle(R.string.title_help); - // - // LayoutInflater inflater = (LayoutInflater) this - // .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - // View layout = inflater.inflate(R.layout.info, null); - // TextView message = (TextView) layout.findViewById(R.id.message); - // message.setText(R.string.text_help); - // - // TransformFilter packageNames = new TransformFilter() { - // public final String transformUrl(final Matcher match, String url) { - // String name = match.group(1).toLowerCase(); - // if (name.equals("astro")) { - // return "com.metago.astro"; - // } else if (name.equals("k-9 mail")) { - // return "com.fsck.k9"; - // } else { - // return "org.openintents.filemanager"; - // } - // } - // }; - // - // Pattern pattern = Pattern.compile("(OI File Manager|ASTRO|K-9 Mail)"); - // String scheme = "market://search?q=pname:"; - // message.setAutoLinkMask(0); - // Linkify.addLinks(message, pattern, scheme, null, packageNames); - // - // alert.setView(layout); - // - // alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - // public void onClick(DialogInterface dialog, int id) { - // MainActivity.this.removeDialog(Id.dialog.help); - // mPreferences.setHasSeenHelp(true); - // } - // }); - // - // return alert.create(); - // } - - default: { - return super.onCreateDialog(id); - } - } } @Override @@ -175,40 +84,22 @@ public class MainActivity extends SherlockActivity { menu.add(0, Id.menu.option.preferences, 0, R.string.menu_preferences) .setIcon(R.drawable.ic_menu_settings) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - menu.add(0, Id.menu.option.about, 1, R.string.menu_about).setIcon(R.drawable.ic_menu_about) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case Id.menu.option.about: { - startActivity(new Intent(this, AboutActivity.class)); - return true; - } - case Id.menu.option.preferences: { + case Id.menu.option.preferences: startActivity(new Intent(this, PreferencesActivity.class)); return true; - } - default: { + default: break; - } + } return false; } - @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { - super.onCreateContextMenu(menu, v, menuInfo); - - TextView nameTextView = (TextView) v.findViewById(R.id.accountName); - if (nameTextView != null) { - menu.setHeaderTitle(nameTextView.getText()); - menu.add(0, Id.menu.delete, 0, R.string.menu_deleteAccount); - } - } - } \ No newline at end of file