mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
commit
4dc71ae588
@ -28,6 +28,8 @@ class Library : Fragment() {
|
||||
lateinit var token: String
|
||||
private lateinit var playlistRecyclerView: RecyclerView
|
||||
private lateinit var refreshLayout: SwipeRefreshLayout
|
||||
private lateinit var createPlaylistButton: FloatingActionButton
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
@ -58,7 +60,8 @@ class Library : Fragment() {
|
||||
Log.d(TAG, "hmm")
|
||||
fetchPlaylists(view)
|
||||
}
|
||||
view.findViewById<FloatingActionButton>(R.id.create_playlist).setOnClickListener {
|
||||
createPlaylistButton = view.findViewById<FloatingActionButton>(R.id.create_playlist)
|
||||
createPlaylistButton.setOnClickListener {
|
||||
val newFragment = CreatePlaylistDialog()
|
||||
newFragment.show(childFragmentManager, "Create Playlist")
|
||||
}
|
||||
@ -71,6 +74,14 @@ class Library : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
// optimize CreatePlaylistFab bottom margin
|
||||
val layoutParams = createPlaylistButton.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.bottomMargin = if (isMiniPlayerVisible) 180 else 64
|
||||
createPlaylistButton.layoutParams = layoutParams
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
private fun fetchPlaylists(view: View) {
|
||||
fun run() {
|
||||
refreshLayout.isRefreshing = true
|
||||
|
@ -92,6 +92,7 @@ import java.util.concurrent.Executors
|
||||
import kotlin.math.abs
|
||||
|
||||
var isFullScreen = false
|
||||
var isMiniPlayerVisible = false
|
||||
|
||||
class PlayerFragment : Fragment() {
|
||||
|
||||
@ -197,9 +198,11 @@ class PlayerFragment : Fragment() {
|
||||
val mainMotionLayout =
|
||||
mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
||||
if (currentId == eId) {
|
||||
isMiniPlayerVisible = true
|
||||
exoPlayerView.useController = false
|
||||
mainMotionLayout.progress = 1F
|
||||
} else if (currentId == sId) {
|
||||
isMiniPlayerVisible = false
|
||||
exoPlayerView.useController = true
|
||||
mainMotionLayout.progress = 0F
|
||||
}
|
||||
@ -218,6 +221,7 @@ class PlayerFragment : Fragment() {
|
||||
playerMotionLayout.transitionToStart()
|
||||
|
||||
view.findViewById<ImageView>(R.id.close_imageView).setOnClickListener {
|
||||
isMiniPlayerVisible = false
|
||||
motionLayout.transitionToEnd()
|
||||
val mainActivity = activity as MainActivity
|
||||
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||
@ -226,6 +230,7 @@ class PlayerFragment : Fragment() {
|
||||
.commit()
|
||||
}
|
||||
view.findViewById<ImageButton>(R.id.close_imageButton).setOnClickListener {
|
||||
isMiniPlayerVisible = false
|
||||
motionLayout.transitionToEnd()
|
||||
val mainActivity = activity as MainActivity
|
||||
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
||||
|
Loading…
Reference in New Issue
Block a user