Fix free version banner inapps
This commit is contained in:
parent
5c0b861d20
commit
b92ba08265
1 changed files with 7 additions and 5 deletions
|
@ -167,8 +167,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
viewPager.setCurrentItem(currentTab);
|
viewPager.setCurrentItem(currentTab);
|
||||||
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this, true);
|
visibleBanner = new BannerAndDownloadFreeVersion(findViewById(R.id.mainLayout), this, true);
|
||||||
|
|
||||||
if (Version.isFreeVersion(getMyApplication()) &&
|
if (shouldShowFreeVersionBanner(getMyApplication())) {
|
||||||
(!getMyApplication().getSettings().LIVE_UPDATES_PURCHASED.get() || Version.isDeveloperVersion(getMyApplication()))) {
|
|
||||||
inAppHelper = new InAppHelper(getMyApplication(), true);
|
inAppHelper = new InAppHelper(getMyApplication(), true);
|
||||||
inAppHelper.addListener(this);
|
inAppHelper.addListener(this);
|
||||||
visibleBanner.setUpdatingPrices(true);
|
visibleBanner.setUpdatingPrices(true);
|
||||||
|
@ -336,6 +335,11 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
return Math.max(downloadsLeft, 0) > 0;
|
return Math.max(downloadsLeft, 0) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean shouldShowFreeVersionBanner(OsmandApplication application) {
|
||||||
|
return (Version.isFreeVersion(application) && !application.getSettings().LIVE_UPDATES_PURCHASED.get())
|
||||||
|
|| application.getSettings().SHOULD_SHOW_FREE_VERSION_BANNER.get();
|
||||||
|
}
|
||||||
|
|
||||||
public static class BannerAndDownloadFreeVersion {
|
public static class BannerAndDownloadFreeVersion {
|
||||||
private final View freeVersionBanner;
|
private final View freeVersionBanner;
|
||||||
private final View downloadProgressLayout;
|
private final View downloadProgressLayout;
|
||||||
|
@ -397,9 +401,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
osmLiveProgress = freeVersionBanner.findViewById(R.id.osmLiveProgress);
|
osmLiveProgress = freeVersionBanner.findViewById(R.id.osmLiveProgress);
|
||||||
osmLiveButton = (AppCompatButton) freeVersionBanner.findViewById(R.id.osmLiveButton);
|
osmLiveButton = (AppCompatButton) freeVersionBanner.findViewById(R.id.osmLiveButton);
|
||||||
|
|
||||||
shouldShowFreeVersionBanner =
|
shouldShowFreeVersionBanner = shouldShowFreeVersionBanner(application);
|
||||||
(Version.isFreeVersion(application) && !application.getSettings().LIVE_UPDATES_PURCHASED.get())
|
|
||||||
|| application.getSettings().SHOULD_SHOW_FREE_VERSION_BANNER.get();
|
|
||||||
|
|
||||||
initFreeVersionBanner();
|
initFreeVersionBanner();
|
||||||
updateBannerInProgress();
|
updateBannerInProgress();
|
||||||
|
|
Loading…
Reference in a new issue