Update bitmap generator

This commit is contained in:
Tommaso Berlose 2020-05-07 18:30:28 +02:00
parent 0b9e9e081e
commit 6a4cfdf22b
14 changed files with 15 additions and 9 deletions

Binary file not shown.

View File

@ -18,7 +18,7 @@ android {
applicationId "com.tommasoberlose.anotherwidget" applicationId "com.tommasoberlose.anotherwidget"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 29 targetSdkVersion 29
versionCode 75 versionCode 76
versionName "2.0.5" versionName "2.0.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Binary file not shown.

View File

@ -15,11 +15,13 @@ object BitmapHelper {
fun getBitmapFromView(view: View, width: Int? = null, height: Int? = null, draw: Boolean = true): Bitmap { fun getBitmapFromView(view: View, width: Int? = null, height: Int? = null, draw: Boolean = true): Bitmap {
//Define a bitmap with the same size as the view //Define a bitmap with the same size as the view
val measuredWidth = View.MeasureSpec.makeMeasureSpec(width ?: view.width, if (width != null) View.MeasureSpec.EXACTLY else View.MeasureSpec.UNSPECIFIED) val measuredWidth = View.MeasureSpec.makeMeasureSpec(width ?: view.width, if (width != null) View.MeasureSpec.EXACTLY else View.MeasureSpec.AT_MOST)
val measuredHeight = View.MeasureSpec.makeMeasureSpec(height ?: view.height, if (height != null) View.MeasureSpec.EXACTLY else View.MeasureSpec.UNSPECIFIED) val measuredHeight = View.MeasureSpec.makeMeasureSpec(height ?: view.height, if (height != null) View.MeasureSpec.EXACTLY else View.MeasureSpec.UNSPECIFIED)
view.measure(measuredWidth, measuredHeight) view.measure(measuredWidth, measuredHeight)
if (draw) { if (draw) {
FirebaseCrashlytics.getInstance().setCustomKey("initialWidth", width ?: -1)
FirebaseCrashlytics.getInstance().setCustomKey("initialHeight", height ?: -1)
FirebaseCrashlytics.getInstance().setCustomKey("measuredWidth", view.measuredWidth) FirebaseCrashlytics.getInstance().setCustomKey("measuredWidth", view.measuredWidth)
FirebaseCrashlytics.getInstance().setCustomKey("measuredWidth_spec", measuredWidth) FirebaseCrashlytics.getInstance().setCustomKey("measuredWidth_spec", measuredWidth)
FirebaseCrashlytics.getInstance().setCustomKey("measuredHeight", view.measuredHeight) FirebaseCrashlytics.getInstance().setCustomKey("measuredHeight", view.measuredHeight)

View File

@ -3,6 +3,7 @@ package com.tommasoberlose.anotherwidget.helpers
import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetManager
import android.content.Context import android.content.Context
import android.content.res.Configuration.ORIENTATION_PORTRAIT import android.content.res.Configuration.ORIENTATION_PORTRAIT
import com.google.firebase.crashlytics.FirebaseCrashlytics
object WidgetHelper { object WidgetHelper {
class WidgetSizeProvider( class WidgetSizeProvider(
@ -16,6 +17,8 @@ object WidgetHelper {
val height = getWidgetHeight(isPortrait, widgetId) val height = getWidgetHeight(isPortrait, widgetId)
val widthInPx = context.dip(width) val widthInPx = context.dip(width)
val heightInPx = context.dip(height) val heightInPx = context.dip(height)
FirebaseCrashlytics.getInstance().setCustomKey("widthInPx", widthInPx)
FirebaseCrashlytics.getInstance().setCustomKey("heightInPx", heightInPx)
return widthInPx to heightInPx return widthInPx to heightInPx
} }

View File

@ -26,6 +26,7 @@ import com.tommasoberlose.anotherwidget.global.Actions
import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.* import com.tommasoberlose.anotherwidget.helpers.*
import com.tommasoberlose.anotherwidget.helpers.WidgetHelper.reduceDimensionWithMaxWidth
import com.tommasoberlose.anotherwidget.receivers.* import com.tommasoberlose.anotherwidget.receivers.*
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.getCapWordString import com.tommasoberlose.anotherwidget.utils.getCapWordString

View File

@ -33,7 +33,7 @@
<string name="main_calendar">Account calendar</string> <string name="main_calendar">Account calendar</string>
<string name="settings_calendar_title">Calendar</string> <string name="settings_calendar_title">Calendar</string>
<string name="settings_weather_title">Weather</string> <string name="settings_weather_title">Weather</string>
<string name="settings_general_title">Typography</string> <string name="settings_general_title">General</string>
<string name="calendar_settings_list_error">Error loading the calendar list</string> <string name="calendar_settings_list_error">Error loading the calendar list</string>
<string name="settings_hour_format_title">Hour format</string> <string name="settings_hour_format_title">Hour format</string>
<string name="settings_hour_format_subtitle_12">12 hour</string> <string name="settings_hour_format_subtitle_12">12 hour</string>

View File

@ -3,7 +3,7 @@
xmlns:dist="http://schemas.android.com/apk/distribution" xmlns:dist="http://schemas.android.com/apk/distribution"
featureSplit="tasksintegration" featureSplit="tasksintegration"
package="com.tommasoberlose.anotherwidget" package="com.tommasoberlose.anotherwidget"
android:versionCode="74" android:versionCode="75"
android:versionName="2.0.5" > android:versionName="2.0.5" >
<uses-sdk <uses-sdk

View File

@ -1,4 +1,4 @@
#Thu May 07 12:28:58 CEST 2020 #Thu May 07 17:54:22 CEST 2020
base.0=/Users/tommaso/Documents/MyCode/another-widget/tasksintegration/build/intermediates/dex/debug/mergeProjectDexDebug/out/classes.dex base.0=/Users/tommaso/Documents/MyCode/another-widget/tasksintegration/build/intermediates/dex/debug/mergeProjectDexDebug/out/classes.dex
path.0=classes.dex path.0=classes.dex
renamed.0=classes.dex renamed.0=classes.dex

View File

@ -4,7 +4,7 @@
featureSplit="tasksintegration" featureSplit="tasksintegration"
package="com.tommasoberlose.anotherwidget" package="com.tommasoberlose.anotherwidget"
android:targetSandboxVersion="2" android:targetSandboxVersion="2"
android:versionCode="74" android:versionCode="75"
android:versionName="2.0.5" > android:versionName="2.0.5" >
<uses-sdk <uses-sdk

View File

@ -3,7 +3,7 @@
3 xmlns:dist="http://schemas.android.com/apk/distribution" 3 xmlns:dist="http://schemas.android.com/apk/distribution"
4 featureSplit="tasksintegration" 4 featureSplit="tasksintegration"
5 package="com.tommasoberlose.anotherwidget" 5 package="com.tommasoberlose.anotherwidget"
6 android:versionCode="74" 6 android:versionCode="75"
7 android:versionName="2.0.5" > 7 android:versionName="2.0.5" >
8 8
9 <uses-sdk 9 <uses-sdk

View File

@ -3,7 +3,7 @@
xmlns:dist="http://schemas.android.com/apk/distribution" xmlns:dist="http://schemas.android.com/apk/distribution"
featureSplit="tasksintegration" featureSplit="tasksintegration"
package="com.tommasoberlose.anotherwidget" package="com.tommasoberlose.anotherwidget"
android:versionCode="74" android:versionCode="75"
android:versionName="2.0.5" > android:versionName="2.0.5" >
<uses-sdk <uses-sdk

View File

@ -3,7 +3,7 @@
xmlns:dist="http://schemas.android.com/apk/distribution" xmlns:dist="http://schemas.android.com/apk/distribution"
featureSplit="tasksintegration" featureSplit="tasksintegration"
package="com.tommasoberlose.anotherwidget" package="com.tommasoberlose.anotherwidget"
android:versionCode="74" android:versionCode="75"
android:versionName="2.0.5" > android:versionName="2.0.5" >
<uses-sdk android:targetSdkVersion="29" /> <uses-sdk android:targetSdkVersion="29" />