import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.util.Base64;
final boolean showOkButton) {
final Intent intent = new Intent(c, HtmlDisplayActivity.class);
intent.putExtra(HTML, html);
- intent.putExtra(TEXT_TO_HIGHLIGHT, textToHighlight);
+ intent.putExtra(TEXT_TO_HIGHLIGHT, textToHighlight == null ? "" : textToHighlight);
intent.putExtra(SHOW_OK_BUTTON, showOkButton);
return intent;
}
/** Called when the activity is first created. */
@Override
public void onCreate(final Bundle savedInstanceState) {
- setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);
+ DictionaryApplication.INSTANCE.init(getApplicationContext());
+ setTheme(DictionaryApplication.INSTANCE.getSelectedTheme().themeId);
super.onCreate(savedInstanceState);
setContentView(R.layout.html_display_activity);
html = getIntent().getStringExtra(HTML);
}
final MyWebView webView = (MyWebView) findViewById(R.id.webView);
+ final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ final String fontSize = prefs.getString(getString(R.string.fontSizeKey), "14");
+ int fontSizeSp;
+ try {
+ fontSizeSp = Integer.parseInt(fontSize.trim());
+ } catch (NumberFormatException e) {
+ fontSizeSp = 14;
+ }
+ webView.getSettings().setDefaultFontSize(fontSizeSp);
try {
// No way to get pure UTF-8 data into WebView
html = Base64.encodeToString(html.getBytes("UTF-8"), Base64.DEFAULT);