Bug fixes

This commit is contained in:
Tommaso Berlose 2017-11-09 19:37:13 +01:00
parent 2757f7f66f
commit 6d297911ee
7 changed files with 19 additions and 5 deletions

View File

@ -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"
}

BIN
app/release/app-release.apk Normal file

Binary file not shown.

View File

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":29},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":31},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]

View File

@ -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))
}
}
}
}
}

View File

@ -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()

View File

@ -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()

View File

@ -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"