From ee60cbf640df8386bd7ffab0508edff9c283fdbd Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 16 Nov 2019 00:20:09 +0800 Subject: Swipe right to go back from ViewPostDetailActivity. Fix inconsistency in elapsed time. --- app/build.gradle | 1 - .../Activity/ViewPostDetailActivity.java | 17 ++------- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 10 +++--- .../CommentsListingRecyclerViewAdapter.java | 10 ++---- .../Adapter/PostRecyclerViewAdapter.java | 17 ++++----- .../Utils/SharedPreferencesUtils.java | 1 + .../infinityforreddit/Utils/Utils.java | 40 ++++++++++++++++++++++ app/src/main/res/values/strings.xml | 13 +++++++ app/src/main/res/xml/main_preferences.xml | 5 +++ 9 files changed, 76 insertions(+), 38 deletions(-) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 6a5610ba..cb188514 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -80,6 +80,5 @@ dependencies { implementation 'androidx.work:work-runtime:2.2.0' implementation 'androidx.preference:preference:1.1.0' implementation 'com.nex3z:flow-layout:1.3.0' - implementation 'com.github.thunder413:DateTimeUtils:3.0' implementation 'com.r0adkll:slidableactivity:2.1.0' } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 4b38e45b..66457f9a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.view.Menu; @@ -34,9 +33,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import com.livefront.bridge.Bridge; import com.r0adkll.slidr.Slidr; -import com.r0adkll.slidr.model.SlidrConfig; -import com.r0adkll.slidr.model.SlidrListener; -import com.r0adkll.slidr.model.SlidrPosition; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -186,16 +182,9 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS EventBus.getDefault().register(this); - SlidrConfig config = new SlidrConfig.Builder() - .sensitivity(1f) - .scrimColor(Color.BLACK) - .scrimStartAlpha(0.8f) - .scrimEndAlpha(0f) - .velocityThreshold(2400) - .distanceThreshold(0.25f) - .build(); - - Slidr.attach(this); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } Resources resources = getResources(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 3a21d872..da09328f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -35,13 +35,10 @@ import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.Target; -import com.github.thunder413.datetimeutils.DateTimeStyle; -import com.github.thunder413.datetimeutils.DateTimeUtils; import com.libRG.CustomTextView; import com.santalu.aspectratioimageview.AspectRatioImageView; import java.util.ArrayList; -import java.util.Date; import java.util.Locale; import butterknife.BindView; @@ -73,8 +70,9 @@ import ml.docilealligator.infinityforreddit.Post; import ml.docilealligator.infinityforreddit.PostDataSource; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.Utils.RedditUtils; import ml.docilealligator.infinityforreddit.SaveThing; +import ml.docilealligator.infinityforreddit.Utils.RedditUtils; +import ml.docilealligator.infinityforreddit.Utils.Utils; import ml.docilealligator.infinityforreddit.VoteThing; import retrofit2.Retrofit; @@ -367,7 +365,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.AdapterImmersive Interface Vote Buttons on the Right Show Elpased Time in Posts and Comments + Swipe Right to Go Back From Comments Lazy Mode Interval Font Size Title Font Size @@ -353,4 +354,16 @@ Card Layout Compact Layout + + Just Now + 1 Minute + %1$d Minutes + 1 Hour + %1$d Hours + Yesterday + %1$d Days + 1 Month + %1$d Months + 1 Year + %1$d Years diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index 548bf949..db4b75a1 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -36,6 +36,11 @@ app:key="show_elapsed_time" app:title="@string/settings_show_elapsed_time"/> + +