Add disable plugin dialog
This commit is contained in:
parent
73eed6b5a8
commit
e7aa7b5aac
12 changed files with 211 additions and 33 deletions
|
@ -6,7 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="bottom"
|
android:gravity="center_vertical"
|
||||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:minHeight="@dimen/bottom_sheet_title_height"
|
android:minHeight="@dimen/bottom_sheet_title_height"
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="open_settings">Open settings</string>
|
||||||
|
<string name="plugin_disabled">Plugin disabled</string>
|
||||||
|
<string name="plugin_disabled_descr">This plugin is a separate application, you will need to remove it separately if you no longer plan to use it.\n\nThe plugin will remain on the device after removing OsmAnd.</string>
|
||||||
<string name="shared_string_menu">Menu</string>
|
<string name="shared_string_menu">Menu</string>
|
||||||
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
|
<string name="ltr_or_rtl_triple_combine_via_dash">%1$s — %2$s — %3$s</string>
|
||||||
<string name="routing_profile_direct_to">Direct-to-point</string>
|
<string name="routing_profile_direct_to">Direct-to-point</string>
|
||||||
|
|
|
@ -4,6 +4,7 @@ package net.osmand;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
@ -158,6 +159,10 @@ public class AndroidUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isIntentSafe(Context context, Intent intent) {
|
||||||
|
return intent.resolveActivity(context.getPackageManager()) != null;
|
||||||
|
}
|
||||||
|
|
||||||
public static Spannable replaceCharsWithIcon(String text, Drawable icon, String[] chars) {
|
public static Spannable replaceCharsWithIcon(String text, Drawable icon, String[] chars) {
|
||||||
Spannable spannable = new SpannableString(text);
|
Spannable spannable = new SpannableString(text);
|
||||||
for (String entry : chars) {
|
for (String entry : chars) {
|
||||||
|
|
|
@ -24,9 +24,9 @@ import net.osmand.plus.activities.TabActivity.TabItem;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||||
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.dialogs.PluginDisabledBottomSheet;
|
||||||
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog;
|
import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||||
|
@ -166,6 +166,15 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showDisableDialog(@Nullable Activity activity) {
|
||||||
|
if (activity instanceof FragmentActivity) {
|
||||||
|
FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager();
|
||||||
|
if (fragmentManager != null) {
|
||||||
|
PluginDisabledBottomSheet.showInstance(fragmentManager, getId(), activity instanceof MapActivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void disable(OsmandApplication app) {
|
public void disable(OsmandApplication app) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +256,7 @@ public abstract class OsmandPlugin {
|
||||||
|
|
||||||
private static boolean updateMarketPlugin(@NonNull OsmandApplication app, @NonNull Set<String> enabledPlugins, @NonNull OsmandPlugin plugin) {
|
private static boolean updateMarketPlugin(@NonNull OsmandApplication app, @NonNull Set<String> enabledPlugins, @NonNull OsmandPlugin plugin) {
|
||||||
boolean marketEnabled = Version.isMarketEnabled(app);
|
boolean marketEnabled = Version.isMarketEnabled(app);
|
||||||
boolean pckg = checkPluginPackage(app, plugin);
|
boolean pckg = plugin.pluginAvailable(app);
|
||||||
boolean paid = plugin.isPaid();
|
boolean paid = plugin.isPaid();
|
||||||
if ((Version.isDeveloperVersion(app) || !Version.isProductionVersion(app)) && !paid) {
|
if ((Version.isDeveloperVersion(app) || !Version.isProductionVersion(app)) && !paid) {
|
||||||
// for test reasons
|
// for test reasons
|
||||||
|
@ -276,7 +285,7 @@ public abstract class OsmandPlugin {
|
||||||
public static void checkInstalledMarketPlugins(@NonNull OsmandApplication app, @Nullable Activity activity) {
|
public static void checkInstalledMarketPlugins(@NonNull OsmandApplication app, @Nullable Activity activity) {
|
||||||
Set<String> enabledPlugins = app.getSettings().getEnabledPlugins();
|
Set<String> enabledPlugins = app.getSettings().getEnabledPlugins();
|
||||||
for (OsmandPlugin plugin : OsmandPlugin.getMarketPlugins()) {
|
for (OsmandPlugin plugin : OsmandPlugin.getMarketPlugins()) {
|
||||||
if (plugin.getInstallURL() != null && checkPluginPackage(app, plugin)) {
|
if (plugin.getInstallURL() != null && plugin.pluginAvailable(app)) {
|
||||||
plugin.onInstall(app, activity);
|
plugin.onInstall(app, activity);
|
||||||
initPlugin(app, plugin);
|
initPlugin(app, plugin);
|
||||||
}
|
}
|
||||||
|
@ -284,13 +293,12 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkPluginPackage(OsmandApplication app, OsmandPlugin plugin) {
|
protected boolean pluginAvailable(OsmandApplication app) {
|
||||||
return plugin.checkPluginPackage(app);
|
return checkPluginPackage(app, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkPluginPackage(OsmandApplication app) {
|
public static boolean checkPluginPackage(@NonNull OsmandApplication app, @NonNull OsmandPlugin plugin) {
|
||||||
return isPackageInstalled(getComponentId1(), app) || isPackageInstalled(getComponentId2(), app);
|
return isPackageInstalled(plugin.getComponentId1(), app) || isPackageInstalled(plugin.getComponentId2(), app);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean enablePlugin(@Nullable Activity activity, OsmandApplication app, OsmandPlugin plugin, boolean enable) {
|
public static boolean enablePlugin(@Nullable Activity activity, OsmandApplication app, OsmandPlugin plugin, boolean enable) {
|
||||||
|
@ -306,17 +314,27 @@ public abstract class OsmandPlugin {
|
||||||
plugin.setActive(false);
|
plugin.setActive(false);
|
||||||
}
|
}
|
||||||
app.getSettings().enablePlugin(plugin.getId(), enable);
|
app.getSettings().enablePlugin(plugin.getId(), enable);
|
||||||
if (activity != null && activity instanceof MapActivity) {
|
if (activity != null) {
|
||||||
final MapActivity mapActivity = (MapActivity) activity;
|
if (activity instanceof MapActivity) {
|
||||||
plugin.updateLayers(mapActivity.getMapView(), mapActivity);
|
final MapActivity mapActivity = (MapActivity) activity;
|
||||||
mapActivity.getDashboard().refreshDashboardFragments();
|
plugin.updateLayers(mapActivity.getMapView(), mapActivity);
|
||||||
|
mapActivity.getDashboard().refreshDashboardFragments();
|
||||||
|
|
||||||
DashFragmentData fragmentData = plugin.getCardFragment();
|
DashFragmentData fragmentData = plugin.getCardFragment();
|
||||||
if (!enable && fragmentData != null) {
|
if (!enable && fragmentData != null) {
|
||||||
FragmentManager fm = mapActivity.getSupportFragmentManager();
|
FragmentManager fm = mapActivity.getSupportFragmentManager();
|
||||||
Fragment fragment = fm.findFragmentByTag(fragmentData.tag);
|
Fragment fragment = fm.findFragmentByTag(fragmentData.tag);
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fm.beginTransaction().remove(fragment).commit();
|
fm.beginTransaction().remove(fragment).commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.isMarketPlugin()) {
|
||||||
|
if (plugin.isActive()) {
|
||||||
|
plugin.showInstallDialog(activity);
|
||||||
|
} else if (OsmandPlugin.checkPluginPackage(app, plugin)) {
|
||||||
|
plugin.showDisableDialog(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,6 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
|
||||||
listModified = true;
|
listModified = true;
|
||||||
}
|
}
|
||||||
getListAdapter().notifyDataSetChanged();
|
getListAdapter().notifyDataSetChanged();
|
||||||
if (plugin.isActive() && plugin.isMarketPlugin()) {
|
|
||||||
plugin.showInstallDialog(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +203,7 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
|
||||||
if (active) {
|
if (active) {
|
||||||
pluginLogo.setBackgroundResource(isLightTheme ? R.drawable.bg_plugin_logo_enabled_light : R.drawable.bg_plugin_logo_enabled_dark);
|
pluginLogo.setBackgroundResource(isLightTheme ? R.drawable.bg_plugin_logo_enabled_light : R.drawable.bg_plugin_logo_enabled_dark);
|
||||||
} else {
|
} else {
|
||||||
TypedArray attributes = getTheme().obtainStyledAttributes(new int[]{R.attr.bg_plugin_logo_disabled});
|
TypedArray attributes = getTheme().obtainStyledAttributes(new int[] {R.attr.bg_plugin_logo_disabled});
|
||||||
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
|
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
|
||||||
attributes.recycle();
|
attributes.recycle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class BottomSheetItemTitleWithDescrAndButton extends BottomSheetItemWithD
|
||||||
int position,
|
int position,
|
||||||
Drawable icon,
|
Drawable icon,
|
||||||
Drawable background,
|
Drawable background,
|
||||||
String title,
|
CharSequence title,
|
||||||
@ColorRes int titleColorId,
|
@ColorRes int titleColorId,
|
||||||
CharSequence description,
|
CharSequence description,
|
||||||
@ColorRes int descriptionColorId,
|
@ColorRes int descriptionColorId,
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class BottomSheetItemWithCompoundButton extends BottomSheetItemWithDescri
|
||||||
int position,
|
int position,
|
||||||
Drawable icon,
|
Drawable icon,
|
||||||
Drawable background,
|
Drawable background,
|
||||||
String title,
|
CharSequence title,
|
||||||
@ColorRes int titleColorId,
|
@ColorRes int titleColorId,
|
||||||
CharSequence description,
|
CharSequence description,
|
||||||
@ColorRes int descriptionColorId,
|
@ColorRes int descriptionColorId,
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
|
||||||
int position,
|
int position,
|
||||||
Drawable icon,
|
Drawable icon,
|
||||||
Drawable background,
|
Drawable background,
|
||||||
String title,
|
CharSequence title,
|
||||||
@ColorRes int titleColorId,
|
@ColorRes int titleColorId,
|
||||||
CharSequence description,
|
CharSequence description,
|
||||||
@ColorRes int descriptionColorId,
|
@ColorRes int descriptionColorId,
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
|
|
||||||
private Drawable background;
|
private Drawable background;
|
||||||
private Drawable icon;
|
private Drawable icon;
|
||||||
protected String title;
|
protected CharSequence title;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
protected int titleColorId = INVALID_ID;
|
protected int titleColorId = INVALID_ID;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
int position,
|
int position,
|
||||||
Drawable icon,
|
Drawable icon,
|
||||||
Drawable background,
|
Drawable background,
|
||||||
String title,
|
CharSequence title,
|
||||||
@ColorRes int titleColorId) {
|
@ColorRes int titleColorId) {
|
||||||
super(customView, layoutId, tag, disabled, onClickListener, position);
|
super(customView, layoutId, tag, disabled, onClickListener, position);
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
|
@ -83,7 +83,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
|
|
||||||
protected Drawable icon;
|
protected Drawable icon;
|
||||||
protected Drawable background;
|
protected Drawable background;
|
||||||
protected String title;
|
protected CharSequence title;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
protected int titleColorId = INVALID_ID;
|
protected int titleColorId = INVALID_ID;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setTitle(String title) {
|
public Builder setTitle(CharSequence title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
package net.osmand.plus.dialogs;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
|
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import static net.osmand.plus.OsmandPlugin.PLUGIN_ID_KEY;
|
||||||
|
|
||||||
|
public class PluginDisabledBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
public static final String TAG = PluginDisabledBottomSheet.class.getName();
|
||||||
|
|
||||||
|
private static final Log LOG = PlatformUtil.getLog(PluginDisabledBottomSheet.class);
|
||||||
|
|
||||||
|
private String pluginId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
final OsmandApplication app = getMyApplication();
|
||||||
|
Context context = getContext();
|
||||||
|
if (context == null || app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
pluginId = savedInstanceState.getString(PLUGIN_ID_KEY);
|
||||||
|
} else {
|
||||||
|
Bundle args = getArguments();
|
||||||
|
if (args != null) {
|
||||||
|
pluginId = args.getString(PLUGIN_ID_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginId);
|
||||||
|
if (plugin == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseBottomSheetItem titleItem = new TitleItem.Builder()
|
||||||
|
.setTitle(getString(R.string.plugin_disabled))
|
||||||
|
.setLayoutId(R.layout.bottom_sheet_item_title_big)
|
||||||
|
.create();
|
||||||
|
items.add(titleItem);
|
||||||
|
|
||||||
|
Typeface typeface = FontCache.getRobotoMedium(getContext());
|
||||||
|
SpannableString pluginTitleSpan = new SpannableString(plugin.getName());
|
||||||
|
pluginTitleSpan.setSpan(new CustomTypefaceSpan(typeface), 0, pluginTitleSpan.length(), 0);
|
||||||
|
|
||||||
|
BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder()
|
||||||
|
.setTitle(pluginTitleSpan)
|
||||||
|
.setTitleColorId(nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light)
|
||||||
|
.setIcon(getContentIcon(R.drawable.ic_extension_dark))
|
||||||
|
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
|
||||||
|
.create();
|
||||||
|
items.add(pluginTitle);
|
||||||
|
|
||||||
|
BaseBottomSheetItem descrItem = new SimpleBottomSheetItem.Builder()
|
||||||
|
.setTitle(getString(R.string.plugin_disabled_descr))
|
||||||
|
.setLayoutId(R.layout.bottom_sheet_item_title_long)
|
||||||
|
.create();
|
||||||
|
items.add(descrItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDismissButtonTextId() {
|
||||||
|
return R.string.shared_string_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return R.string.open_settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRightBottomButtonClick() {
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
Intent intent = getPluginSettingsIntent();
|
||||||
|
if (app != null && AndroidUtils.isIntentSafe(app, intent)) {
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putString(PLUGIN_ID_KEY, pluginId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getPluginSettingsIntent() {
|
||||||
|
Intent intent = null;
|
||||||
|
|
||||||
|
OsmandApplication app = getMyApplication();
|
||||||
|
OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginId);
|
||||||
|
if (plugin != null && app != null) {
|
||||||
|
String installedPackage = null;
|
||||||
|
if (OsmandPlugin.isPackageInstalled(plugin.getComponentId1(), app)) {
|
||||||
|
installedPackage = plugin.getComponentId1();
|
||||||
|
}
|
||||||
|
if (OsmandPlugin.isPackageInstalled(plugin.getComponentId2(), app)) {
|
||||||
|
installedPackage = plugin.getComponentId2();
|
||||||
|
}
|
||||||
|
if (installedPackage != null) {
|
||||||
|
intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
Uri uri = Uri.fromParts("package", installedPackage, null);
|
||||||
|
intent.setData(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInstance(@NonNull FragmentManager fm, String pluginId, Boolean usedOnMap) {
|
||||||
|
try {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(PLUGIN_ID_KEY, pluginId);
|
||||||
|
|
||||||
|
PluginDisabledBottomSheet dialog = new PluginDisabledBottomSheet();
|
||||||
|
dialog.setArguments(args);
|
||||||
|
dialog.setUsedOnMap(usedOnMap);
|
||||||
|
dialog.show(fm, PluginDisabledBottomSheet.TAG);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
LOG.error("showInstance", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,9 +2,11 @@ package net.osmand.plus.dialogs;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.text.SpannableString;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -29,7 +31,9 @@ import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
import net.osmand.plus.download.DownloadValidationManager;
|
import net.osmand.plus.download.DownloadValidationManager;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.settings.BaseSettingsFragment;
|
import net.osmand.plus.settings.BaseSettingsFragment;
|
||||||
|
import net.osmand.plus.widgets.style.CustomTypefaceSpan;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -79,8 +83,12 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm
|
||||||
.create();
|
.create();
|
||||||
items.add(titleItem);
|
items.add(titleItem);
|
||||||
|
|
||||||
|
Typeface typeface = FontCache.getRobotoMedium(getContext());
|
||||||
|
SpannableString pluginTitleSpan = new SpannableString(plugin.getName());
|
||||||
|
pluginTitleSpan.setSpan(new CustomTypefaceSpan(typeface), 0, pluginTitleSpan.length(), 0);
|
||||||
|
|
||||||
BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder()
|
||||||
.setTitle(plugin.getName())
|
.setTitle(pluginTitleSpan)
|
||||||
.setTitleColorId(nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light)
|
.setTitleColorId(nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light)
|
||||||
.setIcon(getContentIcon(R.drawable.ic_extension_dark))
|
.setIcon(getContentIcon(R.drawable.ic_extension_dark))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
|
.setLayoutId(R.layout.bottom_sheet_item_simple_56dp)
|
||||||
|
|
|
@ -89,8 +89,8 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkPluginPackage(OsmandApplication app) {
|
protected boolean pluginAvailable(OsmandApplication app) {
|
||||||
return super.checkPluginPackage(app) || InAppPurchaseHelper.isSubscribedToLiveUpdates(app);
|
return super.pluginAvailable(app) || InAppPurchaseHelper.isSubscribedToLiveUpdates(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue