Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-10-27 16:32:58 +01:00
commit a081ad496d
22 changed files with 188 additions and 93 deletions

View file

@ -1,13 +1,12 @@
package net.osmand.plus; package net.osmand.plus;
import java.io.File; import android.app.Activity;
import java.io.FileInputStream; import android.app.AlertDialog;
import java.io.FileOutputStream; import android.app.ProgressDialog;
import java.io.IOException; import android.content.Context;
import java.lang.reflect.Field; import android.content.DialogInterface;
import java.util.ArrayList; import android.content.Intent;
import java.util.List; import android.content.SharedPreferences;
import java.util.Random;
import net.osmand.IProgress; import net.osmand.IProgress;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
@ -42,13 +41,15 @@ import net.osmand.util.Algorithms;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import android.app.Activity; import java.io.File;
import android.app.AlertDialog; import java.io.FileInputStream;
import android.app.ProgressDialog; import java.io.FileOutputStream;
import android.content.Context; import java.io.IOException;
import android.content.DialogInterface; import java.lang.reflect.Field;
import android.content.Intent; import java.util.ArrayList;
import android.content.SharedPreferences; import java.util.List;
import java.util.Random;
import btools.routingapp.BRouterServiceConnection; import btools.routingapp.BRouterServiceConnection;
/** /**
@ -161,10 +162,6 @@ public class AppInitializer implements IProgress {
return firstTime; return firstTime;
} }
public void setFirstTime(boolean firstTime) {
this.firstTime = firstTime;
}
public boolean checkAppVersionChanged(Activity activity) { public boolean checkAppVersionChanged(Activity activity) {
initUiVars(activity); initUiVars(activity);
boolean showRecentChangesDialog = !firstTime && appVersionChanged; boolean showRecentChangesDialog = !firstTime && appVersionChanged;

View file

@ -31,9 +31,16 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
public static final String TAG = "DASH_NOTES_FRAGMENT"; public static final String TAG = "DASH_NOTES_FRAGMENT";
public static final int TITLE_ID = R.string.map_widget_av_notes; public static final int TITLE_ID = R.string.map_widget_av_notes;
private static final String ROW_NUMBER_TAG = TAG + "_row_number"; private static final String ROW_NUMBER_TAG = TAG + "_row_number";
static final DashFragmentData FRAGMENT_DATA = private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashFragmentData(TAG, DashAudioVideoNotesFragment.class, TITLE_ID, new DashboardOnMap.DefaultShouldShow() {
new DashboardOnMap.DefaultShouldShow(), 100, ROW_NUMBER_TAG); @Override
public int getTitleId() {
return TITLE_ID;
}
};
static final DashFragmentData FRAGMENT_DATA = new DashFragmentData(
TAG, DashAudioVideoNotesFragment.class, SHOULD_SHOW_FUNCTION, 100, ROW_NUMBER_TAG);
AudioVideoNotesPlugin plugin; AudioVideoNotesPlugin plugin;

View file

@ -37,9 +37,15 @@ public class DashFavoritesFragment extends DashLocationFragment {
List<FavouritePoint> points = new ArrayList<FavouritePoint>(); List<FavouritePoint> points = new ArrayList<FavouritePoint>();
public static final String ROW_NUMBER_TAG = TAG + "_row_number"; public static final String ROW_NUMBER_TAG = TAG + "_row_number";
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
public static final DashFragmentData FRAGMENT_DATA = public static final DashFragmentData FRAGMENT_DATA =
new DashFragmentData(TAG, DashFavoritesFragment.class, TITLE_ID, new DashFragmentData(TAG, DashFavoritesFragment.class, SHOULD_SHOW_FUNCTION, 90, ROW_NUMBER_TAG);
new DashboardOnMap.DefaultShouldShow(), 90, ROW_NUMBER_TAG);
@Override @Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View file

@ -13,6 +13,8 @@ import android.widget.TextView;
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.dashboard.tools.DashFragmentData;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
/** /**
@ -22,7 +24,12 @@ import net.osmand.plus.download.DownloadActivity;
public class DashFirstTimeFragment extends DashBaseFragment { public class DashFirstTimeFragment extends DashBaseFragment {
public static final String TAG = "DASH_FIRST_TIME_FRAGMENT"; public static final String TAG = "DASH_FIRST_TIME_FRAGMENT";
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new FirstTimeShouldShow();
static final DashFragmentData FRAGMENT_DATA =
new DashFragmentData(TAG, DashFirstTimeFragment.class, SHOULD_SHOW_FUNCTION, 110, null);
public static boolean interestedInFirstTime = true;
@Override @Override
public void onOpenDash() { public void onOpenDash() {
@ -66,7 +73,7 @@ public class DashFirstTimeFragment extends DashBaseFragment {
view.findViewById(R.id.hide).setOnClickListener(new View.OnClickListener() { view.findViewById(R.id.hide).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
getMyApplication().getAppInitializer().setFirstTime(false); interestedInFirstTime = false;
dashboard.refreshDashboardFragments(); dashboard.refreshDashboardFragments();
} }
}); });
@ -88,4 +95,12 @@ public class DashFirstTimeFragment extends DashBaseFragment {
private void updateCurrentRegion(View view) { private void updateCurrentRegion(View view) {
((TextView) view.findViewById(R.id.region)).setText(getMyApplication().getSettings().DRIVING_REGION.get().name); ((TextView) view.findViewById(R.id.region)).setText(getMyApplication().getSettings().DRIVING_REGION.get().name);
} }
private static class FirstTimeShouldShow extends DashFragmentData.ShouldShowFunction {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return activity.getMyApplication().getAppInitializer().isFirstTime(activity)
&& DashFirstTimeFragment.interestedInFirstTime;
}
}
} }

View file

@ -16,13 +16,21 @@ import android.widget.TextView;
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.ShowRouteInfoActivity; import net.osmand.plus.activities.ShowRouteInfoActivity;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
/** /**
*/ */
public class DashNavigationFragment extends DashBaseFragment { public class DashNavigationFragment extends DashBaseFragment {
public static final String TAG = "DASH_NAVIGATION_FRAGMENT"; public static final String TAG = "DASH_NAVIGATION_FRAGMENT";
public static final int TITLE_ID = R.string.current_route; private static final int TITLE_ID = R.string.current_route;
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
@Override @Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View file

@ -17,6 +17,7 @@ import android.widget.TextView;
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.PluginActivity; import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.development.OsmandDevelopmentPlugin;
import java.util.ArrayList; import java.util.ArrayList;
@ -30,7 +31,14 @@ import java.util.List;
*/ */
public class DashPluginsFragment extends DashBaseFragment { public class DashPluginsFragment extends DashBaseFragment {
public static final String TAG = "DASH_PLUGINS_FRAGMENT"; public static final String TAG = "DASH_PLUGINS_FRAGMENT";
public static final int TITLE_ID = R.string.prefs_plugins; private static final int TITLE_ID = R.string.prefs_plugins;
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
private List<OsmandPlugin> plugins; private List<OsmandPlugin> plugins;
private View.OnClickListener getListener(final OsmandPlugin plugin) { private View.OnClickListener getListener(final OsmandPlugin plugin) {

View file

@ -36,9 +36,15 @@ public class DashRecentsFragment extends DashLocationFragment {
private List<ImageView> arrows = new ArrayList<ImageView>(); private List<ImageView> arrows = new ArrayList<ImageView>();
List<HistoryEntry> points = new ArrayList<HistoryEntry>(); List<HistoryEntry> points = new ArrayList<HistoryEntry>();
private static final String ROW_NUMBER_TAG = TAG + "_row_number"; private static final String ROW_NUMBER_TAG = TAG + "_row_number";
static final DashFragmentData FRAGMENT_DATA = private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashFragmentData(TAG, DashRecentsFragment.class, TITLE_ID, new DashboardOnMap.DefaultShouldShow() {
new DashboardOnMap.DefaultShouldShow(), 80, ROW_NUMBER_TAG); @Override
public int getTitleId() {
return TITLE_ID;
}
};
static final DashFragmentData FRAGMENT_DATA = new DashFragmentData(
TAG, DashRecentsFragment.class, SHOULD_SHOW_FUNCTION, 80, ROW_NUMBER_TAG);
@Override @Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View file

@ -15,6 +15,7 @@ import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndAppCustomization; import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.search.SearchActivity; import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
/** /**
@ -22,8 +23,14 @@ import net.osmand.plus.helpers.FontCache;
* 24.11.2014. * 24.11.2014.
*/ */
public class DashSearchFragment extends DashBaseFragment { public class DashSearchFragment extends DashBaseFragment {
public static final int TITLE_ID = R.string.search_for;
public static final String TAG = "DASH_SEARCH_FRAGMENT"; public static final String TAG = "DASH_SEARCH_FRAGMENT";
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return R.string.search_for;
}
};
@Override @Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View file

@ -23,6 +23,7 @@ import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.dialogs.DirectionsDialogs; import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.WaypointDialogHelper; import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointHelper; import net.osmand.plus.helpers.WaypointHelper;
@ -39,6 +40,13 @@ public class DashWaypointsFragment extends DashLocationFragment {
public static final int TITLE_ID = R.string.waypoints; public static final int TITLE_ID = R.string.waypoints;
List<TargetPoint> points = new ArrayList<TargetPoint>(); List<TargetPoint> points = new ArrayList<TargetPoint>();
private static boolean SHOW_ALL; private static boolean SHOW_ALL;
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
@Override @Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View file

@ -72,30 +72,27 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
public static final String SHOULD_SHOW = "should_show"; public static final String SHOULD_SHOW = "should_show";
private static final DashFragmentData.ShouldShowFunction rateUsShouldShow = new DashRateUsFragment.RateUsShouldShow(); private static final DashFragmentData.ShouldShowFunction rateUsShouldShow = new DashRateUsFragment.RateUsShouldShow();
private static final DefaultShouldShow defaultShouldShow = new DefaultShouldShow();
private static final DashFragmentData.ShouldShowFunction errorShouldShow = new ErrorShouldShow(); private static final DashFragmentData.ShouldShowFunction errorShouldShow = new ErrorShouldShow();
private static final DashFragmentData.ShouldShowFunction firstTimeShouldShow = new FirstTimeShouldShow();
private static final DashFragmentData.ShouldShowFunction chooseAppDirShouldShow = new ChooseAppDirShouldShow(); private static final DashFragmentData.ShouldShowFunction chooseAppDirShouldShow = new ChooseAppDirShouldShow();
private final DashFragmentData[] fragmentsData = new DashFragmentData[]{ private final DashFragmentData[] fragmentsData = new DashFragmentData[]{
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class, new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
-1, rateUsShouldShow, 0, null), rateUsShouldShow, 0, null),
new DashFragmentData(DashFirstTimeFragment.TAG, DashFirstTimeFragment.class, DashFirstTimeFragment.FRAGMENT_DATA,
-1, firstTimeShouldShow, 10, null),
new DashFragmentData(DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class, new DashFragmentData(DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class,
-1, chooseAppDirShouldShow, 20, null), chooseAppDirShouldShow, 20, null),
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class, new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
-1, errorShouldShow, 30, null), errorShouldShow, 30, null),
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class, new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,
DashNavigationFragment.TITLE_ID, defaultShouldShow, 40, null), DashNavigationFragment.SHOULD_SHOW_FUNCTION, 40, null),
new DashFragmentData(DashWaypointsFragment.TAG, DashWaypointsFragment.class, new DashFragmentData(DashWaypointsFragment.TAG, DashWaypointsFragment.class,
DashWaypointsFragment.TITLE_ID, defaultShouldShow, 60, null), DashWaypointsFragment.SHOULD_SHOW_FUNCTION, 60, null),
new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class, new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class,
DashSearchFragment.TITLE_ID, defaultShouldShow, 70, null), DashSearchFragment.SHOULD_SHOW_FUNCTION, 70, null),
DashRecentsFragment.FRAGMENT_DATA, DashRecentsFragment.FRAGMENT_DATA,
DashFavoritesFragment.FRAGMENT_DATA, DashFavoritesFragment.FRAGMENT_DATA,
new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class, new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class,
DashPluginsFragment.TITLE_ID, defaultShouldShow, 140, null) DashPluginsFragment.SHOULD_SHOW_FUNCTION, 140, null)
}; };
private MapActivity mapActivity; private MapActivity mapActivity;
@ -933,7 +930,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
return list; return list;
} }
public static class SettingsShouldShow implements DashFragmentData.ShouldShowFunction { public static class SettingsShouldShow extends DashFragmentData.ShouldShowFunction {
@Override @Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) { public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return settings.registerBooleanPreference(SHOULD_SHOW + tag, true) return settings.registerBooleanPreference(SHOULD_SHOW + tag, true)
@ -949,7 +946,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
} }
} }
private static class ErrorShouldShow implements DashFragmentData.ShouldShowFunction { private static class ErrorShouldShow extends DashFragmentData.ShouldShowFunction {
// If settings null. No changes in setting will be made. // If settings null. No changes in setting will be made.
@Override @Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) { public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
@ -958,14 +955,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
} }
} }
private static class FirstTimeShouldShow extends SettingsShouldShow {
@Override
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
return activity.getMyApplication().getAppInitializer().isFirstTime(activity)
&& super.shouldShow(settings, activity, tag);
}
}
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) {

View file

@ -1,27 +1,23 @@
package net.osmand.plus.dashboard.tools; package net.osmand.plus.dashboard.tools;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
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 implements Comparable<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 int titleStringId;
public final ShouldShowFunction shouldShowFunction; public final ShouldShowFunction shouldShowFunction;
public final int position; public final int position;
public final String rowNumberTag; public final String rowNumberTag;
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass, public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
@StringRes int titleStringId, ShouldShowFunction shouldShowFunction, ShouldShowFunction shouldShowFunction,
int position, String rowNumberTag) { int position, String rowNumberTag) {
this.tag = tag; this.tag = tag;
this.fragmentClass = fragmentClass; this.fragmentClass = fragmentClass;
this.titleStringId = titleStringId;
this.shouldShowFunction = shouldShowFunction; this.shouldShowFunction = shouldShowFunction;
this.position = position; this.position = position;
this.rowNumberTag = rowNumberTag; this.rowNumberTag = rowNumberTag;
@ -36,10 +32,13 @@ public final class DashFragmentData implements Comparable<DashFragmentData> {
return rowNumberTag != null; return rowNumberTag != null;
} }
public boolean canBeDisabled() { public boolean canBeDisabled() {
return titleStringId != -1; return shouldShowFunction.getTitleId() != -1;
}
public static abstract class ShouldShowFunction {
public abstract boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
public int getTitleId() {
return -1;
} }
public interface ShouldShowFunction {
boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
} }
} }

