From d3032555ee0f6722825a5620b97e13e2f97b7cdc Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 3 Dec 2018 14:41:23 +0100 Subject: [PATCH] Added pull down to refresh Single folders only for now --- FAQ.md | 1 - .../java/eu/faircode/email/AdapterFolder.java | 4 +- .../eu/faircode/email/EntityOperation.java | 4 +- .../eu/faircode/email/FragmentMessages.java | 39 ++ .../drawable/baseline_hourglass_empty_24.xml | 10 + app/src/main/res/layout/fragment_messages.xml | 401 +++++++++--------- 6 files changed, 259 insertions(+), 200 deletions(-) create mode 100755 app/src/main/res/drawable/baseline_hourglass_empty_24.xml diff --git a/FAQ.md b/FAQ.md index fb8fe0dd7e..69387931a2 100644 --- a/FAQ.md +++ b/FAQ.md @@ -45,7 +45,6 @@ Anything on this list is in random order and *might* be added in the near future * Snooze timer: snoozed emails are not supported by [IMAP](https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol). * Badge count: there is no standard Android API for this and third party solutions might stop working anytime. * Shortcut frequently contacted: Android [doesn't support this anymore](https://developer.android.com/guide/topics/providers/contacts-provider#ObsoleteData). -* Pull down to refresh: new messages are received in real-time, so manual refreshing is not needed, see also [this FAQ](#user-content-faq2). * Switch language: although it is possible to change the language of an app, Android is not designed for this. Better fix the translation in your language if needed, see [this FAQ](#user-content-faq26) about how to. * Select identities to show in unified inbox: this would add complexity for something which would hardly be used. * Better design: please let me know what you have in mind [in this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168). diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index 3d677d93cf..57a874f7c2 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -135,7 +135,9 @@ public class AdapterFolder extends RecyclerView.Adapter() { + @Override + protected Void onLoad(Context context, Bundle args) { + long id = args.getLong("id"); + + DB db = DB.getInstance(context); + try { + db.beginTransaction(); + + EntityOperation.sync(db, id); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + + return null; + } + }.load(FragmentMessages.this, args); + } + }); + tvSupport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -977,6 +1013,7 @@ public class FragmentMessages extends FragmentEx { ((ActivityBase) getActivity()).addBackPressedListener(onBackPressedListener); // Initialize + swipeRefresh.setEnabled(viewType == AdapterMessage.ViewType.FOLDER); tvNoEmail.setVisibility(View.GONE); bottom_navigation.setVisibility(View.GONE); grpReady.setVisibility(View.GONE); @@ -1072,6 +1109,8 @@ public class FragmentMessages extends FragmentEx { outbox = EntityFolder.OUTBOX.equals(folder.type); getActivity().invalidateOptionsMenu(); } + + swipeRefresh.setRefreshing(folder != null && folder.sync_state != null); } }); break; diff --git a/app/src/main/res/drawable/baseline_hourglass_empty_24.xml b/app/src/main/res/drawable/baseline_hourglass_empty_24.xml new file mode 100755 index 0000000000..22b7e2aedc --- /dev/null +++ b/app/src/main/res/drawable/baseline_hourglass_empty_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/fragment_messages.xml b/app/src/main/res/layout/fragment_messages.xml index 590dae853a..2dccf8b93d 100644 --- a/app/src/main/res/layout/fragment_messages.xml +++ b/app/src/main/res/layout/fragment_messages.xml @@ -6,207 +6,214 @@ android:layout_height="match_parent" tools:context=".ActivityView"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +