Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-16 09:32:23 +01:00
commit e5ed378868
5 changed files with 19 additions and 18 deletions

View file

@ -52,13 +52,15 @@ import java.util.Random;
import btools.routingapp.BRouterServiceConnection; import btools.routingapp.BRouterServiceConnection;
/** /**
* Created by Denis
* on 03.03.15.
*/ */
public class AppInitializer implements IProgress { public class AppInitializer implements IProgress {
// 22 - 2.2
private static final int CURRENT_VERSION_FOR_UGPRADE = 22;
public static final boolean TIPS_AND_TRICKS = false; public static final boolean TIPS_AND_TRICKS = false;
private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$ private static final String FIRST_TIME_APP_RUN = "FIRST_TIME_APP_RUN"; //$NON-NLS-1$
private static final String VERSION_INSTALLED_NUMBER = "VERSION_INSTALLED_NUMBER"; //$NON-NLS-1$
public static final String NUMBER_OF_STARTS = "NUMBER_OF_STARTS"; //$NON-NLS-1$ public static final String NUMBER_OF_STARTS = "NUMBER_OF_STARTS"; //$NON-NLS-1$
public static final String FIRST_INSTALLED = "FIRST_INSTALLED"; //$NON-NLS-1$ public static final String FIRST_INSTALLED = "FIRST_INSTALLED"; //$NON-NLS-1$
private static final String VECTOR_INDEXES_CHECK = "VECTOR_INDEXES_CHECK"; //$NON-NLS-1$ private static final String VECTOR_INDEXES_CHECK = "VECTOR_INDEXES_CHECK"; //$NON-NLS-1$
@ -130,7 +132,13 @@ public class AppInitializer implements IProgress {
firstTime = true; firstTime = true;
startPrefs.edit().putBoolean(FIRST_TIME_APP_RUN, true).commit(); startPrefs.edit().putBoolean(FIRST_TIME_APP_RUN, true).commit();
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit(); startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, CURRENT_VERSION_FOR_UGPRADE).commit();
} else if (!Version.getFullVersion(app).equals(startPrefs.getString(VERSION_INSTALLED, ""))) { } else if (!Version.getFullVersion(app).equals(startPrefs.getString(VERSION_INSTALLED, ""))) {
if(startPrefs.getInt(VERSION_INSTALLED_NUMBER, 0) < 22) {
app.getSettings().SHOW_DASHBOARD_ON_START.set(true);
app.getSettings().SHOW_DASHBOARD_ON_MAP_SCREEN.set(true);
app.getSettings().SHOW_CARD_TO_CHOOSE_DRAWER.set(true);
}
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit(); startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
appVersionChanged = true; appVersionChanged = true;
} }

View file

@ -633,6 +633,10 @@ public class OsmandSettings {
} }
public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache(); public final CommonPreference<Boolean> USE_FAST_RECALCULATION = new BooleanPreference("use_fast_recalculation", true).makeGlobal().cache();
public final CommonPreference<Boolean> SHOW_CARD_TO_CHOOSE_DRAWER = new BooleanPreference("show_card_to_choose_drawer", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_START = new BooleanPreference("should_show_dashboard_on_start", false).makeGlobal();
public final CommonPreference<Boolean> SHOW_DASHBOARD_ON_MAP_SCREEN = new BooleanPreference("show_dashboard_on_map_screen", false).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> USE_INTERNET_TO_DOWNLOAD_TILES = new BooleanPreference("use_internet_to_download_tiles", true).makeGlobal().cache(); public final CommonPreference<Boolean> USE_INTERNET_TO_DOWNLOAD_TILES = new BooleanPreference("use_internet_to_download_tiles", true).makeGlobal().cache();

View file

@ -140,8 +140,6 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents {
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);
@ -393,9 +391,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents {
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 = if (settings.SHOW_DASHBOARD_ON_START.get()) {
settings.registerBooleanPreference(MapActivity.SHOULD_SHOW_DASHBOARD_ON_START, true);
if (shouldShowDashboardOnStart.get() || dashboardOnMap.hasCriticalMessages()) {
dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType); dashboardOnMap.setDashboardVisibility(true, DashboardOnMap.staticVisibleType);
} else { } else {
if (ErrorBottomSheetDialog.shouldShow(settings, this)) { if (ErrorBottomSheetDialog.shouldShow(settings, this)) {

View file

@ -904,12 +904,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
transaction.show(frag).commit(); transaction.show(frag).commit();
} }
// TODO: 11/13/15 Remove
public boolean hasCriticalMessages() {
final OsmandSettings settings = getMyApplication().getSettings();
return rateUsShouldShow.shouldShow(settings, mapActivity, DashRateUsFragment.TAG);
}
View getParentView() { View getParentView() {
return dashboardView; return dashboardView;
} }

View file

@ -71,11 +71,10 @@ public class DashboardSettingsDialogFragment extends DialogFragment
R.layout.show_dashboard_on_start_dialog_item, null, false); R.layout.show_dashboard_on_start_dialog_item, null, false);
final TextView textView = (TextView) view.findViewById(R.id.text); final TextView textView = (TextView) view.findViewById(R.id.text);
textView.setText(R.string.show_on_start); textView.setText(R.string.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); final CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.check_item);
compoundButton.setChecked(shouldShowDashboardOnStart.get()); // FIXME Yura add settings.SHOW_DASHBOARD_ON_MAP_SCREEN
textView.setTextColor(shouldShowDashboardOnStart.get() ? textColorPrimary compoundButton.setChecked(settings.SHOW_DASHBOARD_ON_MAP_SCREEN.get());
textView.setTextColor(settings.SHOW_DASHBOARD_ON_MAP_SCREEN.get() ? textColorPrimary
: textColorSecondary); : textColorSecondary);
compoundButton.setOnCheckedChangeListener( compoundButton.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() { new CompoundButton.OnCheckedChangeListener() {
@ -111,7 +110,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
} }
} }
mapActivity.getDashboard().refreshDashboardFragments(); mapActivity.getDashboard().refreshDashboardFragments();
shouldShowDashboardOnStart.set(compoundButton.isChecked()); settings.SHOW_DASHBOARD_ON_MAP_SCREEN.set(compoundButton.isChecked());
} }
}) })
.setNegativeButton(R.string.shared_string_cancel, null); .setNegativeButton(R.string.shared_string_cancel, null);