1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

Amazfit Bip: fixes to the activities activity

- Prevent the swipe-to-refresh unless we are on top of the list
- Show the most recent activities on top of the list
This commit is contained in:
Daniele Gobbetti 2018-04-02 15:53:19 +02:00
parent 12ca479439
commit cd029e4853
2 changed files with 2 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package nodomain.freeyourgadget.gadgetbridge.adapter;
import android.content.Context;
import android.widget.Toast;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ -24,6 +25,7 @@ public class ActivitySummariesAdapter extends AbstractItemAdapter<BaseActivitySu
try (DBHandler handler = GBApplication.acquireDB()) {
BaseActivitySummaryDao summaryDao = handler.getDaoSession().getBaseActivitySummaryDao();
List<BaseActivitySummary> allSummaries = summaryDao.loadAll();
Collections.reverse(allSummaries); //we fetch by swiping down, hence it makes sense to have most recent activities on top
setItems(allSummaries, true);
} catch (Exception e) {
GB.toast("Error loading activity summaries.", Toast.LENGTH_SHORT, GB.ERROR, e);

View File

@ -3,14 +3,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/itemListView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>