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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 import android.os.Bundle; | 24 import android.os.Bundle; |
25 import android.preference.EditTextPreference; | 25 import android.preference.EditTextPreference; |
26 import android.support.annotation.DrawableRes; | 26 import android.support.annotation.DrawableRes; |
27 import android.support.v4.content.ContextCompat; | 27 import android.support.v4.content.ContextCompat; |
28 import android.text.Editable; | 28 import android.text.Editable; |
29 import android.text.InputType; | 29 import android.text.InputType; |
30 import android.text.TextWatcher; | 30 import android.text.TextWatcher; |
31 import android.util.AttributeSet; | 31 import android.util.AttributeSet; |
32 import android.util.Patterns; | 32 import android.util.Patterns; |
33 import android.view.KeyEvent; | 33 import android.view.KeyEvent; |
| 34 import android.view.View; |
34 import android.view.inputmethod.EditorInfo; | 35 import android.view.inputmethod.EditorInfo; |
35 import android.widget.EditText; | 36 import android.widget.EditText; |
36 import android.widget.TextView; | 37 import android.widget.TextView; |
37 import android.widget.Toast; | 38 import android.widget.Toast; |
38 | 39 |
39 import org.adblockplus.adblockplussbrowser.R; | 40 import org.adblockplus.adblockplussbrowser.R; |
| 41 import org.adblockplus.sbrowser.contentblocker.util.PreferenceUtils; |
40 | 42 |
41 public class UrlInputOpenerPreference extends EditTextPreference implements Text
Watcher, | 43 public class UrlInputOpenerPreference extends EditTextPreference implements Text
Watcher, |
42 TextView.OnEditorActionListener | 44 TextView.OnEditorActionListener |
43 { | 45 { |
44 | 46 |
45 private OnUrlReadyListener onUrlReadyListener; | 47 private OnUrlReadyListener onUrlReadyListener; |
46 private AlertDialog mAlertDialog; | 48 private AlertDialog mAlertDialog; |
47 | 49 |
48 public UrlInputOpenerPreference(Context context) | 50 public UrlInputOpenerPreference(Context context) |
49 { | 51 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 117 } |
116 else | 118 else |
117 { | 119 { |
118 Toast.makeText(getContext(), R.string.whitelist_website_invalid_url_erro
r, Toast.LENGTH_SHORT).show(); | 120 Toast.makeText(getContext(), R.string.whitelist_website_invalid_url_erro
r, Toast.LENGTH_SHORT).show(); |
119 } | 121 } |
120 return true; | 122 return true; |
121 } | 123 } |
122 return false; | 124 return false; |
123 } | 125 } |
124 | 126 |
| 127 @Override |
| 128 protected void onBindView(View view) |
| 129 { |
| 130 super.onBindView(view); |
| 131 PreferenceUtils.setMultilineTitle(view); |
| 132 } |
| 133 |
125 public void setIcon(@DrawableRes int iconResId) | 134 public void setIcon(@DrawableRes int iconResId) |
126 { | 135 { |
127 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId)
; | 136 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId)
; |
128 setIcon(drawable); | 137 setIcon(drawable); |
129 } | 138 } |
130 | 139 |
131 public void setIcon(Drawable icon) | 140 public void setIcon(Drawable icon) |
132 { | 141 { |
133 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) | 142 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) |
134 { | 143 { |
(...skipping 22 matching lines...) Expand all Loading... |
157 { | 166 { |
158 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); | 167 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); |
159 } | 168 } |
160 } | 169 } |
161 | 170 |
162 public interface OnUrlReadyListener | 171 public interface OnUrlReadyListener |
163 { | 172 { |
164 void onUrlReady(String url); | 173 void onUrlReady(String url); |
165 } | 174 } |
166 } | 175 } |
OLD | NEW |