forked from upstream-mirrors/OpenTracks
Add a confirmation dialog when user allows access to other apps
This commit is contained in:
@@ -240,6 +240,8 @@ limitations under the License.
|
|||||||
MyTracks data, including starting/stopping a recording.</string>
|
MyTracks data, including starting/stopping a recording.</string>
|
||||||
<string name="settings_share_data_summary_off">MyTracks data is not shared with any installed app.
|
<string name="settings_share_data_summary_off">MyTracks data is not shared with any installed app.
|
||||||
</string>
|
</string>
|
||||||
|
<string name="settings_share_data_dialog_message">Are you sure? This will allow any app installed
|
||||||
|
on your phone control and access to MyTracks.</string>
|
||||||
|
|
||||||
<string name="settings_share_url_only">Share only URL</string>
|
<string name="settings_share_url_only">Share only URL</string>
|
||||||
<string name="settings_share_url_only_summary_on">Only the URL of the map will be sent when sharing</string>
|
<string name="settings_share_url_only_summary_on">Only the URL of the map will be sent when sharing</string>
|
||||||
|
|||||||
@@ -142,6 +142,33 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add a confirmation dialog for the share data preference.
|
||||||
|
final CheckBoxPreference shareDataPreference = (CheckBoxPreference) findPreference(
|
||||||
|
getString(R.string.share_data_key));
|
||||||
|
shareDataPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
if ((Boolean) newValue) {
|
||||||
|
AlertDialog dialog = new AlertDialog.Builder(SettingsActivity.this)
|
||||||
|
.setCancelable(true)
|
||||||
|
.setTitle(getString(R.string.settings_share_data))
|
||||||
|
.setMessage(getString(R.string.settings_share_data_dialog_message))
|
||||||
|
.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int button) {
|
||||||
|
shareDataPreference.setChecked(true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
|
.create();
|
||||||
|
dialog.show();
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean processIntent() {
|
private boolean processIntent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user