mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-10 08:28:44 +01:00
Fixed IllegalStateException in SubredditSelectionActivity. Downgrade material library to fix the bugs introduced in the last update.
This commit is contained in:
parent
eae6c24868
commit
b62ab6f443
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "ml.docilealligator.infinityforreddit"
|
applicationId "ml.docilealligator.infinityforreddit"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 19
|
versionCode 20
|
||||||
versionName "1.4.0"
|
versionName "1.4.1"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -34,7 +34,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
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.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||||
@ -55,7 +55,7 @@ dependencies {
|
|||||||
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
|
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
|
||||||
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$rootProject.archLifecycleVersion"
|
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$rootProject.archLifecycleVersion"
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
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:retrofit:2.6.2'
|
||||||
implementation 'com.squareup.retrofit2:converter-scalars:2.6.2'
|
implementation 'com.squareup.retrofit2:converter-scalars:2.6.2'
|
||||||
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
implementation 'jp.wasabeef:glide-transformations:4.0.0'
|
||||||
|
@ -145,11 +145,13 @@ public class SubredditSelectionActivity extends BaseActivity {
|
|||||||
mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE);
|
mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE);
|
||||||
mAccountProfileImageUrl = savedInstanceState.getString(ACCOUNT_PROFILE_IMAGE_URL);
|
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) {
|
if (!mNullAccessToken && mAccountName == null) {
|
||||||
getCurrentAccountAndBindView();
|
getCurrentAccountAndBindView();
|
||||||
} else {
|
} else {
|
||||||
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
|
bindView(false);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,13 +170,14 @@ public class SubredditSelectionActivity extends BaseActivity {
|
|||||||
mAccountName = account.getUsername();
|
mAccountName = account.getUsername();
|
||||||
mAccountProfileImageUrl = account.getProfileImageUrl();
|
mAccountProfileImageUrl = account.getProfileImageUrl();
|
||||||
}
|
}
|
||||||
bindView();
|
bindView(true);
|
||||||
}).execute();
|
}).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindView() {
|
private void bindView(boolean initializeFragment) {
|
||||||
loadSubscriptions();
|
loadSubscriptions();
|
||||||
|
|
||||||
|
if (initializeFragment) {
|
||||||
mFragment = new SubscribedSubredditsListingFragment();
|
mFragment = new SubscribedSubredditsListingFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
|
bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
|
||||||
@ -187,6 +190,7 @@ public class SubredditSelectionActivity extends BaseActivity {
|
|||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void loadSubscriptions() {
|
private void loadSubscriptions() {
|
||||||
if (!mInsertSuccess) {
|
if (!mInsertSuccess) {
|
||||||
|
@ -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) {
|
} else if (holder instanceof LoadMoreChildCommentsViewHolder) {
|
||||||
CommentData placeholder;
|
CommentData placeholder;
|
||||||
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
|
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
|
||||||
@ -1730,55 +1779,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
super(itemView);
|
super(itemView);
|
||||||
ButterKnife.bind(this, 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) {
|
if (mVoteButtonsOnTheRight) {
|
||||||
ConstraintSet constraintSet = new ConstraintSet();
|
ConstraintSet constraintSet = new ConstraintSet();
|
||||||
constraintSet.clone(bottomConstraintLayout);
|
constraintSet.clone(bottomConstraintLayout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user