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

Unified Diff: src/org/adblockplus/android/Preferences.java

Issue 8954027: android: Crash fixes (Closed)
Patch Set: Created Nov. 27, 2012, 10:57 a.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
Index: src/org/adblockplus/android/Preferences.java
===================================================================
--- a/src/org/adblockplus/android/Preferences.java
+++ b/src/org/adblockplus/android/Preferences.java
@@ -62,6 +62,8 @@
private static ProxyService proxyService = null;
+ private RefreshableListPreference subscriptionList;
Felix Dahlke 2012/11/28 08:12:56 Are the changes in this file related to the fix?
Andrey Novikov 2012/11/28 08:25:01 Yes, I've just moved initialization to a proper st
+
private AboutDialog aboutDialog;
private boolean showAbout = false;
private boolean trafficDetected = false;
@@ -98,6 +100,23 @@
{
copyAssets();
}
+
+ AdblockPlus application = AdblockPlus.getApplication();
+
+ // Initialize subscription list
Felix Dahlke 2012/11/28 08:37:37 I think it makes sense to put this part into an in
+ subscriptionList = (RefreshableListPreference) findPreference(getString(R.string.pref_subscription));
+ List<Subscription> subscriptions = application.getSubscriptions();
+ String[] entries = new String[subscriptions.size()];
+ String[] entryValues = new String[subscriptions.size()];
+ int i = 0;
+ for (Subscription subscription : subscriptions)
+ {
+ entries[i] = subscription.title;
+ entryValues[i] = subscription.url;
+ i++;
+ }
+ subscriptionList.setEntries(entries);
+ subscriptionList.setEntryValues(entryValues);
}
@Override
@@ -117,24 +136,11 @@
final AdblockPlus application = AdblockPlus.getApplication();
- // Construct subscription list
- RefreshableListPreference subscriptionList = (RefreshableListPreference) findPreference(getString(R.string.pref_subscription));
- List<Subscription> subscriptions = application.getSubscriptions();
- String[] entries = new String[subscriptions.size()];
- String[] entryValues = new String[subscriptions.size()];
- String current = prefs.getString(getString(R.string.pref_subscription), (String) null);
- int i = 0;
- for (Subscription subscription : subscriptions)
- {
- entries[i] = subscription.title;
- entryValues[i] = subscription.url;
- i++;
- }
- subscriptionList.setEntries(entries);
- subscriptionList.setEntryValues(entryValues);
-
boolean firstRun = false;
+ // Get current subscription
+ String current = prefs.getString(getString(R.string.pref_subscription), (String) null);
+
// If there is no current subscription autoselect one
if (current == null)
{
« src/org/adblockplus/android/AdblockPlus.java ('K') | « src/org/adblockplus/android/AdblockPlus.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld