mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-06 11:33:06 +02:00
- Change the default value for the "defaultMapPublic" key to false.
Thus the default is creating new unlisted maps. - Toggle the title of the "defaultMapPublic" setting between "Make new maps public" and "Make new maps unlisted". - Fix bug in TrackNameUtil to check if startTime is -1L.
This commit is contained in:
+27
-1
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks.settings;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.accounts.Account;
|
||||
@@ -41,7 +42,8 @@ import java.util.List;
|
||||
public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
|
||||
private static final int DIALOG_CONFIRM_ALLOW_ACCESS_ID = 0;
|
||||
|
||||
|
||||
private CheckBoxPreference defaultMapPublicCheckBoxPreference;
|
||||
private CheckBoxPreference allowAccessCheckBoxPreference;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -50,6 +52,20 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.sharing_settings);
|
||||
|
||||
defaultMapPublicCheckBoxPreference = (CheckBoxPreference) findPreference(
|
||||
getString(R.string.default_map_public_key));
|
||||
boolean defaultMapPublic = PreferencesUtils.getBoolean(
|
||||
this, R.string.default_map_public_key, PreferencesUtils.DEFAULT_MAP_PUBLIC_DEFAULT);
|
||||
updateDefaultMapPublicTitle(defaultMapPublic);
|
||||
defaultMapPublicCheckBoxPreference.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
updateDefaultMapPublicTitle((Boolean) newValue);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
allowAccessCheckBoxPreference = (CheckBoxPreference) findPreference(
|
||||
getString(R.string.allow_access_key));
|
||||
allowAccessCheckBoxPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@@ -94,4 +110,14 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the title for the default map public check box preference.
|
||||
*
|
||||
* @param value the value
|
||||
*/
|
||||
private void updateDefaultMapPublicTitle(boolean value) {
|
||||
defaultMapPublicCheckBoxPreference.setTitle(value ? R.string.settings_sharing_map_public
|
||||
: R.string.settings_sharing_map_unlisted);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PreferencesUtils {
|
||||
public static final boolean CHART_SHOW_SPEED_DEFAULT = true;
|
||||
|
||||
public static final String DEFAULT_ACTIVITY_DEFAULT = "";
|
||||
public static final boolean DEFAULT_MAP_PUBLIC_DEFAULT = true;
|
||||
public static final boolean DEFAULT_MAP_PUBLIC_DEFAULT = false;
|
||||
public static final int FREQUENCY_OFF = 0;
|
||||
public static final int MAX_RECORDING_DISTANCE_DEFAULT = 200;
|
||||
public static final boolean METRIC_UNITS_DEFAULT = true;
|
||||
|
||||
@@ -79,8 +79,11 @@ public class TrackNameUtils {
|
||||
if (location != null) {
|
||||
return getReverseGeoCoding(context, location);
|
||||
} else {
|
||||
// assume startTime != -1L when location == null
|
||||
return StringUtils.formatDateTime(context, startTime);
|
||||
// Use the startTime if available
|
||||
if (startTime != -1L) {
|
||||
return StringUtils.formatDateTime(context, startTime);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user