View file

@ -211,7 +211,8 @@ public class DashboardSettingsDialogFragment extends DialogFragment
@Override @Override
public void onClick(View v) { public void onClick(View v) {
DashViewHolder localViewHolder = (DashViewHolder) v.getTag(); DashViewHolder localViewHolder = (DashViewHolder) v.getTag();
String header = getContext().getString(getItem(localViewHolder.position).titleStringId); String header = getContext().getString(getItem(localViewHolder.position)
.shouldShowFunction.getTitleId());
String subheader = getContext().getResources().getString(R.string.count_of_lines); String subheader = getContext().getResources().getString(R.string.count_of_lines);
final String stringPosition = String.valueOf(localViewHolder.position); final String stringPosition = String.valueOf(localViewHolder.position);
NumberPickerDialogFragment.createInstance(header, subheader, stringPosition, getNumberOfRows(localViewHolder.position), MAXIMUM_NUMBER_OF_ROWS) NumberPickerDialogFragment.createInstance(header, subheader, stringPosition, getNumberOfRows(localViewHolder.position), MAXIMUM_NUMBER_OF_ROWS)
@ -246,7 +247,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
} else { } else {
numberOfRowsTextView.setVisibility(View.GONE); numberOfRowsTextView.setVisibility(View.GONE);
} }
textView.setText(fragmentData.titleStringId); textView.setText(fragmentData.shouldShowFunction.getTitleId());
textView.setTextColor(dashFragmentAdapter.isChecked(position)? textColorPrimary : textView.setTextColor(dashFragmentAdapter.isChecked(position)? textColorPrimary :
textColorSecondary); textColorSecondary);
this.position = position; this.position = position;

