1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 14:32:54 +01:00

Fix widget device choice dialog behaviour

This commit is contained in:
Arjan Schrijver 2023-08-05 21:48:34 +02:00 committed by Arjan Schrijver
parent d46ed71a46
commit ee4f3fabcf
2 changed files with 4 additions and 31 deletions

View File

@ -83,12 +83,6 @@ public class SleepAlarmWidgetConfigurationActivity extends Activity implements G
String[] allDevicesString = list.toArray(new String[0]); String[] allDevicesString = list.toArray(new String[0]);
builder.setSingleChoiceItems(allDevicesString, 0, new DialogInterface.OnClickListener() { builder.setSingleChoiceItems(allDevicesString, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
ListView lw = ((AlertDialog) dialog).getListView(); ListView lw = ((AlertDialog) dialog).getListView();
@ -106,16 +100,8 @@ public class SleepAlarmWidgetConfigurationActivity extends Activity implements G
finish(); finish();
} }
}); });
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { builder.setCancelable(false);
@Override
public void onClick(DialogInterface dialog, int which) {
Intent resultValue;
resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(RESULT_CANCELED, resultValue);
finish();
}
});
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
dialog.show(); dialog.show();
} }

View File

@ -77,12 +77,6 @@ public class WidgetConfigurationActivity extends Activity implements GBActivity
String[] allDevicesString = list.toArray(new String[0]); String[] allDevicesString = list.toArray(new String[0]);
builder.setSingleChoiceItems(allDevicesString, 0, new DialogInterface.OnClickListener() { builder.setSingleChoiceItems(allDevicesString, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
ListView lw = ((AlertDialog) dialog).getListView(); ListView lw = ((AlertDialog) dialog).getListView();
@ -100,15 +94,8 @@ public class WidgetConfigurationActivity extends Activity implements GBActivity
finish(); finish();
} }
}); });
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { builder.setCancelable(false);
@Override
public void onClick(DialogInterface dialog, int which) {
Intent resultValue; resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(RESULT_CANCELED, resultValue);
finish();
}
});
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
dialog.show(); dialog.show();
} }