| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 public AppInfo build() | 131 public AppInfo build() |
| 132 { | 132 { |
| 133 return new AppInfo(this.addonName, this.addonVersion, this.application, | 133 return new AppInfo(this.addonName, this.addonVersion, this.application, |
| 134 this.applicationVersion, this.platform, this.platformVersion, this.loc ale); | 134 this.applicationVersion, this.platform, this.platformVersion, this.loc ale); |
| 135 } | 135 } |
| 136 | 136 |
| 137 private String checkForCompatibleInstalledBrowser(final PackageManager packa geManager) | 137 private String checkForCompatibleInstalledBrowser(final PackageManager packa geManager) |
| 138 { | 138 { |
| 139 StringBuilder installedCompatibleBrowser = new StringBuilder(); | 139 StringBuilder installedCompatibleBrowser = new StringBuilder(); |
| 140 | 140 |
| 141 if (packageIsInstalled(packageManager, SBROWSER_PACKAGE_NAME) | 141 if (isPackageInstalled(packageManager, SBROWSER_PACKAGE_NAME) |
| 142 || packageIsInstalled(packageManager, SBROWSER_BETA_PACKAGE_NAME)) | 142 || isPackageInstalled(packageManager, SBROWSER_BETA_PACKAGE_NAME)) |
| 143 { | 143 { |
| 144 installedCompatibleBrowser.append(SBROWSER_APP_NAME); | 144 installedCompatibleBrowser.append(SBROWSER_APP_NAME); |
| 145 } | 145 } |
| 146 | 146 |
| 147 if (packageIsInstalled(packageManager, YANDEX_PACKAGE_NAME) | 147 if (isPackageInstalled(packageManager, YANDEX_PACKAGE_NAME) |
| 148 || packageIsInstalled(packageManager, YANDEX_ALPHA_PACKAGE_NAME) | 148 || isPackageInstalled(packageManager, YANDEX_ALPHA_PACKAGE_NAME) |
| 149 || packageIsInstalled(packageManager, YANDEX_BETA_PACKAGE_NAME)) | 149 || isPackageInstalled(packageManager, YANDEX_BETA_PACKAGE_NAME)) |
| 150 { | 150 { |
| 151 installedCompatibleBrowser.append(YANDEX_APP_NAME); | 151 installedCompatibleBrowser.append(YANDEX_APP_NAME); |
| 152 } | 152 } |
| 153 | 153 |
| 154 return installedCompatibleBrowser.toString(); | 154 return installedCompatibleBrowser.toString(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 private boolean packageIsInstalled(final PackageManager packageManager, fina l String packageName) | 157 private boolean isPackageInstalled(final PackageManager packageManager, fina l String packageName) |
|
diegocarloslima
2017/12/18 09:15:30
I would prefer this method to be called isPackageI
jens
2017/12/18 09:29:48
Acknowledged.
| |
| 158 { | 158 { |
| 159 try | 159 try |
| 160 { | 160 { |
| 161 packageManager.getPackageInfo(packageName, 0); | 161 packageManager.getPackageInfo(packageName, 0); |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 catch (PackageManager.NameNotFoundException e) | 164 catch (PackageManager.NameNotFoundException e) |
| 165 { | 165 { |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| LEFT | RIGHT |