View file

@ -1,8 +1,5 @@
package net.osmand.plus.development; package net.osmand.plus.development;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.R;
import net.osmand.plus.dashboard.DashBaseFragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -14,10 +11,27 @@ import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.R;
import net.osmand.plus.dashboard.DashBaseFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData;
public class DashSimulateFragment extends DashBaseFragment { public class DashSimulateFragment extends DashBaseFragment {
public static final String TAG = "DASH_SIMULATE_FRAGMENT"; private static final String TAG = "DASH_SIMULATE_FRAGMENT";
public static final int TITLE_ID = R.string.simulate_your_location; private static final int TITLE_ID = R.string.simulate_your_location;
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
static final DashFragmentData FRAGMENT_DATA = new DashFragmentData(DashSimulateFragment.TAG,
DashSimulateFragment.class,
SHOULD_SHOW_FUNCTION, 150, null);
@Override @Override
public void onOpenDash() { public void onOpenDash() {

View file

@ -12,7 +12,6 @@ import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.activities.ContributionVersionActivity; import net.osmand.plus.activities.ContributionVersionActivity;
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.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;
@ -128,9 +127,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
@Override @Override
public DashFragmentData getCardFragment() { public DashFragmentData getCardFragment() {
return new DashFragmentData(DashSimulateFragment.TAG, return DashSimulateFragment.FRAGMENT_DATA;
DashSimulateFragment.class,
DashSimulateFragment.TITLE_ID,
new DashboardOnMap.DefaultShouldShow(), 150, null);
} }
} }

View file

@ -574,7 +574,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
final boolean firstTime = getMyApplication().getAppInitializer().isFirstTime(this); final boolean firstTime = getMyApplication().getAppInitializer().isFirstTime(this);
final boolean externalExists = final boolean externalExists =
getMyApplication().getSettings().getSecondaryStorage() != null; getMyApplication().getSettings().getSecondaryStorage() != null;
if (firstTime && externalExists) { if (firstTime && externalExists && DataStoragePlaceDialogFragment.isInterestedInFirstTime) {
new DataStoragePlaceDialogFragment().show(getFragmentManager(), null); new DataStoragePlaceDialogFragment().show(getFragmentManager(), null);
} }
} }

