From 3b81b1d2c735ab7c6c01e892d212f1a22878f012 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 12 Oct 2020 22:05:31 +0300 Subject: [PATCH] Remove outdated plugin screens from plugins --- OsmAnd/AndroidManifest.xml | 2 - OsmAnd/res/layout/plugin.xml | 3 +- .../osmand/access/AccessibilityPlugin.java | 5 - OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 4 - .../plus/activities/PluginActivity.java | 241 -------------- .../plus/activities/PluginsActivity.java | 296 ------------------ .../plus/activities/SettingsActivity.java | 32 +- .../audionotes/AudioVideoNotesPlugin.java | 5 - .../plus/dashboard/DashPluginsFragment.java | 8 +- .../development/OsmandDevelopmentPlugin.java | 5 - .../plus/dialogs/MapLayerMenuListener.java | 7 +- .../net/osmand/plus/helpers/GpxUiHelper.java | 9 +- .../monitoring/OsmandMonitoringPlugin.java | 6 - .../osmand/plus/osmedit/OsmEditingPlugin.java | 5 - 14 files changed, 27 insertions(+), 601 deletions(-) delete mode 100644 OsmAnd/src/net/osmand/plus/activities/PluginActivity.java delete mode 100644 OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 4e5395a04a..9de6d31998 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -497,8 +497,6 @@ - - diff --git a/OsmAnd/res/layout/plugin.xml b/OsmAnd/res/layout/plugin.xml index 710015345c..056fc218f0 100644 --- a/OsmAnd/res/layout/plugin.xml +++ b/OsmAnd/res/layout/plugin.xml @@ -23,8 +23,7 @@ + android:orientation="vertical" > getSettingsActivity() { - return SettingsAccessibilityActivity.class; - } - @Override public SettingsScreenType getSettingsScreenType() { return SettingsScreenType.ACCESSIBILITY_SETTINGS; diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 8b3326cf02..4198f7036a 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -111,10 +111,6 @@ public abstract class OsmandPlugin { return app.getUIUtilities().getIcon(getLogoResourceId()); } - public Class getSettingsActivity() { - return null; - } - public SettingsScreenType getSettingsScreenType() { return null; } diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java b/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java deleted file mode 100644 index e367f3cd8e..0000000000 --- a/OsmAnd/src/net/osmand/plus/activities/PluginActivity.java +++ /dev/null @@ -1,241 +0,0 @@ -package net.osmand.plus.activities; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Intent; -import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.text.method.LinkMovementMethod; -import android.util.Log; -import android.view.MenuItem; -import android.view.View; -import android.widget.Button; -import android.widget.CompoundButton; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; - -import net.osmand.AndroidUtils; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.R; -import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; -import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog; -import net.osmand.plus.download.DownloadIndexesThread; -import net.osmand.plus.srtmplugin.SRTMPlugin; - -public class PluginActivity extends OsmandActionBarActivity implements DownloadIndexesThread.DownloadEvents, PluginInstalledBottomSheetDialog.PluginStateListener { - private static final String TAG = "PluginActivity"; - public static final String EXTRA_PLUGIN_ID = "plugin_id"; - - private OsmandPlugin plugin; - - @Override - protected void onCreate(Bundle savedInstanceState) { - ((OsmandApplication) getApplication()).applyTheme(this); - super.onCreate(savedInstanceState); - - Intent intent = getIntent(); - if (intent == null || !intent.hasExtra(EXTRA_PLUGIN_ID)) { - Log.e(TAG, "Required extra '" + EXTRA_PLUGIN_ID + "' is missing"); - finish(); - return; - } - String pluginId = intent.getStringExtra(EXTRA_PLUGIN_ID); - if (pluginId == null) { - Log.e(TAG, "Extra '" + EXTRA_PLUGIN_ID + "' is null"); - finish(); - return; - } - for (OsmandPlugin plugin : OsmandPlugin.getAvailablePlugins()) { - if (!plugin.getId().equals(pluginId)) - continue; - - this.plugin = plugin; - break; - } - if (plugin == null) { - Log.e(TAG, "Plugin '" + EXTRA_PLUGIN_ID + "' not found"); - finish(); - return; - } - - setContentView(R.layout.plugin); - //noinspection ConstantConditions - getSupportActionBar().setTitle(plugin.getName()); - Drawable pluginImage = plugin.getAssetResourceImage(); - if (pluginImage != null) { - ImageView img = (ImageView) findViewById(R.id.plugin_image); - img.setImageDrawable(pluginImage); - } else { - findViewById(R.id.plugin_image_placeholder).setVisibility(View.VISIBLE); - } - - TextView descriptionView = (TextView) findViewById(R.id.plugin_description); - descriptionView.setText(plugin.getDescription()); - - boolean light = getMyApplication().getSettings().isLightContent(); - int linkTextColor = ContextCompat.getColor(this, - light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark); - - descriptionView.setLinkTextColor(linkTextColor); - descriptionView.setMovementMethod(LinkMovementMethod.getInstance()); - AndroidUtils.removeLinkUnderline(descriptionView); - - Button settingsButton = (Button) findViewById(R.id.plugin_settings); - settingsButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - startActivity(new Intent(PluginActivity.this, plugin.getSettingsActivity())); - } - }); - - CompoundButton enableDisableButton = (CompoundButton)findViewById( - R.id.plugin_enable_disable); - enableDisableButton.setOnCheckedChangeListener( - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (plugin.isActive() == isChecked) { - return; - } - - boolean ok = OsmandPlugin.enablePlugin(PluginActivity.this, (OsmandApplication)getApplication(), - plugin, isChecked); - if (!ok) { - return; - } - updateState(); - } - }); - Button getButton = (Button)findViewById(R.id.plugin_get); - getButton.setText(plugin.isPaid() ? R.string.get_plugin : R.string.shared_string_install); - getButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - try { - if (plugin instanceof SRTMPlugin) { - FragmentManager fragmentManager = getSupportFragmentManager(); - if (fragmentManager != null) { - ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager); - } - } else { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL()))); - } - } catch (Exception e) { - //ignored - } - } - }); - - updateState(); - } - - @Override - protected void onResume() { - super.onResume(); - OsmandApplication app = getMyApplication(); - OsmandPlugin.checkInstalledMarketPlugins(app, this); - app.getDownloadThread().setUiActivity(this); - updateState(); - } - - @Override - protected void onPause() { - super.onPause(); - getMyApplication().getDownloadThread().resetUiActivity(this); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int itemId = item.getItemId(); - switch (itemId) { - case android.R.id.home: - finish(); - return true; - - } - return false; - } - - @SuppressLint("NewApi") - private void updateState() { - CompoundButton enableDisableButton = (CompoundButton)findViewById( - R.id.plugin_enable_disable); - Button getButton = (Button)findViewById(R.id.plugin_get); - Button settingsButton = (Button)findViewById(R.id.plugin_settings); - settingsButton.setCompoundDrawablesWithIntrinsicBounds( - getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_settings), - null, null, null); - View installHeader = findViewById(R.id.plugin_install_header); - - if (plugin.needsInstallation()) { - getButton.setVisibility(View.VISIBLE); - enableDisableButton.setVisibility(View.GONE); - settingsButton.setVisibility(View.GONE); - installHeader.setVisibility(View.VISIBLE); - View worldGlobeIcon = installHeader.findViewById(R.id.ic_world_globe); - Drawable worldGlobeDrawable = getMyApplication().getUIUtilities().getThemedIcon( - R.drawable.ic_world_globe_dark); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - worldGlobeIcon.setBackground(worldGlobeDrawable); - } else { - //noinspection deprecation - worldGlobeIcon.setBackgroundDrawable(worldGlobeDrawable); - } - } else { - getButton.setVisibility(View.GONE); - enableDisableButton.setVisibility(View.VISIBLE); - enableDisableButton.setChecked(plugin.isActive()); - - final Class settingsActivity = plugin.getSettingsActivity(); - if (settingsActivity == null || !plugin.isActive()) { - settingsButton.setVisibility(View.GONE); - } else { - settingsButton.setVisibility(View.VISIBLE); - } - - installHeader.setVisibility(View.GONE); - } - } - - // DownloadEvents - @Override - public void newDownloadIndexes() { - for (Fragment fragment : getSupportFragmentManager().getFragments()) { - if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) { - ((DownloadIndexesThread.DownloadEvents) fragment).newDownloadIndexes(); - } - } - } - - @Override - public void downloadInProgress() { - for (Fragment fragment : getSupportFragmentManager().getFragments()) { - if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) { - ((DownloadIndexesThread.DownloadEvents) fragment).downloadInProgress(); - } - } - } - - @Override - public void downloadHasFinished() { - for (Fragment fragment : getSupportFragmentManager().getFragments()) { - if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) { - ((DownloadIndexesThread.DownloadEvents) fragment).downloadHasFinished(); - } - } - } - - @Override - public void onPluginStateChanged(OsmandPlugin plugin) { - updateState(); - } -} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java deleted file mode 100644 index a0e731c7bc..0000000000 --- a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java +++ /dev/null @@ -1,296 +0,0 @@ -package net.osmand.plus.activities; - -import android.app.Activity; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.res.TypedArray; -import android.os.Bundle; -import android.text.method.LinkMovementMethod; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.PopupMenu; -import androidx.core.content.ContextCompat; -import androidx.fragment.app.Fragment; - -import net.osmand.AndroidUtils; -import net.osmand.aidl.ConnectedApp; -import net.osmand.plus.CustomOsmandPlugin; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.R; -import net.osmand.plus.UiUtilities; -import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog; -import net.osmand.plus.download.DownloadIndexesThread; - -import java.util.ArrayList; - -public class PluginsActivity extends OsmandListActivity implements DownloadIndexesThread.DownloadEvents, PluginInstalledBottomSheetDialog.PluginStateListener { - - public static final int ACTIVE_PLUGINS_LIST_MODIFIED = 1; - - private boolean listModified = false; - - @Override - protected void onCreate(Bundle savedInstanceState) { - getMyApplication().applyTheme(this); - super.onCreate(savedInstanceState); - setContentView(R.layout.plugins); - getSupportActionBar().setTitle(R.string.plugins_screen); - setListAdapter(new PluginsListAdapter()); - } - - @Override - public PluginsListAdapter getListAdapter() { - return (PluginsListAdapter) super.getListAdapter(); - } - - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - Object tag = view.getTag(); - if (tag instanceof OsmandPlugin) { - Intent intent = new Intent(this, PluginActivity.class); - intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, ((OsmandPlugin) tag).getId()); - startActivity(intent); - } else if (tag instanceof ConnectedApp) { - switchEnabled((ConnectedApp) tag); - } - } - - @Override - protected void onResume() { - super.onResume(); - OsmandApplication app = getMyApplication(); - OsmandPlugin.checkInstalledMarketPlugins(app, this); - app.getDownloadThread().setUiActivity(this); - getListAdapter().notifyDataSetChanged(); - } - - @Override - protected void onPause() { - super.onPause(); - getMyApplication().getDownloadThread().resetUiActivity(this); - } - - private void enableDisablePlugin(OsmandPlugin plugin, boolean enable) { - OsmandApplication app = getMyApplication(); - if (OsmandPlugin.enablePlugin(this, app, plugin, enable)) { - if (!listModified) { - setResult(ACTIVE_PLUGINS_LIST_MODIFIED); - listModified = true; - } - getListAdapter().notifyDataSetChanged(); - } - } - - private void switchEnabled(@NonNull ConnectedApp app) { - getMyApplication().getAidlApi().switchEnabled(app); - getListAdapter().notifyDataSetChanged(); - } - - // DownloadEvents - @Override - public void newDownloadIndexes() { - for (Fragment fragment : getSupportFragmentManager().getFragments()) { - if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) { - ((DownloadIndexesThread.DownloadEvents) fragment).newDownloadIndexes(); - } - } - } - - @Override - public void downloadInProgress() { - for (Fragment fragment : getSupportFragmentManager().getFragments()) { - if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) { - ((DownloadIndexesThread.DownloadEvents) fragment).downloadInProgress(); - } - } - } - - @Override - public void downloadHasFinished() { - for (Fragment fragment : getSupportFragmentManager().getFragments()) { - if (fragment instanceof DownloadIndexesThread.DownloadEvents && fragment.isAdded()) { - ((DownloadIndexesThread.DownloadEvents) fragment).downloadHasFinished(); - } - } - } - - @Override - public void onPluginStateChanged(OsmandPlugin plugin) { - getListAdapter().notifyDataSetChanged(); - } - - protected class PluginsListAdapter extends ArrayAdapter { - PluginsListAdapter() { - super(PluginsActivity.this, R.layout.plugins_list_item, new ArrayList<>()); - addAll(getMyApplication().getAidlApi().getConnectedApps()); - addAll(OsmandPlugin.getVisiblePlugins()); - } - - @NonNull - @Override - public View getView(int position, View convertView, @NonNull ViewGroup parent) { - View view = convertView; - if (view == null) { - view = getLayoutInflater().inflate(R.layout.plugins_list_item, parent, false); - } - - final Object item = getItem(position); - - boolean active = false; - int logoContDescId = R.string.shared_string_disable; - String name = ""; - boolean isLightTheme = getMyApplication().getSettings().isLightContent(); - - ImageButton pluginLogo = (ImageButton) view.findViewById(R.id.plugin_logo); - ImageView pluginOptions = (ImageView) view.findViewById(R.id.plugin_options); - TextView pluginDescription = (TextView) view.findViewById(R.id.plugin_description); - - if (item instanceof ConnectedApp) { - final ConnectedApp app = (ConnectedApp) item; - active = app.isEnabled(); - if (!active) { - logoContDescId = R.string.shared_string_enable; - } - name = app.getName(); - pluginDescription.setText(R.string.third_party_application); - pluginLogo.setImageDrawable(app.getIcon()); - pluginLogo.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - switchEnabled(app); - } - }); - pluginOptions.setVisibility(View.GONE); - pluginOptions.setOnClickListener(null); - view.setTag(app); - } else if (item instanceof OsmandPlugin) { - final OsmandPlugin plugin = (OsmandPlugin) item; - active = plugin.isActive(); - if (!active) { - logoContDescId = plugin.needsInstallation() - ? R.string.access_shared_string_not_installed : R.string.shared_string_enable; - } - name = plugin.getName(); - pluginDescription.setText(plugin.getDescription()); - - boolean light = getMyApplication().getSettings().isLightContent(); - int linkTextColor = ContextCompat.getColor(PluginsActivity.this, - light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark); - - pluginDescription.setLinkTextColor(linkTextColor); - pluginDescription.setMovementMethod(LinkMovementMethod.getInstance()); - AndroidUtils.removeLinkUnderline(pluginDescription); - - OsmandApplication app = getMyApplication(); - int color = AndroidUtils.getColorFromAttr(PluginsActivity.this, R.attr.list_background_color); - pluginLogo.setImageDrawable(UiUtilities.tintDrawable(plugin.getLogoResource(), color)); - pluginLogo.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (plugin.isActive() || !plugin.needsInstallation()) { - enableDisablePlugin(plugin, !plugin.isActive()); - } - } - }); - pluginOptions.setVisibility(View.VISIBLE); - pluginOptions.setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white)); - pluginOptions.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - showOptionsMenu(v, plugin); - } - }); - view.setTag(plugin); - } - - pluginLogo.setContentDescription(getString(logoContDescId)); - if (active) { - pluginLogo.setBackgroundResource(isLightTheme ? R.drawable.bg_plugin_logo_enabled_light : R.drawable.bg_plugin_logo_enabled_dark); - } else { - TypedArray attributes = getTheme().obtainStyledAttributes(new int[] {R.attr.bg_plugin_logo_disabled}); - pluginLogo.setBackgroundDrawable(attributes.getDrawable(0)); - attributes.recycle(); - } - - TextView pluginName = (TextView) view.findViewById(R.id.plugin_name); - pluginName.setText(name); - pluginName.setContentDescription(name + " " + getString(active - ? R.string.item_checked - : R.string.item_unchecked)); - - return view; - } - } - - private void showOptionsMenu(View v, final OsmandPlugin plugin) { - final Class settingsActivity = plugin.getSettingsActivity(); - - final PopupMenu optionsMenu = new PopupMenu(this, v); - if (plugin.isActive() || !plugin.needsInstallation()) { - MenuItem enableDisableItem = optionsMenu.getMenu().add( - plugin.isActive() ? R.string.shared_string_disable - : R.string.shared_string_enable); - enableDisableItem - .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - enableDisablePlugin(plugin, !plugin.isActive()); - optionsMenu.dismiss(); - return true; - } - }); - } - - if (settingsActivity != null && plugin.isActive()) { - MenuItem settingsItem = optionsMenu.getMenu().add(R.string.shared_string_settings); - settingsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - startActivity(new Intent(PluginsActivity.this, settingsActivity)); - optionsMenu.dismiss(); - return true; - } - }); - } - - if (plugin instanceof CustomOsmandPlugin) { - MenuItem settingsItem = optionsMenu.getMenu().add(R.string.shared_string_delete); - settingsItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - showDeletePluginDialog((CustomOsmandPlugin) plugin); - optionsMenu.dismiss(); - return true; - } - }); - } - - optionsMenu.show(); - } - - private void showDeletePluginDialog(final CustomOsmandPlugin plugin) { - AlertDialog.Builder builder = new AlertDialog.Builder(PluginsActivity.this); - builder.setTitle(getString(R.string.delete_confirmation_msg, plugin.getName())); - builder.setMessage(R.string.are_you_sure); - builder.setNegativeButton(R.string.shared_string_cancel, null); - builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - OsmandApplication app = getMyApplication(); - OsmandPlugin.removeCustomPlugin(app, plugin); - getListAdapter().remove(plugin); - } - }); - builder.show(); - } -} diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index 445af63f70..3509f99d65 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -1,11 +1,9 @@ package net.osmand.plus.activities; -import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.preference.Preference; -import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; @@ -59,21 +57,21 @@ public class SettingsActivity extends SettingsBaseActivity { } PreferenceCategory plugins = (PreferenceCategory) screen.findPreference("plugin_settings"); for(OsmandPlugin op : OsmandPlugin.getEnabledPlugins()) { - final Class sa = op.getSettingsActivity(); - if(sa != null) { - Preference preference = new Preference(this); - preference.setTitle(op.getName()); - preference.setKey(op.getId()); - preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { - - @Override - public boolean onPreferenceClick(Preference preference) { - startActivity(new Intent(SettingsActivity.this, sa)); - return false; - } - }); - plugins.addPreference(preference); - } +// final Class sa = op.getSettingsActivity(); +// if(sa != null) { +// Preference preference = new Preference(this); +// preference.setTitle(op.getName()); +// preference.setKey(op.getId()); +// preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { +// +// @Override +// public boolean onPreferenceClick(Preference preference) { +// startActivity(new Intent(SettingsActivity.this, sa)); +// return false; +// } +// }); +// plugins.addPreference(preference); +// } } } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index fe023e9dd7..839c1b26f0 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -1799,11 +1799,6 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } } - @Override - public Class getSettingsActivity() { - return SettingsAudioVideoActivity.class; - } - @Override public SettingsScreenType getSettingsScreenType() { return SettingsScreenType.MULTIMEDIA_NOTES; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java index e8e944f947..15d222a980 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java @@ -19,7 +19,6 @@ import androidx.fragment.app.FragmentManager; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; -import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; import net.osmand.plus.dashboard.tools.DashFragmentData; @@ -70,9 +69,10 @@ public class DashPluginsFragment extends DashBaseFragment { return new View.OnClickListener() { @Override public void onClick(View view) { - Intent intent = new Intent(getActivity(), PluginActivity.class); - intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, plugin.getId()); - startActivity(intent); + FragmentActivity activity = getActivity(); + if (activity != null) { + PluginsFragment.showInstance(activity.getSupportFragmentManager()); + } closeDashboard(); } }; diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java index b7f0e0e0f8..d7798a646b 100644 --- a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java +++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java @@ -121,11 +121,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin { } } - @Override - public Class getSettingsActivity() { - return SettingsDevelopmentActivity.class; - } - @Override public SettingsScreenType getSettingsScreenType() { return SettingsScreenType.DEVELOPMENT_SETTINGS; diff --git a/OsmAnd/src/net/osmand/plus/dialogs/MapLayerMenuListener.java b/OsmAnd/src/net/osmand/plus/dialogs/MapLayerMenuListener.java index 9234239040..29a64bcee4 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/MapLayerMenuListener.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/MapLayerMenuListener.java @@ -1,7 +1,6 @@ package net.osmand.plus.dialogs; import android.content.DialogInterface; -import android.content.Intent; import android.view.View; import android.widget.ArrayAdapter; import android.widget.CompoundButton; @@ -20,7 +19,7 @@ import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivityLayers; -import net.osmand.plus.activities.PluginActivity; +import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.poi.PoiFiltersHelper; import net.osmand.plus.poi.PoiUIFilter; @@ -149,9 +148,7 @@ final class MapLayerMenuListener extends OnRowItemClick { settings.SHOW_MAP_MARKERS.set(isChecked); } else if (itemId == R.string.layer_map) { if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) { - Intent intent = new Intent(mapActivity, PluginActivity.class); - intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandRasterMapsPlugin.ID); - mapActivity.startActivity(intent); + PluginsFragment.showInstance(mapActivity.getSupportFragmentManager()); } else { ContextMenuItem it = adapter.getItem(pos); mapActivity.getMapLayers().selectMapLayer(mapActivity.getMapView(), it, adapter); diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index 47650dc2ec..dd7e804b4c 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -13,6 +13,7 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; +import android.os.Bundle; import android.text.SpannableString; import android.text.style.StyleSpan; import android.view.ContextThemeWrapper; @@ -80,6 +81,7 @@ import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.helpers.enums.MetricsConstants; import net.osmand.plus.helpers.enums.SpeedConstants; import net.osmand.plus.settings.backend.CommonPreference; @@ -90,7 +92,6 @@ import net.osmand.plus.Version; import net.osmand.plus.activities.ActivityResultListener; import net.osmand.plus.activities.ActivityResultListener.OnActivityResultListener; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.dialogs.ConfigureMapMenu; import net.osmand.plus.dialogs.GpxAppearanceAdapter; @@ -649,9 +650,9 @@ public class GpxUiHelper { confirm.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(activity, PluginActivity.class); - intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandMonitoringPlugin.ID); - activity.startActivity(intent); + Bundle params = new Bundle(); + params.putBoolean(PluginsFragment.OPEN_PLUGINS, true); + MapActivity.launchMapActivityMoveToTop(activity, null, null, params); } }); confirm.setNegativeButton(R.string.shared_string_cancel, null); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 088a9bd31e..ec255b1bbc 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -166,12 +166,6 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { public static final int[] MINUTES = new int[] {2, 3, 5}; public static final int[] MAX_INTERVAL_TO_SEND_MINUTES = new int[] {1, 2, 5, 10, 15, 20, 30, 60, 90, 2 * 60, 3 * 60, 4 * 60, 6 * 60, 12 * 60, 24 * 60}; - - @Override - public Class getSettingsActivity() { - return SettingsMonitoringActivity.class; - } - @Override public SettingsScreenType getSettingsScreenType() { return SettingsScreenType.MONITORING_SETTINGS; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 70f7cd5764..ea779a93b1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -197,11 +197,6 @@ public class OsmEditingPlugin extends OsmandPlugin { return osmBugsLayer; } - @Override - public Class getSettingsActivity() { - return SettingsOsmEditingActivity.class; - } - @Override public SettingsScreenType getSettingsScreenType() { return SettingsScreenType.OPEN_STREET_MAP_EDITING;