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

Side by Side Diff: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/UrlInputOpenerPreference.java

Issue 29449609: Issue 5242 - Adjust setIcon() methods in UrlInputOpenerPreference (Closed)
Patch Set: Created May 26, 2017, 9:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 { 117 {
118 Toast.makeText(getContext(), R.string.whitelist_website_invalid_url_erro r, Toast.LENGTH_SHORT).show(); 118 Toast.makeText(getContext(), R.string.whitelist_website_invalid_url_erro r, Toast.LENGTH_SHORT).show();
119 } 119 }
120 return true; 120 return true;
121 } 121 }
122 return false; 122 return false;
123 } 123 }
124 124
125 public void setIcon(@DrawableRes int iconResId) 125 public void setIcon(@DrawableRes int iconResId)
126 { 126 {
127 final Drawable drawable = ContextCompat.getDrawable(getContext(), iconResId) ; 127 final Drawable drawable = this.getContext().getDrawable(iconResId);
128 setIcon(drawable); 128 setIcon(drawable);
129 } 129 }
130 130
131 public void setIcon(Drawable icon)
132 {
133 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
134 {
135 super.setIcon(icon);
136 }
137 }
138
139 public void setOnUrlReadyListener(OnUrlReadyListener listener) 131 public void setOnUrlReadyListener(OnUrlReadyListener listener)
140 { 132 {
141 this.onUrlReadyListener = listener; 133 this.onUrlReadyListener = listener;
142 } 134 }
143 135
144 private boolean isValidUrl() 136 private boolean isValidUrl()
145 { 137 {
146 return Patterns.WEB_URL.matcher(getUrl()).matches(); 138 return Patterns.WEB_URL.matcher(getUrl()).matches();
147 } 139 }
148 140
149 private String getUrl() 141 private String getUrl()
150 { 142 {
151 return getEditText().getText().toString(); 143 return getEditText().getText().toString();
152 } 144 }
153 145
154 private void setPositiveButtonEnabled(boolean enabled) 146 private void setPositiveButtonEnabled(boolean enabled)
155 { 147 {
156 if (mAlertDialog != null) 148 if (mAlertDialog != null)
157 { 149 {
158 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled); 150 mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(enabled);
159 } 151 }
160 } 152 }
161 153
162 public interface OnUrlReadyListener 154 public interface OnUrlReadyListener
163 { 155 {
164 void onUrlReady(String url); 156 void onUrlReady(String url);
165 } 157 }
166 } 158 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld