1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Amazfit Bip: when deleting activites, delete the correct one

This commit is contained in:
Andreas Shimokawa 2017-11-05 00:20:26 +01:00
parent ac98111502
commit 24f98504b0

View File

@ -18,6 +18,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class ActivitySummariesActivity extends AbstractListActivity<BaseActivitySummary> { public class ActivitySummariesActivity extends AbstractListActivity<BaseActivitySummary> {
private int selectedIndex;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -45,8 +47,7 @@ public class ActivitySummariesActivity extends AbstractListActivity<BaseActivity
delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; deleteItemAt(selectedIndex);
deleteItemAt(info.position);
return true; return true;
} }
}); });
@ -56,6 +57,7 @@ public class ActivitySummariesActivity extends AbstractListActivity<BaseActivity
getItemListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { getItemListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override @Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
selectedIndex = position;
return getItemListView().showContextMenu(); return getItemListView().showContextMenu();
} }
}); });