mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-12-22 21:16:57 +00:00
parent
cade09aceb
commit
7522b5f083
@ -240,6 +240,15 @@ class StoryViewerFragment : Fragment() {
|
||||
storyMedias.set(0, newItem)
|
||||
storiesAdapter!!.submitList(storyMedias)
|
||||
storiesViewModel.setMedia(0)
|
||||
binding.listToggle.setEnabled(true)
|
||||
binding.storiesList.setVisibility(
|
||||
if (Utils.settingsHelper.getBoolean(PreferenceKeys.PREF_STORY_SHOW_LIST)) View.VISIBLE
|
||||
else View.GONE
|
||||
)
|
||||
}
|
||||
else {
|
||||
binding.listToggle.setEnabled(false)
|
||||
binding.storiesList.setVisibility(View.GONE)
|
||||
}
|
||||
})
|
||||
storiesViewModel.getDate().observe(fragmentActivity, {
|
||||
@ -268,6 +277,12 @@ class StoryViewerFragment : Fragment() {
|
||||
binding.btnShare.setOnClickListener({ _ -> shareStoryViaDm() })
|
||||
binding.btnReply.setOnClickListener({ _ -> createReplyDialog(null) })
|
||||
binding.stickers.setOnClickListener({ _ -> showStickerMenu() })
|
||||
binding.listToggle.setOnClickListener({ _ ->
|
||||
binding.storiesList.setVisibility(
|
||||
if (binding.storiesList.visibility == View.GONE) View.VISIBLE
|
||||
else View.GONE
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@ -297,10 +312,22 @@ class StoryViewerFragment : Fragment() {
|
||||
if (models != null) {
|
||||
when (it) {
|
||||
StoryPaginationType.FORWARD -> {
|
||||
paginateStories(false, currentFeedStoryIndex == models.size - 2)
|
||||
if (currentFeedStoryIndex == models.size - 1)
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.no_more_stories,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
else paginateStories(false, currentFeedStoryIndex == models.size - 2)
|
||||
}
|
||||
StoryPaginationType.BACKWARD -> {
|
||||
paginateStories(true, false)
|
||||
if (currentFeedStoryIndex == 0)
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.no_more_stories,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
else paginateStories(true, false)
|
||||
}
|
||||
StoryPaginationType.ERROR -> {
|
||||
Toast.makeText(
|
||||
@ -356,7 +383,6 @@ class StoryViewerFragment : Fragment() {
|
||||
val context = context ?: return
|
||||
live = null
|
||||
if (menuProfile != null) menuProfile!!.isVisible = false
|
||||
profileVisible = false
|
||||
binding.imageViewer.controller = null
|
||||
releasePlayer()
|
||||
val type = options!!.type
|
||||
@ -435,6 +461,9 @@ class StoryViewerFragment : Fragment() {
|
||||
|
||||
releasePlayer()
|
||||
|
||||
profileVisible = currentStory.user?.username != null
|
||||
if (menuProfile != null) menuProfile!!.isVisible = profileVisible
|
||||
|
||||
binding.btnDownload.isEnabled = false
|
||||
binding.btnShare.isEnabled = currentStory.canReshare
|
||||
binding.btnReply.isEnabled = currentStory.canReply
|
||||
@ -544,10 +573,6 @@ class StoryViewerFragment : Fragment() {
|
||||
wasCanceled: Boolean
|
||||
) {
|
||||
binding.btnDownload.isEnabled = false
|
||||
if (menuProfile != null) {
|
||||
profileVisible = false
|
||||
menuProfile!!.isVisible = false
|
||||
}
|
||||
binding.progressView.visibility = View.GONE
|
||||
}
|
||||
})
|
||||
|
@ -11,6 +11,7 @@ object PreferenceKeys {
|
||||
const val PREF_SHOWN_COUNT_TOOLTIP = "shown_count_tooltip"
|
||||
const val PREF_SEARCH_FOCUS_KEYBOARD = "search_focus_keyboard"
|
||||
const val PREF_AUTO_BACKUP_ENABLED = "auto_backup_enabled"
|
||||
const val PREF_STORY_SHOW_LIST = "story_show_list"
|
||||
|
||||
// string prefs
|
||||
const val FOLDER_PATH = "custom_path"
|
||||
|
@ -19,6 +19,7 @@ public class StoriesPreferencesFragment extends BasePreferencesFragment {
|
||||
screen.addPreference(getHideMutedReelsPreference(context));
|
||||
screen.addPreference(getMarkStoriesSeenPreference(context));
|
||||
screen.addPreference(getAutoPlayPreference(context));
|
||||
screen.addPreference(getStoryListPreference(context));
|
||||
}
|
||||
|
||||
private Preference getStorySortPreference(@NonNull final Context context) {
|
||||
@ -62,4 +63,13 @@ public class StoriesPreferencesFragment extends BasePreferencesFragment {
|
||||
preference.setIconSpaceReserved(false);
|
||||
return preference;
|
||||
}
|
||||
|
||||
private Preference getStoryListPreference(@NonNull final Context context) {
|
||||
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
|
||||
preference.setKey(PreferenceKeys.PREF_STORY_SHOW_LIST);
|
||||
preference.setTitle(R.string.story_list_setting);
|
||||
preference.setSummary(R.string.story_list_setting_summary);
|
||||
preference.setIconSpaceReserved(false);
|
||||
return preference;
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +135,7 @@ class SettingsHelper(context: Context) {
|
||||
PreferenceKeys.PLAY_IN_BACKGROUND,
|
||||
PreferenceKeys.PREF_SHOWN_COUNT_TOOLTIP,
|
||||
PreferenceKeys.PREF_SEARCH_FOCUS_KEYBOARD,
|
||||
PreferenceKeys.PREF_STORY_SHOW_LIST,
|
||||
PreferenceKeys.PREF_AUTO_BACKUP_ENABLED
|
||||
)
|
||||
annotation class BooleanSettings
|
||||
|
@ -28,7 +28,7 @@ import kotlinx.coroutines.launch
|
||||
|
||||
class StoryFragmentViewModel : ViewModel() {
|
||||
// large data
|
||||
private val currentStory = MutableLiveData<Story>()
|
||||
private val currentStory = MutableLiveData<Story?>()
|
||||
private val currentMedia = MutableLiveData<StoryMedia>()
|
||||
|
||||
// small data
|
||||
@ -181,7 +181,7 @@ class StoryFragmentViewModel : ViewModel() {
|
||||
|
||||
/* get functions */
|
||||
|
||||
fun getCurrentStory(): LiveData<Story> {
|
||||
fun getCurrentStory(): LiveData<Story?> {
|
||||
return currentStory
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
<string name="dm_mark_as_seen_setting">Mark DM as seen after viewing</string>
|
||||
<string name="dm_mark_as_seen_setting_summary">Other members will know you viewed it</string>
|
||||
<string name="autoplay_stories_setting">Autoplay video stories</string>
|
||||
<string name="story_list_setting">Display story list by default</string>
|
||||
<string name="story_list_setting_summary">For viewing stories</string>
|
||||
<string name="activity_setting">Enable activity notifications</string>
|
||||
<string name="story_sort_setting">Feed stories sort</string>
|
||||
<string name="error_loading_profile">Error loading profile! Is the username valid? If so, you may be ratelimited.</string>
|
||||
|
Loading…
Reference in New Issue
Block a user