From 182524bb9662f2ecbc7301020b5eb620d9b786f3 Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 31 Oct 2012 18:58:10 +0100 Subject: better help screen --- org_apg/libs/htmlcleaner-2.2.jar | Bin 0 -> 107942 bytes org_apg/libs/htmlspanner-0.2-fork.jar | Bin 0 -> 31039 bytes org_apg/res/layout/help_fragment_about.xml | 2 +- org_apg/res/raw/help_about.html | 25 ++++-- org_apg/res/raw/help_changelog.html | 96 +++++++++++++-------- .../thialfihar/android/apg/helper/OtherHelper.java | 23 ++--- .../android/apg/ui/HelpFragmentAbout.java | 21 ++++- .../android/apg/ui/HelpFragmentHtml.java | 23 +++-- 8 files changed, 117 insertions(+), 73 deletions(-) create mode 100644 org_apg/libs/htmlcleaner-2.2.jar create mode 100644 org_apg/libs/htmlspanner-0.2-fork.jar diff --git a/org_apg/libs/htmlcleaner-2.2.jar b/org_apg/libs/htmlcleaner-2.2.jar new file mode 100644 index 000000000..cc922d06b Binary files /dev/null and b/org_apg/libs/htmlcleaner-2.2.jar differ diff --git a/org_apg/libs/htmlspanner-0.2-fork.jar b/org_apg/libs/htmlspanner-0.2-fork.jar new file mode 100644 index 000000000..76223ccc6 Binary files /dev/null and b/org_apg/libs/htmlspanner-0.2-fork.jar differ diff --git a/org_apg/res/layout/help_fragment_about.xml b/org_apg/res/layout/help_fragment_about.xml index 282926310..82cb0a89f 100644 --- a/org_apg/res/layout/help_fragment_about.xml +++ b/org_apg/res/layout/help_fragment_about.xml @@ -51,7 +51,7 @@ -

https://github.com/dschuermann/apg

-

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

+

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

License: Apache License v2

-

Developer: Thialfihar (Main developer v1.x), Senecaso (QRCode, sign key, upload key), Markus Doits (AIDL), Oliver Runge, Dominik Schürmann (Developer v2.x)

+ +

Developer

+

Libraries

-

