1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 17:02:13 +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> {
private int selectedIndex;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -45,8 +47,7 @@ public class ActivitySummariesActivity extends AbstractListActivity<BaseActivity
delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
deleteItemAt(info.position);
deleteItemAt(selectedIndex);
return true;
}
});
@ -56,6 +57,7 @@ public class ActivitySummariesActivity extends AbstractListActivity<BaseActivity
getItemListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
selectedIndex = position;
return getItemListView().showContextMenu();
}
});