aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-09-16 13:25:41 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-09-16 13:25:41 +0000
commit7e96130d200f7791ab4c3e2deb0cc2ca9f152e93 (patch)
tree8cc80987c3245efbc0fec2246e2f8090af6bd8f2
parent8b366c0961f7f79539eac38082e4915ac3f48030 (diff)
downloadinfinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.tar
infinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.tar.gz
infinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.tar.bz2
infinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.tar.lz
infinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.tar.xz
infinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.tar.zst
infinity-for-reddit-7e96130d200f7791ab4c3e2deb0cc2ca9f152e93.zip
Shrink the vertical block in comments tree. Temporarily disable the splash screen to see if android.view.DisplayListCanvas.throwIfCannotDraw exception will be gone. Minor bugs fixed.
Diffstat (limited to '')
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java33
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java10
4 files changed, 34 insertions, 13 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 81a9c8f3..da61fa45 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -193,7 +193,7 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
- android:theme="@style/AppTheme.Launcher">
+ android:theme="@style/AppTheme.NoActionBarWithTransparentStatusBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
index 95cb37dd..eb815582 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java
@@ -511,9 +511,12 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
mMarkwon.setMarkdown(((CommentViewHolder) holder).commentMarkdownView, comment.getCommentContent());
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore() + comment.getVoteType()));
- ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
- params.width = comment.getDepth() * 16;
- ((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
+ ((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 16, 0, 0, 0);
+ if(comment.getDepth() > 0) {
+ ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
+ params.width = 16;
+ ((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
+ }
if(!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
((CommentViewHolder) holder).moreButton.setVisibility(View.VISIBLE);
@@ -717,9 +720,12 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
: mVisibleComments.get(holder.getAdapterPosition() - 1);
- ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
- params.width = placeholder.getDepth() * 16;
- ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
+ ((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(placeholder.getDepth() * 16, 0, 0, 0);
+ if(placeholder.getDepth() > 0) {
+ ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
+ params.width = 16;
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
+ }
if(placeholder.isLoadingMoreChildren()) {
((LoadMoreChildCommentsViewHolder) holder).placeholderTextView.setText(R.string.loading);
@@ -770,6 +776,10 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
}
private int getParentPosition(int position) {
+ if(position >= mVisibleComments.size()) {
+ return -1;
+ }
+
int childDepth = mVisibleComments.get(position).getDepth();
for(int i = position; i >= 0; i--) {
if(mVisibleComments.get(i).getDepth() < childDepth) {
@@ -977,6 +987,10 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
((CommentViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mActivity, R.color.defaultTextColor));
((CommentViewHolder) holder).downVoteButton.clearColorFilter();
((CommentViewHolder) holder).replyButton.clearColorFilter();
+ ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
+ params.width = 0;
+ ((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
+ ((CommentViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
((CommentViewHolder) holder).itemView.setBackgroundColor(
mActivity.getResources().getColor(R.color.cardViewBackgroundColor));
} else if(holder instanceof PostDetailViewHolder) {
@@ -987,6 +1001,11 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
((PostDetailViewHolder) holder).flairTextView.setVisibility(View.GONE);
((PostDetailViewHolder) holder).spoilerTextView.setVisibility(View.GONE);
((PostDetailViewHolder) holder).mNSFWChip.setVisibility(View.GONE);
+ } else if(holder instanceof LoadMoreChildCommentsViewHolder) {
+ ((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
+ ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
+ params.width = 0;
+ ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
}
}
@@ -1413,7 +1432,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
if(mVisibleComments.get(parentPosition).isExpanded()) {
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
int placeholderPosition = commentPosition;
- if(!mVisibleComments.get(commentPosition).getFullName().equals(parentComment.getFullName())) {
+ if(commentPosition >= mVisibleComments.size() || !mVisibleComments.get(commentPosition).getFullName().equals(parentComment.getFullName())) {
for(int i = parentPosition + 1; i < mVisibleComments.size(); i++) {
if(mVisibleComments.get(i).getFullName().equals(parentComment.getFullName())) {
placeholderPosition = i;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index e62b164d..f4c90da5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -157,8 +157,6 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
@Override
protected void onCreate(Bundle savedInstanceState) {
- setTheme(R.style.AppTheme_NoActionBarWithTransparentStatusBar);
-
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
index ed9573fd..ee452eca 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
@@ -165,7 +165,11 @@ public class SubredditSelectionActivity extends AppCompatActivity {
getCurrentAccountAndBindView();
} else {
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
+ if(mFragment == null) {
+ bindView();
+ } else {
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
+ }
}
}
}
@@ -262,8 +266,8 @@ public class SubredditSelectionActivity extends AppCompatActivity {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if(requestCode == SUBREDDIT_SEARCH_REQUEST_CODE) {
if(resultCode == RESULT_OK) {
- String name = data.getExtras().getString(SearchActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- String iconUrl = data.getExtras().getString(SearchActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ String name = data.getStringExtra(SearchActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ String iconUrl = data.getStringExtra(SearchActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
Intent returnIntent = new Intent();
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);