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. --- .../Activity/ViewPostDetailActivity.java | 17 ++------- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 10 +++--- .../CommentsListingRecyclerViewAdapter.java | 10 ++---- .../Adapter/PostRecyclerViewAdapter.java | 17 ++++----- .../Utils/SharedPreferencesUtils.java | 1 + .../infinityforreddit/Utils/Utils.java | 40 ++++++++++++++++++++++ 6 files changed, 58 insertions(+), 37 deletions(-) (limited to 'app/src/main/java/ml') 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.Adapter