Switch from HtmlSpanner to HtmlTextView
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -10,3 +10,4 @@
|
||||
# Project target.
|
||||
target=android-17
|
||||
android.library.reference.1=../libraries/ActionBarSherlock
|
||||
android.library.reference.2=../libraries/HtmlTextView
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
HtmlTextView aboutTextView = (HtmlTextView) 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);
|
||||
}
|
||||
|
||||
// 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));
|
||||
|
||||
@@ -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) {
|
||||
mActivity = getActivity();
|
||||
|
||||
htmlFile = getArguments().getInt(ARG_HTML_FILE);
|
||||
|
||||
// load html from html file from /res/raw
|
||||
InputStream inputStreamText = getResources().openRawResource(htmlFile);
|
||||
|
||||
mActivity = getActivity();
|
||||
|
||||
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));
|
||||
|
||||
@@ -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);
|
||||
HtmlTextView aboutTextView = (HtmlTextView) 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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user