Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a081ad496d
22 changed files with 188 additions and 93 deletions
|
@ -1,13 +1,12 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
|
@ -42,13 +41,15 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import btools.routingapp.BRouterServiceConnection;
|
||||
|
||||
/**
|
||||
|
@ -161,10 +162,6 @@ public class AppInitializer implements IProgress {
|
|||
return firstTime;
|
||||
}
|
||||
|
||||
public void setFirstTime(boolean firstTime) {
|
||||
this.firstTime = firstTime;
|
||||
}
|
||||
|
||||
public boolean checkAppVersionChanged(Activity activity) {
|
||||
initUiVars(activity);
|
||||
boolean showRecentChangesDialog = !firstTime && appVersionChanged;
|
||||
|
|
|
@ -31,9 +31,16 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
public static final String TAG = "DASH_NOTES_FRAGMENT";
|
||||
public static final int TITLE_ID = R.string.map_widget_av_notes;
|
||||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashAudioVideoNotesFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 100, ROW_NUMBER_TAG);
|
||||
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(
|
||||
TAG, DashAudioVideoNotesFragment.class, SHOULD_SHOW_FUNCTION, 100, ROW_NUMBER_TAG);
|
||||
|
||||
|
||||
AudioVideoNotesPlugin plugin;
|
||||
|
||||
|
|
|
@ -37,9 +37,15 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
List<FavouritePoint> points = new ArrayList<FavouritePoint>();
|
||||
|
||||
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 =
|
||||
new DashFragmentData(TAG, DashFavoritesFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 90, ROW_NUMBER_TAG);
|
||||
new DashFragmentData(TAG, DashFavoritesFragment.class, SHOULD_SHOW_FUNCTION, 90, ROW_NUMBER_TAG);
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
|
@ -13,6 +13,8 @@ import android.widget.TextView;
|
|||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +24,12 @@ import net.osmand.plus.download.DownloadActivity;
|
|||
public class DashFirstTimeFragment extends DashBaseFragment {
|
||||
|
||||
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
|
||||
public void onOpenDash() {
|
||||
|
@ -66,7 +73,7 @@ public class DashFirstTimeFragment extends DashBaseFragment {
|
|||
view.findViewById(R.id.hide).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getMyApplication().getAppInitializer().setFirstTime(false);
|
||||
interestedInFirstTime = false;
|
||||
dashboard.refreshDashboardFragments();
|
||||
}
|
||||
});
|
||||
|
@ -88,4 +95,12 @@ public class DashFirstTimeFragment extends DashBaseFragment {
|
|||
private void updateCurrentRegion(View view) {
|
||||
((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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,21 @@ import android.widget.TextView;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.ShowRouteInfoActivity;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class DashNavigationFragment extends DashBaseFragment {
|
||||
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
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.TextView;
|
|||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.PluginActivity;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,7 +31,14 @@ import java.util.List;
|
|||
*/
|
||||
public class DashPluginsFragment extends DashBaseFragment {
|
||||
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 View.OnClickListener getListener(final OsmandPlugin plugin) {
|
||||
|
|
|
@ -36,9 +36,15 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
private List<ImageView> arrows = new ArrayList<ImageView>();
|
||||
List<HistoryEntry> points = new ArrayList<HistoryEntry>();
|
||||
private static final String ROW_NUMBER_TAG = TAG + "_row_number";
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashRecentsFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 80, ROW_NUMBER_TAG);
|
||||
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(
|
||||
TAG, DashRecentsFragment.class, SHOULD_SHOW_FUNCTION, 80, ROW_NUMBER_TAG);
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.plus.IconsCache;
|
|||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
|
||||
/**
|
||||
|
@ -22,8 +23,14 @@ import net.osmand.plus.helpers.FontCache;
|
|||
* 24.11.2014.
|
||||
*/
|
||||
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 DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
|
||||
new DashboardOnMap.DefaultShouldShow() {
|
||||
@Override
|
||||
public int getTitleId() {
|
||||
return R.string.search_for;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.osmand.plus.TargetPointsHelper;
|
|||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||
import net.osmand.plus.helpers.WaypointHelper;
|
||||
|
@ -39,6 +40,13 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
|||
public static final int TITLE_ID = R.string.waypoints;
|
||||
List<TargetPoint> points = new ArrayList<TargetPoint>();
|
||||
private static boolean SHOW_ALL;
|
||||
public static final DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
|
||||
new DashboardOnMap.DefaultShouldShow() {
|
||||
@Override
|
||||
public int getTitleId() {
|
||||
return TITLE_ID;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
|
@ -72,30 +72,27 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
public static final String SHOULD_SHOW = "should_show";
|
||||
|
||||
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 firstTimeShouldShow = new FirstTimeShouldShow();
|
||||
private static final DashFragmentData.ShouldShowFunction chooseAppDirShouldShow = new ChooseAppDirShouldShow();
|
||||
|
||||
private final DashFragmentData[] fragmentsData = new DashFragmentData[]{
|
||||
new DashFragmentData(DashRateUsFragment.TAG, DashRateUsFragment.class,
|
||||
-1, rateUsShouldShow, 0, null),
|
||||
new DashFragmentData(DashFirstTimeFragment.TAG, DashFirstTimeFragment.class,
|
||||
-1, firstTimeShouldShow, 10, null),
|
||||
rateUsShouldShow, 0, null),
|
||||
DashFirstTimeFragment.FRAGMENT_DATA,
|
||||
new DashFragmentData(DashChooseAppDirFragment.TAG, DashChooseAppDirFragment.class,
|
||||
-1, chooseAppDirShouldShow, 20, null),
|
||||
chooseAppDirShouldShow, 20, null),
|
||||
new DashFragmentData(DashErrorFragment.TAG, DashErrorFragment.class,
|
||||
-1, errorShouldShow, 30, null),
|
||||
errorShouldShow, 30, null),
|
||||
new DashFragmentData(DashNavigationFragment.TAG, DashNavigationFragment.class,
|
||||
DashNavigationFragment.TITLE_ID, defaultShouldShow, 40, null),
|
||||
DashNavigationFragment.SHOULD_SHOW_FUNCTION, 40, null),
|
||||
new DashFragmentData(DashWaypointsFragment.TAG, DashWaypointsFragment.class,
|
||||
DashWaypointsFragment.TITLE_ID, defaultShouldShow, 60, null),
|
||||
DashWaypointsFragment.SHOULD_SHOW_FUNCTION, 60, null),
|
||||
new DashFragmentData(DashSearchFragment.TAG, DashSearchFragment.class,
|
||||
DashSearchFragment.TITLE_ID, defaultShouldShow, 70, null),
|
||||
DashSearchFragment.SHOULD_SHOW_FUNCTION, 70, null),
|
||||
DashRecentsFragment.FRAGMENT_DATA,
|
||||
DashFavoritesFragment.FRAGMENT_DATA,
|
||||
new DashFragmentData(DashPluginsFragment.TAG, DashPluginsFragment.class,
|
||||
DashPluginsFragment.TITLE_ID, defaultShouldShow, 140, null)
|
||||
DashPluginsFragment.SHOULD_SHOW_FUNCTION, 140, null)
|
||||
};
|
||||
|
||||
private MapActivity mapActivity;
|
||||
|
@ -933,7 +930,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
return list;
|
||||
}
|
||||
|
||||
public static class SettingsShouldShow implements DashFragmentData.ShouldShowFunction {
|
||||
public static class SettingsShouldShow extends DashFragmentData.ShouldShowFunction {
|
||||
@Override
|
||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||
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.
|
||||
@Override
|
||||
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 {
|
||||
public boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
package net.osmand.plus.dashboard.tools;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
|
||||
public final class DashFragmentData implements Comparable<DashFragmentData> {
|
||||
public final String tag;
|
||||
public final Class<? extends DashBaseFragment> fragmentClass;
|
||||
public final int titleStringId;
|
||||
public final ShouldShowFunction shouldShowFunction;
|
||||
public final int position;
|
||||
public final String rowNumberTag;
|
||||
|
||||
public DashFragmentData(String tag, Class<? extends DashBaseFragment> fragmentClass,
|
||||
@StringRes int titleStringId, ShouldShowFunction shouldShowFunction,
|
||||
ShouldShowFunction shouldShowFunction,
|
||||
int position, String rowNumberTag) {
|
||||
this.tag = tag;
|
||||
this.fragmentClass = fragmentClass;
|
||||
this.titleStringId = titleStringId;
|
||||
this.shouldShowFunction = shouldShowFunction;
|
||||
this.position = position;
|
||||
this.rowNumberTag = rowNumberTag;
|
||||
|
@ -36,10 +32,13 @@ public final class DashFragmentData implements Comparable<DashFragmentData> {
|
|||
return rowNumberTag != null;
|
||||
}
|
||||
public boolean canBeDisabled() {
|
||||
return titleStringId != -1;
|
||||
return shouldShowFunction.getTitleId() != -1;
|
||||
}
|
||||
public interface ShouldShowFunction {
|
||||
boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
|
||||
public static abstract class ShouldShowFunction {
|
||||
public abstract boolean shouldShow(OsmandSettings settings, MapActivity activity, String tag);
|
||||
public int getTitleId() {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -211,7 +211,8 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
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);
|
||||
final String stringPosition = String.valueOf(localViewHolder.position);
|
||||
NumberPickerDialogFragment.createInstance(header, subheader, stringPosition, getNumberOfRows(localViewHolder.position), MAXIMUM_NUMBER_OF_ROWS)
|
||||
|
@ -246,7 +247,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
|||
} else {
|
||||
numberOfRowsTextView.setVisibility(View.GONE);
|
||||
}
|
||||
textView.setText(fragmentData.titleStringId);
|
||||
textView.setText(fragmentData.shouldShowFunction.getTitleId());
|
||||
textView.setTextColor(dashFragmentAdapter.isChecked(position)? textColorPrimary :
|
||||
textColorSecondary);
|
||||
this.position = position;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -14,10 +11,27 @@ import android.widget.ImageButton;
|
|||
import android.widget.LinearLayout;
|
||||
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 static final String TAG = "DASH_SIMULATE_FRAGMENT";
|
||||
public static final int TITLE_ID = R.string.simulate_your_location;
|
||||
private static final String TAG = "DASH_SIMULATE_FRAGMENT";
|
||||
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
|
||||
public void onOpenDash() {
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.ContributionVersionActivity;
|
||||
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.OsmandMapLayer.DrawSettings;
|
||||
|
@ -128,9 +127,6 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return new DashFragmentData(DashSimulateFragment.TAG,
|
||||
DashSimulateFragment.class,
|
||||
DashSimulateFragment.TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 150, null);
|
||||
return DashSimulateFragment.FRAGMENT_DATA;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ public class DownloadActivity extends ActionBarProgressActivity implements Downl
|
|||
final boolean firstTime = getMyApplication().getAppInitializer().isFirstTime(this);
|
||||
final boolean externalExists =
|
||||
getMyApplication().getSettings().getSecondaryStorage() != null;
|
||||
if (firstTime && externalExists) {
|
||||
if (firstTime && externalExists && DataStoragePlaceDialogFragment.isInterestedInFirstTime) {
|
||||
new DataStoragePlaceDialogFragment().show(getFragmentManager(), null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public class DataStoragePlaceDialogFragment extends DialogFragment {
|
|||
|
||||
private File internalStorage;
|
||||
private File externalStorage;
|
||||
public static boolean isInterestedInFirstTime = true;
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
@ -140,7 +141,7 @@ public class DataStoragePlaceDialogFragment extends DialogFragment {
|
|||
public void onClick(View v) {
|
||||
saveFilesLocation(OsmandSettings.EXTERNAL_STORAGE_TYPE_DEFAULT,
|
||||
internalStorage, getActivity());
|
||||
getMyApplication().getAppInitializer().setFirstTime(false);
|
||||
isInterestedInFirstTime = false;
|
||||
dismiss();
|
||||
}
|
||||
};
|
||||
|
@ -151,7 +152,7 @@ public class DataStoragePlaceDialogFragment extends DialogFragment {
|
|||
public void onClick(View v) {
|
||||
saveFilesLocation(OsmandSettings.EXTERNAL_STORAGE_TYPE_EXTERNAL_FILE,
|
||||
externalStorage, getActivity());
|
||||
getMyApplication().getAppInitializer().setFirstTime(false);
|
||||
isInterestedInFirstTime = false;
|
||||
dismiss();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,9 +45,16 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
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 DashFragmentData.ShouldShowFunction SHOULD_SHOW_FUNCTION =
|
||||
new DashboardOnMap.DefaultShouldShow() {
|
||||
@Override
|
||||
public int getTitleId() {
|
||||
return TITLE_ID;
|
||||
}
|
||||
};
|
||||
static final DashFragmentData FRAGMENT_DATA =
|
||||
new DashFragmentData(TAG, DashTrackFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 110, ROW_NUMBER_TAG);
|
||||
new DashFragmentData(TAG, DashTrackFragment.class, SHOULD_SHOW_FUNCTION, 110, ROW_NUMBER_TAG);
|
||||
|
||||
private boolean updateEnable;
|
||||
|
||||
|
|
|
@ -36,9 +36,16 @@ public class DashOsmEditsFragment extends DashBaseFragment
|
|||
public static final int TITLE_ID = R.string.osm_settings;
|
||||
|
||||
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 =
|
||||
new DashFragmentData(TAG, DashOsmEditsFragment.class, TITLE_ID,
|
||||
new DashboardOnMap.DefaultShouldShow(), 130, ROW_NUMBER_TAG);
|
||||
new DashFragmentData(TAG, DashOsmEditsFragment.class, SHOULD_SHOW_FUNCTION, 130, ROW_NUMBER_TAG);
|
||||
|
||||
OsmEditingPlugin plugin;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Intent;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -25,6 +24,8 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
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.util.MapUtils;
|
||||
|
||||
|
@ -42,6 +43,15 @@ public class DashOsMoFragment extends DashLocationFragment implements OsMoGroups
|
|||
|
||||
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();
|
||||
|
||||
OsMoPlugin plugin;
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.download.DownloadFileHelper;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||
|
@ -534,7 +533,6 @@ public class OsMoPlugin extends OsmandPlugin implements OsMoReactor {
|
|||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return new DashFragmentData(DashOsMoFragment.TAG, DashOsMoFragment.class,
|
||||
R.string.osmo_plugin_name, new DashboardOnMap.DefaultShouldShow(), 120, null);
|
||||
return DashOsMoFragment.FRAGMENT_DATA;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
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 java.util.Calendar;
|
||||
|
@ -27,10 +29,21 @@ import java.util.Calendar;
|
|||
* 26.01.2015.
|
||||
*/
|
||||
public class DashParkingFragment extends DashLocationFragment {
|
||||
public static final String TAG = "DASH_PARKING_FRAGMENT";
|
||||
public static final int TITLE_ID = R.string.osmand_parking_plugin_name;
|
||||
private static final String TAG = "DASH_PARKING_FRAGMENT";
|
||||
private static final int TITLE_ID = R.string.osmand_parking_plugin_name;
|
||||
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
|
||||
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_parking_fragment, container, false);
|
||||
|
|
|
@ -27,7 +27,6 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
|
@ -600,7 +599,6 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return new DashFragmentData(DashParkingFragment.TAG, DashParkingFragment.class,
|
||||
DashParkingFragment.TITLE_ID, new DashboardOnMap.DefaultShouldShow(), 50, null);
|
||||
return DashParkingFragment.FRAGMENT_DATA;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue