Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3907 - Integrating Telemetry On / Off UI with functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
bleege committed Feb 12, 2016
1 parent cd21bfc commit e640a9d
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,7 @@ public void onClick(View v) {
// Called when someone selects an attribution, 'Improve this map' adds location data to the url
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = ((Dialog) dialog).getContext();
final Context context = ((Dialog) dialog).getContext();
if (which == ATTRIBUTION_INDEX_TELEMETRY_SETTINGS) {

int array = R.array.attribution_telemetry_options;
Expand All @@ -2877,7 +2877,26 @@ public void onClick(DialogInterface dialog, int which) {
String[] items = context.getResources().getStringArray(array);
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AttributionAlertDialogStyle);
builder.setTitle(R.string.attributionsDialogTitle);
builder.setAdapter(new ArrayAdapter<>(context, R.layout.attribution_list_item, items), this);
builder.setAdapter(new ArrayAdapter<>(context, R.layout.attribution_list_item, items), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
String url = context.getResources().getStringArray(R.array.attribution_links)[3];
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
context.startActivity(intent);
return;
case 1:
MapboxEventManager.getMapboxEventManager(context).setTelemetryEnabled(false);
return;
case 2:
MapboxEventManager.getMapboxEventManager(context).setTelemetryEnabled(true);
return;
}
}
});

builder.show();
return;
}
Expand Down

0 comments on commit e640a9d

Please sign in to comment.