From 3bee5b146c360a6d2d82a85b6e036a36ea8007f9 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 11 Sep 2022 18:26:52 +0200 Subject: [PATCH] collapse sheets by default --- .../com/github/libretube/adapters/ChannelAdapter.kt | 2 +- .../com/github/libretube/adapters/PlaylistAdapter.kt | 2 +- .../com/github/libretube/adapters/PlaylistsAdapter.kt | 2 +- .../com/github/libretube/adapters/SearchAdapter.kt | 4 ++-- .../com/github/libretube/adapters/TrendingAdapter.kt | 2 +- .../github/libretube/adapters/WatchHistoryAdapter.kt | 2 +- .../com/github/libretube/fragments/PlaylistFragment.kt | 2 +- .../libretube/fragments/SubscriptionsFragment.kt | 1 - .../github/libretube/sheets/VideoOptionsBottomSheet.kt | 1 - .../java/com/github/libretube/views/BottomSheet.kt | 10 ---------- 10 files changed, 8 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt b/app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt index c09a7ba1a..e09ada15c 100644 --- a/app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/ChannelAdapter.kt @@ -6,11 +6,11 @@ import android.view.ViewGroup import androidx.fragment.app.FragmentManager import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.VideoRowBinding -import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.toID import com.github.libretube.obj.StreamItem +import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.util.ImageHelper import com.github.libretube.util.NavigationHelper diff --git a/app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt b/app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt index 9a84c4ce1..079a96a19 100644 --- a/app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/PlaylistAdapter.kt @@ -9,13 +9,13 @@ import androidx.fragment.app.FragmentManager import androidx.recyclerview.widget.RecyclerView import com.github.libretube.api.RetrofitInstance import com.github.libretube.databinding.PlaylistRowBinding -import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.extensions.TAG import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.toID import com.github.libretube.obj.PlaylistId import com.github.libretube.obj.StreamItem +import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.util.ImageHelper import com.github.libretube.util.NavigationHelper import com.github.libretube.util.PreferenceHelper diff --git a/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt b/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt index b4d4c3acb..2ba6f8c5b 100644 --- a/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/PlaylistsAdapter.kt @@ -9,10 +9,10 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.R import com.github.libretube.api.RetrofitInstance import com.github.libretube.databinding.PlaylistsRowBinding -import com.github.libretube.sheets.PlaylistOptionsBottomSheet import com.github.libretube.extensions.TAG import com.github.libretube.obj.PlaylistId import com.github.libretube.obj.Playlists +import com.github.libretube.sheets.PlaylistOptionsBottomSheet import com.github.libretube.util.ImageHelper import com.github.libretube.util.NavigationHelper import com.github.libretube.util.PreferenceHelper diff --git a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt index 80986a92d..1561faec8 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt @@ -10,13 +10,13 @@ import com.github.libretube.api.SubscriptionHelper import com.github.libretube.databinding.ChannelRowBinding import com.github.libretube.databinding.PlaylistSearchRowBinding import com.github.libretube.databinding.VideoRowBinding -import com.github.libretube.sheets.PlaylistOptionsBottomSheet -import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.toID import com.github.libretube.obj.SearchItem +import com.github.libretube.sheets.PlaylistOptionsBottomSheet +import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.util.ImageHelper import com.github.libretube.util.NavigationHelper import kotlinx.coroutines.CoroutineScope diff --git a/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt b/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt index 89f0e7e63..71854de61 100644 --- a/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/TrendingAdapter.kt @@ -6,12 +6,12 @@ import android.view.ViewGroup import androidx.fragment.app.FragmentManager import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.TrendingRowBinding -import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.extensions.formatShort import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setWatchProgressLength import com.github.libretube.extensions.toID import com.github.libretube.obj.StreamItem +import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.util.ImageHelper import com.github.libretube.util.NavigationHelper diff --git a/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt index 9b88ddf3d..09be5f47b 100644 --- a/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt @@ -7,9 +7,9 @@ import androidx.recyclerview.widget.RecyclerView import com.github.libretube.databinding.WatchHistoryRowBinding import com.github.libretube.db.DatabaseHelper import com.github.libretube.db.obj.WatchHistoryItem -import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.extensions.setFormattedDuration import com.github.libretube.extensions.setWatchProgressLength +import com.github.libretube.sheets.VideoOptionsBottomSheet import com.github.libretube.util.ImageHelper import com.github.libretube.util.NavigationHelper diff --git a/app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt index 9359f4253..478b64316 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlaylistFragment.kt @@ -14,10 +14,10 @@ import com.github.libretube.adapters.PlaylistAdapter import com.github.libretube.api.RetrofitInstance import com.github.libretube.constants.IntentData import com.github.libretube.databinding.FragmentPlaylistBinding -import com.github.libretube.sheets.PlaylistOptionsBottomSheet import com.github.libretube.extensions.BaseFragment import com.github.libretube.extensions.TAG import com.github.libretube.extensions.toID +import com.github.libretube.sheets.PlaylistOptionsBottomSheet import retrofit2.HttpException import java.io.IOException diff --git a/app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt b/app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt index 59fd18612..3018664c3 100644 --- a/app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/SubscriptionsFragment.kt @@ -16,7 +16,6 @@ import com.github.libretube.constants.PreferenceKeys import com.github.libretube.databinding.FragmentSubscriptionsBinding import com.github.libretube.extensions.BaseFragment import com.github.libretube.models.SubscriptionsViewModel -import com.github.libretube.obj.BottomSheetItem import com.github.libretube.util.PreferenceHelper import com.github.libretube.views.BottomSheet diff --git a/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt index 7a0042674..0a9180ec0 100644 --- a/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/sheets/VideoOptionsBottomSheet.kt @@ -26,7 +26,6 @@ class VideoOptionsBottomSheet( ) : BottomSheet() { override fun onCreate(savedInstanceState: Bundle?) { - // List that stores the different menu options. In the future could be add more options here. val optionsList = mutableListOf( context?.getString(R.string.playOnBackground)!!, diff --git a/app/src/main/java/com/github/libretube/views/BottomSheet.kt b/app/src/main/java/com/github/libretube/views/BottomSheet.kt index 9ac6ef127..b0e99b1a4 100644 --- a/app/src/main/java/com/github/libretube/views/BottomSheet.kt +++ b/app/src/main/java/com/github/libretube/views/BottomSheet.kt @@ -8,8 +8,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.adapters.BottomSheetAdapter import com.github.libretube.databinding.BottomSheetBinding import com.github.libretube.obj.BottomSheetItem -import com.google.android.material.bottomsheet.BottomSheetBehavior -import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment open class BottomSheet : BottomSheetDialogFragment() { @@ -22,14 +20,6 @@ open class BottomSheet : BottomSheetDialogFragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { - dialog!!.setOnShowListener { dialog -> - val d = dialog as BottomSheetDialog - val bottomSheetInternal = - d.findViewById(com.google.android.material.R.id.design_bottom_sheet)!! - BottomSheetBehavior.from(bottomSheetInternal).state = - BottomSheetBehavior.STATE_EXPANDED - } - binding = BottomSheetBinding.inflate(layoutInflater) return binding.root }