From 7e96130d200f7791ab4c3e2deb0cc2ca9f152e93 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 16 Sep 2019 21:25:41 +0800 Subject: 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. --- app/src/main/AndroidManifest.xml | 2 +- .../CommentAndPostRecyclerViewAdapter.java | 33 +++++++++++++++++----- .../infinityforreddit/MainActivity.java | 2 -- .../SubredditSelectionActivity.java | 10 +++++-- 4 files changed, 34 insertions(+), 13 deletions(-) (limited to 'app/src') 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 @@ + android:theme="@style/AppTheme.NoActionBarWithTransparentStatusBar"> 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 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 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= 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= 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); -- cgit v1.2.3