1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 00:27:30 +00:00
This commit is contained in:
Austin Huang 2020-12-31 20:20:46 -05:00
parent 251228dcc4
commit f85e0fc54c
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
14 changed files with 49 additions and 15 deletions

View File

@ -554,7 +554,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
if (!hasStories) return;
// show stories
final NavDirections action = HashTagFragmentDirections
.actionHashtagFragmentToStoryViewerFragment(-1, null, true, false, hashtagModel.getName(), hashtagModel.getName(), false);
.actionHashtagFragmentToStoryViewerFragment(-1, null, true, false, hashtagModel.getName(), hashtagModel.getName(), false, false);
NavHostFragment.findNavController(this).navigate(action);
});
}

View File

@ -523,7 +523,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
if (hasStories) {
// show stories
final NavDirections action = LocationFragmentDirections
.actionLocationFragmentToStoryViewerFragment(-1, null, false, true, locationId, locationModel.getName(), false);
.actionLocationFragmentToStoryViewerFragment(-1, null, false, true, locationId, locationModel.getName(), false, false);
NavHostFragment.findNavController(this).navigate(action);
}
});

View File

@ -77,7 +77,7 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
public void onPreviewClick(final NotificationModel model) {
if (model.getType() == NotificationType.RESPONDED_STORY) {
final NavDirections action = NotificationsViewerFragmentDirections.actionNotificationsViewerFragmentToStoryViewerFragment(
-1, null, false, false, model.getPostId(), model.getUsername(), false);
-1, null, false, false, model.getPostId(), model.getUsername(), false, true);
NavHostFragment.findNavController(NotificationsViewerFragment.this).navigate(action);
}
else {
@ -155,7 +155,7 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
}
else if (model.getType() == NotificationType.RESPONDED_STORY) {
final NavDirections action = NotificationsViewerFragmentDirections.actionNotificationsViewerFragmentToStoryViewerFragment(
-1, null, false, false, model.getPostId(), model.getUsername(), false);
-1, null, false, false, model.getPostId(), model.getUsername(), false, true);
NavHostFragment.findNavController(NotificationsViewerFragment.this).navigate(action);
return;
}

View File

