From fdaf41f2c97383e89e8b3b6dc47ee165ef17ef7a Mon Sep 17 00:00:00 2001 From: stom79 Date: Mon, 10 Sep 2018 19:35:17 +0200 Subject: [PATCH] Some fixes --- .../activities/WhoToFollowActivity.java | 7 +- .../fragments/WhoToFollowFragment.java | 10 +- .../res/layout/activity_who_to_follow.xml | 140 ++++++++++-------- app/src/main/res/values/strings.xml | 2 + 4 files changed, 87 insertions(+), 72 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WhoToFollowActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WhoToFollowActivity.java index c5acaeb30..d58eaf9c3 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WhoToFollowActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WhoToFollowActivity.java @@ -84,14 +84,15 @@ public class WhoToFollowActivity extends BaseActivity implements OnRetrieveWhoTo cal.setTime(new Date( )); cal.add(Calendar.MINUTE, -5); Date dateAllowed = cal.getTime(); - if( lastDateListNameRefresh == null || Helper.stringToDate(WhoToFollowActivity.this, lastDateListNameRefresh).after(dateAllowed)) + if( lastDateListNameRefresh == null || Helper.stringToDate(WhoToFollowActivity.this, lastDateListNameRefresh).before(dateAllowed)) { new WhoToFollowAsyncTask(WhoToFollowActivity.this, item, WhoToFollowActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - else { + mainLoader.setVisibility(View.VISIBLE); + }else { String lastList = sharedpreferences.getString(Helper.LAST_LIST_NAME + item, null); List list = Helper.restoreArrayFromString(lastList); displayResults(list); } - mainLoader.setVisibility(View.VISIBLE); + setTitle(item); } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/WhoToFollowFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/WhoToFollowFragment.java index 6f0e146fa..4312c0bf0 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/WhoToFollowFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/WhoToFollowFragment.java @@ -20,6 +20,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -58,17 +59,18 @@ public class WhoToFollowFragment extends Fragment implements OnRetrieveWhoToFoll SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String lastDateListRefresh = sharedpreferences.getString(Helper.LAST_DATE_LIST_REFRESH, null); Calendar cal = Calendar.getInstance(); - cal.setTime(new Date( )); + cal.setTime(new Date()); cal.add(Calendar.MINUTE, -15); Date dateAllowed = cal.getTime(); - if( lastDateListRefresh == null || Helper.stringToDate(context, lastDateListRefresh).after(dateAllowed)) + if (lastDateListRefresh == null || Helper.stringToDate(context, lastDateListRefresh).before(dateAllowed)){ + mainLoader.setVisibility(View.VISIBLE); new WhoToFollowAsyncTask(context, null, WhoToFollowFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - else { + }else { String lastList = sharedpreferences.getString(Helper.LAST_LIST, null); List list = Helper.restoreArrayFromString(lastList); displayResults(list); } - mainLoader.setVisibility(View.VISIBLE); + return rootView; } diff --git a/app/src/main/res/layout/activity_who_to_follow.xml b/app/src/main/res/layout/activity_who_to_follow.xml index 5850a6ff5..6e526cfc0 100644 --- a/app/src/main/res/layout/activity_who_to_follow.xml +++ b/app/src/main/res/layout/activity_who_to_follow.xml @@ -17,79 +17,89 @@ --> - - - - - - - - + + - - - - - - - + android:background="?attr/colorPrimary" + app:layout_scrollFlags="scroll|enterAlways" + android:theme="@style/AppThemeDark_NoActionBar" + app:popupTheme="?attr/popupOverlay"/> + + + + + + + + + + + + + - - +