| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 20 matching lines...) Expand all Loading... | |
| 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.View; |
| 35 import android.view.inputmethod.EditorInfo; | 35 import android.view.inputmethod.EditorInfo; |
| 36 import android.widget.EditText; | 36 import android.widget.EditText; |
| 37 import android.widget.TextView; | 37 import android.widget.TextView; |
| 38 import android.widget.Toast; | 38 import android.widget.Toast; |
| 39 | 39 |
| 40 import org.adblockplus.adblockplussbrowser.R; | 40 import org.adblockplus.adblockplussbrowser.R; |
| 41 import org.adblockplus.sbrowser.contentblocker.util.PreferenceUtils; | |
| 41 | 42 |
| 42 public class UrlInputOpenerPreference extends EditTextPreference implements Text Watcher, | 43 public class UrlInputOpenerPreference extends EditTextPreference implements Text Watcher, |
| 43 TextView.OnEditorActionListener | 44 TextView.OnEditorActionListener |
| 44 { | 45 { |
| 45 | 46 |
| 46 private OnUrlReadyListener onUrlReadyListener; | 47 private OnUrlReadyListener onUrlReadyListener; |
| 47 private AlertDialog mAlertDialog; | 48 private AlertDialog mAlertDialog; |
| 48 | 49 |
| 49 public UrlInputOpenerPreference(Context context) | 50 public UrlInputOpenerPreference(Context context) |
| 50 { | 51 { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 } | 121 } |
| 121 return true; | 122 return true; |
| 122 } | 123 } |
| 123 return false; | 124 return false; |
| 124 } | 125 } |
| 125 | 126 |
| 126 @Override | 127 @Override |
| 127 protected void onBindView(View view) | 128 protected void onBindView(View view) |
| 128 { | 129 { |
| 129 super.onBindView(view); | 130 super.onBindView(view); |
| 130 final TextView title = (TextView) view.findViewById(android.R.id.title); | 131 PreferenceUtils.setMultilineTitle(view); |
| 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 } | 132 } |
| 136 | 133 |
| 137 public void setIcon(@DrawableRes int iconResId) | 134 public void setIcon(@DrawableRes int iconResId) |
| 138 { | 135 { |
| 139 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId) ; | 136 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId) ; |
| 140 setIcon(drawable); | 137 setIcon(drawable); |
| 141 } | 138 } |
| 142 | 139 |
| 143 public void setIcon(Drawable icon) | 140 public void setIcon(Drawable icon) |
| 144 { | 141 { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 169 { | 166 { |
| 170 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); | 167 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); |
| 171 } | 168 } |
| 172 } | 169 } |
| 173 | 170 |
| 174 public interface OnUrlReadyListener | 171 public interface OnUrlReadyListener |
| 175 { | 172 { |
| 176 void onUrlReady(String url); | 173 void onUrlReady(String url); |
| 177 } | 174 } |
| 178 } | 175 } |
| LEFT | RIGHT |