diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-09-17 00:44:48 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-09-17 00:44:48 +0000 |
commit | 3592dc29dabe1fbc41f4af5536e395987963c810 (patch) | |
tree | 0f7ad4c54fd819f553c917726e61957f8b2b74b9 /app | |
parent | 4e036da000a6242d2f37a00f09f3c938c13e640e (diff) | |
download | infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.tar infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.tar.gz infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.tar.bz2 infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.tar.lz infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.tar.xz infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.tar.zst infinity-for-reddit-3592dc29dabe1fbc41f4af5536e395987963c810.zip |
Fixed android.view.DisplayListCanvas.throwIfCannotDraw in ViewPostDetailActivity. Fixed app crashes when pressing the comment button in ViewPostDetailActivity while the post is not loaded. Re-enable spalsh screen.
Diffstat (limited to '')
5 files changed, 37 insertions, 21 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index da61fa45..81a9c8f3 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.NoActionBarWithTransparentStatusBar"> + android:theme="@style/AppTheme.Launcher"> <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 1cbc1466..28249f40 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java @@ -741,7 +741,6 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie private void loadImage(PostDetailViewHolder holder) { RequestBuilder imageRequestBuilder = mGlide.load(mPost.getPreviewUrl()) - .apply(new RequestOptions().override(mPost.getPreviewWidth(), mPost.getPreviewHeight())) .listener(new RequestListener<Drawable>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java index 389dc1d5..f07c0f39 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java @@ -163,6 +163,8 @@ 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/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java index 27b31083..04e013fe 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java @@ -305,6 +305,9 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo if(mMenu != null) { MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); + + mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); + if(mAccessToken != null) { if(mPost.isSaved()) { saveItem.setVisible(true); @@ -431,6 +434,9 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo if(mMenu != null) { MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); + + mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); + if(mAccessToken != null) { if(post.isSaved()) { saveItem.setVisible(true); @@ -654,6 +660,9 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo if(mMenu != null) { MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); + + mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); + if(mAccessToken != null) { if(post.isSaved()) { saveItem.setVisible(true); @@ -906,6 +915,9 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo if(mPost != null) { MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); + + mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); + if(mAccessToken != null) { if(mPost.isSaved()) { saveItem.setVisible(true); @@ -964,27 +976,29 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo refresh(true, true); return true; case R.id.action_comment_view_post_detail_activity: - if(mPost.isArchived()) { - showMessage(R.string.archived_post_reply_unavailable); - return true; - } + if(mPost != null) { + if(mPost.isArchived()) { + showMessage(R.string.archived_post_reply_unavailable); + return true; + } - if(mPost.isLocked()) { - showMessage(R.string.locked_post_comment_unavailable); - return true; - } + if(mPost.isLocked()) { + showMessage(R.string.locked_post_comment_unavailable); + return true; + } - if(mAccessToken == null) { - showMessage(R.string.login_first); - return true; - } + if(mAccessToken == null) { + showMessage(R.string.login_first); + return true; + } - Intent intent = new Intent(this, CommentActivity.class); - intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, mPost.getTitle()); - intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, mPost.getFullName()); - intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0); - intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false); - startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE); + Intent intent = new Intent(this, CommentActivity.class); + intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, mPost.getTitle()); + intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, mPost.getFullName()); + intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0); + intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false); + startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE); + } return true; case R.id.action_save_view_post_detail_activity: if(mPost != null && mAccessToken != null) { diff --git a/app/src/main/res/menu/view_post_detail_activity.xml b/app/src/main/res/menu/view_post_detail_activity.xml index d971b154..63c2106f 100644 --- a/app/src/main/res/menu/view_post_detail_activity.xml +++ b/app/src/main/res/menu/view_post_detail_activity.xml @@ -6,7 +6,8 @@ android:orderInCategory="1" android:title="@string/action_add_comment" android:icon="@drawable/ic_insert_comment_white_24dp" - app:showAsAction="ifRoom" /> + app:showAsAction="ifRoom" + android:visible="false" /> <item android:id="@+id/action_save_view_post_detail_activity" |