| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * @param defaultSubscriptions | 39 * @param defaultSubscriptions |
| 40 * @return The URL of the filter list which fits best for the device language. | 40 * @return The URL of the filter list which fits best for the device language. |
| 41 * If no match was found, return EASYLIST as default. | 41 * If no match was found, return EASYLIST as default. |
| 42 */ | 42 */ |
| 43 public static String chooseDefaultSubscriptionUrl(List<DefaultSubscriptionInfo
> defaultSubscriptions) | 43 public static String chooseDefaultSubscriptionUrl(List<DefaultSubscriptionInfo
> defaultSubscriptions) |
| 44 { | 44 { |
| 45 for (final DefaultSubscriptionInfo info : defaultSubscriptions) | 45 for (final DefaultSubscriptionInfo info : defaultSubscriptions) |
| 46 { | 46 { |
| 47 String lang = getDeviceLanguageCode(); | 47 if (info != null && info.getPrefixes().contains(getDeviceLanguageCode()) &
& info.isComplete()) |
| 48 if (info != null && info.getPrefixes().contains(lang) && info.isComplete()
) | |
| 49 { | 48 { |
| 50 return info.getUrl(); | 49 return info.getUrl(); |
| 51 } | 50 } |
| 52 } | 51 } |
| 53 return Engine.EASYLIST_URL; | 52 return Engine.EASYLIST_URL; |
| 54 } | 53 } |
| 55 | 54 |
| 56 @SuppressWarnings("deprecation") | 55 @SuppressWarnings("deprecation") |
| 57 private static String getDeviceLanguageCode() | 56 private static String getDeviceLanguageCode() |
| 58 { | 57 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 return HEBREW_NEW; | 82 return HEBREW_NEW; |
| 84 case YIDDISH_OLD: | 83 case YIDDISH_OLD: |
| 85 return YIDDISH_NEW; | 84 return YIDDISH_NEW; |
| 86 case INDONESIAN_OLD: | 85 case INDONESIAN_OLD: |
| 87 return INDONESIAN_NEW; | 86 return INDONESIAN_NEW; |
| 88 default: | 87 default: |
| 89 return language; | 88 return language; |
| 90 } | 89 } |
| 91 } | 90 } |
| 92 } | 91 } |
| LEFT | RIGHT |