Taking plugins into account. Optional dashboard on start. Itroduced fragment deletion bug
This commit is contained in:
parent
8925b5fb30
commit
0909559182
12 changed files with 203 additions and 93 deletions
|
@ -2,6 +2,8 @@ package net.osmand.plus;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -9,9 +11,9 @@ import net.osmand.IProgress;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.access.AccessibilityPlugin;
|
import net.osmand.access.AccessibilityPlugin;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
|
||||||
import net.osmand.plus.activities.TabActivity.TabItem;
|
import net.osmand.plus.activities.TabActivity.TabItem;
|
||||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||||
|
@ -31,7 +33,6 @@ import org.apache.commons.logging.Log;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
public abstract class OsmandPlugin {
|
public abstract class OsmandPlugin {
|
||||||
|
@ -165,7 +166,9 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
app.getSettings().enablePlugin(plugin.getId(), enable);
|
app.getSettings().enablePlugin(plugin.getId(), enable);
|
||||||
if(activity instanceof MapActivity) {
|
if(activity instanceof MapActivity) {
|
||||||
plugin.updateLayers(((MapActivity) activity).getMapView(), (MapActivity) activity);
|
final MapActivity mapActivity = (MapActivity) activity;
|
||||||
|
plugin.updateLayers(mapActivity.getMapView(), mapActivity);
|
||||||
|
mapActivity.getDashboard().refreshDashboardFragments();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -195,6 +198,8 @@ public abstract class OsmandPlugin {
|
||||||
|
|
||||||
public void registerOptionsMenuItems(MapActivity mapActivity, ContextMenuAdapter helper) {}
|
public void registerOptionsMenuItems(MapActivity mapActivity, ContextMenuAdapter helper) {}
|
||||||
|
|
||||||
|
public DashFragmentData getCardFragment() {return null;}
|
||||||
|
|
||||||
public void updateLocation(Location location) {}
|
public void updateLocation(Location location) {}
|
||||||
|
|
||||||
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabItem> mTabs, Intent intent) { }
|
public void addMyPlacesTab(FavoritesActivity favoritesActivity, List<TabItem> mTabs, Intent intent) { }
|
||||||
|
@ -354,6 +359,14 @@ public abstract class OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Collection<DashFragmentData> getPluginsCardsList() {
|
||||||
|
HashSet<DashFragmentData> collection = new HashSet<>();
|
||||||
|
for (OsmandPlugin plugin : getEnabledPlugins()) {
|
||||||
|
final DashFragmentData fragmentData = plugin.getCardFragment();
|
||||||
|
if (fragmentData != null) collection.add(fragmentData);
|
||||||
|
}
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isPackageInstalled(String packageInfo,
|
private static boolean isPackageInstalled(String packageInfo,
|
||||||
OsmandApplication app) {
|
OsmandApplication app) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import android.os.Message;
|
||||||
import android.support.v4.app.NotificationCompat.Builder;
|
import android.support.v4.app.NotificationCompat.Builder;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.NotificationCompat;
|
import android.support.v7.app.NotificationCompat;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -130,6 +129,8 @@ public class MapActivity extends AccessibleActivity {
|
||||||
private IMapDownloaderCallback downloaderCallback;
|
private IMapDownloaderCallback downloaderCallback;
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
|
|
||||||
|
public static final String SHOULD_SHOW_DASHBOARD_ON_START = "should_show_dashboard_on_start";
|
||||||
|
|
||||||
private Notification getNotification() {
|
private Notification getNotification() {
|
||||||
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
||||||
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
@ -384,6 +385,9 @@ public class MapActivity extends AccessibleActivity {
|
||||||
long tm = System.currentTimeMillis();
|
long tm = System.currentTimeMillis();
|
||||||
if (app.isApplicationInitializing() || DashboardOnMap.staticVisible) {
|
if (app.isApplicationInitializing() || DashboardOnMap.staticVisible) {
|
||||||
if (!dashboardOnMap.isVisible()) {
|
if (!dashboardOnMap.isVisible()) {
|
||||||
|
final OsmandSettings.CommonPreference<Boolean> shouldShowDashboardOnStart =
|
||||||
|
settings.registerBooleanPreference(MapActivity.SHOULD_SHOW_DASHBOARD_ON_START, true);
|
||||||
|
if (shouldShowDashboardOnStart.get())
|
||||||
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
|
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
import net.osmand.plus.activities.TabActivity.TabItem;
|
import net.osmand.plus.activities.TabActivity.TabItem;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
|
@ -1058,6 +1059,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
if (am != null) {
|
if (am != null) {
|
||||||
unregisterMediaListener(am);
|
unregisterMediaListener(am);
|
||||||
}
|
}
|
||||||
|
ifgetCardFragment().tagasdf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1298,4 +1300,10 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
public int getAssetResourceName() {
|
public int getAssetResourceName() {
|
||||||
return R.drawable.audio_video_notes;
|
return R.drawable.audio_video_notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashFragmentData getCardFragment() {
|
||||||
|
return new DashFragmentData(DashAudioVideoNotesFragment.TAG,
|
||||||
|
DashAudioVideoNotesFragment.class, getName(), 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -10,10 +8,10 @@ import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.Animation.AnimationListener;
|
import android.view.animation.Animation.AnimationListener;
|
||||||
import android.view.animation.TranslateAnimation;
|
import android.view.animation.TranslateAnimation;
|
||||||
|
@ -46,21 +44,14 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.IntermediatePointsDialog;
|
import net.osmand.plus.activities.IntermediatePointsDialog;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.audionotes.DashAudioVideoNotesFragment;
|
|
||||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
|
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
|
||||||
import net.osmand.plus.dashboard.tools.TransactionBuilder;
|
import net.osmand.plus.dashboard.tools.TransactionBuilder;
|
||||||
import net.osmand.plus.development.DashSimulateFragment;
|
|
||||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
|
||||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
import net.osmand.plus.monitoring.DashTrackFragment;
|
|
||||||
import net.osmand.plus.osmedit.DashOsmEditsFragment;
|
|
||||||
import net.osmand.plus.osmo.DashOsMoFragment;
|
|
||||||
import net.osmand.plus.parkingpoint.DashParkingFragment;
|
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.DownloadedRegionsLayer;
|
import net.osmand.plus.views.DownloadedRegionsLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -84,26 +75,29 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
private static final DefaultShouldShow defaultShouldShow = new DefaultShouldShow();
|
private static final DefaultShouldShow defaultShouldShow = new DefaultShouldShow();
|
||||||
private static final DefaultShouldShow errorShouldShow = new ErrorShouldShow();
|
private static final DefaultShouldShow errorShouldShow = new ErrorShouldShow();
|
||||||
private static final DashFragmentData.ShouldShowFunction firstTimeShouldShow = new FirstTimeShouldShow();
|
private static final DashFragmentData.ShouldShowFunction firstTimeShouldShow = new FirstTimeShouldShow();
|
||||||
private static final DefaultShouldShow simulateShouldShow = new SimulateShouldShow();
|
|
||||||
private static final DashFragmentData.ShouldShowFunction chooseAppDirShouldShow = new ChooseAppDirShouldShow();
|
private static final DashFragmentData.ShouldShowFunction chooseAppDirShouldShow = new ChooseAppDirShouldShow();
|
||||||
|
|
||||||
private static final DashFragmentData[] fragmentsData = new DashFragmentData[]{
|
private static final DashFragmentData[] fragmentsData = new DashFragmentData[]{
|
||||||
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class, "Rate us", rateUsShouldShow, true),
|
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
|
||||||
new DashFragmentData(DashFirstTimeFragment.TAG, DashFirstTimeFragment.class, "First time", firstTimeShouldShow, true),
|
"Rate us", rateUsShouldShow, true, 0),
|
||||||
new DashFragmentData(DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class, "Choose app dir", chooseAppDirShouldShow, true),
|
new DashFragmentData(DashFirstTimeFragment.TAG, DashFirstTimeFragment.class,
|
||||||
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class, "Error", errorShouldShow, true),
|
"First time", firstTimeShouldShow, true, 1),
|
||||||
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class, "Navigation", defaultShouldShow),
|
new DashFragmentData(DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class,
|
||||||
new DashFragmentData(DashParkingFragment.TAG, DashParkingFragment.class, "Parking", defaultShouldShow),
|
"Choose app dir", chooseAppDirShouldShow, true, 2),
|
||||||
new DashFragmentData(DashWaypointsFragment.TAG, DashWaypointsFragment.class, "Waypoints", defaultShouldShow),
|
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
|
||||||
new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class, "Search", defaultShouldShow),
|
"Error", errorShouldShow, true, 3),
|
||||||
new DashFragmentData(DashRecentsFragment.TAG, DashRecentsFragment.class, "Recent places", defaultShouldShow),
|
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,
|
||||||
new DashFragmentData(DashFavoritesFragment.TAG, DashFavoritesFragment.class, "Favourites", defaultShouldShow),
|
"Navigation", defaultShouldShow, 4),
|
||||||
new DashFragmentData(DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class, "Notes", defaultShouldShow),
|
new DashFragmentData(DashWaypointsFragment.TAG, DashWaypointsFragment.class,
|
||||||
new DashFragmentData(DashTrackFragment.TAG, DashTrackFragment.class, "Track", defaultShouldShow),
|
"Waypoints", defaultShouldShow, 6),
|
||||||
new DashFragmentData(DashOsMoFragment.TAG, DashOsMoFragment.class, "OsMo", defaultShouldShow),
|
new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class,
|
||||||
new DashFragmentData(DashOsmEditsFragment.TAG, DashOsmEditsFragment.class, "OsmEdits", defaultShouldShow),
|
"Search", defaultShouldShow, 7),
|
||||||
new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class, "Plugins", defaultShouldShow),
|
new DashFragmentData(DashRecentsFragment.TAG, DashRecentsFragment.class,
|
||||||
new DashFragmentData(DashSimulateFragment.TAG, DashSimulateFragment.class, "Simulate", simulateShouldShow),
|
"Recent places", defaultShouldShow, 8),
|
||||||
|
new DashFragmentData(DashFavoritesFragment.TAG, DashFavoritesFragment.class,
|
||||||
|
"Favourites", defaultShouldShow, 9),
|
||||||
|
new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class,
|
||||||
|
"Plugins", 14)
|
||||||
};
|
};
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
@ -140,6 +134,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
private List<LocationPointWrapper> deletedPoints = new ArrayList<LocationPointWrapper>();
|
private List<LocationPointWrapper> deletedPoints = new ArrayList<LocationPointWrapper>();
|
||||||
private Drawable gradientToolbar;
|
private Drawable gradientToolbar;
|
||||||
|
|
||||||
|
public DashFragmentData[] getFragmentsData() {
|
||||||
|
return fragmentsData;
|
||||||
|
}
|
||||||
|
|
||||||
public enum DashboardType {
|
public enum DashboardType {
|
||||||
WAYPOINTS,
|
WAYPOINTS,
|
||||||
WAYPOINTS_FLAT,
|
WAYPOINTS_FLAT,
|
||||||
|
@ -358,12 +356,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
actionButton.setVisibility(View.GONE);
|
actionButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int convertPixelsToDp(float dp, Context context) {
|
|
||||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
|
||||||
return Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
|
|
||||||
}
|
|
||||||
|
|
||||||
public net.osmand.Location getMyLocation() {
|
public net.osmand.Location getMyLocation() {
|
||||||
return myLocation;
|
return myLocation;
|
||||||
}
|
}
|
||||||
|
@ -467,6 +459,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
//fabButton.showFloatingActionButton();
|
//fabButton.showFloatingActionButton();
|
||||||
open(dashboardView.findViewById(R.id.animateContent), animation);
|
open(dashboardView.findViewById(R.id.animateContent), animation);
|
||||||
updateLocation(true, true, false);
|
updateLocation(true, true, false);
|
||||||
|
// addOrUpdateDashboardFragments();
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapViewTrackingUtilities().setDashboard(null);
|
mapActivity.getMapViewTrackingUtilities().setDashboard(null);
|
||||||
hide(dashboardView.findViewById(R.id.animateContent), animation);
|
hide(dashboardView.findViewById(R.id.animateContent), animation);
|
||||||
|
@ -477,7 +470,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
df.get().onCloseDash();
|
df.get().onCloseDash();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +661,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
OsmandSettings settings = getMyApplication().getSettings();
|
OsmandSettings settings = getMyApplication().getSettings();
|
||||||
TransactionBuilder builder =
|
TransactionBuilder builder =
|
||||||
new TransactionBuilder(mapActivity.getSupportFragmentManager(), settings, mapActivity);
|
new TransactionBuilder(mapActivity.getSupportFragmentManager(), settings, mapActivity);
|
||||||
builder.addFragmentsData(fragmentsData).getFragmentTransaction().commit();
|
Log.v(TAG, "pluginsCards=" + OsmandPlugin.getPluginsCardsList());
|
||||||
|
builder.addFragmentsData(fragmentsData)
|
||||||
|
.addFragmentsData(OsmandPlugin.getPluginsCardsList())
|
||||||
|
.getFragmentTransaction().commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
|
@ -687,7 +682,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateLocation(final boolean centerChanged, final boolean locationChanged, final boolean compassChanged) {
|
public void updateLocation(final boolean centerChanged, final boolean locationChanged,
|
||||||
|
final boolean compassChanged) {
|
||||||
if (inLocationUpdate) {
|
if (inLocationUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -919,10 +915,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
return dashboardView;
|
return dashboardView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DashFragmentData[] getFragmentsData() {
|
|
||||||
return fragmentsData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SettingsShouldShow implements DashFragmentData.ShouldShowFunction {
|
public static class SettingsShouldShow implements DashFragmentData.ShouldShowFunction {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||||
|
@ -954,14 +946,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SimulateShouldShow extends DefaultShouldShow {
|
|
||||||
@Override
|
|
||||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
|
||||||
return super.shouldShow(settings, activity, tag)
|
|
||||||
&& OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ChooseAppDirShouldShow extends SettingsShouldShow {
|
private static class ChooseAppDirShouldShow extends SettingsShouldShow {
|
||||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||||
|
|
|
@ -1,36 +1,59 @@
|
||||||
package net.osmand.plus.dashboard.tools;
|
package net.osmand.plus.dashboard.tools;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||||
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
|
|
||||||
public final class DashFragmentData {
|
public final class DashFragmentData implements Comparable<DashFragmentData> {
|
||||||
public final String tag;
|
public final String tag;
|
||||||
public final Class<? extends DashBaseFragment> fragmentClass;
|
public final Class<? extends DashBaseFragment> fragmentClass;
|
||||||
public final String title;
|
public final String title;
|
||||||
public final ShouldShowFunction shouldShowFunction;
|
public final ShouldShowFunction shouldShowFunction;
|
||||||
public final boolean customDeletionLogic;
|
public final boolean customDeletionLogic;
|
||||||
|
public final int position;
|
||||||
|
|
||||||
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
|
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
|
||||||
String title, ShouldShowFunction shouldShowFunction,
|
String title, ShouldShowFunction shouldShowFunction,
|
||||||
boolean customDeletionLogic) {
|
boolean customDeletionLogic, int position) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.fragmentClass = fragmentClass;
|
this.fragmentClass = fragmentClass;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.shouldShowFunction = shouldShowFunction;
|
this.shouldShowFunction = shouldShowFunction;
|
||||||
this.customDeletionLogic = customDeletionLogic;
|
this.customDeletionLogic = customDeletionLogic;
|
||||||
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
|
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
|
||||||
String title, ShouldShowFunction shouldShowFunction) {
|
String title, ShouldShowFunction shouldShowFunction, int position) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.fragmentClass = fragmentClass;
|
this.fragmentClass = fragmentClass;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.shouldShowFunction = shouldShowFunction;
|
this.shouldShowFunction = shouldShowFunction;
|
||||||
customDeletionLogic = false;
|
customDeletionLogic = false;
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
|
||||||
|
String title, int position) {
|
||||||
|
this.tag = tag;
|
||||||
|
this.fragmentClass = fragmentClass;
|
||||||
|
this.title = title;
|
||||||
|
this.shouldShowFunction = new DashboardOnMap.DefaultShouldShow();
|
||||||
|
customDeletionLogic = false;
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NonNull DashFragmentData another) {
|
||||||
|
return position - another.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ShouldShowFunction {
|
public interface ShouldShowFunction {
|
||||||
boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
|
boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,82 +13,113 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
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.dashboard.DashboardOnMap;
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DashboardSettingsDialogFragment extends DialogFragment {
|
public class DashboardSettingsDialogFragment extends DialogFragment {
|
||||||
private static final String CHECKED_ITEMS = "checked_items";
|
private static final String CHECKED_ITEMS = "checked_items";
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private DashFragmentData[] fragmentsData;
|
private ArrayList<DashFragmentData> mFragmentsData;
|
||||||
private DashFragmentAdapter adapter;
|
private DashFragmentAdapter mAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
mapActivity = (MapActivity) activity;
|
mapActivity = (MapActivity) activity;
|
||||||
ArrayList<DashFragmentData> fragmentsList = new ArrayList<>();
|
mFragmentsData = new ArrayList<>();
|
||||||
for(DashFragmentData fragmentData : mapActivity.getDashboard().getFragmentsData()) {
|
for(DashFragmentData fragmentData : mapActivity.getDashboard().getFragmentsData()) {
|
||||||
if (!fragmentData.customDeletionLogic) fragmentsList.add(fragmentData);
|
if (!fragmentData.customDeletionLogic) mFragmentsData.add(fragmentData);
|
||||||
}
|
}
|
||||||
fragmentsData = fragmentsList.toArray(new DashFragmentData[fragmentsList.size()]);
|
mFragmentsData.addAll(OsmandPlugin.getPluginsCardsList());
|
||||||
|
Collections.sort(mFragmentsData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
|
||||||
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||||
|
|
||||||
|
View view = LayoutInflater.from(getActivity()).inflate(
|
||||||
|
R.layout.dashboard_settings_dialog_item, null, false);
|
||||||
|
final TextView textView = (TextView) view.findViewById(R.id.text);
|
||||||
|
textView.setText("Show on start");
|
||||||
|
final OsmandSettings.CommonPreference<Boolean> shouldShowDashboardOnStart =
|
||||||
|
settings.registerBooleanPreference(MapActivity.SHOULD_SHOW_DASHBOARD_ON_START, true);
|
||||||
|
final CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.check_item);
|
||||||
|
compoundButton.setChecked(shouldShowDashboardOnStart.get());
|
||||||
|
textView.setTextColor(shouldShowDashboardOnStart.get() ? 0xFF212121 : 0xFF8c8c8c);
|
||||||
|
compoundButton.setOnCheckedChangeListener(
|
||||||
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
|
textView.setTextColor(b ? 0xFF212121 : 0xFF8c8c8c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
if (savedInstanceState != null && savedInstanceState.containsKey(CHECKED_ITEMS)) {
|
if (savedInstanceState != null && savedInstanceState.containsKey(CHECKED_ITEMS)) {
|
||||||
adapter = new DashFragmentAdapter(getActivity(), fragmentsData,
|
mAdapter = new DashFragmentAdapter(getActivity(), mFragmentsData,
|
||||||
savedInstanceState.getBooleanArray(CHECKED_ITEMS));
|
savedInstanceState.getBooleanArray(CHECKED_ITEMS));
|
||||||
} else {
|
} else {
|
||||||
adapter = new DashFragmentAdapter(getActivity(), fragmentsData,
|
mAdapter = new DashFragmentAdapter(getActivity(), mFragmentsData,
|
||||||
settings);
|
settings);
|
||||||
}
|
}
|
||||||
builder.setTitle(R.string.dahboard_options_dialog_title)
|
builder.setTitle(R.string.dahboard_options_dialog_title)
|
||||||
.setAdapter(adapter, null)
|
.setAdapter(mAdapter, null)
|
||||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int type) {
|
public void onClick(DialogInterface dialogInterface, int type) {
|
||||||
boolean[] shouldShow = adapter.getCheckedItems();
|
boolean[] shouldShow = mAdapter.getCheckedItems();
|
||||||
for (int i = 0; i < shouldShow.length; i++) {
|
for (int i = 0; i < shouldShow.length; i++) {
|
||||||
settings.registerBooleanPreference(
|
settings.registerBooleanPreference(
|
||||||
DashboardOnMap.SHOULD_SHOW + fragmentsData[i].tag, true)
|
DashboardOnMap.SHOULD_SHOW + mFragmentsData.get(i).tag, true)
|
||||||
.makeGlobal().set(shouldShow[i]);
|
.makeGlobal().set(shouldShow[i]);
|
||||||
}
|
}
|
||||||
mapActivity.getDashboard().refreshDashboardFragments();
|
mapActivity.getDashboard().refreshDashboardFragments();
|
||||||
|
shouldShowDashboardOnStart.set(compoundButton.isChecked());
|
||||||
|
// TODO save as preference
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||||
return builder.create();
|
final AlertDialog dialog = builder.create();
|
||||||
|
|
||||||
|
ListView listView = dialog.getListView();
|
||||||
|
listView.addHeaderView(view);
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putBooleanArray(CHECKED_ITEMS, adapter.getCheckedItems());
|
outState.putBooleanArray(CHECKED_ITEMS, mAdapter.getCheckedItems());
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DashFragmentAdapter extends ArrayAdapter<DashFragmentData> {
|
private static class DashFragmentAdapter extends ArrayAdapter<DashFragmentData> {
|
||||||
private final boolean[] checkedItems;
|
private final boolean[] checkedItems;
|
||||||
|
|
||||||
public DashFragmentAdapter(Context context, DashFragmentData[] objects, boolean[] checkedItems) {
|
public DashFragmentAdapter(Context context, List<DashFragmentData> objects,
|
||||||
|
boolean[] checkedItems) {
|
||||||
super(context, 0, objects);
|
super(context, 0, objects);
|
||||||
this.checkedItems = checkedItems;
|
this.checkedItems = checkedItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DashFragmentAdapter(Context context, DashFragmentData[] objects, OsmandSettings settings) {
|
public DashFragmentAdapter(Context context, List<DashFragmentData> objects,
|
||||||
|
OsmandSettings settings) {
|
||||||
super(context, 0, objects);
|
super(context, 0, objects);
|
||||||
checkedItems = new boolean[objects.length];
|
checkedItems = new boolean[objects.size()];
|
||||||
for (int i = 0; i < objects.length; i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
checkedItems[i] = settings.registerBooleanPreference(
|
checkedItems[i] = settings.registerBooleanPreference(
|
||||||
DashboardOnMap.SHOULD_SHOW + objects[i].tag, true).makeGlobal().get();
|
DashboardOnMap.SHOULD_SHOW + objects.get(i).tag, true).makeGlobal().get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ import net.osmand.plus.dashboard.DashBaseFragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +21,7 @@ import java.util.List;
|
||||||
public final class TransactionBuilder {
|
public final class TransactionBuilder {
|
||||||
private static final String TAG = "TransactionBuilder";
|
private static final String TAG = "TransactionBuilder";
|
||||||
private FragmentManager manager;
|
private FragmentManager manager;
|
||||||
private List<DashFragmentData> fragments = new ArrayList<>();
|
private final List<DashFragmentData> fragments;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ public final class TransactionBuilder {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
fragments = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransactionBuilder addFragmentsData(DashFragmentData... dashFragmentsData) {
|
public TransactionBuilder addFragmentsData(DashFragmentData... dashFragmentsData) {
|
||||||
|
@ -35,9 +38,20 @@ public final class TransactionBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TransactionBuilder addFragmentsData(Collection<DashFragmentData> dashFragmentsData) {
|
||||||
|
fragments.addAll(dashFragmentsData);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionBuilder addFragment(DashFragmentData fragmentData) {
|
||||||
|
fragments.add(fragmentData);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public FragmentTransaction getFragmentTransaction() {
|
public FragmentTransaction getFragmentTransaction() {
|
||||||
Log.v(TAG, "getFragmentTransaction(" + ")");
|
Log.v(TAG, "getFragmentTransaction(" + ")");
|
||||||
FragmentTransaction fragmentTransaction = manager.beginTransaction();
|
FragmentTransaction fragmentTransaction = manager.beginTransaction();
|
||||||
|
Collections.sort(fragments);
|
||||||
for (DashFragmentData dashFragmentData : fragments) {
|
for (DashFragmentData dashFragmentData : fragments) {
|
||||||
DashBaseFragment fragment =
|
DashBaseFragment fragment =
|
||||||
(DashBaseFragment) manager.findFragmentByTag(dashFragmentData.tag);
|
(DashBaseFragment) manager.findFragmentByTag(dashFragmentData.tag);
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
package net.osmand.plus.development;
|
package net.osmand.plus.development;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
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.dashboard.DashboardOnMap;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
import android.app.Activity;
|
|
||||||
|
|
||||||
public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
private static final String ID = "osmand.development";
|
private static final String ID = "osmand.development";
|
||||||
|
@ -24,10 +27,12 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return app.getString(R.string.osmand_development_plugin_description);
|
return app.getString(R.string.osmand_development_plugin_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return app.getString(R.string.debugging_and_development);
|
return app.getString(R.string.debugging_and_development);
|
||||||
|
@ -99,4 +104,11 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
||||||
return R.drawable.osmand_development;
|
return R.drawable.osmand_development;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashFragmentData getCardFragment() {
|
||||||
|
return new DashFragmentData(DashSimulateFragment.TAG,
|
||||||
|
DashSimulateFragment.class,
|
||||||
|
getName(),
|
||||||
|
new DashboardOnMap.DefaultShouldShow(), 15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
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.activities.SavingTrackHelper;
|
import net.osmand.plus.activities.SavingTrackHelper;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -462,4 +463,8 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
return ll;
|
return ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashFragmentData getCardFragment() {
|
||||||
|
return new DashFragmentData(DashTrackFragment.TAG, DashTrackFragment.class, getName(), 11);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -27,6 +27,8 @@ import net.osmand.plus.activities.EnumAdapter;
|
||||||
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
|
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TabActivity;
|
import net.osmand.plus.activities.TabActivity;
|
||||||
|
import net.osmand.plus.dashboard.DashPluginsFragment;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||||
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
|
import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo;
|
||||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||||
|
@ -343,5 +345,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + osmPoint.getId();
|
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + osmPoint.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashFragmentData getCardFragment() {
|
||||||
|
return new DashFragmentData(DashOsmEditsFragment.TAG, DashOsmEditsFragment.class, getName(), 13);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.download.DownloadFileHelper;
|
import net.osmand.plus.download.DownloadFileHelper;
|
||||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||||
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||||
|
@ -530,4 +531,8 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
||||||
return app.getSettings().OSMO_USE_HTTPS.get();
|
return app.getSettings().OSMO_USE_HTTPS.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashFragmentData getCardFragment() {
|
||||||
|
return new DashFragmentData(DashOsMoFragment.TAG, DashOsMoFragment.class, getName(), 12);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
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.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
|
@ -559,4 +560,9 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
return ctx.getString(R.string.osmand_parking_position_description, timeLimitDesc.toString());
|
return ctx.getString(R.string.osmand_parking_position_description, timeLimitDesc.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashFragmentData getCardFragment() {
|
||||||
|
return new DashFragmentData(DashParkingFragment.TAG, DashParkingFragment.class, getName(), 5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue