widgets: remove compact/mini widgets
Remove the compact and mini widgets, as there seems to be no real way for both controls and metadata to be packed into them.
This commit is contained in:
@@ -189,7 +189,7 @@ fun @receiver:DrawableRes Int.resolveDrawable(context: Context) =
|
||||
* Resolve a drawable resource into an [AnimatedVectorDrawable]
|
||||
* @see resolveDrawable
|
||||
*/
|
||||
fun @receiver:DrawableRes Int.toAnimDrawable(context: Context) =
|
||||
fun @receiver:DrawableRes Int.resolveAnimDrawable(context: Context) =
|
||||
resolveDrawable(context) as AnimatedVectorDrawable
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,19 +26,20 @@ import android.util.AttributeSet
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.widget.AppCompatImageButton
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.toAnimDrawable
|
||||
import org.oxycblt.auxio.resolveAnimDrawable
|
||||
|
||||
/**
|
||||
* Custom [AppCompatImageButton] that handles the animated play/pause icons.
|
||||
* @author OxygenCobalt
|
||||
* TODO: Replace this with a material icon that does the path manipulation manually.
|
||||
*/
|
||||
class PlayPauseButton @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = -1
|
||||
) : AppCompatImageButton(context, attrs, defStyleAttr) {
|
||||
private val iconPauseToPlay = R.drawable.ic_pause_to_play.toAnimDrawable(context)
|
||||
private val iconPlayToPause = R.drawable.ic_play_to_pause.toAnimDrawable(context)
|
||||
private val iconPauseToPlay = R.drawable.ic_pause_to_play.resolveAnimDrawable(context)
|
||||
private val iconPlayToPause = R.drawable.ic_play_to_pause.resolveAnimDrawable(context)
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
||||
@@ -94,19 +94,6 @@ fun createDefaultWidget(context: Context): RemoteViews {
|
||||
return createViews(context, R.layout.widget_default)
|
||||
}
|
||||
|
||||
fun createMiniWidget(context: Context, state: WidgetState): RemoteViews {
|
||||
val views = createViews(context, R.layout.widget_mini)
|
||||
views.applyMeta(state)
|
||||
return views
|
||||
}
|
||||
|
||||
fun createCompactWidget(context: Context, state: WidgetState): RemoteViews {
|
||||
val views = createViews(context, R.layout.widget_compact)
|
||||
views.applyMeta(state)
|
||||
views.applyCover(context, state)
|
||||
return views
|
||||
}
|
||||
|
||||
fun createSmallWidget(context: Context, state: WidgetState): RemoteViews {
|
||||
val views = createViews(context, R.layout.widget_small)
|
||||
views.applyMeta(state)
|
||||
|
||||
@@ -71,13 +71,9 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
)
|
||||
|
||||
// Map each widget form to the cells where it would look at least okay.
|
||||
// The large widgets are 140 instead of 110 so that they're backwards compatible
|
||||
// with the old widget size reporting
|
||||
val views = mapOf(
|
||||
SizeF(180f, 40f) to createMiniWidget(context, state),
|
||||
SizeF(250f, 40f) to createCompactWidget(context, state),
|
||||
SizeF(180f, 140f) to createSmallWidget(context, state),
|
||||
SizeF(250f, 140f) to createFullWidget(context, state)
|
||||
SizeF(180f, 110f) to createSmallWidget(context, state),
|
||||
SizeF(250f, 110f) to createFullWidget(context, state)
|
||||
)
|
||||
|
||||
appWidgetManager.applyViewsCompat(context, views)
|
||||
|
||||
Reference in New Issue
Block a user