Merge pull request #11197 from osmandapp/amazon_fixes
Open market for free amazon version
This commit is contained in:
commit
489769b4b2
15 changed files with 79 additions and 83 deletions
|
@ -23,7 +23,7 @@ public class Version {
|
||||||
return getBuildFlavor().contains("huawei");
|
return getBuildFlavor().contains("huawei");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isAmazon() {
|
public static boolean isAmazon() {
|
||||||
return getBuildFlavor().contains("amazon");
|
return getBuildFlavor().contains("amazon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog.PluginStateListener;
|
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog.PluginStateListener;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
|
||||||
|
@ -168,7 +169,7 @@ public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStat
|
||||||
if (plugin instanceof SRTMPlugin) {
|
if (plugin instanceof SRTMPlugin) {
|
||||||
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
|
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
|
||||||
if (fragmentManager != null) {
|
if (fragmentManager != null) {
|
||||||
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager);
|
ChoosePlanDialogFragment.showDialogInstance(app, fragmentManager, ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
|
||||||
|
|
|
@ -5,6 +5,8 @@ import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -27,6 +29,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
@ -34,7 +37,6 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
@ -48,6 +50,7 @@ import net.osmand.plus.inapp.InAppPurchases.InAppPurchase;
|
||||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo;
|
import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo;
|
||||||
import net.osmand.plus.liveupdates.SubscriptionFragment;
|
import net.osmand.plus.liveupdates.SubscriptionFragment;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -709,57 +712,41 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showFreeVersionInstance(@NonNull FragmentManager fm) {
|
public enum ChoosePlanDialogType {
|
||||||
try {
|
|
||||||
ChoosePlanFreeBannerDialogFragment fragment = new ChoosePlanFreeBannerDialogFragment();
|
FREE_VERSION("showFreeVersionInstance", ChoosePlanFreeBannerDialogFragment.TAG, ChoosePlanFreeBannerDialogFragment.class),
|
||||||
fragment.show(fm, ChoosePlanFreeBannerDialogFragment.TAG);
|
WIKIPEDIA("showWikipediaInstance", ChoosePlanWikipediaDialogFragment.TAG, ChoosePlanWikipediaDialogFragment.class),
|
||||||
} catch (RuntimeException e) {
|
WIKIVOYAGE("showWikivoyageInstance", ChoosePlanWikivoyageDialogFragment.TAG, ChoosePlanWikivoyageDialogFragment.class),
|
||||||
LOG.error("showFreeVersionInstance", e);
|
SEA_DEPTH_MAPS("showSeaDepthMapsInstance", ChoosePlanSeaDepthMapsDialogFragment.TAG, ChoosePlanSeaDepthMapsDialogFragment.class),
|
||||||
|
HILLSHADE_SRTM_PLUGIN("showHillshadeSrtmPluginInstance", ChoosePlanHillshadeSrtmDialogFragment.TAG, ChoosePlanHillshadeSrtmDialogFragment.class),
|
||||||
|
OSM_LIVE("showOsmLiveInstance", ChoosePlanOsmLiveBannerDialogFragment.TAG, ChoosePlanOsmLiveBannerDialogFragment.class);
|
||||||
|
|
||||||
|
private final String tag;
|
||||||
|
private final String errorName;
|
||||||
|
private final Class<? extends ChoosePlanDialogFragment> fragmentClass;
|
||||||
|
|
||||||
|
ChoosePlanDialogType(String errorName, String tag, Class<? extends ChoosePlanDialogFragment> fragmentClass) {
|
||||||
|
this.tag = tag;
|
||||||
|
this.errorName = errorName;
|
||||||
|
this.fragmentClass = fragmentClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showWikipediaInstance(@NonNull FragmentManager fm) {
|
public static void showDialogInstance(@NonNull OsmandApplication app, @NonNull FragmentManager manager,
|
||||||
|
@NonNull ChoosePlanDialogType dialogType) {
|
||||||
|
if (Version.isAmazon() && !Version.isPaidVersion(app)) {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
if (AndroidUtils.isIntentSafe(app, intent)) {
|
||||||
|
app.startActivity(intent);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
ChoosePlanWikipediaDialogFragment fragment = new ChoosePlanWikipediaDialogFragment();
|
ChoosePlanDialogFragment fragment = (ChoosePlanDialogFragment) Fragment.instantiate(app, dialogType.fragmentClass.getName());
|
||||||
fragment.show(fm, ChoosePlanWikipediaDialogFragment.TAG);
|
fragment.show(manager, dialogType.tag);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
LOG.error("showWikipediaInstance", e);
|
LOG.error(dialogType.errorName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showWikivoyageInstance(@NonNull FragmentManager fm) {
|
|
||||||
try {
|
|
||||||
ChoosePlanWikivoyageDialogFragment fragment = new ChoosePlanWikivoyageDialogFragment();
|
|
||||||
fragment.show(fm, ChoosePlanWikivoyageDialogFragment.TAG);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
LOG.error("showWikivoyageInstance", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showSeaDepthMapsInstance(@NonNull FragmentManager fm) {
|
|
||||||
try {
|
|
||||||
ChoosePlanSeaDepthMapsDialogFragment fragment = new ChoosePlanSeaDepthMapsDialogFragment();
|
|
||||||
fragment.show(fm, ChoosePlanSeaDepthMapsDialogFragment.TAG);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
LOG.error("showSeaDepthMapsInstance", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showHillshadeSrtmPluginInstance(@NonNull FragmentManager fm) {
|
|
||||||
try {
|
|
||||||
ChoosePlanHillshadeSrtmDialogFragment fragment = new ChoosePlanHillshadeSrtmDialogFragment();
|
|
||||||
fragment.show(fm, ChoosePlanHillshadeSrtmDialogFragment.TAG);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
LOG.error("showHillshadeSrtmPluginInstance", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showOsmLiveInstance(@NonNull FragmentManager fm) {
|
|
||||||
try {
|
|
||||||
ChoosePlanOsmLiveBannerDialogFragment fragment = new ChoosePlanOsmLiveBannerDialogFragment();
|
|
||||||
fragment.show(fm, ChoosePlanOsmLiveBannerDialogFragment.TAG);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
LOG.error("showOsmLiveInstance", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.OsmAndFeature;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.OsmAndFeature;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||||
|
@ -235,7 +236,7 @@ public abstract class OsmLiveGoneDialog extends BaseOsmAndDialogFragment {
|
||||||
dismiss();
|
dismiss();
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(app, activity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,6 +21,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.PluginsFragment;
|
import net.osmand.plus.activities.PluginsFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||||
|
@ -55,7 +56,7 @@ public class DashPluginsFragment extends DashBaseFragment {
|
||||||
if (plugin instanceof SRTMPlugin) {
|
if (plugin instanceof SRTMPlugin) {
|
||||||
FragmentManager fragmentManager = getFragmentManager();
|
FragmentManager fragmentManager = getFragmentManager();
|
||||||
if (fragmentManager != null) {
|
if (fragmentManager != null) {
|
||||||
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager);
|
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), fragmentManager, ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
|
||||||
|
|
|
@ -22,8 +22,6 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.Space;
|
import android.widget.Space;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.ibm.icu.impl.IllegalIcuArgumentException;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.UiThread;
|
import androidx.annotation.UiThread;
|
||||||
|
@ -35,6 +33,8 @@ import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.ibm.icu.impl.IllegalIcuArgumentException;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
|
@ -52,7 +52,9 @@ import net.osmand.plus.activities.TabActivity;
|
||||||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
|
import net.osmand.plus.download.ReloadIndexesTask.ReloadIndexesListener;
|
||||||
import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment;
|
import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment;
|
||||||
import net.osmand.plus.download.ui.DownloadResourceGroupFragment;
|
import net.osmand.plus.download.ui.DownloadResourceGroupFragment;
|
||||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
||||||
|
@ -63,7 +65,6 @@ import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
|
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
|
||||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.download.ReloadIndexesTask.ReloadIndexesListener;
|
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -407,7 +408,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
collapseBanner();
|
collapseBanner();
|
||||||
} else {
|
} else {
|
||||||
ctx.getMyApplication().logEvent("click_free_dialog");
|
ctx.getMyApplication().logEvent("click_free_dialog");
|
||||||
ChoosePlanDialogFragment.showFreeVersionInstance(ctx.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(ctx.getMyApplication(), ctx.getSupportFragmentManager(), ChoosePlanDialogType.FREE_VERSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,7 @@ import net.osmand.plus.activities.LocalIndexInfo;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.PluginsFragment;
|
import net.osmand.plus.activities.PluginsFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.download.CityItem;
|
import net.osmand.plus.download.CityItem;
|
||||||
import net.osmand.plus.download.CustomIndexItem;
|
import net.osmand.plus.download.CustomIndexItem;
|
||||||
import net.osmand.plus.download.DownloadItem;
|
import net.osmand.plus.download.DownloadItem;
|
||||||
|
@ -353,10 +354,10 @@ public class ItemViewHolder {
|
||||||
switch (clickAction) {
|
switch (clickAction) {
|
||||||
case ASK_FOR_FULL_VERSION_PURCHASE:
|
case ASK_FOR_FULL_VERSION_PURCHASE:
|
||||||
context.getMyApplication().logEvent("in_app_purchase_show_from_wiki_context_menu");
|
context.getMyApplication().logEvent("in_app_purchase_show_from_wiki_context_menu");
|
||||||
ChoosePlanDialogFragment.showWikipediaInstance(context.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(context.getMyApplication(), context.getSupportFragmentManager(), ChoosePlanDialogType.WIKIPEDIA);
|
||||||
break;
|
break;
|
||||||
case ASK_FOR_DEPTH_CONTOURS_PURCHASE:
|
case ASK_FOR_DEPTH_CONTOURS_PURCHASE:
|
||||||
ChoosePlanDialogFragment.showSeaDepthMapsInstance(context.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(context.getMyApplication(), context.getSupportFragmentManager(), ChoosePlanDialogType.SEA_DEPTH_MAPS);
|
||||||
break;
|
break;
|
||||||
case ASK_FOR_SEAMARKS_PLUGIN:
|
case ASK_FOR_SEAMARKS_PLUGIN:
|
||||||
showPluginsScreen();
|
showPluginsScreen();
|
||||||
|
@ -364,7 +365,7 @@ public class ItemViewHolder {
|
||||||
context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show();
|
context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
case ASK_FOR_SRTM_PLUGIN_PURCHASE:
|
case ASK_FOR_SRTM_PLUGIN_PURCHASE:
|
||||||
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(context.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(context.getMyApplication(), context.getSupportFragmentManager(), ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN);
|
||||||
break;
|
break;
|
||||||
case ASK_FOR_SRTM_PLUGIN_ENABLE:
|
case ASK_FOR_SRTM_PLUGIN_ENABLE:
|
||||||
showPluginsScreen();
|
showPluginsScreen();
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.osmand.Collator;
|
||||||
import net.osmand.OsmAndCollator;
|
import net.osmand.OsmAndCollator;
|
||||||
import net.osmand.map.OsmandRegions;
|
import net.osmand.map.OsmandRegions;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.OsmAndListFragment;
|
import net.osmand.plus.base.OsmAndListFragment;
|
||||||
|
@ -190,7 +191,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
||||||
if (listAdapter.isShowOsmLiveBanner() && position == 0) {
|
if (listAdapter.isShowOsmLiveBanner() && position == 0) {
|
||||||
DownloadActivity activity = getMyActivity();
|
DownloadActivity activity = getMyActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(activity.getMyApplication(), activity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final IndexItem e = (IndexItem) getListAdapter().getItem(position);
|
final IndexItem e = (IndexItem) getListAdapter().getItem(position);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
|
@ -322,7 +323,7 @@ public class DiscountHelper {
|
||||||
} else {
|
} else {
|
||||||
for (InAppPurchase p : purchaseHelper.getLiveUpdates().getAllSubscriptions()) {
|
for (InAppPurchase p : purchaseHelper.getLiveUpdates().getAllSubscriptions()) {
|
||||||
if (url.contains(p.getSku())) {
|
if (url.contains(p.getSku())) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(app, mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,17 +368,17 @@ public class DiscountHelper {
|
||||||
} else if (url.startsWith(SHOW_CHOOSE_PLAN_PREFIX)) {
|
} else if (url.startsWith(SHOW_CHOOSE_PLAN_PREFIX)) {
|
||||||
String planType = url.substring(SHOW_CHOOSE_PLAN_PREFIX.length()).trim();
|
String planType = url.substring(SHOW_CHOOSE_PLAN_PREFIX.length()).trim();
|
||||||
if (CHOOSE_PLAN_TYPE_FREE.equals(planType)) {
|
if (CHOOSE_PLAN_TYPE_FREE.equals(planType)) {
|
||||||
ChoosePlanDialogFragment.showFreeVersionInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.FREE_VERSION);
|
||||||
} else if (CHOOSE_PLAN_TYPE_LIVE.equals(planType)) {
|
} else if (CHOOSE_PLAN_TYPE_LIVE.equals(planType)) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
} else if (CHOOSE_PLAN_TYPE_SEA_DEPTH.equals(planType)) {
|
} else if (CHOOSE_PLAN_TYPE_SEA_DEPTH.equals(planType)) {
|
||||||
ChoosePlanDialogFragment.showSeaDepthMapsInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.SEA_DEPTH_MAPS);
|
||||||
} else if (CHOOSE_PLAN_TYPE_HILLSHADE.equals(planType)) {
|
} else if (CHOOSE_PLAN_TYPE_HILLSHADE.equals(planType)) {
|
||||||
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN);
|
||||||
} else if (CHOOSE_PLAN_TYPE_WIKIPEDIA.equals(planType)) {
|
} else if (CHOOSE_PLAN_TYPE_WIKIPEDIA.equals(planType)) {
|
||||||
ChoosePlanDialogFragment.showWikipediaInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.WIKIPEDIA);
|
||||||
} else if (CHOOSE_PLAN_TYPE_WIKIVOYAGE.equals(planType)) {
|
} else if (CHOOSE_PLAN_TYPE_WIKIVOYAGE.equals(planType)) {
|
||||||
ChoosePlanDialogFragment.showWikivoyageInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.WIKIVOYAGE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
|
|
@ -35,6 +35,7 @@ import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -213,7 +214,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
subscriptionsButton.setOnClickListener(new View.OnClickListener() {
|
subscriptionsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(getActivity().getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(app, getActivity().getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (isDonationSupported()) {
|
if (isDonationSupported()) {
|
||||||
|
@ -249,7 +250,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(app, activity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogListener;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogListener;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.download.AbstractDownloadActivity;
|
import net.osmand.plus.download.AbstractDownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
|
@ -95,7 +96,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (!InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication()) && showSettingOnly) {
|
if (!InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication()) && showSettingOnly) {
|
||||||
ChoosePlanDialogFragment.showOsmLiveInstance(getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,9 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
|
||||||
import androidx.appcompat.view.ContextThemeWrapper;
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
|
@ -32,9 +29,9 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchBannerListItem;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchFreeBannerListItem;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
|
import net.osmand.plus.search.listitems.QuickSearchBannerListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchHeaderListItem;
|
import net.osmand.plus.search.listitems.QuickSearchHeaderListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchListItem;
|
import net.osmand.plus.search.listitems.QuickSearchListItem;
|
||||||
import net.osmand.plus.search.listitems.QuickSearchListItemType;
|
import net.osmand.plus.search.listitems.QuickSearchListItemType;
|
||||||
|
@ -50,9 +47,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.ButtonItem;
|
||||||
import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.INVALID_ID;
|
import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.INVALID_ID;
|
||||||
import static net.osmand.search.core.ObjectType.POI_TYPE;
|
import static net.osmand.search.core.ObjectType.POI_TYPE;
|
||||||
import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.ButtonItem;
|
|
||||||
|
|
||||||
public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
|
public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
|
||||||
|
|
||||||
|
@ -265,8 +262,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
|
||||||
btnGet.setOnClickListener(new View.OnClickListener() {
|
btnGet.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ChoosePlanDialogFragment.showWikipediaInstance(
|
ChoosePlanDialogFragment.showDialogInstance(app, activity.getSupportFragmentManager(), ChoosePlanDialogType.WIKIPEDIA);
|
||||||
activity.getSupportFragmentManager());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.settings.backend.CommonPreference;
|
import net.osmand.plus.settings.backend.CommonPreference;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -139,7 +140,8 @@ public class ContourLinesMenu {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (itemId == R.string.srtm_plugin_name) {
|
} else if (itemId == R.string.srtm_plugin_name) {
|
||||||
ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager());
|
ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(),
|
||||||
|
mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN);
|
||||||
closeDashboard(mapActivity);
|
closeDashboard(mapActivity);
|
||||||
} else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) {
|
} else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) {
|
||||||
plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() {
|
plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleDividerItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleDividerItem;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.wikivoyage.article.WikivoyageArticleWikiLinkFragment;
|
import net.osmand.plus.wikivoyage.article.WikivoyageArticleWikiLinkFragment;
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ public class WikipediaArticleWikiLinkFragment extends MenuBottomSheetDialogFragm
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
FragmentManager fm = getFragmentManager();
|
FragmentManager fm = getFragmentManager();
|
||||||
if (fm != null) {
|
if (fm != null) {
|
||||||
ChoosePlanDialogFragment.showWikivoyageInstance(fm);
|
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), fm, ChoosePlanDialogType.WIKIVOYAGE);
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||||
|
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread;
|
import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
|
@ -300,7 +301,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
|| item.getType() == DownloadActivityType.TRAVEL_FILE) && !Version.isPaidVersion(app)) {
|
|| item.getType() == DownloadActivityType.TRAVEL_FILE) && !Version.isPaidVersion(app)) {
|
||||||
FragmentManager fm = getFragmentManager();
|
FragmentManager fm = getFragmentManager();
|
||||||
if (fm != null) {
|
if (fm != null) {
|
||||||
ChoosePlanDialogFragment.showWikipediaInstance(fm);
|
ChoosePlanDialogFragment.showDialogInstance(app, fm, ChoosePlanDialogType.WIKIPEDIA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||||
|
@ -356,7 +357,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
|| item.getType() == DownloadActivityType.TRAVEL_FILE) && !Version.isPaidVersion(app)) {
|
|| item.getType() == DownloadActivityType.TRAVEL_FILE) && !Version.isPaidVersion(app)) {
|
||||||
FragmentManager fm = getFragmentManager();
|
FragmentManager fm = getFragmentManager();
|
||||||
if (fm != null) {
|
if (fm != null) {
|
||||||
ChoosePlanDialogFragment.showWikipediaInstance(fm);
|
ChoosePlanDialogFragment.showDialogInstance(app, fm, ChoosePlanDialogType.WIKIPEDIA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||||
|
|
Loading…
Reference in a new issue