- 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:
Jimmy Shih
2012-06-11 14:55:15 -07:00
parent daa85ff675
commit 0d79893b19
5 changed files with 56 additions and 19 deletions
@@ -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);
}
}