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-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 12 matching lines...) Expand all Loading... | |
23 import org.adblockplus.adblockplussbrowser.BuildConfig; | 23 import org.adblockplus.adblockplussbrowser.BuildConfig; |
24 import org.adblockplus.sbrowser.contentblocker.engine.DefaultSubscriptionInfo; | 24 import org.adblockplus.sbrowser.contentblocker.engine.DefaultSubscriptionInfo; |
25 import org.adblockplus.sbrowser.contentblocker.engine.Engine; | 25 import org.adblockplus.sbrowser.contentblocker.engine.Engine; |
26 | 26 |
27 import android.content.res.Resources; | 27 import android.content.res.Resources; |
28 | 28 |
29 public class SubscriptionUtils | 29 public class SubscriptionUtils |
30 { | 30 { |
31 | 31 |
32 public static final String EASYLIST_URL = "https://easylist-downloads.adblockp lus.org/easylist.txt"; | 32 public static final String EASYLIST_URL = "https://easylist-downloads.adblockp lus.org/easylist.txt"; |
33 private static final String EASYLIST_CHINA_URL ="https://easylist-downloads.ad blockplus.org/easylistchina+easylist.txt"; | 33 private static final String EASYLIST_CHINA_URL ="https://easylist-downloads.ad blockplus.org/easylistchina+easylist.txt"; |
anton
2018/04/20 14:03:20
why can't it be public?
diegocarloslima
2018/04/20 14:48:52
It actually can, but since it was't being used any
anton
2018/04/20 14:50:28
ok, i'm not strong about it. Just wanted to make s
| |
34 | 34 |
35 private static final String INDONESIAN_OLD = "in"; | 35 private static final String INDONESIAN_OLD = "in"; |
36 private static final String INDONESIAN_NEW = "id"; | 36 private static final String INDONESIAN_NEW = "id"; |
37 private static final String HEBREW_OLD = "iw"; | 37 private static final String HEBREW_OLD = "iw"; |
38 private static final String HEBREW_NEW = "he"; | 38 private static final String HEBREW_NEW = "he"; |
39 private static final String YIDDISH_OLD = "ji"; | 39 private static final String YIDDISH_OLD = "ji"; |
40 private static final String YIDDISH_NEW = "yi"; | 40 private static final String YIDDISH_NEW = "yi"; |
41 | 41 |
42 /** | 42 /** |
43 * @param defaultSubscriptions | 43 * @param defaultSubscriptions |
44 * @return The URL of the filter list which fits best for the device language. | 44 * @return The URL of the filter list which fits best for the device language. |
45 * If no match was found, return EASYLIST as default. | 45 * If no match was found, return EASYLIST as default. |
46 */ | 46 */ |
47 public static String chooseDefaultSubscriptionUrl(List<DefaultSubscriptionInfo > defaultSubscriptions) | 47 public static String chooseDefaultSubscriptionUrl(List<DefaultSubscriptionInfo > defaultSubscriptions) |
48 { | 48 { |
49 if(BuildConfig.FLAVOR.equals(BuildConfig.FLAVOR_REGION_CHINA)) | 49 if (BuildConfig.FLAVOR.equals(BuildConfig.FLAVOR_REGION_CHINA)) |
anton
2018/04/20 14:03:20
isn't space require here?
diegocarloslima
2018/04/20 14:48:52
Acknowledged.
| |
50 { | 50 { |
51 return EASYLIST_CHINA_URL; | 51 return EASYLIST_CHINA_URL; |
52 } | 52 } |
53 for (final DefaultSubscriptionInfo info : defaultSubscriptions) | 53 for (final DefaultSubscriptionInfo info : defaultSubscriptions) |
54 { | 54 { |
55 if (info != null && info.getPrefixes().contains(getDeviceLanguageCode()) & & info.isComplete()) | 55 if (info != null && info.getPrefixes().contains(getDeviceLanguageCode()) & & info.isComplete()) |
56 { | 56 { |
57 return info.getUrl(); | 57 return info.getUrl(); |
58 } | 58 } |
59 } | 59 } |
(...skipping 30 matching lines...) Expand all Loading... | |
90 return HEBREW_NEW; | 90 return HEBREW_NEW; |
91 case YIDDISH_OLD: | 91 case YIDDISH_OLD: |
92 return YIDDISH_NEW; | 92 return YIDDISH_NEW; |
93 case INDONESIAN_OLD: | 93 case INDONESIAN_OLD: |
94 return INDONESIAN_NEW; | 94 return INDONESIAN_NEW; |
95 default: | 95 default: |
96 return language; | 96 return language; |
97 } | 97 } |
98 } | 98 } |
99 } | 99 } |
LEFT | RIGHT |