From 0a289d82b2566da4654ce750cdf2a0a3b4c1b759 Mon Sep 17 00:00:00 2001 From: Tommaso Berlose Date: Tue, 7 Nov 2017 00:01:40 +0100 Subject: [PATCH] Fix events order, fix horizontal resize, add widget preview toggle, fix next event function, fix weather icon click listner and relase v1.3-beta1 --- app/build.gradle | 2 +- app/release/output.json | 2 +- app/src/main/AndroidManifest.xml | 11 +- .../anotherwidget/object/Constants.kt | 3 + .../anotherwidget/object/Event.kt | 3 +- .../receiver/OpenWeatherIntentReceiver.kt | 1 + .../anotherwidget/receiver/UpdatesReceiver.kt | 2 +- .../anotherwidget/ui/AWApplication.kt | 27 +++++ .../anotherwidget/ui/activity/MainActivity.kt | 56 ++++++++--- .../ui/activity/SupportDevActivity.kt | 94 +++++++++--------- .../anotherwidget/ui/widget/TheWidget.kt | 38 +++++-- .../anotherwidget/util/CalendarUtil.kt | 57 +++-------- .../anotherwidget/util/CrocodileService.kt | 2 +- .../anotherwidget/util/MyMigration.java | 51 ++++++++++ .../tommasoberlose/anotherwidget/util/Util.kt | 22 ++-- .../anotherwidget/util/WeatherUtil.kt | 13 +-- .../drawable-hdpi/ic_action_hide_preview.png | Bin 0 -> 854 bytes .../drawable-hdpi/ic_action_show_preview.png | Bin 0 -> 770 bytes .../drawable-mdpi/ic_action_hide_preview.png | Bin 0 -> 527 bytes .../drawable-mdpi/ic_action_show_preview.png | Bin 0 -> 500 bytes .../drawable-xhdpi/ic_action_hide_preview.png | Bin 0 -> 981 bytes .../drawable-xhdpi/ic_action_show_preview.png | Bin 0 -> 980 bytes .../ic_action_hide_preview.png | Bin 0 -> 1702 bytes .../ic_action_show_preview.png | Bin 0 -> 1661 bytes app/src/main/res/layout/main_menu_layout.xml | 29 ++++++ app/src/main/res/layout/the_widget.xml | 1 - app/src/main/res/layout/the_widget_sans.xml | 14 ++- app/src/main/res/values-it-rIT/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + app/src/main/res/xml-v21/the_widget_info.xml | 2 +- app/src/main/res/xml/the_widget_info.xml | 2 +- 31 files changed, 297 insertions(+), 139 deletions(-) create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/ui/AWApplication.kt create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/util/MyMigration.java create mode 100644 app/src/main/res/drawable-hdpi/ic_action_hide_preview.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_show_preview.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_hide_preview.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_show_preview.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_hide_preview.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_show_preview.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_hide_preview.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_show_preview.png diff --git a/app/build.gradle b/app/build.gradle index e42095a..6e859f1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,7 +17,7 @@ android { applicationId "com.tommasoberlose.anotherwidget" minSdkVersion 19 targetSdkVersion 26 - versionCode 27 + versionCode 28 versionName "1.3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/app/release/output.json b/app/release/output.json index e921328..c964bde 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":27},"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":28},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2a7811a..65c8ddb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,7 @@ android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" + android:name=".ui.AWApplication" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> @@ -113,7 +114,7 @@ + android:exported="false"> @@ -121,10 +122,12 @@ + android:enabled="true"/> - + \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/object/Constants.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/object/Constants.kt index ec123ed..bbc910e 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/object/Constants.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/object/Constants.kt @@ -32,6 +32,7 @@ object Constants { val PREF_CALENDAR_ALL_DAY = "PREF_CALENDAR_ALL_DAY" val PREF_CALENDAR_FILTER = "PREF_CALENDAR_FILTER" + val PREF_EVENT_ID = "PREF_EVENT_ID" val PREF_NEXT_EVENT_ID = "PREF_NEXT_EVENT_ID" val PREF_NEXT_EVENT_NAME = "PREF_NEXT_EVENT_NAME" val PREF_NEXT_EVENT_START_DATE = "PREF_NEXT_EVENT_START_DATE" @@ -69,6 +70,8 @@ object Constants { val PREF_SECOND_ROW_INFORMATION = "PREF_SECOND_ROW_INFORMATION" val PREF_CUSTOM_FONT = "PREF_CUSTOM_FONT" val PREF_SHOW_NEXT_EVENT = "PREF_SHOW_NEXT_EVENT" + val PREF_SHOW_WIDGET_PREVIEW = "PREF_SHOW_WIDGET_PREVIEW" + val PREF_SCHEMA_VERSION = "PREF_SCHEMA_VERSION" val CUSTOM_FONT_PRODUCT_SANS = 1 diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/object/Event.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/object/Event.kt index 0eb6744..0120edd 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/object/Event.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/object/Event.kt @@ -10,7 +10,8 @@ import java.util.Date * Created by tommaso on 05/10/17. */ -open class Event(var id: Int = 0, +open class Event(var id: Long = 0, + var eventID: Long = 0, var title: String = "", var startDate: Long = 0, var endDate: Long = 0, 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 07de471..e8e5a1f 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/OpenWeatherIntentReceiver.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/OpenWeatherIntentReceiver.kt @@ -3,6 +3,7 @@ package com.tommasoberlose.anotherwidget.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import android.util.Log import com.tommasoberlose.anotherwidget.`object`.Constants import com.tommasoberlose.anotherwidget.util.Util diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/UpdatesReceiver.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/UpdatesReceiver.kt index bc6d26c..1986777 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/UpdatesReceiver.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/receiver/UpdatesReceiver.kt @@ -27,7 +27,7 @@ class UpdatesReceiver : BroadcastReceiver() { setUpdates(context) } else if (intent.action.equals(Constants.ACTION_TIME_UPDATE) || intent.action.equals("com.sec.android.widgetapp.APPWIDGET_RESIZE") || intent.action == "android.intent.action.USER_PRESENT") { val e: Event = CalendarUtil.getNextEvent(context) - if (e.id == 0 || e.endDate <= Calendar.getInstance().timeInMillis) { + if (e.id == 0.toLong() || e.endDate <= Calendar.getInstance().timeInMillis) { CalendarUtil.updateEventList(context) } else { Util.updateWidget(context) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/AWApplication.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/AWApplication.kt new file mode 100644 index 0000000..66adade --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/AWApplication.kt @@ -0,0 +1,27 @@ +package com.tommasoberlose.anotherwidget.ui + +import android.annotation.SuppressLint +import android.app.Application +import android.content.SharedPreferences +import android.preference.PreferenceManager +import android.util.Log +import com.tommasoberlose.anotherwidget.`object`.Constants +import com.tommasoberlose.anotherwidget.util.MyMigration +import com.tommasoberlose.anotherwidget.util.Util + +import io.realm.Realm +import io.realm.RealmConfiguration + +class AWApplication : Application() { + @SuppressLint("ApplySharedPref") + override fun onCreate() { + super.onCreate() + Realm.init(this) + val config = RealmConfiguration.Builder() + .schemaVersion(2) + .migration(MyMigration()) + .deleteRealmIfMigrationNeeded() + .build() + Realm.setDefaultConfiguration(config) + } +} \ No newline at end of file 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 4ff744e..4536b97 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 @@ -59,6 +59,7 @@ class MainActivity : AppCompatActivity() { } } + @SuppressLint("ApplySharedPref") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) @@ -66,6 +67,8 @@ class MainActivity : AppCompatActivity() { sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) + val SP = PreferenceManager.getDefaultSharedPreferences(this) + if (intent.extras?.containsKey(Constants.ACTION_EXTRA_OPEN_WEATHER_PROVIDER) == true) { startActivityForResult(Intent(this, WeatherProviderActivity::class.java), Constants.WEATHER_PROVIDER_REQUEST_CODE) } @@ -98,6 +101,28 @@ class MainActivity : AppCompatActivity() { } }) + if (SP.getBoolean(Constants.PREF_SHOW_WIDGET_PREVIEW, true)) { + menuView.widget_preview_icon.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_hide_preview)) + menuView.widget_preview_label.text = getString(R.string.action_hide_widget_preview) + menuView.action_toggle_widget_preview.setOnClickListener { + SP.edit() + .putBoolean(Constants.PREF_SHOW_WIDGET_PREVIEW, false) + .commit() + updateUI() + mBottomSheetDialog.dismiss() + } + } else { + menuView.widget_preview_icon.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_show_preview)) + menuView.widget_preview_label.text = getString(R.string.action_show_widget_preview) + menuView.action_toggle_widget_preview.setOnClickListener { + SP.edit() + .putBoolean(Constants.PREF_SHOW_WIDGET_PREVIEW, true) + .commit() + updateUI() + mBottomSheetDialog.dismiss() + } + } + menuView.action_rate.setOnClickListener(object: View.OnClickListener { override fun onClick(p0: View?) { Util.rateApp(this@MainActivity, "https://play.google.com/store/apps/details?id=com.tommasoberlose.anotherwidget") @@ -183,16 +208,23 @@ class MainActivity : AppCompatActivity() { updateClockView() val SP = PreferenceManager.getDefaultSharedPreferences(this) - val displayMetrics = Resources.getSystem().displayMetrics - 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() + + if (SP.getBoolean(Constants.PREF_SHOW_WIDGET_PREVIEW, true)) { + val displayMetrics = Resources.getSystem().displayMetrics + 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() + } + if (SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) + SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) > 50) { + height += Util.convertDpToPixel(24f, this).toInt() + } + widget_bitmap.setImageBitmap(Util.getBitmapFromView(main_layout, displayMetrics.widthPixels, height - Util.convertDpToPixel(32f, this).toInt())) + widget.layoutParams.height = height + Util.convertDpToPixel(16f, this).toInt() + + widget.visibility = View.VISIBLE + } else { + widget.visibility = View.GONE } - if (SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) + SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) > 50) { - height += Util.convertDpToPixel(24f, this).toInt() - } - widget_bitmap.setImageBitmap(Util.getBitmapFromView(main_layout, displayMetrics.widthPixels, height - Util.convertDpToPixel(32f, this).toInt())) - widget.layoutParams.height = height + Util.convertDpToPixel(16f, this).toInt() } @@ -283,7 +315,7 @@ class MainActivity : AppCompatActivity() { if (calendarLayout) { val e = CalendarUtil.getNextEvent(this) - if (e.id != 0) { + if (e.id != 0.toLong()) { next_event.text = e.title if (SP.getBoolean(Constants.PREF_SHOW_NEXT_EVENT, false) && CalendarUtil.getEventsCount(this) > 1) { @@ -364,8 +396,8 @@ class MainActivity : AppCompatActivity() { second_row_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f second_row_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f - weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f - weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f + weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f + weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f empty_weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f empty_weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/SupportDevActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/SupportDevActivity.kt index c832173..3c12d63 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/SupportDevActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/SupportDevActivity.kt @@ -32,62 +32,66 @@ class SupportDevActivity : AppCompatActivity(), BillingProcessor.IBillingHandler override fun onBillingInitialized() { loader.visibility = View.GONE - val isAvailable = BillingProcessor.isIabServiceAvailable(this) - val isOneTimePurchaseSupported = bp!!.isOneTimePurchaseSupported - if (isAvailable && isOneTimePurchaseSupported) { - val coffee = bp!!.getPurchaseListingDetails("donation_coffee") - val donuts = bp!!.getPurchaseListingDetails("donation_donuts") - val breakfast = bp!!.getPurchaseListingDetails("donation_breakfast") - val lunch = bp!!.getPurchaseListingDetails("donation_lunch") - val dinner = bp!!.getPurchaseListingDetails("donation_dinner") + try { + val isAvailable = BillingProcessor.isIabServiceAvailable(this) + val isOneTimePurchaseSupported = bp!!.isOneTimePurchaseSupported + if (isAvailable && isOneTimePurchaseSupported) { + val coffee = bp!!.getPurchaseListingDetails("donation_coffee") + val donuts = bp!!.getPurchaseListingDetails("donation_donuts") + val breakfast = bp!!.getPurchaseListingDetails("donation_breakfast") + val lunch = bp!!.getPurchaseListingDetails("donation_lunch") + val dinner = bp!!.getPurchaseListingDetails("donation_dinner") - if (coffee != null) { - import_donation_coffee.text = coffee.priceText - action_donation_coffee.setOnClickListener { - bp!!.purchase(this, "donation_coffee") + if (coffee != null) { + import_donation_coffee.text = coffee.priceText + action_donation_coffee.setOnClickListener { + bp!!.purchase(this, "donation_coffee") + } + } else { + action_donation_coffee.visibility = View.GONE } - } else { - action_donation_coffee.visibility = View.GONE - } - if (donuts != null) { - import_donation_donuts.text = donuts.priceText - action_donation_donuts.setOnClickListener { - bp!!.purchase(this, "donation_donuts") + if (donuts != null) { + import_donation_donuts.text = donuts.priceText + action_donation_donuts.setOnClickListener { + bp!!.purchase(this, "donation_donuts") + } + } else { + action_donation_donuts.visibility = View.GONE } - } else { - action_donation_donuts.visibility = View.GONE - } - if (breakfast != null) { - import_donation_breakfast.text = breakfast.priceText - action_donation_breakfast.setOnClickListener { - bp!!.purchase(this, "donation_breakfast") + if (breakfast != null) { + import_donation_breakfast.text = breakfast.priceText + action_donation_breakfast.setOnClickListener { + bp!!.purchase(this, "donation_breakfast") + } + } else { + action_donation_breakfast.visibility = View.GONE } - } else { - action_donation_breakfast.visibility = View.GONE - } - if (lunch != null) { - import_donation_lunch.text = lunch.priceText - action_donation_lunch.setOnClickListener { - bp!!.purchase(this, "donation_lunch") + if (lunch != null) { + import_donation_lunch.text = lunch.priceText + action_donation_lunch.setOnClickListener { + bp!!.purchase(this, "donation_lunch") + } + } else { + action_donation_lunch.visibility = View.GONE } - } else { - action_donation_lunch.visibility = View.GONE - } - if (dinner != null) { - import_donation_dinner.text = dinner.priceText - action_donation_dinner.setOnClickListener { - bp!!.purchase(this, "donation_dinner") + if (dinner != null) { + import_donation_dinner.text = dinner.priceText + action_donation_dinner.setOnClickListener { + bp!!.purchase(this, "donation_dinner") + } + } else { + action_donation_dinner.visibility = View.GONE } - } else { - action_donation_dinner.visibility = View.GONE - } - products_list.visibility = View.VISIBLE - } else { + products_list.visibility = View.VISIBLE + } else { + products_card.visibility = View.GONE + } + } catch (ignored: Exception) { products_card.visibility = View.GONE } } 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 9b72f48..feea9af 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 @@ -45,6 +45,7 @@ import android.text.style.StyleSpan import android.util.DisplayMetrics import android.util.TypedValue import android.widget.LinearLayout +import com.tommasoberlose.anotherwidget.receiver.OpenWeatherIntentReceiver import com.tommasoberlose.anotherwidget.ui.view.CustomTypefaceSpan import kotlinx.android.synthetic.main.the_widget.* import kotlinx.android.synthetic.main.the_widget.view.* @@ -136,6 +137,8 @@ class TheWidget : AppWidgetProvider() { views = updateLocationView(context, views, appWidgetId) views = updateClockView(context, views, appWidgetId) + views = fixViewsMargin(context, views) + appWidgetManager.updateAppWidget(appWidgetId, views) } @@ -160,7 +163,7 @@ class TheWidget : AppWidgetProvider() { if (calendarLayout) { val e = CalendarUtil.getNextEvent(context) - if (e.id != 0) { + if (e.id != 0.toLong()) { views.setTextViewText(R.id.next_event, e.title) if (SP.getBoolean(Constants.PREF_SHOW_NEXT_EVENT, false) && CalendarUtil.getEventsCount(context) > 1) { @@ -277,8 +280,9 @@ class TheWidget : AppWidgetProvider() { views.setTextViewText(R.id.temp, temp) views.setTextViewText(R.id.calendar_temp, temp) - - val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, Intent(Constants.ACTION_OPEN_WEATHER_INTENT), 0) + val i = Intent(context, OpenWeatherIntentReceiver::class.java) + i.action = Constants.ACTION_OPEN_WEATHER_INTENT + val weatherPIntent = PendingIntent.getBroadcast(context, widgetID, i, 0) views.setOnClickPendingIntent(R.id.weather, weatherPIntent) views.setOnClickPendingIntent(R.id.calendar_weather, weatherPIntent) @@ -293,9 +297,7 @@ class TheWidget : AppWidgetProvider() { val SP = PreferenceManager.getDefaultSharedPreferences(context) if (!SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) { views.setViewVisibility(R.id.time, View.GONE) - views.setViewVisibility(R.id.bottom_divider, View.VISIBLE) } else { - views.setViewVisibility(R.id.bottom_divider, View.GONE) val now = Calendar.getInstance() if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) { val textBadHour = SpannableString(Constants.badHourFormat.format(now.timeInMillis).replace(" ", "")) @@ -315,6 +317,26 @@ class TheWidget : AppWidgetProvider() { return views } + fun fixViewsMargin(context: Context, views: RemoteViews): RemoteViews { + val SP = PreferenceManager.getDefaultSharedPreferences(context) + views.setViewVisibility(R.id.bottom_divider_24, View.GONE) + views.setViewVisibility(R.id.bottom_divider_16, View.GONE) + views.setViewVisibility(R.id.bottom_divider_8, View.GONE) + val eVisible = SP.getBoolean(Constants.PREF_SHOW_EVENTS, true) && Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR) + if (SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) { + if (eVisible) { + views.setViewVisibility(R.id.bottom_divider_8, View.VISIBLE) + } else { + views.setViewVisibility(R.id.bottom_divider_24, View.VISIBLE) + } + } else { + if (eVisible) { + views.setViewVisibility(R.id.bottom_divider_8, View.VISIBLE) + } + } + return views + } + fun updateCalendarViewByLayout(context: Context, v: View): View { val SP = PreferenceManager.getDefaultSharedPreferences(context) val now = Calendar.getInstance() @@ -332,7 +354,7 @@ class TheWidget : AppWidgetProvider() { if (calendarLayout) { val e = CalendarUtil.getNextEvent(context) - if (e.id != 0) { + if (e.id != 0.toLong()) { v.next_event.text = e.title if (SP.getBoolean(Constants.PREF_SHOW_NEXT_EVENT, false) && CalendarUtil.getEventsCount(context) > 1) { @@ -418,8 +440,8 @@ class TheWidget : AppWidgetProvider() { v.second_row_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f v.second_row_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f - v.weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f - v.weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f + v.weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f + v.weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f v.empty_weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f v.empty_weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt index 79fd85b..2e67c94 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt @@ -72,7 +72,7 @@ object CalendarUtil { instance.begin = start.timeInMillis - start.timeZone.getOffset(start.timeInMillis) instance.end = end.timeInMillis - end.timeZone.getOffset(end.timeInMillis) } - eventList.add(Event(e.id.toInt(), e.title, instance.begin, instance.end, e.calendarId.toInt(), e.allDay, e.eventLocation ?: "")) + eventList.add(Event(instance.id, e.id, e.title, instance.begin, instance.end, e.calendarId.toInt(), e.allDay, e.eventLocation ?: "")) } } } @@ -118,8 +118,7 @@ object CalendarUtil { } fun saveEvents(context: Context, eventList: ArrayList) { - Realm.init(context) - val db = Realm.getDefaultInstance() + val db = Util.getRealInstance(context) db.executeTransaction { realm -> realm.where(Event::class.java).findAll().deleteAllFromRealm() realm.copyToRealm(eventList) @@ -128,13 +127,13 @@ object CalendarUtil { @SuppressLint("ApplySharedPref") fun resetNextEventData(context: Context) { - Realm.init(context) - val db = Realm.getDefaultInstance() + val db = Util.getRealInstance(context) db.executeTransaction { db.where(Event::class.java).findAll().deleteAllFromRealm() } val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) SP.edit() + .remove(Constants.PREF_EVENT_ID) .remove(Constants.PREF_NEXT_EVENT_ID) .remove(Constants.PREF_NEXT_EVENT_NAME) .remove(Constants.PREF_NEXT_EVENT_START_DATE) @@ -150,34 +149,20 @@ object CalendarUtil { fun saveNextEventData(context: Context, event: Event) { val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) SP.edit() - .putInt(Constants.PREF_NEXT_EVENT_ID, event.id) + .putLong(Constants.PREF_EVENT_ID, event.id) .commit() Util.updateWidget(context) } fun getNextEvent(context: Context): Event { val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) - Realm.init(context) - val db = Realm.getDefaultInstance() - val nextEvent = db.where(Event::class.java).equalTo("id", SP.getInt(Constants.PREF_NEXT_EVENT_ID, 0)).findFirst() + val db = Util.getRealInstance(context) + val nextEvent = db.where(Event::class.java).equalTo("id", SP.getLong(Constants.PREF_EVENT_ID, 0)).findFirst() return if (nextEvent != null) { nextEvent } else { val eventList = db.where(Event::class.java).findAll() - if (eventList.isNotEmpty()) { - eventList.sortWith(Comparator { event: Event, event1: Event -> - if (event.allDay && event1.allDay) { - event.startDate.compareTo(event1.startDate) - } else if (event.allDay) { - 1 - } else if (event1.allDay) { - -1 - } else { - event1.startDate.compareTo(event.startDate) - } - }) - eventList.reverse() eventList[0] ?: Event() } else { Event() @@ -187,36 +172,21 @@ object CalendarUtil { @SuppressLint("ApplySharedPref") fun goToNextEvent(context: Context) { - Realm.init(context) - val db = Realm.getDefaultInstance() + val db = Util.getRealInstance(context) val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context) val eventList = db.where(Event::class.java).findAll() if (eventList.isNotEmpty()) { - /* - eventList.sortWith(Comparator { event: Event, event1: Event -> - if (event.allDay && event1.allDay) { - event.startDate.compareTo(event1.startDate) - } else if (event.allDay) { - 1 - } else if (event1.allDay) { - -1 - } else { - event1.startDate.compareTo(event.startDate) - } - }) - eventList.reverse()*/ - var found = false for (e in eventList) { - if (e.id == SP.getInt(Constants.PREF_NEXT_EVENT_ID, 0)) { + if (e.id == SP.getLong(Constants.PREF_EVENT_ID, 0)) { if (eventList.indexOf(e) < eventList.size - 1) { SP.edit() - .putInt(Constants.PREF_NEXT_EVENT_ID, eventList[eventList.indexOf(e) + 1]?.id ?: 0) + .putLong(Constants.PREF_EVENT_ID, eventList[eventList.indexOf(e) + 1]?.id ?: 0) .commit() } else { SP.edit() - .putInt(Constants.PREF_NEXT_EVENT_ID, eventList[0]?.id ?: 0) + .putLong(Constants.PREF_EVENT_ID, eventList[0]?.id ?: 0) .commit() } found = true @@ -226,7 +196,7 @@ object CalendarUtil { if (!found) { SP.edit() - .putInt(Constants.PREF_NEXT_EVENT_ID, eventList[0]?.id ?: 0) + .putLong(Constants.PREF_EVENT_ID, eventList[0]?.id ?: 0) .commit() } } else { @@ -237,8 +207,7 @@ object CalendarUtil { } fun getEventsCount(context: Context): Int { - Realm.init(context) - val db = Realm.getDefaultInstance() + val db = Util.getRealInstance(context) return db.where(Event::class.java).findAll().size } } \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/util/CrocodileService.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/util/CrocodileService.kt index 377b7a9..4affcef 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/CrocodileService.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/CrocodileService.kt @@ -51,7 +51,7 @@ class CrocodileService : Service() { override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(this, "Settings") + val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(this, "Config") .setSmallIcon(R.drawable.ic_stat_name) .setPriority(Notification.PRIORITY_MIN) .setColor(ContextCompat.getColor(this, R.color.colorPrimary)) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/util/MyMigration.java b/app/src/main/java/com/tommasoberlose/anotherwidget/util/MyMigration.java new file mode 100644 index 0000000..2711af0 --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/MyMigration.java @@ -0,0 +1,51 @@ +package com.tommasoberlose.anotherwidget.util; + +import android.support.annotation.NonNull; +import android.util.Log; + +import io.realm.DynamicRealm; +import io.realm.DynamicRealmObject; +import io.realm.RealmMigration; +import io.realm.RealmObjectSchema; +import io.realm.RealmSchema; + +/** + * Created by tommaso on 06/11/17. + */ + +public class MyMigration implements RealmMigration { + @Override + public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { + + RealmSchema schema = realm.getSchema(); + if (oldVersion == 1) { + RealmObjectSchema event = schema.get("Event"); + if (event != null) { + if (!event.hasField("eventID")) { + event.addField("eventID", long.class); + } + event + .addField("id_tmp", long.class) + .transform(new RealmObjectSchema.Function() { + @Override + public void apply(@NonNull DynamicRealmObject obj) { + obj.setLong("id_tmp", obj.getInt("id")); + } + }) + .removeField("id") + .renameField("id_tmp", "id"); + } + oldVersion++; + } + } + + @Override + public int hashCode() { + return 37; + } + + @Override + public boolean equals(Object o) { + return (o instanceof MyMigration); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt index dbedead..605d9a3 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt @@ -39,6 +39,8 @@ import android.widget.RemoteViews import android.widget.Toast import com.tommasoberlose.anotherwidget.`object`.Constants import com.tommasoberlose.anotherwidget.`object`.Event +import io.realm.Realm +import io.realm.RealmConfiguration import org.joda.time.DateTime import java.util.concurrent.TimeUnit @@ -68,7 +70,7 @@ object Util { val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; if (!Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR)) { - val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Settings") + val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Config") .setSmallIcon(R.drawable.ic_stat_name) .setPriority(Notification.PRIORITY_MIN) .setColor(ContextCompat.getColor(context, R.color.colorPrimary)) @@ -284,7 +286,7 @@ object Util { if (SP.getString(Constants.PREF_WEATHER_APP_PACKAGE, "").equals("")) { val weatherIntent: Intent = Intent(Intent.ACTION_VIEW) weatherIntent.addCategory(Intent.CATEGORY_DEFAULT) - weatherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + weatherIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity") weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline") return weatherIntent @@ -295,12 +297,12 @@ object Util { return try { val intent: Intent = pm.getLaunchIntentForPackage(SP.getString(Constants.PREF_WEATHER_APP_PACKAGE, "")) intent.addCategory(Intent.CATEGORY_LAUNCHER) - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK intent } catch (e: Exception) { val weatherIntent: Intent = Intent(Intent.ACTION_VIEW) weatherIntent.addCategory(Intent.CATEGORY_DEFAULT) - weatherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + weatherIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity") weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline") weatherIntent @@ -311,7 +313,7 @@ object Util { fun getEventIntent(context: Context, e: Event): Intent { val SP = PreferenceManager.getDefaultSharedPreferences(context) if (SP.getString(Constants.PREF_EVENT_APP_PACKAGE, "").equals("")) { - val uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, e.id.toLong()) + val uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, e.eventID) val intent = Intent(Intent.ACTION_VIEW) .setData(uri) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) @@ -380,7 +382,7 @@ object Util { val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; if (show) { - val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Settings") + val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Config") .setSmallIcon(R.drawable.ic_stat_name) .setPriority(Notification.PRIORITY_MIN) .setColor(ContextCompat.getColor(context, R.color.colorPrimary)) @@ -402,7 +404,7 @@ object Util { val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; if (show) { - val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Settings") + val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Config") .setSmallIcon(R.drawable.ic_stat_name) .setColor(ContextCompat.getColor(context, R.color.colorPrimary)) .setContentTitle(context.getString(R.string.settings_weather_provider_api_key_title)) @@ -566,7 +568,7 @@ object Util { @SuppressLint("ApplySharedPref") fun updateSettingsByDefault(context: Context) { try { - context.startService(Intent(context, CrocodileService::class.java)) + // context.startService(Intent(context, CrocodileService::class.java)) } catch (e: Exception) { } @@ -584,6 +586,10 @@ object Util { editor.commit() } + fun getRealInstance(context: Context): Realm { + return Realm.getDefaultInstance() + } + fun getNextAlarm(context: Context): String? { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { val SP = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/util/WeatherUtil.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/util/WeatherUtil.kt index a00513d..75ca5cf 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/WeatherUtil.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/WeatherUtil.kt @@ -188,15 +188,10 @@ object WeatherUtil { icon = "82" } - val uiManager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager - return when { - uiManager.nightMode == UiModeManager.MODE_NIGHT_YES -> icon + "n" - uiManager.nightMode == UiModeManager.MODE_NIGHT_NO -> icon + "d" - else -> return if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) >= 19 || Calendar.getInstance().get(Calendar.HOUR_OF_DAY) < 7) { - icon + "n" - } else { - icon + "d" - } + return if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) >= 19 || Calendar.getInstance().get(Calendar.HOUR_OF_DAY) < 7) { + icon + "n" + } else { + icon + "d" } } } diff --git a/app/src/main/res/drawable-hdpi/ic_action_hide_preview.png b/app/src/main/res/drawable-hdpi/ic_action_hide_preview.png new file mode 100644 index 0000000000000000000000000000000000000000..08908006409b16086f936927eb0faf936c2b9967 GIT binary patch literal 854 zcmV-c1F8IpP)R$q$MqBN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`}|9UtCAWw~yw0PnaghN(Hm* z4(nRwE?6((wMvdJ%PNX}BbVe(E6l*hsU|w@8@l^k#rjE;eXi}P{j4eVP5IIZ3rr2$!G5`Po07*qoM6N<$f*IIg AqW}N^ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_hide_preview.png b/app/src/main/res/drawable-mdpi/ic_action_hide_preview.png new file mode 100644 index 0000000000000000000000000000000000000000..9fbd1f54211d095df2b48519b760936b1389ecfa GIT binary patch literal 527 zcmV+q0`UEbP)Y5Qd{jjEY8L5fv1Ih2(EoB!NT>=>pnVMhFNNDprCBDJ&APun|!#Bm}guP!T;P ziuj-6J1~Layq&$%z**$rfrFjhefDE^?;?@@(|^R%>2%Vd0mj4VJPDq_7dQ_~qRIk4 zB=9~AmcR~|J%A6;2KV3$Y;#Pk=MvN?I1yzUFJKEyg(=Y$Sp|bZ1rj{1CW(Ep0rH^8 z!YxJQ7)d=}hzG@@=y8YL(I#~{(NE(rqSmXTPq1Lcc~#Feo=3I=$pZ0jnQBMJ_{ zA(#_w6_olllR!zS)KoTRl*Q=`nHS5U&1BBq`51UqDpV}l(UqtfGRe&y)sX^gmTAw4 z*tQ}e1&Wq7OH!b030@Yljn%8J+&&xE7w3DdD%?+(UGVv3=8D2;+cnd<}E%z+;aGyn6NxpVFf1bp+&H$!W;+oNC^9D*Cr06#>7?j3+75FTXW z8L$s*&@#j(pQ(Nl4})Fmu+<}~kZmy3ZSokn76R8m3FHWM{Uqow!Gvk@IH+p^eSr)J zx%h=ZR`^uUo}UDQC<%4RlLiee3Ps$3ah;>;;6iwfX{MbA6<`r%Fvp%}g*a7R0eQjc z0R&lc%SH3y6hX~MYhtxC`51T;9Ewa^6?A2$D+#(6Fv1Ji^7x(Bm{ytx7SrWCVy^Q7 zHvXZ2Ogv~<%jYO?#)g(6aJ9nc$03&~Z?xaoc{ z39dZWL_z%>M3IJ-POmn$STEc04runV9jmQ;PsQrzTrdrez;_pkn{;xT9puR<0#?8Y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=u`)4BMV471HVWfx>HaVULt%R|6mtFQmj^`j@a6>pxeCCcGDq;l96YX*g z))*1<_HqqyFDcp8OiE?v(@}oX?m>rt+f10}xsnSzn&%MwNGkoUA*Qm6(a~Vi;f&l7 zBY}6MB-d28F2O}p{F3jcky6>k=%~%XBkCv2_lnC7EF8=YIK&tS>zjcpYlU=lK|P*? ze{+B|=VPf3WO?`{qGz)uU}de4j$Uv`QB0B2*Xz=xZwH72sY~#>PIwO1^6BVE!m}HR z3-5EMvjEZL6tSALEaClw#9*yI;kkO^-1UHONE&DjG1+$2ExS2k43orQZO9?h%d9bX zx+L7bCk{YE{v`=x7$fG6HYNQ1QWW}G^Zz38FqQ`%B@`_3X=7Ew`v+pBvQg+CC!T)~ zySkt~#8uFc@cyH*QrYOXV9mSFxoRd4K299S)`WMz9ILX1mKWB%pH5qRIYk;slY=L6 zIYwm-eMhYJ#_Q4!W*aFL(K}nk2~*F9a-i`A9= zcG(4b9LNkRYIJ;mE+id!yd=`+?M{LG&|QQGQFA`EDcTAL&$$B3zdCX@nSe*7{tV!F)_|S(z6zX4(n+eDqaDpdUNz!e^#&Yjq!3c+lbfheBdsR%qCB05k7EvSSy~xv7r=*}Y zQ0fpVSnJBnEqbi97Ggbh6sxTXwcQ3#;1aDd<4mg4mKW_iLgYR|4%V`Da~`WMSEM(S z*}^`Y_w_8Fsq@PH{2J(@msCp#iOT&NqzwE{~DwW{x-qK#4d}>ToTE; zA=Z=ojf{>QjG*@ooj&s{poh!KpAGGYXy zBcmfTLK-@1F^$EeqX|kskjek(Xr@BH7NT~VmiR^}R_LF=fALjq8VYBGwmjwUF|EX* wBmLi{c9=He=C6!)OiWBnOiWBnOe#_S1whK7p}L?EegFUf07*qoM6N<$g6p6!y#N3J literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_show_preview.png b/app/src/main/res/drawable-xxhdpi/ic_action_show_preview.png new file mode 100644 index 0000000000000000000000000000000000000000..2563a5b08dfb8668bff1059dc1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DoE{Z{P3>GKi3Yd$N1$I?|@`t>+K?T{x ztr6dX#iGUwFVhd;ksgGeYeCCK#N}U2()>RBiow7fx~r3CfdcVj-XB-$o<+;hTC-2WPL0A0}7pLzW&8$zav%t zA&#Ct57TmsDcoQ%7z_r3!C){L3 + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml index 2dfbda3..dd4d653 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -151,4 +151,6 @@ Una Pranzo Veloce Another Widget è attivo AW è attivo in background + Mostra Anteprima Widget + Nascondi Anteprima Widget \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8611ef1..a1db4aa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -156,4 +156,6 @@ A Quick Lunch Another Widget is Running AW is running in the background + Show Widget Preview + Hide Widget Preview diff --git a/app/src/main/res/xml-v21/the_widget_info.xml b/app/src/main/res/xml-v21/the_widget_info.xml index 9c71ab6..b7bb16b 100644 --- a/app/src/main/res/xml-v21/the_widget_info.xml +++ b/app/src/main/res/xml-v21/the_widget_info.xml @@ -8,6 +8,6 @@ android:minResizeHeight="60dp" android:minResizeWidth="300dp" android:previewImage="@drawable/widget_preview" - android:resizeMode="vertical" + android:resizeMode="vertical|horizontal" android:updatePeriodMillis="60000" android:widgetCategory="home_screen" /> \ No newline at end of file diff --git a/app/src/main/res/xml/the_widget_info.xml b/app/src/main/res/xml/the_widget_info.xml index 219c9a1..2104f8b 100644 --- a/app/src/main/res/xml/the_widget_info.xml +++ b/app/src/main/res/xml/the_widget_info.xml @@ -7,6 +7,6 @@ android:minResizeHeight="60dp" android:minResizeWidth="300dp" android:previewImage="@drawable/widget_preview" - android:resizeMode="vertical" + android:resizeMode="vertical|horizontal" android:updatePeriodMillis="60000" android:widgetCategory="home_screen" /> \ No newline at end of file