View file

@ -31,6 +31,7 @@ public class DataStoragePlaceDialogFragment extends DialogFragment {
private File internalStorage; private File internalStorage;
private File externalStorage; private File externalStorage;
public static boolean isInterestedInFirstTime = true;
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
@ -140,7 +141,7 @@ public class DataStoragePlaceDialogFragment extends DialogFragment {
public void onClick(View v) { public void onClick(View v) {
saveFilesLocation(OsmandSettings.EXTERNAL_STORAGE_TYPE_DEFAULT, saveFilesLocation(OsmandSettings.EXTERNAL_STORAGE_TYPE_DEFAULT,
internalStorage, getActivity()); internalStorage, getActivity());
getMyApplication().getAppInitializer().setFirstTime(false); isInterestedInFirstTime = false;
dismiss(); dismiss();
} }
}; };
@ -151,7 +152,7 @@ public class DataStoragePlaceDialogFragment extends DialogFragment {
public void onClick(View v) { public void onClick(View v) {
saveFilesLocation(OsmandSettings.EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE, saveFilesLocation(OsmandSettings.EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE,
externalStorage, getActivity()); externalStorage, getActivity());
getMyApplication().getAppInitializer().setFirstTime(false); isInterestedInFirstTime = false;
dismiss(); dismiss();
} }
}; };

