diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-09 13:16:54 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-09 13:16:54 +0200 |
commit | 5b6880d2e34f4c8a4bfba87b5ce53d3c6727b744 (patch) | |
tree | 0e9c9f0c3b9cd9f0a7d5a15512a70b36001a87de /OpenPGP-Keychain | |
parent | 5dc693c64c14000a3a03903736d000a45795bcee (diff) | |
download | open-keychain-5b6880d2e34f4c8a4bfba87b5ce53d3c6727b744.tar.gz open-keychain-5b6880d2e34f4c8a4bfba87b5ce53d3c6727b744.tar.bz2 open-keychain-5b6880d2e34f4c8a4bfba87b5ce53d3c6727b744.zip |
Switch from HtmlSpanner to HtmlTextView
Diffstat (limited to 'OpenPGP-Keychain')
-rw-r--r-- | OpenPGP-Keychain/libs/htmlcleaner-2.2.jar | bin | 107942 -> 0 bytes | |||
-rw-r--r-- | OpenPGP-Keychain/libs/htmlspanner-0.2-fork.jar | bin | 31039 -> 0 bytes | |||
-rw-r--r-- | OpenPGP-Keychain/project.properties | 1 | ||||
-rw-r--r-- | OpenPGP-Keychain/res/layout/help_fragment_about.xml | 2 | ||||
-rw-r--r-- | OpenPGP-Keychain/res/layout/share_nfc_beam.xml | 2 | ||||
-rw-r--r-- | OpenPGP-Keychain/res/raw/help_about.html | 2 | ||||
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java | 30 | ||||
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentHtml.java | 34 | ||||
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ShareNfcBeamActivity.java | 29 |
9 files changed, 20 insertions, 80 deletions
diff --git a/OpenPGP-Keychain/libs/htmlcleaner-2.2.jar b/OpenPGP-Keychain/libs/htmlcleaner-2.2.jar Binary files differdeleted file mode 100644 index cc922d06b..000000000 --- a/OpenPGP-Keychain/libs/htmlcleaner-2.2.jar +++ /dev/null diff --git a/OpenPGP-Keychain/libs/htmlspanner-0.2-fork.jar b/OpenPGP-Keychain/libs/htmlspanner-0.2-fork.jar Binary files differdeleted file mode 100644 index 76223ccc6..000000000 --- a/OpenPGP-Keychain/libs/htmlspanner-0.2-fork.jar +++ /dev/null diff --git a/OpenPGP-Keychain/project.properties b/OpenPGP-Keychain/project.properties index cfb577df7..2ad34628b 100644 --- a/OpenPGP-Keychain/project.properties +++ b/OpenPGP-Keychain/project.properties @@ -10,3 +10,4 @@ # Project target. target=android-17 android.library.reference.1=../libraries/ActionBarSherlock +android.library.reference.2=../libraries/HtmlTextView diff --git a/OpenPGP-Keychain/res/layout/help_fragment_about.xml b/OpenPGP-Keychain/res/layout/help_fragment_about.xml index 82cb0a89f..71788e720 100644 --- a/OpenPGP-Keychain/res/layout/help_fragment_about.xml +++ b/OpenPGP-Keychain/res/layout/help_fragment_about.xml @@ -51,7 +51,7 @@ </LinearLayout> </LinearLayout> - <net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView + <org.sufficientlysecure.htmltextview.HtmlTextView android:id="@+id/help_about_text" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/OpenPGP-Keychain/res/layout/share_nfc_beam.xml b/OpenPGP-Keychain/res/layout/share_nfc_beam.xml index 59e8e0844..692f53e4e 100644 --- a/OpenPGP-Keychain/res/layout/share_nfc_beam.xml +++ b/OpenPGP-Keychain/res/layout/share_nfc_beam.xml @@ -4,7 +4,7 @@ android:layout_height="fill_parent" android:orientation="vertical" > - <net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView + <org.sufficientlysecure.htmltextview.HtmlTextView android:id="@+id/nfc_beam_text" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/OpenPGP-Keychain/res/raw/help_about.html b/OpenPGP-Keychain/res/raw/help_about.html index 26f4a0345..0ed0d3b05 100644 --- a/OpenPGP-Keychain/res/raw/help_about.html +++ b/OpenPGP-Keychain/res/raw/help_about.html @@ -28,7 +28,7 @@ And don't add newlines before or after p tags because of transifex --> <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><a href="https://github.com/dschuermann/html-textview">HtmlTextView</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> diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java index a2d2290dc..e7a977707 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentAbout.java @@ -17,22 +17,15 @@ package org.sufficientlysecure.keychain.ui; -import java.io.IOException; -import java.io.InputStream; - -import net.nightwhistler.htmlspanner.HtmlSpanner; -import net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView; - +import org.sufficientlysecure.htmltextview.HtmlTextView; import org.sufficientlysecure.keychain.Constants; -import org.sufficientlysecure.keychain.helper.OtherHelper; -import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.util.Log; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; -import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -57,26 +50,13 @@ public class HelpFragmentAbout extends SherlockFragment { 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 - InputStream inputStreamText = getResources().openRawResource(R.raw.help_about); - TextView versionText = (TextView) view.findViewById(R.id.help_about_version); versionText.setText(getString(R.string.help_about_version) + " " + getVersion()); - JellyBeanSpanFixTextView aboutTextView = (JellyBeanSpanFixTextView) view - .findViewById(R.id.help_about_text); - - // load html into textview - 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); - } + HtmlTextView aboutTextView = (HtmlTextView) view.findViewById(R.id.help_about_text); - // make links work - aboutTextView.setMovementMethod(LinkMovementMethod.getInstance()); + // load html from raw resource (Parsing handled by HtmlTextView library) + aboutTextView.setHtmlFromRawResource(getActivity(), R.raw.help_about); // no flickering when clicking textview for Android < 4 aboutTextView.setTextColor(getResources().getColor(android.R.color.black)); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentHtml.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentHtml.java index c4bab5734..ce932fd70 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentHtml.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/HelpFragmentHtml.java @@ -17,20 +17,10 @@ package org.sufficientlysecure.keychain.ui; -import java.io.IOException; -import java.io.InputStream; - -import net.nightwhistler.htmlspanner.HtmlSpanner; -import net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView; - -import org.sufficientlysecure.keychain.Constants; -import org.sufficientlysecure.keychain.helper.OtherHelper; -import org.sufficientlysecure.keychain.util.Log; -import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.htmltextview.HtmlTextView; import android.app.Activity; import android.os.Bundle; -import android.text.method.LinkMovementMethod; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; @@ -73,15 +63,12 @@ public class HelpFragmentHtml extends SherlockFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - htmlFile = getArguments().getInt(ARG_HTML_FILE); - - // load html from html file from /res/raw - InputStream inputStreamText = getResources().openRawResource(htmlFile); - mActivity = getActivity(); + + htmlFile = getArguments().getInt(ARG_HTML_FILE); ScrollView scroller = new ScrollView(mActivity); - JellyBeanSpanFixTextView text = new JellyBeanSpanFixTextView(mActivity); + HtmlTextView text = new HtmlTextView(mActivity); // padding int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, mActivity @@ -90,17 +77,8 @@ public class HelpFragmentHtml extends SherlockFragment { scroller.addView(text); - // load html into textview - 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()); + // load html from raw resource (Parsing handled by HtmlTextView library) + text.setHtmlFromRawResource(getActivity(), htmlFile); // no flickering when clicking textview for Android < 4 text.setTextColor(getResources().getColor(android.R.color.black)); diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ShareNfcBeamActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ShareNfcBeamActivity.java index 10adcc4ab..474e0a9e4 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ShareNfcBeamActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/ShareNfcBeamActivity.java @@ -17,12 +17,7 @@ package org.sufficientlysecure.keychain.ui; -import java.io.IOException; -import java.io.InputStream; - -import net.nightwhistler.htmlspanner.HtmlSpanner; -import net.nightwhistler.htmlspanner.JellyBeanSpanFixTextView; - +import org.sufficientlysecure.htmltextview.HtmlTextView; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.helper.ActionBarHelper; @@ -42,8 +37,6 @@ import android.os.Handler; import android.os.Message; import android.os.Parcelable; import android.provider.Settings; -import android.text.method.LinkMovementMethod; -import android.util.Log; import android.widget.Toast; import com.actionbarsherlock.app.SherlockFragmentActivity; @@ -131,27 +124,15 @@ public class ShareNfcBeamActivity extends SherlockFragmentActivity implements } private void buildView() { - // load html from html file from /res/raw - InputStream inputStreamText = getResources().openRawResource(R.raw.nfc_beam_share); - setContentView(R.layout.share_nfc_beam); - JellyBeanSpanFixTextView text = (JellyBeanSpanFixTextView) findViewById(R.id.nfc_beam_text); - - // load html into textview - 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); - } + HtmlTextView aboutTextView = (HtmlTextView) findViewById(R.id.nfc_beam_text); - // make links work - text.setMovementMethod(LinkMovementMethod.getInstance()); + // load html from raw resource (Parsing handled by HtmlTextView library) + aboutTextView.setHtmlFromRawResource(this, R.raw.nfc_beam_share); // no flickering when clicking textview for Android < 4 - text.setTextColor(getResources().getColor(android.R.color.black)); + aboutTextView.setTextColor(getResources().getColor(android.R.color.black)); // set actionbar without home button if called from another app ActionBarHelper.setBackButton(this); |