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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 public SubscriptionPreferenceCategory(Context context, AttributeSet attrs) | 46 public SubscriptionPreferenceCategory(Context context, AttributeSet attrs) |
47 { | 47 { |
48 super(context, attrs); | 48 super(context, attrs); |
49 } | 49 } |
50 | 50 |
51 public SubscriptionPreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) | 51 public SubscriptionPreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) |
52 { | 52 { |
53 super(context, attrs, defStyleAttr); | 53 super(context, attrs, defStyleAttr); |
54 } | 54 } |
55 | 55 |
56 private static synchronized void initSubscriptions() | 56 private static synchronized void initSubscriptions(Context context) |
jens
2019/01/10 14:10:59
Context could be final.
diegocarloslima
2019/01/16 13:44:22
Acknowledged.
| |
57 { | 57 { |
58 if (subscriptionContainer == null) | 58 if (subscriptionContainer == null) |
59 { | 59 { |
60 subscriptionContainer = SubscriptionContainer.create(); | 60 subscriptionContainer = SubscriptionContainer.create(context); |
61 } | 61 } |
62 else | 62 else |
63 { | 63 { |
64 subscriptionContainer.refresh(); | 64 subscriptionContainer.refresh(); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 @Override | 68 @Override |
69 protected void onAttachedToActivity() | 69 protected void onAttachedToActivity() |
70 { | 70 { |
71 this.isEnabledList = this.getKey().endsWith("subscriptionEnabled"); | 71 this.isEnabledList = this.getKey().endsWith("subscriptionEnabled"); |
72 | 72 |
73 this.setEnabled(false); | 73 this.setEnabled(false); |
74 this.setShouldDisableView(true); | 74 this.setShouldDisableView(true); |
75 | 75 |
76 super.onAttachedToActivity(); | 76 super.onAttachedToActivity(); |
77 | 77 |
78 showProgressDialog(); | 78 showProgressDialog(); |
79 | 79 |
80 AddOnBridge.postToHandler(new Runnable() | 80 ExtensionBridge.postToHandler(new Runnable() |
81 { | 81 { |
82 @Override | 82 @Override |
83 public void run() | 83 public void run() |
84 { | 84 { |
85 initSubscriptions(); | 85 initSubscriptions(getContext()); |
86 subscriptionContainer.addSubscriptionListener( | 86 subscriptionContainer.addSubscriptionListener( |
87 SubscriptionPreferenceCategory.this.subscriptionChangeListener); | 87 SubscriptionPreferenceCategory.this.subscriptionChangeListener); |
88 | 88 |
89 ThreadUtils.postToUiThread(new Runnable() | 89 ThreadUtils.postToUiThread(new Runnable() |
90 { | 90 { |
91 @Override | 91 @Override |
92 public void run() | 92 public void run() |
93 { | 93 { |
94 SubscriptionPreferenceCategory.this.refreshEntries(); | 94 SubscriptionPreferenceCategory.this.refreshEntries(); |
95 } | 95 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 | 199 |
200 private class SubscriptionChangeListener implements SubscriptionContainer.Subs criptionListener | 200 private class SubscriptionChangeListener implements SubscriptionContainer.Subs criptionListener |
201 { | 201 { |
202 @Override | 202 @Override |
203 public void onSubscriptionUpdated() | 203 public void onSubscriptionUpdated() |
204 { | 204 { |
205 SubscriptionPreferenceCategory.this.refreshEntries(); | 205 SubscriptionPreferenceCategory.this.refreshEntries(); |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 | |
OLD | NEW |