View file

@ -45,9 +45,16 @@ public class DashTrackFragment extends DashBaseFragment {
public static final int TITLE_ID = R.string.shared_string_my_tracks; public static final int TITLE_ID = R.string.shared_string_my_tracks;
private static final String ROW_NUMBER_TAG = TAG + "_row_number"; private static final String ROW_NUMBER_TAG = TAG + "_row_number";
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
static final DashFragmentData FRAGMENT_DATA = static final DashFragmentData FRAGMENT_DATA =
new DashFragmentData(TAG, DashTrackFragment.class, TITLE_ID, new DashFragmentData(TAG, DashTrackFragment.class, SHOULD_SHOW_FUNCTION, 110, ROW_NUMBER_TAG);
new DashboardOnMap.DefaultShouldShow(), 110, ROW_NUMBER_TAG);
private boolean updateEnable; private boolean updateEnable;

View file

@ -36,9 +36,16 @@ public class DashOsmEditsFragment extends DashBaseFragment
public static final int TITLE_ID = R.string.osm_settings; public static final int TITLE_ID = R.string.osm_settings;
private static final String ROW_NUMBER_TAG = TAG + "_row_number"; private static final String ROW_NUMBER_TAG = TAG + "_row_number";
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
static final DashFragmentData FRAGMENT_DATA = static final DashFragmentData FRAGMENT_DATA =
new DashFragmentData(TAG, DashOsmEditsFragment.class, TITLE_ID, new DashFragmentData(TAG, DashOsmEditsFragment.class, SHOULD_SHOW_FUNCTION, 130, ROW_NUMBER_TAG);
new DashboardOnMap.DefaultShouldShow(), 130, ROW_NUMBER_TAG);
OsmEditingPlugin plugin; OsmEditingPlugin plugin;

View file

@ -4,7 +4,6 @@ import android.content.Intent;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -25,6 +24,8 @@ 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.DashLocationFragment; import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice; import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
@ -42,6 +43,15 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
public static final String TAG = "DASH_OSMO_FRAGMENT"; public static final String TAG = "DASH_OSMO_FRAGMENT";
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return R.string.osmo_plugin_name;
}
};
static final DashFragmentData FRAGMENT_DATA = new DashFragmentData(
DashOsMoFragment.TAG, DashOsMoFragment.class, SHOULD_SHOW_FUNCTION, 120, null);
private Handler uiHandler = new Handler(); private Handler uiHandler = new Handler();
OsMoPlugin plugin; OsMoPlugin plugin;

