mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-08 15:35:24 +02: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:
parent
12ca479439
commit
cd029e4853
@ -3,6 +3,7 @@ package nodomain.freeyourgadget.gadgetbridge.adapter;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ public class ActivitySummariesAdapter extends AbstractItemAdapter<BaseActivitySu
|
|||||||
try (DBHandler handler = GBApplication.acquireDB()) {
|
try (DBHandler handler = GBApplication.acquireDB()) {
|
||||||
BaseActivitySummaryDao summaryDao = handler.getDaoSession().getBaseActivitySummaryDao();
|
BaseActivitySummaryDao summaryDao = handler.getDaoSession().getBaseActivitySummaryDao();
|
||||||
List<BaseActivitySummary> allSummaries = summaryDao.loadAll();
|
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);
|
setItems(allSummaries, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GB.toast("Error loading activity summaries.", Toast.LENGTH_SHORT, GB.ERROR, e);
|
GB.toast("Error loading activity summaries.", Toast.LENGTH_SHORT, GB.ERROR, e);
|
||||||
|
@ -3,14 +3,9 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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
|
<ListView
|
||||||
android:id="@+id/itemListView"
|
android:id="@+id/itemListView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
Loading…
Reference in New Issue
Block a user