From 9469ecc611a6be16ae0c7fe60e8704574675c3cb Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 26 Aug 2019 20:16:40 +0800 Subject: Don't start lazy mode when refreshing posts in PostFragment. Minor bugs fixed. --- .../java/ml/docilealligator/infinityforreddit/PostFragment.java | 2 ++ .../ml/docilealligator/infinityforreddit/PostImageActivity.java | 4 +++- .../java/ml/docilealligator/infinityforreddit/PostLinkActivity.java | 4 +++- .../java/ml/docilealligator/infinityforreddit/PostTextActivity.java | 3 ++- .../ml/docilealligator/infinityforreddit/PostVideoActivity.java | 4 +++- .../infinityforreddit/ViewSubredditDetailActivity.java | 6 +++--- 6 files changed, 16 insertions(+), 7 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java index b9275e62..7420893e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java @@ -406,6 +406,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator { if(isInLazyMode) { stopLazyMode(); } + + hasPost = false; mPostViewModel.refresh(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java index 6e52811c..ca684b35 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java @@ -227,7 +227,9 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS isPosting = false; if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { - subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); + loadSubredditIconSuccessful = false; + subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); + subredditSelected = true; subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setText(subredditName); loadSubredditIcon(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java index faa7769c..415929c4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java @@ -197,7 +197,9 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh isPosting = false; if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { - subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); + loadSubredditIconSuccessful = false; + subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); + subredditSelected = true; subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setText(subredditName); flairTextView.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java index 1d34d6fa..79e22955 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java @@ -198,7 +198,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { loadSubredditIconSuccessful = false; - subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); + subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); + subredditSelected = true; subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setText(subredditName); flairTextView.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java index bfdb0a21..92bef7e7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java @@ -225,7 +225,9 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS isPosting = false; if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) { - subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME); + loadSubredditIconSuccessful = false; + subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); + subredditSelected = true; subredditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor)); subredditNameTextView.setText(subredditName); loadSubredditIcon(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java index 6527c928..c1f10bd4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java @@ -554,17 +554,17 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So break; case PostTypeBottomSheetFragment.TYPE_LINK: intent = new Intent(this, PostLinkActivity.class); - intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(PostLinkActivity.EXTRA_SUBREDDIT_NAME, subredditName); startActivity(intent); break; case PostTypeBottomSheetFragment.TYPE_IMAGE: intent = new Intent(this, PostImageActivity.class); - intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(PostImageActivity.EXTRA_SUBREDDIT_NAME, subredditName); startActivity(intent); break; case PostTypeBottomSheetFragment.TYPE_VIDEO: intent = new Intent(this, PostVideoActivity.class); - intent.putExtra(PostTextActivity.EXTRA_SUBREDDIT_NAME, subredditName); + intent.putExtra(PostVideoActivity.EXTRA_SUBREDDIT_NAME, subredditName); startActivity(intent); } } -- cgit v1.2.3