View file

@ -22,7 +22,6 @@ 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.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData; 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;
@ -534,7 +533,6 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
@Override @Override
public DashFragmentData getCardFragment() { public DashFragmentData getCardFragment() {
return new DashFragmentData(DashOsMoFragment.TAG, DashOsMoFragment.class, return DashOsMoFragment.FRAGMENT_DATA;
R.string.osmo_plugin_name, new DashboardOnMap.DefaultShouldShow(), 120, null);
} }
} }

View file

@ -18,6 +18,8 @@ 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.DashLocationFragment; import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
import java.util.Calendar; import java.util.Calendar;
@ -27,10 +29,21 @@ import java.util.Calendar;
* 26.01.2015. * 26.01.2015.
*/ */
public class DashParkingFragment extends DashLocationFragment { public class DashParkingFragment extends DashLocationFragment {
public static final String TAG = "DASH_PARKING_FRAGMENT"; private static final String TAG = "DASH_PARKING_FRAGMENT";
public static final int TITLE_ID = R.string.osmand_parking_plugin_name; private static final int TITLE_ID = R.string.osmand_parking_plugin_name;
ParkingPositionPlugin plugin; ParkingPositionPlugin plugin;
private static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
new DashboardOnMap.DefaultShouldShow() {
@Override
public int getTitleId() {
return TITLE_ID;
}
};
static final DashFragmentData FRAGMENT_DATA = new DashFragmentData(
DashParkingFragment.TAG, DashParkingFragment.class,
SHOULD_SHOW_FUNCTION, 50, null);
@Override @Override
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_parking_fragment, container, false); View view = getActivity().getLayoutInflater().inflate(R.layout.dash_parking_fragment, container, false);

View file

@ -27,7 +27,6 @@ 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.DashboardOnMap;
import net.osmand.plus.dashboard.tools.DashFragmentData; import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.AnimateDraggingMapThread;
@ -600,7 +599,6 @@ public class ParkingPositionPlugin extends OsmandPlugin {
@Override @Override
public DashFragmentData getCardFragment() { public DashFragmentData getCardFragment() {
return new DashFragmentData(DashParkingFragment.TAG, DashParkingFragment.class, return DashParkingFragment.FRAGMENT_DATA;
DashParkingFragment.TITLE_ID, new DashboardOnMap.DefaultShouldShow(), 50, null);
} }
} }