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 |
(...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; |
40 | 41 |
41 public class UrlInputOpenerPreference extends EditTextPreference implements Text Watcher, | 42 public class UrlInputOpenerPreference extends EditTextPreference implements Text Watcher, |
42 TextView.OnEditorActionListener | 43 TextView.OnEditorActionListener |
43 { | 44 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 } | 116 } |
116 else | 117 else |
117 { | 118 { |
118 Toast.makeText(getContext(), R.string.whitelist_website_invalid_url_erro r, Toast.LENGTH_SHORT).show(); | 119 Toast.makeText(getContext(), R.string.whitelist_website_invalid_url_erro r, Toast.LENGTH_SHORT).show(); |
119 } | 120 } |
120 return true; | 121 return true; |
121 } | 122 } |
122 return false; | 123 return false; |
123 } | 124 } |
124 | 125 |
126 @Override | |
127 protected void onBindView(View view) | |
128 { | |
129 super.onBindView(view); | |
130 final TextView title = (TextView) view.findViewById(android.R.id.title); | |
131 if (title != null) { | |
132 title.setSingleLine(false); | |
133 title.setEllipsize(null); | |
134 } | |
diegocarloslima
2017/05/25 18:53:56
To avoid duplication of this snippet here and in a
jens
2017/05/30 12:17:00
Acknowledged.
| |
135 } | |
136 | |
125 public void setIcon(@DrawableRes int iconResId) | 137 public void setIcon(@DrawableRes int iconResId) |
126 { | 138 { |
127 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId) ; | 139 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId) ; |
128 setIcon(drawable); | 140 setIcon(drawable); |
129 } | 141 } |
130 | 142 |
131 public void setIcon(Drawable icon) | 143 public void setIcon(Drawable icon) |
132 { | 144 { |
133 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) | 145 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) |
134 { | 146 { |
(...skipping 22 matching lines...) Expand all Loading... | |
157 { | 169 { |
158 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); | 170 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); |
159 } | 171 } |
160 } | 172 } |
161 | 173 |
162 public interface OnUrlReadyListener | 174 public interface OnUrlReadyListener |
163 { | 175 { |
164 void onUrlReady(String url); | 176 void onUrlReady(String url); |
165 } | 177 } |
166 } | 178 } |
OLD | NEW |