@ -63,7 +63,7 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
@Override
public void onFeedStoryClick(final FeedStoryModel model, final int position) {
if (model == null) return;
final NavDirections action = StoryListViewerFragmentDirections.actionStoryListFragmentToStoryViewerFragment(position, null, false, false, null, null, false);
final NavDirections action = StoryListViewerFragmentDirections.actionStoryListFragmentToStoryViewerFragment(position, null, false, false, null, null, false, false);
NavHostFragment.findNavController(StoryListViewerFragment.this).navigate(action);
}
@ -78,7 +78,7 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
public void onHighlightClick(final HighlightModel model, final int position) {
if (model == null) return;
final NavDirections action = StoryListViewerFragmentDirections.actionStoryListFragmentToStoryViewerFragment(
position, getString(R.string.action_archive), false, false, null, null, true);
position, getString(R.string.action_archive), false, false, null, null, true, false);
NavHostFragment.findNavController(StoryListViewerFragment.this).navigate(action);
}
@ -138,6 +138,13 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr
shouldRefresh = false;
}
@Override
public void onResume() {
super.onResume();
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) actionBar.setTitle(type == "feed" ? R.string.feed_stories : R.string.action_archive);
}
@Override
public void onDestroy() {
if (archivesViewModel != null) archivesViewModel.getList().postValue(null);

View File

@ -133,14 +133,13 @@ public class StoryViewerFragment extends Fragment {
private SimpleExoPlayer player;
private boolean isHashtag, isLoc;
private String highlight;
private boolean fetching = false, sticking = false;
private boolean fetching = false, sticking = false, shouldRefresh = true;
private int currentFeedStoryIndex;
private double sliderValue;
private StoriesViewModel storiesViewModel;
private boolean shouldRefresh = true;
private StoryViewerFragmentArgs fragmentArgs;
private ViewModel viewModel;
private boolean isHighlight, isArchive;
private boolean isHighlight, isArchive, isNotification;
private final String cookie = settingsHelper.getString(Constants.COOKIE);
@ -258,6 +257,7 @@ public class StoryViewerFragment extends Fragment {
highlight = fragmentArgs.getHighlight();
isHighlight = !TextUtils.isEmpty(highlight);
isArchive = fragmentArgs.getIsArchive();
isNotification = fragmentArgs.getIsNotification();
if (currentFeedStoryIndex >= 0) {
viewModel = isHighlight
? isArchive
@ -693,7 +693,7 @@ public class StoryViewerFragment extends Fragment {
}
storiesViewModel.getList().setValue(Collections.emptyList());
if (currentStoryMediaId == null) return;
else if (currentFeedStoryIndex == -1) {
else if (isNotification) {
storiesService.fetch(currentStoryMediaId, new ServiceCallback<StoryModel>() {
@Override
public void onSuccess(final StoryModel storyModel) {
@ -728,7 +728,9 @@ public class StoryViewerFragment extends Fragment {
binding.storiesList.setVisibility(View.GONE);
return;
}
binding.storiesList.setVisibility(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();

View File

@ -357,7 +357,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
new FeedStoriesAdapter.OnFeedStoryClickListener() {
@Override
public void onFeedStoryClick(FeedStoryModel model, int position) {
final NavDirections action = FeedFragmentDirections.actionFeedFragmentToStoryViewerFragment(position, null, false, false, null, null, false);
final NavDirections action = FeedFragmentDirections.actionFeedFragmentToStoryViewerFragment(position, null, false, false, null, null, false, false);
NavHostFragment.findNavController(FeedFragment.this).navigate(action);
}

View File

@ -1008,7 +1008,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
if (which == 1) {
// show stories
final NavDirections action = ProfileFragmentDirections
.actionProfileFragmentToStoryViewerFragment(-1, null, false, false, profileModel.getId(), username, false);
.actionProfileFragmentToStoryViewerFragment(-1, null, false, false, profileModel.getId(), username, false, false);
NavHostFragment.findNavController(this).navigate(action);
return;
}
@ -1069,7 +1069,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
highlightsViewModel = new ViewModelProvider(fragmentActivity).get(HighlightsViewModel.class);
highlightsAdapter = new HighlightsAdapter((model, position) -> {
final NavDirections action = ProfileFragmentDirections
.actionProfileFragmentToStoryViewerFragment(position, model.getTitle(), false, false, null, null, false);
.actionProfileFragmentToStoryViewerFragment(position, model.getTitle(), false, false, null, null, false, false);
NavHostFragment.findNavController(this).navigate(action);
});
final Context context = getContext();

View File

@ -217,7 +217,7 @@ public class StoriesService extends BaseService {
null,
highlightNode.getString(Constants.EXTRAS_ID),
highlightNode.getJSONObject("cover_image_version").getString("url"),
highlightNode.getLong("timestamp"),
highlightNode.getLong("latest_reel_media"),
highlightNode.getInt("media_count")
));
}
@ -246,6 +246,7 @@ public class StoriesService extends BaseService {
final boolean highlight,
final ServiceCallback<List<StoryModel>> callback) {
final String url = buildUrl(id, isLoc, isHashtag, highlight);
Log.d("austin_debug", url);
final Call<String> userStoryCall = repository.getUserStory(Constants.I_USER_AGENT, url);
userStoryCall.enqueue(new Callback<String>() {
@Override

View File

@ -134,5 +134,9 @@
android:name="isArchive"
app:argType="boolean"
app:nullable="false" />
<argument
android:name="isNotification"
app:argType="boolean"
app:nullable="false" />
</fragment>
</navigation>

View File

@ -101,6 +101,10 @@
android:name="isArchive"
app:argType="boolean"
app:nullable="false" />
<argument
android:name="isNotification"
app:argType="boolean"
app:nullable="false" />
</fragment>
<action
android:id="@+id/action_global_hashTagFragment"

View File

@ -109,5 +109,9 @@
android:name="isArchive"
app:argType="boolean"
app:nullable="false" />
<argument
android:name="isNotification"
app:argType="boolean"
app:nullable="false" />
</fragment>
</navigation>

View File

@ -93,5 +93,9 @@
android:name="isArchive"
app:argType="boolean"
app:nullable="false" />
<argument
android:name="isNotification"
app:argType="boolean"
app:nullable="false" />
</fragment>
</navigation>

View File

@ -183,6 +183,10 @@
android:name="isArchive"
app:argType="boolean"
app:nullable="false" />
<argument
android:name="isNotification"
app:argType="boolean"
app:nullable="false" />
</fragment>
<fragment
android:id="@+id/directMessagesThreadFragment"

View File

@ -68,5 +68,9 @@
android:name="isArchive"
app:argType="boolean"
app:nullable="false" />
<argument
android:name="isNotification"
app:argType="boolean"
app:nullable="false" />
</fragment>
</navigation>