aboutsummaryrefslogtreecommitdiffstats
path: root/org_apg
diff options
context:
space:
mode:
authorDominik <dominik@dominikschuermann.de>2012-10-31 18:58:10 +0100
committerDominik <dominik@dominikschuermann.de>2012-10-31 18:58:10 +0100
commit182524bb9662f2ecbc7301020b5eb620d9b786f3 (patch)
treeda92069ffd6d82b1f5a7dc94385ee9da980c94ba /org_apg
parent586358599e93214f36fb7d75e7dcbba68628fc32 (diff)
downloadopen-keychain-182524bb9662f2ecbc7301020b5eb620d9b786f3.tar.gz
open-keychain-182524bb9662f2ecbc7301020b5eb620d9b786f3.tar.bz2
open-keychain-182524bb9662f2ecbc7301020b5eb620d9b786f3.zip
better help screen
Diffstat (limited to 'org_apg')
-rw-r--r--org_apg/libs/htmlcleaner-2.2.jarbin0 -> 107942 bytes
-rw-r--r--org_apg/libs/htmlspanner-0.2-fork.jarbin0 -> 31039 bytes
-rw-r--r--org_apg/res/layout/help_fragment_about.xml2
-rw-r--r--org_apg/res/raw/help_about.html25
-rw-r--r--org_apg/res/raw/help_changelog.html96
-rw-r--r--org_apg/src/org/thialfihar/android/apg/helper/OtherHelper.java23
-rw-r--r--org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentAbout.java21
-rw-r--r--org_apg/src/org/thialfihar/android/apg/ui/HelpFragmentHtml.java23
8 files changed, 117 insertions, 73 deletions
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
--- /dev/null
+++ b/org_apg/libs/htmlcleaner-2.2.jar
Binary files 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
--- /dev/null
+++ b/org_apg/libs/htmlspanner-0.2-fork.jar
Binary files 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 @@
</LinearLayout>
</LinearLayout>
- <TextView
+ <net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView
android:id="@+id/help_about_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/org_apg/res/raw/help_about.html b/org_apg/res/raw/help_about.html
index 3cd5dadf7..7781ca85a 100644
--- a/org_apg/res/raw/help_about.html
+++ b/org_apg/res/raw/help_about.html
@@ -6,15 +6,26 @@ And don't add newlines before or after p tags because of transifex -->
</head>
<body>
<p><a href="https://github.com/dschuermann/apg">https://github.com/dschuermann/apg</a></p>
-<p>Android Privacy Guard (APG) is a OpenPGP implementation for Android.</p>
+<p>Android Privacy Guard (APG) is an OpenPGP implementation for Android.</p>
<p>License: Apache License v2</p>
-<p>Developer: Thialfihar (Main developer v1.x), Senecaso (QRCode, sign key, upload key), Markus Doits (AIDL), Oliver Runge, Dominik Schürmann (Developer v2.x)</p>
+
+<h2>Developer</h2>
+<ul>
+<li>Thialfihar (Main developer v1.x)</li>
+<li>Senecaso (QRCode, sign key, upload key)</li>
+<li>Markus Doits (AIDL)</li>
+<li>Oliver Runge</li>
+<li>Dominik Schürmann (Developer v2.x)</li>
+</ul>
<h2>Libraries</h2>
-<p>• <a href="http://actionbarsherlock.com/">ActionBarSherlock</a> (Apache License v2)
-<br/>• <a href="http://code.google.com/p/zxing/">ZXing QRCode Integration</a> (Apache License v2)
-<br/>• <a href="https://github.com/rtyley/spongycastle">SpongyCastle</a> (MIT X11 License)
-<br/>• Icons from <a href="http://rrze-icon-set.berlios.de/">RRZE Icon Set</a> (Creative Commons Attribution Share-Alike licence 3.0)
-<br/>• Icons from <a href="http://tango.freedesktop.org/">Tango Icon Set</a> (Public Domain)</p>
+<ul>
+<li><a href="http://actionbarsherlock.com">ActionBarSherlock</a> (Apache License v2)</li>
+<li><a href="http://code.google.com/p/zxing/">ZXing QRCode Integration</a> (Apache License v2)</li>
+<li><a href="http://rtyley.github.com/spongycastle/">SpongyCastle</a> (MIT X11 License)</li>
+<li><a href="https://github.com/dschuermann/HtmlSpanner">HtmlSpanner Fork</a> (Apache License v2)</li>
+<li>Icons from <a href="http://rrze-icon-set.berlios.de/">RRZE Icon Set</a> (Creative Commons Attribution Share-Alike licence 3.0)</li>
+<li>Icons from <a href="http://tango.freedesktop.org/">Tango Icon Set</a> (Public Domain)</li>
+</ul>
</body>
</html> \ 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 -->
</head>
<body>
<h2>2.0</h2>
-<p>* Complete redesign
-<br/>* Integration of different branches:
-<br/>* Share public keys via qr codes
-<br/>* Sign keys
-<br/>* Upload keys to server</p>
+<ul>
+<li>Complete redesign</li>
+<li>Integration of different branches:</li>
+<li>Share public keys via qr codes</li>
+<li>Sign keys</li>
+<li>Upload keys to server</li>
+</ul>
<h2><h2>1.08</h2>
-<p>* basic key server support
-<br/>* app2sd (untested, let me know if there are problems)
-<br/>* more choices for pass phrase cache: 1, 2, 4, 8, hours
-<br/>* translations: Norwegian (thanks, Sander Danielsen), Chinese (thanks, Zhang Fredrick)
-<br/>* bugfixes
-<br/>* optimizations</p>
+<ul>
+<li>basic key server support</li>
+<li>app2sd (untested, let me know if there are problems)</li>
+<li>more choices for pass phrase cache: 1, 2, 4, 8, hours</li>
+<li>translations: Norwegian (thanks, Sander Danielsen), Chinese (thanks, Zhang Fredrick)</li>
+<li>bugfixes</li>
+<li>optimizations</li>
+</ul>
<h2>1.0.7</h2>
-<p>* clear sign problem with lacking trailing newline fixed
-<br/>* more options for pass phrase cache time to live (20, 40, 60 mins)</p>
+<ul>
+<li>clear sign problem with lacking trailing newline fixed</li>
+<li>more options for pass phrase cache time to live (20, 40, 60 mins)</li>
+</ul>
<h2>1.0.6</h2>
-<p>* account adding crash on Froyo fixed
-<br/>* secure file deletion
-<br/>* option to delete key file after import
-<br/>* stream encryption/decryption (gallery, etc.)
-<br/>* new options (language, force v3 signatures)
-<br/>* interface changes
-<br/>* bugfixes</p>
+<ul>
+<li>account adding crash on Froyo fixed</li>
+<li>secure file deletion</li>
+<li>option to delete key file after import</li>
+<li>stream encryption/decryption (gallery, etc.)</li>
+<li>new options (language, force v3 signatures)</li>
+<li>interface changes</li>
+<li>bugfixes</li>
+</ul>
<h2>1.0.5</h2>
-<p>* German and Italian translation
-<br/>* much smaller package, due to reduced BC sources
-<br/>* new preferences GUI
-<br/>* layout adjustment for localization
-<br/>* signature bugfix</p>
+<ul>
+<li>German and Italian translation</li>
+<li>much smaller package, due to reduced BC sources</li>
+<li>new preferences GUI</li>
+<li>layout adjustment for localization</li>
+<li>signature bugfix</li>
+</ul>
<h2>1.0.4</h2>
-<p>* fixed another crash caused by some SDK bug with query builder</p>
+<ul>
+<li>fixed another crash caused by some SDK bug with query builder</li>
+</ul>
<h2>1.0.3</h2>
-<p>* fixed crashes during encryption/signing and possibly key export</p>
+<ul>
+<li>fixed crashes during encryption/signing and possibly key export</li>
+</ul>
<h2>1.0.2</h2>
-<p>* filterable key lists
-<br/>* smarter preselection of encryption keys
-<br/>* new Intent handling for VIEW and SEND, allows files to be encrypted/decrypted out of file managers
-<br/>* fixes and additional features (key preselection) for k9, new beta build available</p>
+<ul>
+<li>filterable key lists</li>
+<li>smarter preselection of encryption keys</li>
+<li>new Intent handling for VIEW and SEND, allows files to be encrypted/decrypted out of file managers</li>
+<li>fixes and additional features (key preselection) for k9, new beta build available</li>
+</ul>
<h2>1.0.1</h2>
-<p>* GMail account listing was broken in 1.0.0, fixed again</p>
+<ul>
+<li>GMail account listing was broken in 1.0.0, fixed again</li>
+</ul>
<h2>1.0.0</h2>
-<p>* k9mail integration, APG supporting beta build of k9mail
-<br/>* support of more file managers (including ASTRO)
-<br/>* Slovenian translation
-<br/>* new database, much faster, less memory usage
-<br/>* defined Intents and content provider for other apps
-<br/>* bugfixes</p>
+<ul>
+<li>k9mail integration, APG supporting beta build of k9mail</li>
+<li>support of more file managers (including ASTRO)</li>
+<li>Slovenian translation</li>
+<li>new database, much faster, less memory usage</li>
+<li>defined Intents and content provider for other apps</li>
+<li>bugfixes</li>
+</ul>
</body>
</html> \ 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());