aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/build.gradle8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java98
3 files changed, 71 insertions, 67 deletions
diff --git a/app/build.gradle b/app/build.gradle
index e36b6bbe..c4a04917 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21
targetSdkVersion 29
- versionCode 19
- versionName "1.4.0"
+ versionCode 20
+ versionName "1.4.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -34,7 +34,7 @@ repositories {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'com.google.android.material:material:1.2.0-alpha01'
+ implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
@@ -55,7 +55,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$rootProject.archLifecycleVersion"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
- implementation 'io.reactivex.rxjava2:rxjava:2.2.13'
+ implementation 'io.reactivex.rxjava2:rxjava:2.2.14'
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.2'
implementation 'jp.wasabeef:glide-transformations:4.0.0'
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java
index 160fa136..ffd882d6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java
@@ -145,11 +145,13 @@ public class SubredditSelectionActivity extends BaseActivity {
mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE);
mAccountProfileImageUrl = savedInstanceState.getString(ACCOUNT_PROFILE_IMAGE_URL);
+ mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
+
if (!mNullAccessToken && mAccountName == null) {
getCurrentAccountAndBindView();
} else {
- mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
+ bindView(false);
}
}
}
@@ -168,24 +170,26 @@ public class SubredditSelectionActivity extends BaseActivity {
mAccountName = account.getUsername();
mAccountProfileImageUrl = account.getProfileImageUrl();
}
- bindView();
+ bindView(true);
}).execute();
}
- private void bindView() {
+ private void bindView(boolean initializeFragment) {
loadSubscriptions();
- mFragment = new SubscribedSubredditsListingFragment();
- Bundle bundle = new Bundle();
- bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
- bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_PROFILE_IMAGE_URL, mAccountProfileImageUrl);
- bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_IS_SUBREDDIT_SELECTION, true);
- if (getIntent().hasExtra(EXTRA_EXTRA_CLEAR_SELECTION)) {
- bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_EXTRA_CLEAR_SELECTION,
- getIntent().getExtras().getBoolean(EXTRA_EXTRA_CLEAR_SELECTION));
+ if (initializeFragment) {
+ mFragment = new SubscribedSubredditsListingFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
+ bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_PROFILE_IMAGE_URL, mAccountProfileImageUrl);
+ bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_IS_SUBREDDIT_SELECTION, true);
+ if (getIntent().hasExtra(EXTRA_EXTRA_CLEAR_SELECTION)) {
+ bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_EXTRA_CLEAR_SELECTION,
+ getIntent().getExtras().getBoolean(EXTRA_EXTRA_CLEAR_SELECTION));
+ }
+ mFragment.setArguments(bundle);
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
}
- mFragment.setArguments(bundle);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
}
private void loadSubscriptions() {
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 12f06260..50454381 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -890,6 +890,55 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
});
}
});
+
+ ((CommentViewHolder) holder).authorTextView.setOnClickListener(view -> {
+ Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
+ if (mIsSingleCommentThreadMode) {
+ intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mVisibleComments.get(holder.getAdapterPosition() - 2).getAuthor());
+ } else {
+ intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mVisibleComments.get(holder.getAdapterPosition() - 1).getAuthor());
+ }
+ mActivity.startActivity(intent);
+ });
+
+ ((CommentViewHolder) holder).shareButton.setOnClickListener(view -> {
+ try {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("text/plain");
+ String extraText = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2).getPermalink()
+ : mVisibleComments.get(holder.getAdapterPosition() - 1).getPermalink();
+ intent.putExtra(Intent.EXTRA_TEXT, extraText);
+ mActivity.startActivity(Intent.createChooser(intent, mActivity.getString(R.string.share)));
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(mActivity, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ ((CommentViewHolder) holder).expandButton.setOnClickListener(view -> {
+ if (((CommentViewHolder) holder).expandButton.getVisibility() == View.VISIBLE) {
+ int commentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1;
+ if(commentPosition < mVisibleComments.size()) {
+ if (mVisibleComments.get(commentPosition).isExpanded()) {
+ collapseChildren(commentPosition);
+ ((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
+ } else {
+ expandChildren(commentPosition);
+ mVisibleComments.get(commentPosition).setExpanded(true);
+ ((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
+ }
+ }
+ }
+ });
+
+ ((CommentViewHolder) holder).commentMarkdownView.setOnLongClickListener(view -> {
+ ((CommentViewHolder) holder).expandButton.performClick();
+ return true;
+ });
+
+ ((CommentViewHolder) holder).itemView.setOnLongClickListener(view -> {
+ ((CommentViewHolder) holder).expandButton.performClick();
+ return true;
+ });
} else if (holder instanceof LoadMoreChildCommentsViewHolder) {
CommentData placeholder;
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
@@ -1730,55 +1779,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
super(itemView);
ButterKnife.bind(this, itemView);
- authorTextView.setOnClickListener(view -> {
- Intent intent = new Intent(mActivity, ViewUserDetailActivity.class);
- if (mIsSingleCommentThreadMode) {
- intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mVisibleComments.get(getAdapterPosition() - 2).getAuthor());
- } else {
- intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mVisibleComments.get(getAdapterPosition() - 1).getAuthor());
- }
- mActivity.startActivity(intent);
- });
-
- shareButton.setOnClickListener(view -> {
- try {
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType("text/plain");
- String extraText = mIsSingleCommentThreadMode ? mVisibleComments.get(getAdapterPosition() - 2).getPermalink()
- : mVisibleComments.get(getAdapterPosition() - 1).getPermalink();
- intent.putExtra(Intent.EXTRA_TEXT, extraText);
- mActivity.startActivity(Intent.createChooser(intent, mActivity.getString(R.string.share)));
- } catch (ActivityNotFoundException e) {
- Toast.makeText(mActivity, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
- }
- });
-
- expandButton.setOnClickListener(view -> {
- if (expandButton.getVisibility() == View.VISIBLE) {
- int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
- if(commentPosition < mVisibleComments.size()) {
- if (mVisibleComments.get(commentPosition).isExpanded()) {
- collapseChildren(commentPosition);
- expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
- } else {
- expandChildren(commentPosition);
- mVisibleComments.get(commentPosition).setExpanded(true);
- expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
- }
- }
- }
- });
-
- commentMarkdownView.setOnLongClickListener(view -> {
- expandButton.performClick();
- return true;
- });
-
- itemView.setOnLongClickListener(view -> {
- expandButton.performClick();
- return true;
- });
-
if (mVoteButtonsOnTheRight) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(bottomConstraintLayout);