widgets: dont use system padding in size compat
Don't take the app widget host padding into account when trying to calculate the widget sizing. Doing such produces bad results, at least on my devices. At least, it does now for some reason.
This commit is contained in:
parent
7f07764b68
commit
51b9b0e734
3 changed files with 8 additions and 20 deletions
|
@ -12,6 +12,7 @@ at the cost of longer loading times
|
|||
|
||||
#### What's Fixed
|
||||
- Fixed default material theme being used before app shows up
|
||||
- Fixed shuffle shortcut and file opening not working on startup on some devices
|
||||
|
||||
#### What's Changed
|
||||
- Updated music hashing (Will wipe playback state)
|
||||
|
|
|
@ -67,19 +67,17 @@ class MainActivity : AppCompatActivity() {
|
|||
startService(Intent(this, IndexerService::class.java))
|
||||
startService(Intent(this, PlaybackService::class.java))
|
||||
|
||||
logD("YOU FUCKING RETARD DO BASCIS ${intent?.action}")
|
||||
|
||||
if (!intentToDelayedAction(intent)) {
|
||||
if (!startIntentDelayedAction(intent)) {
|
||||
playbackModel.startDelayedAction(PlaybackViewModel.DelayedAction.RestoreState)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
intentToDelayedAction(intent)
|
||||
startIntentDelayedAction(intent)
|
||||
}
|
||||
|
||||
private fun intentToDelayedAction(intent: Intent?): Boolean {
|
||||
private fun startIntentDelayedAction(intent: Intent?): Boolean {
|
||||
if (intent == null) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
SizeF(180f, 100f) to createThinWidget(context, state),
|
||||
SizeF(180f, 152f) to createSmallWidget(context, state),
|
||||
SizeF(272f, 152f) to createWideWidget(context, state),
|
||||
SizeF(180f, 270f) to createMediumWidget(context, state),
|
||||
SizeF(272f, 270f) to createLargeWidget(context, state))
|
||||
SizeF(180f, 272f) to createMediumWidget(context, state),
|
||||
SizeF(272f, 272f) to createLargeWidget(context, state))
|
||||
|
||||
AppWidgetManager.getInstance(context).applyViewsCompat(context, views)
|
||||
}
|
||||
|
@ -134,19 +134,11 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
// and do this for each.
|
||||
val ids = getAppWidgetIds(name)
|
||||
|
||||
// Most of the major launchers seem to provide widget sizes that don't include
|
||||
// padding. Query for the padding here so we can get a sane result later on.
|
||||
val padding = AppWidgetHostView.getDefaultPaddingForWidget(context, name, null)
|
||||
|
||||
val density = context.resources.displayMetrics.density
|
||||
val padW = ((padding.left + padding.right) / density).toInt()
|
||||
val padH = ((padding.top + padding.bottom) / density).toInt()
|
||||
|
||||
for (id in ids) {
|
||||
val options = getAppWidgetOptions(id)
|
||||
|
||||
var width: Int
|
||||
var height: Int
|
||||
val width: Int
|
||||
val height: Int
|
||||
|
||||
// Landscape/Portrait modes use different dimen bounds
|
||||
if (context.isLandscape) {
|
||||
|
@ -157,9 +149,6 @@ class WidgetProvider : AppWidgetProvider() {
|
|||
height = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT)
|
||||
}
|
||||
|
||||
height += padH
|
||||
width += padW
|
||||
|
||||
logD("Assuming true widget dimens are ${width}x$height")
|
||||
|
||||
// Find the layout with the greatest area that fits entirely within
|
||||
|
|
Loading…
Reference in a new issue