LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 private volatile UpdateCheckDoneCallback updateCheckDoneCallback; | 63 private volatile UpdateCheckDoneCallback updateCheckDoneCallback; |
64 private volatile FilterChangeCallback filterChangeCallback; | 64 private volatile FilterChangeCallback filterChangeCallback; |
65 | 65 |
66 private ABPEngine(final Context context) | 66 private ABPEngine(final Context context) |
67 { | 67 { |
68 this.context = context; | 68 this.context = context; |
69 } | 69 } |
70 | 70 |
71 public static AppInfo generateAppInfo(final Context context) | 71 public static AppInfo generateAppInfo(final Context context) |
72 { | 72 { |
| 73 final boolean developmentBuild = !context.getResources().getBoolean(R.bool.d
ef_release); |
73 String version = "0"; | 74 String version = "0"; |
74 try | 75 try |
75 { | 76 { |
76 final PackageInfo info = context.getPackageManager().getPackageInfo(contex
t.getPackageName(), 0); | 77 final PackageInfo info = context.getPackageManager().getPackageInfo(contex
t.getPackageName(), 0); |
77 version = info.versionName + "." + info.versionCode; | 78 version = info.versionName; |
| 79 if (developmentBuild) |
| 80 version += "." + info.versionCode; |
78 } | 81 } |
79 catch (final NameNotFoundException e) | 82 catch (final NameNotFoundException e) |
80 { | 83 { |
81 Log.e(TAG, "Failed to get the application version number", e); | 84 Log.e(TAG, "Failed to get the application version number", e); |
82 } | 85 } |
83 final String sdkVersion = String.valueOf(VERSION.SDK_INT); | 86 final String sdkVersion = String.valueOf(VERSION.SDK_INT); |
84 final String locale = Locale.getDefault().toString().replace('_', '-'); | 87 final String locale = Locale.getDefault().toString().replace('_', '-'); |
85 final boolean developmentBuild = !context.getResources().getBoolean(R.bool.d
ef_release); | |
86 | 88 |
87 return AppInfo.builder() | 89 return AppInfo.builder() |
88 .setVersion(version) | 90 .setVersion(version) |
89 .setApplicationVersion(sdkVersion) | 91 .setApplicationVersion(sdkVersion) |
90 .setLocale(locale) | 92 .setLocale(locale) |
91 .setDevelopmentBuild(developmentBuild) | 93 .setDevelopmentBuild(developmentBuild) |
92 .build(); | 94 .build(); |
93 } | 95 } |
94 | 96 |
95 public static ABPEngine create(final Context context, final AppInfo appInfo, f
inal String basePath) | 97 public static ABPEngine create(final Context context, final AppInfo appInfo, f
inal String basePath) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 272 |
271 public void updateSubscriptionStatus(final String url) | 273 public void updateSubscriptionStatus(final String url) |
272 { | 274 { |
273 final Subscription sub = this.filterEngine.getSubscription(url); | 275 final Subscription sub = this.filterEngine.getSubscription(url); |
274 if (sub != null) | 276 if (sub != null) |
275 { | 277 { |
276 Utils.updateSubscriptionStatus(this.context, sub); | 278 Utils.updateSubscriptionStatus(this.context, sub); |
277 } | 279 } |
278 } | 280 } |
279 } | 281 } |
LEFT | RIGHT |