1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-03 22:45:52 +01:00

fixed settings bug

This commit is contained in:
dakhnod 2019-08-01 22:39:34 +02:00
parent 236a48e398
commit 8db0812ed0

View File

@ -142,7 +142,7 @@ public class ConfigActivity extends AbstractGBActivity {
appList.setAdapter(adapter = new PackageAdapter(this, R.layout.qhybrid_package_settings_item, list)); appList.setAdapter(adapter = new PackageAdapter(this, R.layout.qhybrid_package_settings_item, list));
appList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { appList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override @Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, final int i, long l) { public boolean onItemLongClick(final AdapterView<?> adapterView, View view, final int i, long l) {
PopupMenu menu = new PopupMenu(ConfigActivity.this, view); PopupMenu menu = new PopupMenu(ConfigActivity.this, view);
menu.getMenu().add("edit"); menu.getMenu().add("edit");
menu.getMenu().add("delete"); menu.getMenu().add("delete");
@ -151,7 +151,7 @@ public class ConfigActivity extends AbstractGBActivity {
public boolean onMenuItemClick(MenuItem menuItem) { public boolean onMenuItemClick(MenuItem menuItem) {
switch (menuItem.getTitle().toString()) { switch (menuItem.getTitle().toString()) {
case "edit": { case "edit": {
TimePicker picker = new TimePicker(ConfigActivity.this, list.get(i)); TimePicker picker = new TimePicker(ConfigActivity.this, (PackageConfig) adapterView.getItemAtPosition(i));
picker.finishListener = new TimePicker.OnFinishListener() { picker.finishListener = new TimePicker.OnFinishListener() {
@Override @Override
public void onFinish(boolean success, PackageConfig config) { public void onFinish(boolean success, PackageConfig config) {
@ -178,16 +178,16 @@ public class ConfigActivity extends AbstractGBActivity {
break; break;
} }
case "delete": { case "delete": {
helper.deleteConfig(list.get(i)); helper.deleteConfig((PackageConfig) adapterView.getItemAtPosition(i));
refreshList(); refreshList();
break; break;
} }
} }
return false; return true;
} }
}); });
menu.show(); menu.show();
return false; return true;
} }
}); });
@ -195,7 +195,7 @@ public class ConfigActivity extends AbstractGBActivity {
@Override @Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent notificationIntent = new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION); Intent notificationIntent = new Intent(QHybridSupport.QHYBRID_COMMAND_NOTIFICATION);
notificationIntent.putExtra("CONFIG", list.get(i)); notificationIntent.putExtra("CONFIG", (PackageConfig) adapterView.getItemAtPosition(i));
LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(notificationIntent); LocalBroadcastManager.getInstance(ConfigActivity.this).sendBroadcast(notificationIntent);
} }
}); });