2020-01-09 10:44:32 +01:00
|
|
|
/* Copyright (C) 2017-2020 Andreas Shimokawa, Carsten Pfeiffer
|
2018-06-25 18:35:46 +02:00
|
|
|
|
|
|
|
This file is part of Gadgetbridge.
|
|
|
|
|
|
|
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Gadgetbridge is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2017-10-19 21:52:38 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.activities;
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.widget.ListView;
|
|
|
|
|
2020-08-31 23:22:17 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2017-10-19 21:52:38 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
2020-10-17 13:37:32 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.adapter.AbstractActivityListingAdapter;
|
2017-10-19 21:52:38 +02:00
|
|
|
|
|
|
|
public abstract class AbstractListActivity<T> extends AbstractGBActivity {
|
2020-10-17 13:37:32 +02:00
|
|
|
private AbstractActivityListingAdapter<T> itemAdapter;
|
2017-10-19 21:52:38 +02:00
|
|
|
private ListView itemListView;
|
|
|
|
|
2020-10-17 13:37:32 +02:00
|
|
|
public void setItemAdapter(AbstractActivityListingAdapter<T> itemAdapter) {
|
2017-10-19 21:52:38 +02:00
|
|
|
this.itemAdapter = itemAdapter;
|
|
|
|
itemListView.setAdapter(itemAdapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void refresh() {
|
|
|
|
this.itemAdapter.loadItems();
|
|
|
|
}
|
|
|
|
|
2020-08-11 21:54:02 +02:00
|
|
|
public void setActivityKindFilter(int activityKind){
|
|
|
|
this.itemAdapter.setActivityKindFilter(activityKind);
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:16:36 +02:00
|
|
|
public void setDateFromFilter(long date){
|
|
|
|
this.itemAdapter.setDateFromFilter(date);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDateToFilter(long date){
|
|
|
|
this.itemAdapter.setDateToFilter(date);
|
|
|
|
}
|
|
|
|
|
2020-08-24 00:09:10 +02:00
|
|
|
public void setNameContainsFilter(String name){
|
|
|
|
this.itemAdapter.setNameContainsFilter(name);
|
|
|
|
}
|
|
|
|
|
2020-08-31 23:22:17 +02:00
|
|
|
public void setItemsFilter(List items) {
|
|
|
|
this.itemAdapter.setItemsFilter(items);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDeviceFilter(long device) {
|
|
|
|
this.itemAdapter.setDeviceFilter(device);
|
|
|
|
}
|
|
|
|
|
2020-10-17 13:37:32 +02:00
|
|
|
public AbstractActivityListingAdapter<T> getItemAdapter() {
|
2017-10-19 21:52:38 +02:00
|
|
|
return itemAdapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ListView getItemListView() {
|
|
|
|
return itemListView;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
setContentView(R.layout.activity_list);
|
2018-03-31 16:21:25 +02:00
|
|
|
itemListView = findViewById(R.id.itemListView);
|
2017-10-19 21:52:38 +02:00
|
|
|
}
|
|
|
|
}
|