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

@ -292,6 +292,18 @@
android:name="android.appwidget.provider"
android:resource="@xml/app_widget_md3_info" />
</receiver>
<receiver
android:name=".appwidgets.AppWidgetCircle"
android:exported="true"
android:label="@string/app_widget_circle_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/app_widget_circle_info" />
</receiver>
<service
android:name=".service.MusicService"

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,8 +115,7 @@ 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)) {

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

View file

@ -183,9 +183,6 @@
<style name="BottomSheetStyle" parent="Widget.Material3.BottomSheet">
<item name="android:maxWidth">@empty</item>
<item name="paddingBottomSystemWindowInsets">false</item>
<item name="marginLeftSystemWindowInsets">false</item>
<item name="marginRightSystemWindowInsets">false</item>
</style>
<style name="MaterialCardViewStroke">

View file

@ -4,7 +4,7 @@ buildscript {
ext {
kotlin_version = '1.6.10'
navigation_version = '2.4.0-rc01'
mdc_version = '1.6.0-alpha01'
mdc_version = '1.5.0'
preference_version = '1.2.0-rc01'
appcompat_version = '1.4.1'
}