@@ -240,6 +240,15 @@ class StoryViewerFragment : Fragment() {
240
240
storyMedias.set(0 , newItem)
241
241
storiesAdapter!! .submitList(storyMedias)
242
242
storiesViewModel.setMedia(0 )
243
+ binding.listToggle.setEnabled(true )
244
+ binding.storiesList.setVisibility(
245
+ if (Utils .settingsHelper.getBoolean(PreferenceKeys .PREF_STORY_SHOW_LIST )) View .VISIBLE
246
+ else View .GONE
247
+ )
248
+ }
249
+ else {
250
+ binding.listToggle.setEnabled(false )
251
+ binding.storiesList.setVisibility(View .GONE )
243
252
}
244
253
})
245
254
storiesViewModel.getDate().observe(fragmentActivity, {
@@ -268,6 +277,12 @@ class StoryViewerFragment : Fragment() {
268
277
binding.btnShare.setOnClickListener({ _ -> shareStoryViaDm() })
269
278
binding.btnReply.setOnClickListener({ _ -> createReplyDialog(null ) })
270
279
binding.stickers.setOnClickListener({ _ -> showStickerMenu() })
280
+ binding.listToggle.setOnClickListener({ _ ->
281
+ binding.storiesList.setVisibility(
282
+ if (binding.storiesList.visibility == View .GONE ) View .VISIBLE
283
+ else View .GONE
284
+ )
285
+ })
271
286
}
272
287
273
288
@SuppressLint(" ClickableViewAccessibility" )
@@ -297,10 +312,22 @@ class StoryViewerFragment : Fragment() {
297
312
if (models != null ) {
298
313
when (it) {
299
314
StoryPaginationType .FORWARD -> {
300
- paginateStories(false , currentFeedStoryIndex == models.size - 2 )
315
+ if (currentFeedStoryIndex == models.size - 1 )
316
+ Toast .makeText(
317
+ context,
318
+ R .string.no_more_stories,
319
+ Toast .LENGTH_SHORT
320
+ ).show()
321
+ else paginateStories(false , currentFeedStoryIndex == models.size - 2 )
301
322
}
302
323
StoryPaginationType .BACKWARD -> {
303
- paginateStories(true , false )
324
+ if (currentFeedStoryIndex == 0 )
325
+ Toast .makeText(
326
+ context,
327
+ R .string.no_more_stories,
328
+ Toast .LENGTH_SHORT
329
+ ).show()
330
+ else paginateStories(true , false )
304
331
}
305
332
StoryPaginationType .ERROR -> {
306
333
Toast .makeText(
@@ -356,7 +383,6 @@ class StoryViewerFragment : Fragment() {
356
383
val context = context ? : return
357
384
live = null
358
385
if (menuProfile != null ) menuProfile!! .isVisible = false
359
- profileVisible = false
360
386
binding.imageViewer.controller = null
361
387
releasePlayer()
362
388
val type = options!! .type
@@ -435,6 +461,9 @@ class StoryViewerFragment : Fragment() {
435
461
436
462
releasePlayer()
437
463
464
+ profileVisible = currentStory.user?.username != null
465
+ if (menuProfile != null ) menuProfile!! .isVisible = profileVisible
466
+
438
467
binding.btnDownload.isEnabled = false
439
468
binding.btnShare.isEnabled = currentStory.canReshare
440
469
binding.btnReply.isEnabled = currentStory.canReply
@@ -544,10 +573,6 @@ class StoryViewerFragment : Fragment() {
544
573
wasCanceled : Boolean
545
574
) {
546
575
binding.btnDownload.isEnabled = false
547
- if (menuProfile != null ) {
548
- profileVisible = false
549
- menuProfile!! .isVisible = false
550
- }
551
576
binding.progressView.visibility = View .GONE
552
577
}
553
578
})
0 commit comments