Code Cleanup

This commit is contained in:
Prathamesh More 2022-01-16 17:57:31 +05:30
parent c8ce98b1df
commit ea4a54d404
10 changed files with 23 additions and 24 deletions

View file

@ -395,12 +395,10 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
bottomSheetBehavior.peekHeight = -windowInsets.safeGetBottomInsets()
bottomSheetBehavior.state = STATE_COLLAPSED
libraryViewModel.setFabMargin(if (isBottomNavVisible) dip(R.dimen.bottom_nav_height) else 0)
binding.slidingPanel.elevation = 0F
binding.bottomNavigationView.elevation = 10F
} else {
if (MusicPlayerRemote.playingQueue.isNotEmpty()) {
binding.slidingPanel.elevation = 0F
binding.bottomNavigationView.elevation = 10F
binding.bottomNavigationView.elevation = 5F
if (isBottomNavVisible) {
println("List")
if (animate) {

View file

@ -109,8 +109,7 @@ class AlbumCoverStylePreferenceDialog : DialogFragment(),
val albumCoverStyle = values()[position]
val inflater = LayoutInflater.from(context)
val binding = PreferenceNowPlayingScreenItemBinding.inflate(inflater, collection, false)
collection.addView(binding.root)
val binding = PreferenceNowPlayingScreenItemBinding.inflate(inflater, collection, true)
Glide.with(context).load(albumCoverStyle.drawableResId).into(binding.image)
binding.title.setText(albumCoverStyle.titleRes)

View file

@ -115,14 +115,13 @@ private class NowPlayingScreenAdapter(private val context: Context) : PagerAdapt
val nowPlayingScreen = values()[position]
val inflater = LayoutInflater.from(context)
val binding = PreferenceNowPlayingScreenItemBinding.inflate(inflater, collection, false )
collection.addView(binding.root)
val binding = PreferenceNowPlayingScreenItemBinding.inflate(inflater, collection, true)
Glide.with(context).load(nowPlayingScreen.drawableResId).into(binding.image)
binding.title.setText(nowPlayingScreen.titleRes)
if (isNowPlayingThemes(nowPlayingScreen)) {
binding.proText.show()
binding.proText.setText(R.string.pro)
}else{
} else {
binding.proText.hide()
}
return binding.root

View file

@ -21,11 +21,9 @@ class HomeImageLayout @JvmOverloads constructor(
init {
if (PreferenceUtil.isHomeBanner) {
bannerImageBinding = BannerImageLayoutBinding.inflate(LayoutInflater.from(context))
addView(bannerImageBinding!!.root)
bannerImageBinding = BannerImageLayoutBinding.inflate(LayoutInflater.from(context), this, true)
} else {
userImageBinding = UserImageLayoutBinding.inflate(LayoutInflater.from(context))
addView(userImageBinding!!.root)
userImageBinding = UserImageLayoutBinding.inflate(LayoutInflater.from(context), this, true)
}
}

View file

@ -47,8 +47,7 @@ class ListItemView : FrameLayout {
}
private fun init(context: Context, attrs: AttributeSet?) {
binding = ListItemViewNoCardBinding.inflate(LayoutInflater.from(context))
addView(binding.root)
binding = ListItemViewNoCardBinding.inflate(LayoutInflater.from(context), this, true)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ListItemView)
if (typedArray.hasValue(R.styleable.ListItemView_listItemIcon)) {

View file

@ -22,8 +22,7 @@ class PermissionItem @JvmOverloads constructor(
init {
val attributes = context.obtainStyledAttributes(attrs, R.styleable.PermissionItem, 0, 0)
binding = ItemPermissionBinding.inflate(LayoutInflater.from(context))
addView(binding.root)
binding = ItemPermissionBinding.inflate(LayoutInflater.from(context), this, true)
binding.title.text = attributes.getText(R.styleable.PermissionItem_permissionTitle)
binding.summary.text =

View file

@ -30,11 +30,9 @@ class SettingListItemView @JvmOverloads constructor(
defStyleAttr: Int = -1,
defStyleRes: Int = -1
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
private var binding: ListSettingItemViewBinding =
ListSettingItemViewBinding.inflate(LayoutInflater.from(context))
init {
addView(binding.root)
val binding: ListSettingItemViewBinding =
ListSettingItemViewBinding.inflate(LayoutInflater.from(context), this, true)
val typedArray =
context.obtainStyledAttributes(attrs, R.styleable.SettingListItemView)
binding.icon