aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java48
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java2
8 files changed, 92 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
index 92ef6064..f932427f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
@@ -133,7 +133,7 @@ public class LinkResolverActivity extends AppCompatActivity {
Intent intent = new Intent(this, ViewMultiRedditDetailActivity.class);
intent.putExtra(ViewMultiRedditDetailActivity.EXTRA_MULTIREDDIT_PATH, path);
startActivity(intent);
- } else if (path.matches(REDD_IT_POST_PATTERN)) {
+ } else if (authority.equals("redd.it") && path.matches(REDD_IT_POST_PATTERN)) {
Intent intent = new Intent(this, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, path.substring(1));
startActivity(intent);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
index b1d2890d..2ef1d14f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
@@ -36,6 +36,7 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import me.zhanghai.android.fastscroll.FastScrollerBuilder;
import ml.docilealligator.infinityforreddit.Adapter.MultiRedditListingRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask;
@@ -179,6 +180,7 @@ public class MultiRedditListingActivity extends BaseActivity {
}
}
});
+ new FastScrollerBuilder(mRecyclerView).build();
mMultiRedditViewModel = new ViewModelProvider(this,
new MultiRedditViewModel.Factory(getApplication(), mRedditDataRoomDatabase, mAccountName))
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 aad2f712..d103ce96 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -138,6 +138,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private int mColorPrimaryLightTheme;
private int mColorAccent;
+ private int mCircularProgressBarBackgroundColor;
private int mCardViewColor;
private int mSecondaryTextColor;
private int mPostTitleColor;
@@ -294,6 +295,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorAccent = customThemeWrapper.getColorAccent();
+ mCircularProgressBarBackgroundColor = customThemeWrapper.getCircularProgressBarBackground();
mCardViewColor = customThemeWrapper.getCardViewBackgroundColor();
mPostTitleColor = customThemeWrapper.getPostTitleColor();
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
@@ -2169,6 +2171,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
commentTimeTextView.setTextColor(mSecondaryTextColor);
commentMarkdownView.setTextColor(mCommentTextColor);
authorFlairTextView.setTextColor(mAuthorFlairTextColor);
+ topScoreTextView.setTextColor(mSecondaryTextColor);
commentDivider.setBackgroundColor(mDividerColor);
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
@@ -2209,6 +2212,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
LoadCommentsViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
+ circleProgressBar.setBackgroundTintList(ColorStateList.valueOf(mCircularProgressBarBackgroundColor));
circleProgressBar.setColorSchemeColors(mColorAccent);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java
index dd5c8be1..a60cf1e1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java
@@ -21,6 +21,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
+import me.zhanghai.android.fastscroll.PopupTextProvider;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.FavoriteThing;
@@ -30,7 +31,7 @@ import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUse
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
-public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements PopupTextProvider {
private static final int VIEW_TYPE_FAVORITE_USER_DIVIDER = 0;
private static final int VIEW_TYPE_FAVORITE_USER = 1;
private static final int VIEW_TYPE_USER_DIVIDER = 2;
@@ -289,6 +290,21 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
notifyDataSetChanged();
}
+ @NonNull
+ @Override
+ public String getPopupText(int position) {
+ switch (getItemViewType(position)) {
+ case VIEW_TYPE_USER_DIVIDER:
+ int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ?
+ mFavoriteSubscribedUserData.size() + 2 : 0;
+ return mSubscribedUserData.get(position - offset).getName().substring(0, 1).toUpperCase();
+ case VIEW_TYPE_FAVORITE_USER:
+ return mFavoriteSubscribedUserData.get(position - 1).getName().substring(0, 1).toUpperCase();
+ default:
+ return "";
+ }
+ }
+
class FavoriteUserViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.thing_icon_gif_image_view_item_subscribed_thing)
GifImageView iconGifImageView;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java
index 8d99220e..7ededb6d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java
@@ -22,6 +22,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
+import me.zhanghai.android.fastscroll.PopupTextProvider;
import ml.docilealligator.infinityforreddit.Activity.ViewMultiRedditDetailActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Fragment.MultiRedditOptionsBottomSheetFragment;
@@ -32,7 +33,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
-public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements PopupTextProvider {
private static final int VIEW_TYPE_FAVORITE_MULTI_REDDIT_DIVIDER = 0;
private static final int VIEW_TYPE_FAVORITE_MULTI_REDDIT = 1;
@@ -328,6 +329,21 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
notifyDataSetChanged();
}
+ @NonNull
+ @Override
+ public String getPopupText(int position) {
+ switch (getItemViewType(position)) {
+ case VIEW_TYPE_MULTI_REDDIT:
+ int offset = (mFavoriteMultiReddits != null && mFavoriteMultiReddits.size() > 0) ?
+ mFavoriteMultiReddits.size() + 2 : 0;
+ return mMultiReddits.get(position - offset).getDisplayName().substring(0, 1).toUpperCase();
+ case VIEW_TYPE_FAVORITE_MULTI_REDDIT:
+ return mFavoriteMultiReddits.get(position - 1).getDisplayName().substring(0, 1).toUpperCase();
+ default:
+ return "";
+ }
+ }
+
class MultiRedditViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.multi_reddit_icon_gif_image_view_item_multi_reddit)
GifImageView iconImageView;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java
index 3f503fea..d5cb996a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java
@@ -21,6 +21,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
+import me.zhanghai.android.fastscroll.PopupTextProvider;
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.FavoriteThing;
@@ -30,7 +31,7 @@ import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.Subscrib
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
-public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements PopupTextProvider {
private static final int VIEW_TYPE_FAVORITE_SUBREDDIT_DIVIDER = 0;
private static final int VIEW_TYPE_FAVORITE_SUBREDDIT = 1;
private static final int VIEW_TYPE_SUBREDDIT_DIVIDER = 2;
@@ -409,6 +410,51 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
this.userIconUrl = userIconUrl;
}
+ @NonNull
+ @Override
+ public String getPopupText(int position) {
+ switch (getItemViewType(position)) {
+ case VIEW_TYPE_SUBREDDIT:
+ if (hasClearSelectionRow && position == 0) {
+ return "";
+ } else if (itemClickListener != null && !hasClearSelectionRow && position == 0) {
+ return "";
+ } else if (hasClearSelectionRow && position == 1) {
+ return "";
+ } else {
+ int offset;
+ if (itemClickListener != null) {
+ if (hasClearSelectionRow) {
+ offset = (mFavoriteSubscribedSubredditData != null && mFavoriteSubscribedSubredditData.size() > 0) ?
+ mFavoriteSubscribedSubredditData.size() + 4 : 0;
+ } else {
+ offset = (mFavoriteSubscribedSubredditData != null && mFavoriteSubscribedSubredditData.size() > 0) ?
+ mFavoriteSubscribedSubredditData.size() + 3 : 0;
+ }
+ } else {
+ offset = (mFavoriteSubscribedSubredditData != null && mFavoriteSubscribedSubredditData.size() > 0) ?
+ mFavoriteSubscribedSubredditData.size() + 2 : 0;
+ }
+
+ return mSubscribedSubredditData.get(position - offset).getName().substring(0, 1).toUpperCase();
+ }
+ case VIEW_TYPE_FAVORITE_SUBREDDIT:
+ int offset;
+ if (itemClickListener != null) {
+ if (hasClearSelectionRow) {
+ offset = 3;
+ } else {
+ offset = 2;
+ }
+ } else {
+ offset = 1;
+ }
+ return mFavoriteSubscribedSubredditData.get(position - offset).getName().substring(0, 1).toUpperCase();
+ default:
+ return "";
+ }
+ }
+
public interface ItemClickListener {
void onClick(String name, String iconUrl, boolean subredditIsUser);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java
index acee318a..f34dee6c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java
@@ -29,6 +29,7 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import me.zhanghai.android.fastscroll.FastScrollerBuilder;
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
import ml.docilealligator.infinityforreddit.Adapter.FollowedUsersRecyclerViewAdapter;
@@ -108,6 +109,7 @@ public class FollowedUsersListingFragment extends Fragment implements FragmentCo
mOauthRetrofit, mRedditDataRoomDatabase, customThemeWrapper,
getArguments().getString(EXTRA_ACCESS_TOKEN));
mRecyclerView.setAdapter(adapter);
+ new FastScrollerBuilder(mRecyclerView).build();
mSubscribedUserViewModel = new ViewModelProvider(this,
new SubscribedUserViewModel.Factory(mActivity.getApplication(), mRedditDataRoomDatabase, getArguments().getString(EXTRA_ACCOUNT_NAME)))
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java
index 09bd6e32..7ee62bdf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java
@@ -29,6 +29,7 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import me.zhanghai.android.fastscroll.FastScrollerBuilder;
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity;
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
@@ -122,6 +123,7 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
}
mRecyclerView.setAdapter(adapter);
+ new FastScrollerBuilder(mRecyclerView).build();
mSubscribedSubredditViewModel = new ViewModelProvider(this,
new SubscribedSubredditViewModel.Factory(mActivity.getApplication(), mRedditDataRoomDatabase, accountName))