| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 private EditText editText = null; | 43 private EditText editText = null; |
| 44 private Button button = null; | 44 private Button button = null; |
| 45 | 45 |
| 46 private boolean submitEnabled = false; | 46 private boolean submitEnabled = false; |
| 47 private boolean triedSubmit = false; | 47 private boolean triedSubmit = false; |
| 48 private String currentEditTextValue = null; | 48 private String currentEditTextValue = null; |
| 49 | 49 |
| 50 public enum Type | 50 public enum Type |
| 51 { | 51 { |
| 52 ADD_BLOCKING_LIST, | 52 ADD_SUBSCRIPTION, |
| 53 ADD_WHITELIST | 53 ADD_WHITELISTED_SITE |
| 54 } | 54 } |
| 55 | 55 |
| 56 public UrlInputDialog(final Context context, final Type type, final UrlReadyCa
llback callback) | 56 public UrlInputDialog(final Context context, final Type type, final UrlReadyCa
llback callback) |
| 57 { | 57 { |
| 58 super(context); | 58 super(context); |
| 59 this.type = type; | 59 this.type = type; |
| 60 this.callback = callback; | 60 this.callback = callback; |
| 61 } | 61 } |
| 62 | 62 |
| 63 @Override | 63 @Override |
| (...skipping 15 matching lines...) Expand all Loading... |
| 79 this.button.setOnClickListener(this); | 79 this.button.setOnClickListener(this); |
| 80 | 80 |
| 81 if (this.currentEditTextValue != null) | 81 if (this.currentEditTextValue != null) |
| 82 { | 82 { |
| 83 this.editText.setText(this.currentEditTextValue); | 83 this.editText.setText(this.currentEditTextValue); |
| 84 } | 84 } |
| 85 this.updateButtonState(); | 85 this.updateButtonState(); |
| 86 | 86 |
| 87 switch (this.type) | 87 switch (this.type) |
| 88 { | 88 { |
| 89 case ADD_BLOCKING_LIST: | 89 case ADD_SUBSCRIPTION: |
| 90 this.button.setText(R.string.abb_add_filter_list_button); | 90 this.button.setText(R.string.abb_add_subscription_button); |
| 91 this.editText.setHint(R.string.abb_add_filter_list_url); | 91 this.editText.setHint(R.string.abb_add_subscription_url); |
| 92 this.setTitle(R.string.abb_pref_category_add_other_list); | 92 this.setTitle(R.string.abb_pref_category_add_other_list); |
| 93 break; | 93 break; |
| 94 default: | 94 default: |
| 95 break; | 95 break; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 private void updateButtonState() | 99 private void updateButtonState() |
| 100 { | 100 { |
| 101 this.button.setEnabled(this.submitEnabled); | 101 this.button.setEnabled(this.submitEnabled); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 @Override | 187 @Override |
| 188 public void onClick(final View v) | 188 public void onClick(final View v) |
| 189 { | 189 { |
| 190 if (this.currentEditTextValue != null) | 190 if (this.currentEditTextValue != null) |
| 191 { | 191 { |
| 192 this.validateAndSubmit(this.currentEditTextValue); | 192 this.validateAndSubmit(this.currentEditTextValue); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 } | 195 } |
| LEFT | RIGHT |