| Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH | 
| 4 * | 4 * | 
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as | 
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. | 
| 8 * | 8 * | 
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, | 
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. | 
| 13 * | 13 * | 
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License | 
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
| 16 */ | 16 */ | 
| 17 | 17 | 
| 18 package org.adblockplus.sbrowser.contentblocker; | 18 package org.adblockplus.sbrowser.contentblocker; | 
| 19 | 19 | 
| 20 import java.io.BufferedReader; | |
| 21 import java.io.IOException; | |
| 22 import java.io.InputStreamReader; | |
| 23 | |
| 24 import org.adblockplus.sbrowser.contentblocker.engine.Engine; | 20 import org.adblockplus.sbrowser.contentblocker.engine.Engine; | 
| 25 import org.adblockplus.sbrowser.contentblocker.engine.EngineService; | 21 import org.adblockplus.sbrowser.contentblocker.engine.EngineService; | 
| 26 import org.adblockplus.adblockplussbrowser.R; | 22 import org.adblockplus.adblockplussbrowser.R; | 
| 27 | 23 | 
| 28 import android.app.AlertDialog; | 24 import android.app.AlertDialog; | 
| 29 import android.app.Dialog; | 25 import android.app.Dialog; | 
| 30 import android.app.ProgressDialog; | 26 import android.app.ProgressDialog; | 
| 31 import android.content.DialogInterface; | 27 import android.content.DialogInterface; | 
| 32 import android.content.DialogInterface.OnClickListener; | 28 import android.content.DialogInterface.OnClickListener; | 
| 33 import android.content.Intent; | 29 import android.content.Intent; | 
| 34 import android.content.SharedPreferences; | 30 import android.content.SharedPreferences; | 
| 35 import android.net.Uri; | 31 import android.net.Uri; | 
| 36 import android.os.Bundle; | 32 import android.os.Bundle; | 
| 37 import android.preference.PreferenceActivity; | 33 import android.preference.PreferenceActivity; | 
| 38 import android.preference.PreferenceManager; | 34 import android.preference.PreferenceManager; | 
| 39 import android.text.Html; | 35 import android.text.Html; | 
| 40 import android.util.Log; | 36 import android.util.Log; | 
| 41 | 37 | 
| 42 public class MainPreferences extends PreferenceActivity implements | 38 public class MainPreferences extends PreferenceActivity implements | 
| 43 EngineService.OnEngineCreatedCallback, SharedPreferences.OnSharedPreferenceC hangeListener | 39 EngineService.OnEngineCreatedCallback, SharedPreferences.OnSharedPreferenceC hangeListener | 
| 44 { | 40 { | 
| 45 private static final String TAG = MainPreferences.class.getSimpleName(); | 41 private static final String TAG = MainPreferences.class.getSimpleName(); | 
| 46 private static final String SBROWSER_APP_ID = "com.sec.android.app.sbrowser"; | 42 public static final String SBROWSER_APP_ID = "com.sec.android.app.sbrowser"; | 
| 
 
diegocarloslima
2017/05/05 17:44:11
I think it will be better to move this field to En
 
jens
2017/05/09 09:44:45
Acknowledged.
 
 | |
| 47 private Engine engine = null; | 43 private Engine engine = null; | 
| 48 private Dialog dialog; | 44 private Dialog dialog; | 
| 49 private int dialogTitleResId; | 45 private int dialogTitleResId; | 
| 50 | 46 | 
| 51 private SharedPreferences getSharedPreferences() | 47 private SharedPreferences getSharedPreferences() | 
| 52 { | 48 { | 
| 53 return PreferenceManager.getDefaultSharedPreferences(this.getApplicationCont ext()); | 49 return PreferenceManager.getDefaultSharedPreferences(this.getApplicationCont ext()); | 
| 54 } | 50 } | 
| 55 | 51 | 
| 56 @Override | 52 @Override | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 final boolean applicationActivated = this.getSharedPreferences() | 179 final boolean applicationActivated = this.getSharedPreferences() | 
| 184 .getBoolean(this.getString(R.string.key_application_activated), false); | 180 .getBoolean(this.getString(R.string.key_application_activated), false); | 
| 185 | 181 | 
| 186 if (!applicationActivated) | 182 if (!applicationActivated) | 
| 187 { | 183 { | 
| 188 Log.d(TAG, "Showing setup dialog"); | 184 Log.d(TAG, "Showing setup dialog"); | 
| 189 this.dialogTitleResId = R.string.setup_dialog_title; | 185 this.dialogTitleResId = R.string.setup_dialog_title; | 
| 190 this.dialog = new AlertDialog.Builder(this) | 186 this.dialog = new AlertDialog.Builder(this) | 
| 191 .setCancelable(false) | 187 .setCancelable(false) | 
| 192 .setTitle(this.dialogTitleResId) | 188 .setTitle(this.dialogTitleResId) | 
| 193 .setMessage(Html.fromHtml(getString(R.string.setup_dialog_message))) | 189 .setMessage(Html.fromHtml(getString(Engine.hasSamsungInternetVersion5O rNewer(MainPreferences.this) ? | 
| 190 R.string.setup_dialog_message_sbrowser_5 : R.string.setup_dial og_message_sbrowser_4))) | |
| 194 .setNeutralButton(R.string.setup_dialog_button, new OnClickListener() | 191 .setNeutralButton(R.string.setup_dialog_button, new OnClickListener() | 
| 195 { | 192 { | 
| 196 @Override | 193 @Override | 
| 197 public void onClick(DialogInterface dialog, int which) | 194 public void onClick(DialogInterface dialog, int which) | 
| 198 { | 195 { | 
| 199 Engine.openSBrowserSettings(MainPreferences.this); | 196 Engine.openSBrowserSettings(MainPreferences.this); | 
| 200 } | 197 } | 
| 201 }) | 198 }) | 
| 202 .create(); | 199 .create(); | 
| 203 this.dialog.show(); | 200 this.dialog.show(); | 
| (...skipping 28 matching lines...) Expand all Loading... | |
| 232 this.engine.changeSubscriptionState(id, enabled); | 229 this.engine.changeSubscriptionState(id, enabled); | 
| 233 } | 230 } | 
| 234 else if (this.getString(R.string.key_application_activated).equals(key)) | 231 else if (this.getString(R.string.key_application_activated).equals(key)) | 
| 235 { | 232 { | 
| 236 if (this.dialogTitleResId == R.string.setup_dialog_title) | 233 if (this.dialogTitleResId == R.string.setup_dialog_title) | 
| 237 { | 234 { | 
| 238 this.dismissDialog(); | 235 this.dismissDialog(); | 
| 239 } | 236 } | 
| 240 } | 237 } | 
| 241 } | 238 } | 
| 242 } | 239 } | 
| OLD | NEW |