Fixed UserInfoFragment.kt save fab bottom margin

This commit is contained in:
Prathamesh More 2021-10-05 14:03:11 +05:30
parent f9188b05ca
commit 72a11495fa

View file

@ -28,6 +28,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.doOnPreDraw
import androidx.core.view.updateLayoutParams
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import code.name.monkey.appthemehelper.util.ColorUtil
@ -39,6 +40,7 @@ import code.name.monkey.retromusic.databinding.FragmentUserInfoBinding
import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.applyToolbar
import code.name.monkey.retromusic.extensions.resolveColor
import code.name.monkey.retromusic.fragments.LibraryViewModel
import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.glide.RetroGlideExtension
import code.name.monkey.retromusic.util.ImageUtil
@ -56,6 +58,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
@ -65,6 +68,7 @@ class UserInfoFragment : Fragment() {
private var _binding: FragmentUserInfoBinding? = null
private val binding get() = _binding!!
private val libraryViewModel: LibraryViewModel by sharedViewModel()
override fun onCreateView(
inflater: LayoutInflater,
@ -123,6 +127,11 @@ class UserInfoFragment : Fragment() {
view.doOnPreDraw {
startPostponedEnterTransition()
}
libraryViewModel.getFabMargin().observe(viewLifecycleOwner, {
binding.next.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = it
}
})
}
private fun loadProfile() {