ActionBarSherlock (Apache License v2) -
ZXing QRCode Integration (Apache License v2) -
SpongyCastle (MIT X11 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 index 328a2b203..bf013342b 100644 --- a/org_apg/res/raw/help_changelog.html +++ b/org_apg/res/raw/help_changelog.html @@ -6,61 +6,81 @@ And don't add newlines before or after p tags because of transifex -->

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

+

1.0.7

-

* clear sign problem with lacking trailing newline fixed -
* more options for pass phrase cache time to live (20, 40, 60 mins)

+

1.0.6

-

* account adding crash on Froyo fixed -
* secure file deletion -
* option to delete key file after import -
* stream encryption/decryption (gallery, etc.) -
* new options (language, force v3 signatures) -
* interface changes -
* bugfixes

+

1.0.5

-

* German and Italian translation -
* much smaller package, due to reduced BC sources -
* new preferences GUI -
* layout adjustment for localization -
* signature bugfix

+

1.0.4

-

* fixed another crash caused by some SDK bug with query builder

+

1.0.3

-

* fixed crashes during encryption/signing and possibly key export

+

1.0.2

-

* filterable key lists -
* smarter preselection of encryption keys -
* new Intent handling for VIEW and SEND, allows files to be encrypted/decrypted out of file managers -
* fixes and additional features (key preselection) for k9, new beta build available

+

1.0.1

-

* GMail account listing was broken in 1.0.0, fixed again

+

1.0.0

-

* k9mail integration, APG supporting beta build of k9mail -
* support of more file managers (including ASTRO) -
* Slovenian translation -
* new database, much faster, less memory usage -
* defined Intents and content provider for other apps -
* bugfixes

+ \ No newline at end of file diff --git a/org_apg/src/org/thialfihar/android/apg/helper/OtherHelper.java b/org_apg/src/org/thialfihar/android/apg/helper/OtherHelper.java index 5323289bf..07fcad33e 100644 --- a/org_apg/src/org/thialfihar/android/apg/helper/OtherHelper.java +++ b/org_apg/src/org/thialfihar/android/apg/helper/OtherHelper.java @@ -36,30 +36,17 @@ import android.os.Bundle; public class OtherHelper { /** - * Reads html files from /res/raw/example.html to output them as string. See - * http://www.monocube.com/2011/02/08/android-tutorial-html-file-in-webview/ + * Gets input stream of raw resource * * @param context * current context * @param resourceID * of html file to read - * @return content of html file with formatting + * @return input stream of resource */ - public static String readContentFromResource(Context context, int resourceID) { + public static InputStream getInputStreamFromResource(Context context, int resourceID) { InputStream raw = context.getResources().openRawResource(resourceID); - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - int i; - try { - i = raw.read(); - while (i != -1) { - stream.write(i); - i = raw.read(); - } - raw.close(); - } catch (IOException e) { - e.printStackTrace(); - } - return stream.toString(); + return raw; } /** @@ -147,7 +134,7 @@ public class OtherHelper { output[1] = "<" + chunks[1]; } output[0] = userId; - + return output; } diff --git a/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java index c41c7a266..1b80db66b 100644 --- a/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java +++ b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java @@ -16,6 +16,12 @@ package org.thialfihar.android.apg.ui; +import java.io.IOException; +import java.io.InputStream; + +import net.nightwhistler.htmlspanner.HtmlSpanner; +import net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView; + import org.thialfihar.android.apg.Constants; import org.thialfihar.android.apg.R; import org.thialfihar.android.apg.helper.OtherHelper; @@ -24,7 +30,6 @@ 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 org.thialfihar.android.apg.util.Log; import android.view.LayoutInflater; @@ -52,15 +57,23 @@ public class HelpFragmentAbout extends SherlockFragment { View view = inflater.inflate(R.layout.help_fragment_about, container, false); // load html from html file from /res/raw - String aboutText = OtherHelper.readContentFromResource(this.getActivity(), R.raw.help_about); + InputStream inputStreamText = OtherHelper.getInputStreamFromResource(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); + JellyBeanSpanFixTextView aboutTextView = (JellyBeanSpanFixTextView) view + .findViewById(R.id.help_about_text); // load html into textview - aboutTextView.setText(Html.fromHtml(aboutText)); + HtmlSpanner htmlSpanner = new HtmlSpanner(); + htmlSpanner.setStripExtraWhiteSpace(true); + try { + aboutTextView.setText(htmlSpanner.fromHtml(inputStreamText)); + } catch (IOException e) { + Log.e(Constants.TAG, "Error while reading raw resources as stream", e); + } // make links work aboutTextView.setMovementMethod(LinkMovementMethod.getInstance()); diff --git a/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java index ea90d6855..e46e7b112 100644 --- a/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java +++ b/org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java @@ -16,18 +16,24 @@ package org.thialfihar.android.apg.ui; +import java.io.IOException; +import java.io.InputStream; + +import net.nightwhistler.htmlspanner.HtmlSpanner; +import net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView; + +import org.thialfihar.android.apg.Constants; import org.thialfihar.android.apg.helper.OtherHelper; +import org.thialfihar.android.apg.util.Log; 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; @@ -68,12 +74,13 @@ public class HelpFragmentHtml extends SherlockFragment { htmlFile = getArguments().getInt(ARG_HTML_FILE); // load html from html file from /res/raw - String helpText = OtherHelper.readContentFromResource(this.getActivity(), htmlFile); + InputStream inputStreamText = OtherHelper.getInputStreamFromResource(this.getActivity(), + htmlFile); mActivity = getActivity(); ScrollView scroller = new ScrollView(mActivity); - TextView text = new TextView(mActivity); + JellyBeanSpanFixTextView text = new JellyBeanSpanFixTextView(mActivity); // padding int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, mActivity @@ -83,7 +90,13 @@ public class HelpFragmentHtml extends SherlockFragment { scroller.addView(text); // load html into textview - text.setText(Html.fromHtml(helpText)); + HtmlSpanner htmlSpanner = new HtmlSpanner(); + htmlSpanner.setStripExtraWhiteSpace(true); + try { + text.setText(htmlSpanner.fromHtml(inputStreamText)); + } catch (IOException e) { + Log.e(Constants.TAG, "Error while reading raw resources as stream", e); + } // make links work text.setMovementMethod(LinkMovementMethod.getInstance()); -- cgit v1.2.3