Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java

Issue 29370727: Issue 4505 - Add translations (Closed)
Patch Set: Removing now unused readTextFile Created Jan. 6, 2017, 4:07 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « res/values/strings.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java
===================================================================
--- a/src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java
+++ b/src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java
@@ -102,17 +102,17 @@ public class MainPreferences extends Pre
private void checkForCompatibleSBrowserAndProceed()
{
if (!Engine.hasCompatibleSBrowserInstalled(this.getApplicationContext()))
{
final AlertDialog d = new AlertDialog.Builder(this)
.setCancelable(false)
.setTitle(R.string.sbrowser_dialog_title)
- .setMessage(Html.fromHtml(this.readTextFile(R.raw.sbrowser_dialog)))
+ .setMessage(Html.fromHtml(getString(R.string.sbrowser_dialog_message)))
.setNeutralButton(R.string.sbrowser_dialog_button, new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
try
{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="
@@ -138,17 +138,17 @@ public class MainPreferences extends Pre
final SharedPreferences prefs = this.getSharedPreferences();
final String keyAaInfoShown = this.getString(R.string.key_aa_info_shown);
final boolean aaInfoShown = prefs.getBoolean(keyAaInfoShown, false);
if (!aaInfoShown)
{
final AlertDialog d = new AlertDialog.Builder(this)
.setCancelable(false)
.setTitle(R.string.aa_dialog_title)
- .setMessage(Html.fromHtml(this.readTextFile(R.raw.aa_dialog)))
+ .setMessage(Html.fromHtml(getString(R.string.aa_dialog_message)))
.setNeutralButton(R.string.aa_dialog_button, new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
prefs.edit()
.putBoolean(keyAaInfoShown, true)
.commit();
@@ -169,17 +169,17 @@ public class MainPreferences extends Pre
.getBoolean(this.getString(R.string.key_application_activated), false);
if (!applicationActivated)
{
Log.d(TAG, "Showing setup dialog");
this.setupDialog = new AlertDialog.Builder(this)
.setCancelable(false)
.setTitle(R.string.setup_dialog_title)
- .setMessage(Html.fromHtml(this.readTextFile(R.raw.setup_dialog)))
+ .setMessage(Html.fromHtml(getString(R.string.setup_dialog_message)))
.setNeutralButton(R.string.setup_dialog_button, new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
Engine.openSBrowserSettings(MainPreferences.this);
}
})
@@ -220,37 +220,9 @@ public class MainPreferences extends Pre
{
if (this.setupDialog != null)
{
this.setupDialog.dismiss();
this.setupDialog = null;
}
}
}
-
- private String readTextFile(int id)
- {
- try
- {
- final BufferedReader r = new BufferedReader(new InputStreamReader(this.getResources()
- .openRawResource(id), "UTF-8"));
- try
- {
- final StringBuilder sb = new StringBuilder();
- for (String line = r.readLine(); line != null; line = r.readLine())
- {
- sb.append(line);
- sb.append('\n');
- }
- return sb.toString();
- }
- finally
- {
- r.close();
- }
- }
- catch (IOException e)
- {
- Log.e(TAG, "Resource reading failed for: " + id, e);
- return "...";
- }
- }
}
« no previous file with comments | « res/values/strings.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld