diff --git a/app/build.gradle b/app/build.gradle index dc8eec8..4905f6d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,7 +17,7 @@ android { applicationId "com.tommasoberlose.anotherwidget" minSdkVersion 19 targetSdkVersion 26 - versionCode 29 + versionCode 31 versionName "1.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/app/release/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..7b48e37 Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 2863276..cd0675e 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":29},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":31},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}] \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/OpenWeatherIntentReceiver.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/OpenWeatherIntentReceiver.kt index 3b8b80f..d49de0d 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/OpenWeatherIntentReceiver.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/OpenWeatherIntentReceiver.kt @@ -3,9 +3,13 @@ package com.tommasoberlose.anotherwidget.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import android.net.Uri import android.util.Log import com.tommasoberlose.anotherwidget.`object`.Constants import com.tommasoberlose.anotherwidget.util.Util +import android.support.v4.content.ContextCompat.startActivity + + class OpenWeatherIntentReceiver : BroadcastReceiver() { @@ -15,7 +19,16 @@ class OpenWeatherIntentReceiver : BroadcastReceiver() { try { context.startActivity(Util.getWeatherIntent(context)) } catch (e: Exception) { - context.applicationContext.startActivity(Util.getWeatherIntent(context.applicationContext)) + try { + context.applicationContext.startActivity(Util.getWeatherIntent(context.applicationContext)) + } catch (e: Exception) { + val uri = Uri.parse("http://www.google.com/#q=weather") + try { + context.startActivity(Intent(Intent.ACTION_VIEW, uri)) + } catch (e: Exception) { + context.applicationContext.startActivity(Intent(Intent.ACTION_VIEW, uri)) + } + } } } } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/MainActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/MainActivity.kt index 1135ed7..08af345 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/MainActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/MainActivity.kt @@ -217,7 +217,7 @@ class MainActivity : AppCompatActivity() { } var height = Util.convertDpToPixel(120f, this).toInt() if (SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) { - height += Util.convertSpToPixels(SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f), this).toInt() + Util.convertDpToPixel(8f, this).toInt() + height += Util.convertSpToPixels(SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f), this).toInt() + Util.convertDpToPixel(16f, this).toInt() } if (SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) + SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) > 50) { height += Util.convertDpToPixel(24f, this).toInt() diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widget/TheWidget.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widget/TheWidget.kt index 4bad735..4a24ecc 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widget/TheWidget.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widget/TheWidget.kt @@ -93,7 +93,7 @@ class TheWidget : AppWidgetProvider() { height = widgetInfo.minHeight } if (SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) { - height += Util.convertSpToPixels(SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f), context).toInt() + Util.convertDpToPixel(8f, context).toInt() + height += Util.convertSpToPixels(SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f), context).toInt() + Util.convertDpToPixel(16f, context).toInt() } if (SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) > 30 && SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) > 22) { height += Util.convertDpToPixel(24f, context).toInt() diff --git a/app/src/main/res/layout/the_widget.xml b/app/src/main/res/layout/the_widget.xml index 1765638..c681254 100644 --- a/app/src/main/res/layout/the_widget.xml +++ b/app/src/main/res/layout/the_widget.xml @@ -9,6 +9,7 @@ android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:gravity="center" + android:layout_marginTop="-8dp" android:lineSpacingMultiplier="1" android:lineSpacingExtra="0dp" android:visibility="gone"