Fix miniplayer showing, cardview,remmeber last selected option,

This commit is contained in:
h4h13 2019-10-12 02:31:39 +05:30
parent 0e179d6842
commit b9e3483a47
22 changed files with 154 additions and 380 deletions

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2019 Hemanth Savarala.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package code.name.monkey.retromusic.views
import android.content.Context
import android.util.AttributeSet
import code.name.monkey.retromusic.util.PreferenceUtil
import com.google.android.material.card.MaterialCardView
import com.google.android.material.shape.CornerFamily
import com.google.android.material.shape.MaterialShapeDrawable
/**
* Created by hemanths on 2019-10-11.
*/
class TopCornerCardView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : MaterialCardView(context, attrs, defStyleAttr) {
private val shapeDrawable = MaterialShapeDrawable()
init {
val cornerSize= PreferenceUtil.getInstance(context).dialogCorner
val shapeModel = shapeDrawable.shapeAppearanceModel
background = shapeDrawable
shapeDrawable.shapeAppearanceModel = shapeModel.toBuilder()
.setTopLeftCorner(CornerFamily.ROUNDED, cornerSize)
.setBottomLeftCorner(CornerFamily.ROUNDED, cornerSize)
.setBottomRightCorner(CornerFamily.ROUNDED, cornerSize)
.setTopRightCorner(CornerFamily.ROUNDED, cornerSize)
.build()
}
}