Browse Source

#532 point 2

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
b5e1101709
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 21
      app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java

21
app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java

@ -132,7 +132,7 @@ public class StoryViewerFragment extends Fragment {
private MenuItem menuDm; private MenuItem menuDm;
private SimpleExoPlayer player; private SimpleExoPlayer player;
private boolean isHashtag, isLoc; private boolean isHashtag, isLoc;
private String highlight;
private String highlight, actionBarTitle;
private boolean fetching = false, sticking = false, shouldRefresh = true; private boolean fetching = false, sticking = false, shouldRefresh = true;
private int currentFeedStoryIndex; private int currentFeedStoryIndex;
private double sliderValue; private double sliderValue;
@ -239,6 +239,15 @@ public class StoryViewerFragment extends Fragment {
releasePlayer(); releasePlayer();
} }
@Override
public void onResume() {
super.onResume();
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(actionBarTitle);
}
}
@Override @Override
public void onDestroy() { public void onDestroy() {
releasePlayer(); releasePlayer();
@ -681,6 +690,7 @@ public class StoryViewerFragment extends Fragment {
if (isHighlight) { if (isHighlight) {
final ActionBar actionBar = fragmentActivity.getSupportActionBar(); final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
actionBarTitle = highlight;
actionBar.setTitle(highlight); actionBar.setTitle(highlight);
} }
} }
@ -688,6 +698,7 @@ public class StoryViewerFragment extends Fragment {
currentStoryUsername = currentStoryUsername.replace("@", ""); currentStoryUsername = currentStoryUsername.replace("@", "");
final ActionBar actionBar = fragmentActivity.getSupportActionBar(); final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
actionBarTitle = currentStoryUsername;
actionBar.setTitle(currentStoryUsername); actionBar.setTitle(currentStoryUsername);
} }
} }
@ -729,13 +740,6 @@ public class StoryViewerFragment extends Fragment {
return; return;
} }
binding.storiesList.setVisibility((storyModels.size() == 1 && currentFeedStoryIndex == -1) ? View.GONE : View.VISIBLE); binding.storiesList.setVisibility((storyModels.size() == 1 && currentFeedStoryIndex == -1) ? View.GONE : View.VISIBLE);
binding.btnBackward.setVisibility(currentFeedStoryIndex == -1 ? View.GONE : View.VISIBLE);
binding.btnForward.setVisibility(currentFeedStoryIndex == -1 ? View.GONE : View.VISIBLE);
storiesViewModel.getList().setValue(storyModels);
currentStory = storyModels.get(0);
refreshStory();
}
binding.storiesList.setVisibility((storyModels.size() == 1 && currentFeedStoryIndex == -1) ? View.GONE : View.VISIBLE);
if (currentFeedStoryIndex == -1) { if (currentFeedStoryIndex == -1) {
binding.btnBackward.setVisibility(View.GONE); binding.btnBackward.setVisibility(View.GONE);
binding.btnForward.setVisibility(View.GONE); binding.btnForward.setVisibility(View.GONE);
@ -823,6 +827,7 @@ public class StoryViewerFragment extends Fragment {
if (isHashtag || isLoc) { if (isHashtag || isLoc) {
final ActionBar actionBar = fragmentActivity.getSupportActionBar(); final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
actionBarTitle = currentStory.getUsername();
actionBar.setTitle(currentStory.getUsername()); actionBar.setTitle(currentStory.getUsername());
} }
} }

Loading…
Cancel
Save