From 891977612ef72dcfec1281d3b25b96b3c8cb90d6 Mon Sep 17 00:00:00 2001 From: Tommaso Berlose Date: Sun, 15 Oct 2017 15:02:49 +0200 Subject: [PATCH] New changes and fixes --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 8 +- .../object/ApplicationListEvent.kt | 16 + .../anotherwidget/object/Constants.kt | 15 +- .../object/CustomLocationEvent.kt | 14 + .../ui/activity/ChooseApplicationActivity.kt | 114 +++++ .../ui/activity/CustomLocationActivity.kt | 69 ++- .../anotherwidget/ui/activity/MainActivity.kt | 241 +++++++--- .../anotherwidget/ui/widget/TheWidget.kt | 49 +- .../anotherwidget/util/CalendarUtil.kt | 20 +- .../tommasoberlose/anotherwidget/util/Util.kt | 84 +++- app/src/main/res/anim/slide_down.xml | 10 + app/src/main/res/anim/slide_up.xml | 10 + app/src/main/res/anim/stay.xml | 5 + .../main/res/drawable-hdpi/ic_action_aw.png | Bin 0 -> 954 bytes .../drawable-hdpi/ic_action_geolocation.png | Bin 0 -> 945 bytes .../main/res/drawable-hdpi/ic_action_gps.png | Bin 0 -> 945 bytes .../res/drawable-hdpi/ic_action_refresh.png | Bin 0 -> 661 bytes .../res/drawable-hdpi/ic_action_reset.png | Bin 0 -> 607 bytes .../main/res/drawable-mdpi/ic_action_aw.png | Bin 0 -> 597 bytes .../drawable-mdpi/ic_action_geolocation.png | Bin 0 -> 586 bytes .../main/res/drawable-mdpi/ic_action_gps.png | Bin 0 -> 586 bytes .../res/drawable-mdpi/ic_action_refresh.png | Bin 0 -> 419 bytes .../res/drawable-mdpi/ic_action_reset.png | Bin 0 -> 398 bytes .../main/res/drawable-xhdpi/ic_action_aw.png | Bin 0 -> 1188 bytes .../drawable-xhdpi/ic_action_geolocation.png | Bin 0 -> 1145 bytes .../main/res/drawable-xhdpi/ic_action_gps.png | Bin 0 -> 1145 bytes .../res/drawable-xhdpi/ic_action_refresh.png | Bin 0 -> 832 bytes .../res/drawable-xhdpi/ic_action_reset.png | Bin 0 -> 757 bytes .../main/res/drawable-xxhdpi/ic_action_aw.png | Bin 0 -> 2012 bytes .../drawable-xxhdpi/ic_action_geolocation.png | Bin 0 -> 2023 bytes .../res/drawable-xxhdpi/ic_action_gps.png | Bin 0 -> 2023 bytes .../res/drawable-xxhdpi/ic_action_refresh.png | Bin 0 -> 1364 bytes .../res/drawable-xxhdpi/ic_action_reset.png | Bin 0 -> 1253 bytes .../layout/activity_choose_application.xml | 85 ++++ .../res/layout/activity_custom_location.xml | 90 +++- app/src/main/res/layout/activity_main.xml | 446 ++++++++++-------- .../main/res/layout/custom_location_item.xml | 1 + app/src/main/res/layout/the_widget.xml | 1 + app/src/main/res/values-it-rIT/strings.xml | 20 + app/src/main/res/values/strings.xml | 21 + app/src/main/res/xml/the_widget_info.xml | 1 + build.gradle | 2 +- 43 files changed, 1004 insertions(+), 319 deletions(-) create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/object/ApplicationListEvent.kt create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/object/CustomLocationEvent.kt create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/ChooseApplicationActivity.kt create mode 100644 app/src/main/res/anim/slide_down.xml create mode 100644 app/src/main/res/anim/slide_up.xml create mode 100644 app/src/main/res/anim/stay.xml create mode 100644 app/src/main/res/drawable-hdpi/ic_action_aw.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_geolocation.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_gps.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_refresh.png create mode 100644 app/src/main/res/drawable-hdpi/ic_action_reset.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_aw.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_geolocation.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_gps.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_refresh.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_reset.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_aw.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_geolocation.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_gps.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_refresh.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_reset.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_aw.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_geolocation.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_gps.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_refresh.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_reset.png create mode 100644 app/src/main/res/layout/activity_choose_application.xml diff --git a/app/build.gradle b/app/build.gradle index 7aa2b7a..fb03c0e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,4 +48,5 @@ dependencies { compile 'com.android.support:design:26.1.0' compile 'com.github.rubensousa:bottomsheetbuilder:1.6.0' compile 'com.github.johnhiott:DarkSkyApi:v0.1.5' + compile 'org.greenrobot:eventbus:3.0.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 83723f1..a40cddd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,6 +21,7 @@ android:screenOrientation="portrait"> + @@ -72,7 +73,12 @@ android:name="io.fabric.ApiKey" android:value="5232fd734b08a20a984c2de02b37df19269608ef" /> - + + \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/object/ApplicationListEvent.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/object/ApplicationListEvent.kt new file mode 100644 index 0000000..0ab019d --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/object/ApplicationListEvent.kt @@ -0,0 +1,16 @@ +package com.tommasoberlose.anotherwidget.`object` + +import android.content.pm.ApplicationInfo + +/** + * Created by tommaso on 15/10/17. + */ + +class ApplicationListEvent(apps: List, filtered: Boolean) { + var apps: List = ArrayList() + var filtered: Boolean = false + init { + this.apps = apps + this.filtered = filtered + } +} \ 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 2aaecad..ce590c9 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/object/Constants.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/object/Constants.kt @@ -12,10 +12,16 @@ import java.util.* object Constants { val CALENDAR_REQUEST_CODE = 1 val LOCATION_REQUEST_CODE = 2 + val CALENDAR_APP_REQUEST_CODE = 3 + val WEATHER_APP_REQUEST_CODE = 4 + val RESULT_CODE_CUSTOM_LOCATION = 45 + val RESULT_APP_NAME = "RESULT_APP_NAME" + val RESULT_APP_PACKAGE = "RESULT_APP_PACKAGE" - val PREF_FIRST_STEP = "PREF_FIRST_STEP" + val PREF_SHOW_EVENTS = "PREF_SHOW_EVENTS" + val PREF_SHOW_WEATHER = "PREF_SHOW_WEATHER" val PREF_WEATHER_ICON = "PREF_WEATHER_ICON" val PREF_WEATHER_TEMP = "PREF_WEATHER_TEMP" val PREF_WEATHER_TEMP_UNIT = "PREF_WEATHER_TEMP_UNIT" @@ -34,11 +40,16 @@ object Constants { val PREF_HOUR_FORMAT = "PREF_HOUR_FORMAT" val PREF_ITA_FORMAT_DATE = "PREF_ITA_FORMAT_DATE" val PREF_WEATHER_REFRESH_PERIOD = "PREF_WEATHER_REFRESH_PERIOD" + val PREF_SHOW_UNTIL = "PREF_SHOW_UNTIL" + val PREF_CALENDAR_APP_NAME = "PREF_CALENDAR_APP_NAME" + val PREF_CALENDAR_APP_PACKAGE = "PREF_CALENDAR_APP_PACKAGE" + val PREF_WEATHER_APP_NAME = "PREF_WEATHER_APP_NAME" + val PREF_WEATHER_APP_PACKAGE = "PREF_WEATHER_APP_PACKAGE" val itDateFormat = SimpleDateFormat("EEEE, d MMM") val engDateFormat = SimpleDateFormat("EEEE, MMM d") val goodHourFormat = SimpleDateFormat("HH:mm") - val badHourFormat = SimpleDateFormat("KK:mm aa") + val badHourFormat = SimpleDateFormat("hh:mm a") val ACTION_TIME_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_TIME_UPDATE" val ACTION_CALENDAR_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_CALENDAR_UPDATE" diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/object/CustomLocationEvent.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/object/CustomLocationEvent.kt new file mode 100644 index 0000000..3757f23 --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/object/CustomLocationEvent.kt @@ -0,0 +1,14 @@ +package com.tommasoberlose.anotherwidget.`object` + +import android.location.Address + +/** + * Created by tommaso on 14/10/17. + */ + +class CustomLocationEvent(addresses: ArrayList
) { + var addresses: ArrayList
= ArrayList() + init { + this.addresses = addresses + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/ChooseApplicationActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/ChooseApplicationActivity.kt new file mode 100644 index 0000000..b976c0b --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/ChooseApplicationActivity.kt @@ -0,0 +1,114 @@ +package com.tommasoberlose.anotherwidget.ui.activity + +import android.app.Activity +import android.location.Address +import android.support.v7.app.AppCompatActivity +import android.os.Bundle +import android.preference.PreferenceManager +import com.tommasoberlose.anotherwidget.R +import com.tommasoberlose.anotherwidget.`object`.Constants +import com.tommasoberlose.anotherwidget.`object`.CustomLocationEvent +import kotlinx.android.synthetic.main.activity_choose_application.* +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.Subscribe +import org.greenrobot.eventbus.ThreadMode +import android.content.Intent +import android.content.pm.ApplicationInfo +import android.widget.AdapterView +import android.widget.ArrayAdapter +import com.tommasoberlose.anotherwidget.`object`.ApplicationListEvent +import android.content.pm.PackageManager +import android.location.Geocoder +import android.text.Editable +import android.text.TextWatcher +import android.util.Log + + +class ChooseApplicationActivity : AppCompatActivity() { + lateinit var adapter: ArrayAdapter + val appList = ArrayList() + val appListFiltered = ArrayList() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_choose_application) + val pm = packageManager + + action_default.setOnClickListener { + selectDefaultApp() + } + + adapter = ArrayAdapter(this, R.layout.custom_location_item, appList.map { it.name }) + list_view.adapter = adapter + + list_view.onItemClickListener = AdapterView.OnItemClickListener { parent, view, position, id -> + val resultIntent = Intent() + resultIntent.putExtra(Constants.RESULT_APP_NAME, pm.getApplicationLabel(appListFiltered[position]).toString()) + resultIntent.putExtra(Constants.RESULT_APP_PACKAGE, appListFiltered[position].packageName) + setResult(Activity.RESULT_OK, resultIntent) + finish() + } + + location.addTextChangedListener(object: TextWatcher { + override fun afterTextChanged(text: Editable?) { + Thread().run { + val appsFiltered = appList.filter { pm.getApplicationLabel(it).toString().contains(text.toString(), true) } + EventBus.getDefault().post(ApplicationListEvent(appsFiltered, true)) + } + } + + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { + } + + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { + } + }) + + } + + fun selectDefaultApp() { + val resultIntent = Intent() + resultIntent.putExtra(Constants.RESULT_APP_NAME, getString(R.string.default_name)) + resultIntent.putExtra(Constants.RESULT_APP_PACKAGE, "") + setResult(Activity.RESULT_OK, intent) + finish() + } + + public override fun onStart() { + super.onStart() + EventBus.getDefault().register(this) + } + + public override fun onResume() { + super.onResume() + Thread().run { + val pm = packageManager + val apps = pm.getInstalledApplications(0) + EventBus.getDefault().post(ApplicationListEvent(apps, false)) + } + } + + public override fun onStop() { + EventBus.getDefault().unregister(this) + super.onStop() + } + + @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) + fun onMessageEvent(event: ApplicationListEvent) { + val pm = packageManager + adapter.clear() + if (!event.filtered) { + appList.clear() + event.apps.mapTo(appList, {it}) + for (a:ApplicationInfo in appList) { + adapter.add(pm.getApplicationLabel(a).toString()) + } + } + appListFiltered.clear() + event.apps.mapTo(appListFiltered, {it}) + for (a:ApplicationInfo in appListFiltered) { + adapter.add(pm.getApplicationLabel(a).toString()) + } + adapter.notifyDataSetChanged() + } +} diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/CustomLocationActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/CustomLocationActivity.kt index c535e19..684b64c 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/CustomLocationActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/CustomLocationActivity.kt @@ -19,13 +19,24 @@ import android.util.Log import android.view.View import android.widget.AdapterView import android.widget.ArrayAdapter +import android.widget.ListView import android.widget.Toast import com.tommasoberlose.anotherwidget.`object`.Constants +import com.tommasoberlose.anotherwidget.`object`.CustomLocationEvent import com.tommasoberlose.anotherwidget.util.WeatherUtil import kotlinx.android.synthetic.main.activity_custom_location.* +import org.greenrobot.eventbus.EventBus +import org.greenrobot.eventbus.ThreadMode +import org.greenrobot.eventbus.Subscribe + + + + class CustomLocationActivity : AppCompatActivity() { + lateinit var adapter: ArrayAdapter + val addressesList = ArrayList
() @SuppressLint("ApplySharedPref") override fun onCreate(savedInstanceState: Bundle?) { @@ -34,11 +45,7 @@ class CustomLocationActivity : AppCompatActivity() { val SP = PreferenceManager.getDefaultSharedPreferences(this) - val list = ArrayList() - val addressesList = ArrayList
() - val thread: Thread = Thread() - - var adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, list) + adapter = ArrayAdapter(this, R.layout.custom_location_item, addressesList.map { it.getAddressLine(0) }) list_view.adapter = adapter list_view.onItemClickListener = AdapterView.OnItemClickListener { parent, view, position, id -> @@ -51,21 +58,26 @@ class CustomLocationActivity : AppCompatActivity() { finish() } + action_geolocation.setOnClickListener { + SP.edit() + .remove(Constants.PREF_CUSTOM_LOCATION_LAT) + .remove(Constants.PREF_CUSTOM_LOCATION_LON) + .remove(Constants.PREF_CUSTOM_LOCATION_ADD) + .commit() + setResult(Activity.RESULT_OK) + finish() + } + location.addTextChangedListener(object: TextWatcher { override fun afterTextChanged(text: Editable?) { - val coder = Geocoder(this@CustomLocationActivity) - try { - val addresses = coder.getFromLocationName(text.toString(), 10) as ArrayList
- list.clear() - addressesList.clear() - - addresses.mapTo(list) { it.getAddressLine(0) } - addresses.mapTo(addressesList) { it } - - adapter = ArrayAdapter(this@CustomLocationActivity, R.layout.custom_location_item, list) - list_view.adapter = adapter - } catch (ignored: Exception) { - Toast.makeText(this@CustomLocationActivity, "Erroreeeee", Toast.LENGTH_SHORT).show() + Thread().run { + val coder = Geocoder(this@CustomLocationActivity) + try { + val addresses = coder.getFromLocationName(text.toString(), 10) as ArrayList
+ EventBus.getDefault().post(CustomLocationEvent(addresses)) + } catch (ignored: Exception) { + EventBus.getDefault().post(CustomLocationEvent(ArrayList
())) + } } } @@ -77,4 +89,25 @@ class CustomLocationActivity : AppCompatActivity() { }) } + + public override fun onStart() { + super.onStart() + EventBus.getDefault().register(this) + } + + public override fun onStop() { + EventBus.getDefault().unregister(this) + super.onStop() + } + + @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) + fun onMessageEvent(event: CustomLocationEvent) { + adapter.clear() + addressesList.clear() + event.addresses.mapTo(addressesList, {it}) + for (a:Address in addressesList) { + adapter.add(a.getAddressLine(0)) + } + adapter.notifyDataSetChanged() + } } 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 f47077f..fb9bc53 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 @@ -15,7 +15,6 @@ import android.view.View import com.tommasoberlose.anotherwidget.`object`.Constants import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.util.Util -import com.tommasoberlose.anotherwidget.receiver.UpdatesReceiver import com.tommasoberlose.anotherwidget.receiver.WeatherReceiver import java.util.* import java.util.concurrent.TimeUnit @@ -25,13 +24,9 @@ import com.tommasoberlose.anotherwidget.util.CalendarUtil import com.tommasoberlose.anotherwidget.util.WeatherUtil import android.content.DialogInterface import android.graphics.drawable.Drawable -import android.support.v4.content.ContextCompat import android.util.Log -import android.view.MenuItem import android.widget.Toast import com.crashlytics.android.Crashlytics -import com.github.rubensousa.bottomsheetbuilder.BottomSheetBuilder -import com.github.rubensousa.bottomsheetbuilder.BottomSheetMenuDialog import com.tommasoberlose.anotherwidget.`object`.CalendarSelector import io.fabric.sdk.android.Fabric import kotlinx.android.synthetic.main.activity_main.* @@ -40,18 +35,38 @@ import kotlinx.android.synthetic.main.the_widget.* class MainActivity : AppCompatActivity() { + var mAppWidgetId: Int = -1 + private val receiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { updateUI() } } - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) Fabric.with(this, Crashlytics()) + val extras = intent.extras + if (extras != null) { + mAppWidgetId = extras.getInt( + AppWidgetManager.EXTRA_APPWIDGET_ID, + AppWidgetManager.INVALID_APPWIDGET_ID) + + if (mAppWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { + + action_refresh.visibility = View.GONE + action_support.visibility = View.GONE + action_share.visibility = View.GONE + action_add_widget.visibility = View.VISIBLE + + action_add_widget.setOnClickListener { + addNewWidget() + } + } + } + action_support.setOnClickListener(object: View.OnClickListener { override fun onClick(p0: View?) { Util.openURI(this@MainActivity, "https://paypal.me/tommasoberlose") @@ -64,11 +79,28 @@ class MainActivity : AppCompatActivity() { } }) - action_rate.setOnClickListener(object: View.OnClickListener { - override fun onClick(p0: View?) { - Util.openURI(this@MainActivity, "https://play.google.com/store/apps/details?id=com.tommasoberlose.anotherwidget") - } - }) + action_refresh.setOnClickListener { + WeatherUtil.updateWeather(this) + CalendarUtil.updateEventList(this) + Util.updateWidget(this) + } + } + + override fun onBackPressed() { + if (mAppWidgetId > 0) { + addNewWidget() + } else { + super.onBackPressed() + } + } + + fun addNewWidget() { + val resultValue = Intent() + resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId) + setResult(Activity.RESULT_OK, resultValue) + finish() + sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) + sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) } override fun onResume() { @@ -89,38 +121,19 @@ class MainActivity : AppCompatActivity() { when (requestCode) { Constants.CALENDAR_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) { CalendarUtil.updateEventList(this) + updateAppWidget() + updateSettings() } Constants.LOCATION_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) { WeatherUtil.updateWeather(this) + updateAppWidget() + updateSettings() } } } fun updateUI() { - no_calendar_permission_container.visibility= View.GONE - no_location_permission_container.visibility= View.GONE - all_set_container.visibility = View.GONE updateSettings() - - if (!Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR)) { - no_calendar_permission_container.visibility = View.VISIBLE - request_calendar.setOnClickListener(object: View.OnClickListener { - override fun onClick(view: View?) { - ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.READ_CALENDAR), Constants.CALENDAR_REQUEST_CODE) - } - }) - } else { - if (!Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)) { - no_location_permission_container.visibility = View.VISIBLE - request_location.setOnClickListener(object: View.OnClickListener { - override fun onClick(view: View?) { - ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), Constants.LOCATION_REQUEST_CODE) - } - }) - } else { - all_set_container.visibility = View.VISIBLE - } - } updateAppWidget() } @@ -134,19 +147,35 @@ class MainActivity : AppCompatActivity() { } } + @SuppressLint("ApplySharedPref") override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (requestCode == Constants.RESULT_CODE_CUSTOM_LOCATION) { - if (resultCode == Activity.RESULT_OK) { + val SP = PreferenceManager.getDefaultSharedPreferences(this) + if (requestCode == Constants.RESULT_CODE_CUSTOM_LOCATION && resultCode == Activity.RESULT_OK) { updateSettings() WeatherUtil.updateWeather(this) - } + } else if (requestCode == Constants.CALENDAR_APP_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) { + SP.edit() + .putString(Constants.PREF_CALENDAR_APP_NAME, data.getStringExtra(Constants.RESULT_APP_NAME)) + .putString(Constants.PREF_CALENDAR_APP_PACKAGE, data.getStringExtra(Constants.RESULT_APP_PACKAGE)) + .commit() + Util.updateWidget(this) + updateSettings() + updateAppWidget() + } else if (requestCode == Constants.WEATHER_APP_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) { + SP.edit() + .putString(Constants.PREF_WEATHER_APP_NAME, data.getStringExtra(Constants.RESULT_APP_NAME)) + .putString(Constants.PREF_WEATHER_APP_PACKAGE, data.getStringExtra(Constants.RESULT_APP_PACKAGE)) + .commit() + Util.updateWidget(this) + updateSettings() + updateAppWidget() } } fun updateCalendarView() { val SP = PreferenceManager.getDefaultSharedPreferences(this) val now = Calendar.getInstance() - val calendarLayout = Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR) + val calendarLayout = SP.getBoolean(Constants.PREF_SHOW_EVENTS, true) && Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR) empty_layout.visibility = View.VISIBLE calendar_layout.visibility = View.GONE @@ -184,7 +213,22 @@ class MainActivity : AppCompatActivity() { if (!e.allDay) { val startHour: String = if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) Constants.badHourFormat.format(e.startDate) else Constants.goodHourFormat.format(e.startDate) val endHour: String = if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) Constants.badHourFormat.format(e.endDate) else Constants.goodHourFormat.format(e.endDate) - next_event_date.text = String.format("%s - %s", startHour, endHour) + var dayDiff = TimeUnit.MILLISECONDS.toDays(e.endDate - e.startDate) + + val startCal = Calendar.getInstance() + startCal.timeInMillis = e.startDate + + val endCal = Calendar.getInstance() + endCal.timeInMillis = e.endDate + + if (startCal.get(Calendar.HOUR_OF_DAY) >= endCal.get(Calendar.HOUR_OF_DAY)) { + dayDiff++ + } + var multipleDay: String = "" + if (dayDiff > 0) { + multipleDay = String.format(" (+%s%s)", dayDiff, getString(R.string.day_char)) + } + next_event_date.text = String.format("%s - %s%s", startHour, endHour, multipleDay) } else { next_event_date.text = dateStringValue } @@ -196,9 +240,9 @@ class MainActivity : AppCompatActivity() { } fun updateLocationView() { - val locationLayout = Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) - val SP = PreferenceManager.getDefaultSharedPreferences(this) + val locationLayout = SP.getBoolean(Constants.PREF_SHOW_WEATHER, true) && Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) + if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) { weather.visibility = View.VISIBLE calendar_weather.visibility = View.VISIBLE @@ -227,6 +271,63 @@ class MainActivity : AppCompatActivity() { @SuppressLint("ApplySharedPref") fun updateSettings() { val SP = PreferenceManager.getDefaultSharedPreferences(this) + + if (SP.getBoolean(Constants.PREF_SHOW_EVENTS, true) && Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR)) { + calendar_settings.visibility = View.VISIBLE + action_show_events.setOnClickListener { + SP.edit() + .putBoolean(Constants.PREF_SHOW_EVENTS, false) + .commit() + updateSettings() + updateAppWidget() + Util.updateWidget(this) + } + show_events_label.text = getString(R.string.show_events_visible) + } else { + calendar_settings.visibility= View.GONE + action_show_events.setOnClickListener { + if (Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR)) { + SP.edit() + .putBoolean(Constants.PREF_SHOW_EVENTS, true) + .commit() + updateSettings() + updateAppWidget() + Util.updateWidget(this) + } else { + ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.READ_CALENDAR), Constants.CALENDAR_REQUEST_CODE) + } + } + show_events_label.text = if (Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR)) getString(R.string.show_events_not_visible) else getString(R.string.description_permission_calendar) + } + + if (SP.getBoolean(Constants.PREF_SHOW_WEATHER, true) && Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)) { + weather_settings.visibility = View.VISIBLE + action_show_weather.setOnClickListener { + SP.edit() + .putBoolean(Constants.PREF_SHOW_WEATHER, false) + .commit() + updateSettings() + updateAppWidget() + Util.updateWidget(this) + } + show_weather_label.text = getString(R.string.show_weather_visible) + } else { + weather_settings.visibility= View.GONE + action_show_weather.setOnClickListener { + if (Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)) { + SP.edit() + .putBoolean(Constants.PREF_SHOW_WEATHER, true) + .commit() + updateSettings() + updateAppWidget() + Util.updateWidget(this) + } else { + ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), Constants.LOCATION_REQUEST_CODE) + } + } + show_weather_label.text = if (Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)) getString(R.string.show_weather_not_visible) else getString(R.string.description_permission_location) + } + temp_unit.text = if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("F")) getString(R.string.fahrenheit) else getString(R.string.celsius) action_change_unit.setOnClickListener { SP.edit().putString(Constants.PREF_WEATHER_TEMP_UNIT, if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("F")) "C" else "F").commit() @@ -244,8 +345,9 @@ class MainActivity : AppCompatActivity() { hour_format_label.text = if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) getString(R.string.settings_hour_format_subtitle_12) else getString(R.string.settings_hour_format_subtitle_24) action_hour_format.setOnClickListener { SP.edit().putString(Constants.PREF_HOUR_FORMAT, if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) "24" else "12").commit() - sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) updateSettings() + updateAppWidget() + Util.updateWidget(this) } val now = Calendar.getInstance() @@ -257,31 +359,38 @@ class MainActivity : AppCompatActivity() { action_date_format.setOnClickListener { SP.edit().putBoolean(Constants.PREF_ITA_FORMAT_DATE, !SP.getBoolean(Constants.PREF_ITA_FORMAT_DATE, false)).commit() updateSettings() + updateAppWidget() Util.updateWidget(this) } label_weather_refresh_period.text = getString(Util.getRefreshPeriodString(SP.getInt(Constants.PREF_WEATHER_REFRESH_PERIOD, 1))) action_weather_refresh_period.setOnClickListener { - val dialog: BottomSheetMenuDialog = BottomSheetBuilder(this, R.style.Theme_Design_Light_BottomSheetDialog) - .setMode(BottomSheetBuilder.MODE_LIST) - .setMenu(R.menu.weather_refresh_period_menu) - .setIconTintColor(ContextCompat.getColor(this, R.color.black_50)) - .delayDismissOnItemClick(false) - .setItemClickListener({ item: MenuItem -> - SP.edit().putInt(Constants.PREF_WEATHER_REFRESH_PERIOD, when (item.itemId) { - R.id.refresh_1 -> 1 - R.id.refresh_2 -> 2 - R.id.refresh_3 -> 3 - R.id.refresh_4 -> 4 - R.id.refresh_5 -> 5 - else -> 1 - }).commit() - updateSettings() - WeatherReceiver().setUpdates(this@MainActivity) - }) - .createDialog() + SP.edit().putInt(Constants.PREF_WEATHER_REFRESH_PERIOD, when (SP.getInt(Constants.PREF_WEATHER_REFRESH_PERIOD, 1)) { + 0 -> 1 + 1 -> 2 + 2 -> 3 + 3 -> 4 + 4 -> 5 + 5 -> 0 + else -> 1 + }).commit() + updateSettings() + WeatherReceiver().setUpdates(this@MainActivity) + } - dialog.show() + show_until_label.text = getString(Util.getShowUntilString(SP.getInt(Constants.PREF_SHOW_UNTIL, 1))) + action_show_until.setOnClickListener { + SP.edit().putInt(Constants.PREF_SHOW_UNTIL, when (SP.getInt(Constants.PREF_SHOW_UNTIL, 1)) { + 0 -> 1 + 1 -> 2 + 2 -> 3 + 3 -> 4 + 4 -> 5 + 5 -> 0 + else -> 1 + }).commit() + updateSettings() + sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) } label_custom_location.text = SP.getString(Constants.PREF_CUSTOM_LOCATION_ADD, getString(R.string.custom_location_gps)) @@ -289,6 +398,16 @@ class MainActivity : AppCompatActivity() { startActivityForResult(Intent(this, CustomLocationActivity::class.java), Constants.RESULT_CODE_CUSTOM_LOCATION) } + calendar_app_label.text = SP.getString(Constants.PREF_CALENDAR_APP_NAME, getString(R.string.default_name)) + action_calendar_app.setOnClickListener { + startActivityForResult(Intent(this, ChooseApplicationActivity::class.java), Constants.CALENDAR_APP_REQUEST_CODE) + } + + weather_app_label.text = SP.getString(Constants.PREF_WEATHER_APP_NAME, getString(R.string.default_name)) + action_weather_app.setOnClickListener { + startActivityForResult(Intent(this, ChooseApplicationActivity::class.java), Constants.WEATHER_APP_REQUEST_CODE) + } + action_filter_calendar.setOnClickListener { val calendarSelectorList: List = CalendarUtil.getCalendarList(this) var calFiltered = SP.getString(Constants.PREF_CALENDAR_FILTER, "") 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 a7fdb2b..a203cbd 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 @@ -29,6 +29,10 @@ import android.net.Uri import android.widget.TextClock import android.widget.TextView import android.content.ComponentName +import android.support.v4.content.ContextCompat.startActivity +import android.provider.CalendarContract.Events + + @@ -72,7 +76,7 @@ class TheWidget : AppWidgetProvider() { fun updateCalendarView(context: Context, views: RemoteViews, widgetID: Int): RemoteViews { val SP = PreferenceManager.getDefaultSharedPreferences(context) val now = Calendar.getInstance() - val calendarLayout = Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR) + val calendarLayout = SP.getBoolean(Constants.PREF_SHOW_EVENTS, true) && Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR) views.setViewVisibility(R.id.empty_layout, View.VISIBLE) views.setViewVisibility(R.id.calendar_layout, View.GONE) @@ -83,9 +87,8 @@ class TheWidget : AppWidgetProvider() { views.setTextViewText(R.id.empty_date, dateStringValue) //views.setImageViewBitmap(R.id.empty_date, Util.buildUpdate(context, Constants.dateFormat.format(now.time)[0].toUpperCase() + Constants.dateFormat.format(now.time).substring(1), "fonts/product_sans_regular.ttf")) - val calIntent = Intent(Intent.ACTION_MAIN) - calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR) - val calPIntent = PendingIntent.getActivity(context, widgetID, calIntent, 0) + + val calPIntent = PendingIntent.getActivity(context, widgetID, Util.getCalendarIntent(context), 0) views.setOnClickPendingIntent(R.id.main_layout, calPIntent) @@ -114,7 +117,24 @@ class TheWidget : AppWidgetProvider() { if (!e.allDay) { val startHour: String = if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) Constants.badHourFormat.format(e.startDate) else Constants.goodHourFormat.format(e.startDate) val endHour: String = if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) Constants.badHourFormat.format(e.endDate) else Constants.goodHourFormat.format(e.endDate) - views.setTextViewText(R.id.next_event_date, String.format("%s - %s", startHour, endHour)) + var dayDiff = TimeUnit.MILLISECONDS.toDays(e.endDate - e.startDate) + + val startCal = Calendar.getInstance() + startCal.timeInMillis = e.startDate + + val endCal = Calendar.getInstance() + endCal.timeInMillis = e.endDate + + if (startCal.get(Calendar.HOUR_OF_DAY) >= endCal.get(Calendar.HOUR_OF_DAY)) { + dayDiff++ + } + + var multipleDay: String = "" + if (dayDiff > 0) { + multipleDay = String.format(" (+%s%s)", dayDiff, context.getString(R.string.day_char)) + } + + views.setTextViewText(R.id.next_event_date, String.format("%s - %s%s", startHour, endHour, multipleDay)) } else { views.setTextViewText(R.id.next_event_date, dateStringValue) } @@ -122,11 +142,12 @@ class TheWidget : AppWidgetProvider() { views.setViewVisibility(R.id.empty_layout, View.GONE) views.setViewVisibility(R.id.calendar_layout, View.VISIBLE) - val builder = CalendarContract.CONTENT_URI.buildUpon() - builder.appendPath("time") - ContentUris.appendId(builder, e.startDate) + + val uri = ContentUris.withAppendedId(Events.CONTENT_URI, e.id.toLong()) val intent = Intent(Intent.ACTION_VIEW) - .setData(builder.build()) + .setData(uri) + intent.putExtra("beginTime", e.startDate); + intent.putExtra("endTime", e.endDate); val pIntent = PendingIntent.getActivity(context, widgetID, intent, 0) views.setOnClickPendingIntent(R.id.main_layout, pIntent) } @@ -136,9 +157,9 @@ class TheWidget : AppWidgetProvider() { } fun updateLocationView(context: Context, views: RemoteViews, widgetID: Int): RemoteViews { - val locationLayout = Util.checkGrantedPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) - val SP = PreferenceManager.getDefaultSharedPreferences(context) + val locationLayout = SP.getBoolean(Constants.PREF_SHOW_WEATHER, true) && Util.checkGrantedPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) + if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) { views.setViewVisibility(R.id.weather, View.VISIBLE) views.setViewVisibility(R.id.calendar_weather, View.VISIBLE) @@ -159,12 +180,8 @@ class TheWidget : AppWidgetProvider() { views.setTextViewText(R.id.temp, temp) views.setTextViewText(R.id.calendar_temp, temp) - val weatherIntent: Intent = Intent(Intent.ACTION_VIEW) - weatherIntent.addCategory(Intent.CATEGORY_DEFAULT) - weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity") - weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline") - val weatherPIntent = PendingIntent.getActivity(context, widgetID, weatherIntent, 0) + val weatherPIntent = PendingIntent.getActivity(context, widgetID, Util.getWeatherIntent(context), 0) views.setOnClickPendingIntent(R.id.weather, weatherPIntent) views.setOnClickPendingIntent(R.id.calendar_weather, weatherPIntent) 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 82d4b95..bb569c0 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt @@ -25,12 +25,21 @@ object CalendarUtil { val eventList = ArrayList() val now = Calendar.getInstance() - val hourLimit = Calendar.getInstance() - hourLimit.add(Calendar.HOUR, 8) + val limit = Calendar.getInstance() + when (SP.getInt(Constants.PREF_SHOW_UNTIL, 1)) { + 0 -> limit.add(Calendar.HOUR, 3) + 1 -> limit.add(Calendar.HOUR, 6) + 2 -> limit.add(Calendar.HOUR, 12) + 3 -> limit.add(Calendar.DAY_OF_MONTH, 1) + 4 -> limit.add(Calendar.DAY_OF_MONTH, 3) + 5 -> limit.add(Calendar.DAY_OF_MONTH, 7) + else -> limit.add(Calendar.HOUR, 6) + } + val builder = CalendarContract.Instances.CONTENT_URI.buildUpon() ContentUris.appendId(builder, now.timeInMillis) - ContentUris.appendId(builder, hourLimit.timeInMillis) + ContentUris.appendId(builder, limit.timeInMillis) if (!Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR)) { resetNextEventData(context) @@ -107,10 +116,13 @@ object CalendarUtil { calendarList.add(CalendarSelector(calendarCursor.getInt(0), calendarCursor.getString(1), calendarCursor.getString(2))) calendarCursor.moveToNext() } + } else { + Log.d("AW", "No calendar") } calendarCursor.close() } catch (ignored: Exception) { + ignored.printStackTrace() try { val calendarCursor = context.contentResolver.query(CalendarContract.Calendars.CONTENT_URI, arrayOf(CalendarContract.Calendars._ID, CalendarContract.Calendars.NAME, CalendarContract.Calendars.ACCOUNT_NAME), @@ -130,7 +142,7 @@ object CalendarUtil { calendarCursor.close() } catch (ignore: Exception) { - + ignore.printStackTrace() } finally { return calendarList } 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 97e32f2..8a1ae5f 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt @@ -24,8 +24,12 @@ import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable import android.support.annotation.StringRes import android.util.TypedValue - - +import android.content.Intent +import android.content.ComponentName +import android.preference.PreferenceManager +import android.util.Log +import android.widget.Toast +import com.tommasoberlose.anotherwidget.`object`.Constants /** @@ -34,7 +38,6 @@ import android.util.TypedValue object Util { - fun checkGrantedPermission(context: Context, permission: String): Boolean { return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED } @@ -43,7 +46,7 @@ object Util { val widgetManager = AppWidgetManager.getInstance(context) val widgetComponent = ComponentName(context, TheWidget::class.java) val widgetIds = widgetManager.getAppWidgetIds(widgetComponent) - val update = Intent() + val update = Intent(context, TheWidget::class.java) update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds) update.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE context.sendBroadcast(update) @@ -78,9 +81,20 @@ object Util { val customTabsIntent: CustomTabsIntent = builder.build(); customTabsIntent.launchUrl(context, Uri.parse(url)); } catch (e: Exception) { - val legalIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url)); - context.startActivity(legalIntent); + try { + val openIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url)); + context.startActivity(openIntent); + } catch (ignored: Exception) { + val clipboard:ClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + val clip = ClipData.newPlainText(context.getString(R.string.app_name), url); + clipboard.primaryClip = clip; + Toast.makeText(context, R.string.error_opening_uri, Toast.LENGTH_LONG).show() + } } + val clipboard:ClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + val clip = ClipData.newPlainText(context.getString(R.string.app_name), url); + clipboard.primaryClip = clip; + Toast.makeText(context, R.string.error_opening_uri, Toast.LENGTH_LONG).show() } fun share(context: Context) { @@ -157,4 +171,62 @@ object Util { else -> R.string.settings_weather_refresh_period_subtitle_0 } } + + fun getShowUntilString(period: Int): Int { + return when (period) { + 0 -> R.string.settings_show_until_subtitle_0 + 1 -> R.string.settings_show_until_subtitle_1 + 2 -> R.string.settings_show_until_subtitle_2 + 3 -> R.string.settings_show_until_subtitle_3 + 4 -> R.string.settings_show_until_subtitle_4 + 5 -> R.string.settings_show_until_subtitle_5 + else -> R.string.settings_show_until_subtitle_1 + } + } + + fun getCalendarIntent(context: Context): Intent { + val SP = PreferenceManager.getDefaultSharedPreferences(context) + if (SP.getString(Constants.PREF_CALENDAR_APP_PACKAGE, "").equals("")) { + val calIntent = Intent(Intent.ACTION_MAIN) + calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR) + return calIntent + } else { + val pm: PackageManager = context.packageManager + return try { + val intent: Intent = pm.getLaunchIntentForPackage(SP.getString(Constants.PREF_CALENDAR_APP_PACKAGE, "")) + intent.addCategory(Intent.CATEGORY_LAUNCHER) + intent + } catch (e: Exception) { + e.printStackTrace() + val calIntent = Intent(Intent.ACTION_MAIN) + calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR) + calIntent + } + } + } + + fun getWeatherIntent(context: Context): Intent { + val SP = PreferenceManager.getDefaultSharedPreferences(context) + if (SP.getString(Constants.PREF_WEATHER_APP_PACKAGE, "").equals("")) { + val weatherIntent: Intent = Intent(Intent.ACTION_VIEW) + weatherIntent.addCategory(Intent.CATEGORY_DEFAULT) + weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity") + weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline") + return weatherIntent + } else { + val pm: PackageManager = context.packageManager + return try { + val intent: Intent = pm.getLaunchIntentForPackage(SP.getString(Constants.PREF_WEATHER_APP_PACKAGE, "")) + intent.addCategory(Intent.CATEGORY_LAUNCHER) + intent + } catch (e: Exception) { + val weatherIntent: Intent = Intent(Intent.ACTION_VIEW) + weatherIntent.addCategory(Intent.CATEGORY_DEFAULT) + weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity") + weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline") + weatherIntent + } + } + } + } diff --git a/app/src/main/res/anim/slide_down.xml b/app/src/main/res/anim/slide_down.xml new file mode 100644 index 0000000..04b4878 --- /dev/null +++ b/app/src/main/res/anim/slide_down.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_up.xml b/app/src/main/res/anim/slide_up.xml new file mode 100644 index 0000000..a70ce80 --- /dev/null +++ b/app/src/main/res/anim/slide_up.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/stay.xml b/app/src/main/res/anim/stay.xml new file mode 100644 index 0000000..0f9dfd0 --- /dev/null +++ b/app/src/main/res/anim/stay.xml @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_action_aw.png b/app/src/main/res/drawable-hdpi/ic_action_aw.png new file mode 100644 index 0000000000000000000000000000000000000000..ee22b414abf3b464509da0c5325e04ecd510d246 GIT binary patch literal 954 zcmV;r14aCaP)Vp8 zQFbn22jL2#ozO@4%IGDu5iS$9D(?TJcroEBAx`*dh&UTlIGu`z3AKa~3&kbA5o!oo zek)%@==cZ4C7uxq{8D};p??aMchEy9^~2x$3>6v?Fd5U$ziyVx`k6|`$aLXkX*u*V zo6u>fNC#&n#A^$~RgmXul)KF`g;tGx5obMza~y@|E!^RxX7XxFm)fBDvV$Q1LdX!D z&0>x+N3hJo4MueV$*wVGVZbRdezk_PTyRcAabl&T~_YKc?YS z2u>?zHm5V&a+5j?6PBpJhxelv^Ta%qn`ESNC&F8hU33KH7KQw?#+(*y0uX-Xg@|yKhakHrWH(GVMCQK%|5tI84|;WR0C&n?&enkS z9>MxOk&}PRH(FGy#qb`5lpF(pFBE#NLIVa37W#m7hbjXITLf~%uKLl?h+24VfH@*A zocJH7Kzey@u*ikKC=BZ@V#|5n1>^TY|7Uo9Bo{K-g;$6TWsVCnfVUP>qY1`DHY;%9 z)kp*OB$+rW`1_$6lqeU5#w-lz(iCs+G`vmH098s1c}!d__zyg|cLn#Xg#k?(H*C=q zlDRs6ZT9$CmjG`;l8RGhraW;#GIgW98odq*&a1=*CWxh+3gx6v_@LvQfT|1>sSu~8 z7cS}ZKAh%;5~ac95`7qW4PIHJ&ZYK8A0IV5FW?y6K68c;g40}B_horMz*Ao+*)>Wu z1&4Ww_LN<-aDCsOLgiJ-oS*8Oi8X{zDN??~ue+h89Pv}7{8L?!`f-_C=aQXlt`^Vv zezmBHi|d@uY%X^jegEo744KbmM}!N&0Z5g-e6qWw3Nlp}&4m9Kr1M4<3jWm-w4eno cXfw9`0zwl&8@hw|OaK4?07*qoM6N<$f?c_^x&QzG literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_action_geolocation.png b/app/src/main/res/drawable-hdpi/ic_action_geolocation.png new file mode 100644 index 0000000000000000000000000000000000000000..cb729bb04f2d37f49a066bc1dcbe0041c8299027 GIT binary patch literal 945 zcmV;i15W&jP)<5ejRsnl}9H40-&;VQjb^$AZk*A_~KVTV<0n{xD+d-^7 z0W1OfI;H#qpx{7h4tc)W-nqptYDS>J?5GY&f_nO3nB8&-L84$SC zG@&NZ?UoYoqaTDVpxxFSb6CQFKwQ&_b40h0PEF;|XbXICfwH|n;SJ0}MxZHl>V8*{qH zvSUCYCq?#TbXrwT*n3Gi9kbapjgEbVk*$o$ZcAhDtfZV?Hf?B%lBPSPd4mt*b)9BE zEEyUUbQ>a-;J1>N@=#UNyZn}rCTEB<7rZ(kC9&s2t$3{W=F<}SNv}Ux`_5P2jrHa6!GOX?pM{e) z(+?)C2`m5)Fgi7fiR5umu!c_T_dV68_m#3oz?)E8#xPpNF-TVt@H_5d|JUa)^<`Mu T26Y*N00000NkvXXu0mjf=#-~% literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_action_gps.png b/app/src/main/res/drawable-hdpi/ic_action_gps.png new file mode 100644 index 0000000000000000000000000000000000000000..cb729bb04f2d37f49a066bc1dcbe0041c8299027 GIT binary patch literal 945 zcmV;i15W&jP)<5ejRsnl}9H40-&;VQjb^$AZk*A_~KVTV<0n{xD+d-^7 z0W1OfI;H#qpx{7h4tc)W-nqptYDS>J?5GY&f_nO3nB8&-L84$SC zG@&NZ?UoYoqaTDVpxxFSb6CQFKwQ&_b40h0PEF;|XbXICfwH|n;SJ0}MxZHl>V8*{qH zvSUCYCq?#TbXrwT*n3Gi9kbapjgEbVk*$o$ZcAhDtfZV?Hf?B%lBPSPd4mt*b)9BE zEEyUUbQ>a-;J1>N@=#UNyZn}rCTEB<7rZ(kC9&s2t$3{W=F<}SNv}Ux`_5P2jrHa6!GOX?pM{e) z(+?)C2`m5)Fgi7fiR5umu!c_T_dV68_m#3oz?)E8#xPpNF-TVt@H_5d|JUa)^<`Mu T26Y*N00000NkvXXu0mjf=#-~% literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_action_refresh.png b/app/src/main/res/drawable-hdpi/ic_action_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..a61eb2498dad5ad87bd7a3ba3a44368dc3e10f08 GIT binary patch literal 661 zcmV;G0&4w+JuoO$t$^&D(5UsVava(R{!cOo+MbLN^=6{Oc z!UP_}K7GmC4SBEwza}K#&TM9OXV$We88c?gSfN@voeqH_zc^b8M!*I*0*~O0c%;wP zz%Yoo)SLog-Hx|{P4Es^I1k8i4EF9;2fH}L9Hs^n|1pv`z zaPGlz&M{~p?Tqs&EdfBVlX6<-$Q@V*1HvJZ>qH|M1aWZx$8QttGqnNG&dZz^PECSh z7aC#u?vsmuMqL1u^JkJp_CaM1dez_{p8?EE7FYp651Pf`LVEyoRDMZz-iz}ARA6Qz2}hNy~uo)>V$@{2hHP-OYZBt1)w-vT&h0rdDS0DcR{HLex5 zwcrsY=?aliRTr6yZug36E5;t?GL#B1kwR^z-N||mPobcLh6~y!8q6kr{IMg6)(}Z vlqTXudPscN4^3cz3OHmLGiJ<~u|l<9?1ge#=Fz!I00000NkvXXu0mjfe3U3N literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_action_reset.png b/app/src/main/res/drawable-hdpi/ic_action_reset.png new file mode 100644 index 0000000000000000000000000000000000000000..9b008a0e328b727047c07b44ccd6cf4f1e4e6d1a GIT binary patch literal 607 zcmV-l0-*hgP)((_9K+65F; zcv7$f8b?) zP>sMWco8IX0>Xm$2sn3`8!KMw1mz@V6Y|oQ(6CGVxGk1#dM3RVIqGF})!sI{#IiQ{ zJuh~-80x^fO`y_)z>+or-rvLotIUAQXGUzXcc4#~K*C`~IRe#!_%JvX#J_IqP)K<$R6Tq3I_N*N;(#kiPx z`Jd)F`Tpv0?00?>!^KX0_B-eMd(QJbJ1@U;Or~tfmj7Im$z&tpAr^@>VwspGItWW9 z1NRX7#H)g9BvbH{flG)DgTOK;M9WVEFCz}W7+m9laC|3tF0rEsAcndh-0IlGhyan# z{Psedlj2Q7_h`bTBKQ?yW}W>8qtV7}*P+FUJf>elpA?N^WUuFNLCW54kiaPHa)=wI z+o4x5tz8Hs1`b=%v70$QSJ?Yu*C0u> zy^7dFy@iON-lsWw(s2@E!Nh0yj5rmGHjSO*#WMoidA6OOQLi+bf-!?{M>TUMbAjg) zY`Y{q${lT{a3Dsdg3Y&!;beWc4R+7~?24phS9t>N6dkwN`(5eXvo?J695zUxn)wMc z-7OzLF`dk7uoz{><9J_+RnOl&ej4U?TOYHr$@A%zoCL95_7rm*0Q_taQ{upxVV7dm zvh&0&Cty(oOP4#M{yQgPIdSwS$1zKyRA*OY{z4)p;!5LkqFu=fGkG_(;WO;Vf)kh0 jS)wzem(py>mftLIOuULG6_mT<00000NkvXXu0mjfj0Y0T literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_geolocation.png b/app/src/main/res/drawable-mdpi/ic_action_geolocation.png new file mode 100644 index 0000000000000000000000000000000000000000..5f5c47b087dacea8b6090d0327ac2e00ce8a67c0 GIT binary patch literal 586 zcmV-Q0=4~#P)lvq&^d;rDT;T9Pz)%dR0z+Uy9C*Wb6(D*n z!!5udMx9s#&4W1tiVDDz8Cd~Spbrdy2jGjzd;r(`8ZQGTQThZFfsjNt1eAa|kr#7s z_gT4ZT!g+3_!Z`z0S&TUrt3(+gg6PiP?Yny0E28t)Xn5J31iJc<^sqd=MFLrqNk~9 zTqB-8^034IFwkWuLOkojDam%s$?1ryIB-W4-$;zVY&n9@5+_PzyrSa32!%g^ARFr` z)B#;`I_x7lbTXP0J8@l5n*(3E6}?QI?lP;dP5~ zaYVyxPLYgP-4>#mq!2|g5+-XpJ&AEYHZXf@Vye}!v&(CAB#VRlvq&^d;rDT;T9Pz)%dR0z+Uy9C*Wb6(D*n z!!5udMx9s#&4W1tiVDDz8Cd~Spbrdy2jGjzd;r(`8ZQGTQThZFfsjNt1eAa|kr#7s z_gT4ZT!g+3_!Z`z0S&TUrt3(+gg6PiP?Yny0E28t)Xn5J31iJc<^sqd=MFLrqNk~9 zTqB-8^034IFwkWuLOkojDam%s$?1ryIB-W4-$;zVY&n9@5+_PzyrSa32!%g^ARFr` z)B#;`I_x7lbTXP0J8@l5n*(3E6}?QI?lP;dP5~ zaYVyxPLYgP-4>#mq!2|g5+-XpJ&AEYHZXf@Vye}!v&(CAB#VRQp8ZREuHF(k{)NYL9t4F|L#X$~VnUkZ+N(MD=kg9YPCe8Enn`6 z14&~f6)Y#&0eMIo6^T%<3&foSa1<#HXhL!T=Rg#<$PQo`2nXaNIY4e89N>xMfN%=T zQ3YaWC>9_^qaac?Tuy8@#8N7*f|_vzh`A^!h(gG4Kp2w#I&y+f9$Ey$YBysN^qL|S z<41v5g4{TaMz3OtsEk6s^#NN=BQY%`cRB*J}J_?2$002{)W+{JO8b1I4 N002ovPDHLkV1nAcoCW{@ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_reset.png b/app/src/main/res/drawable-mdpi/ic_action_reset.png new file mode 100644 index 0000000000000000000000000000000000000000..2e3a2e31eaf3ddf23b026deec590996414517d7e GIT binary patch literal 398 zcmV;90df9`P)%hQJRc7QfoO3tCV1Aq!sf!GU(rLbhdbwI2S#A-ks z2MQsoIsmB1lEl27MKuQi6)*wu8Z-+|191}&djoMg5FbF32Nls$)C_@OAU=v@K^mI8 zCJ>)QlAi;_Lex$Jkw_NsVUeE+m0JkJ%(O^^g-8zI#UeigDmNb#ZPZSLt!Qzaf+nwq z76m;(%tcKHEX0xs>w(x4 zveu^falnj%;S~A+JA>W$Er0-tY;_>;}NHW?+`O*)PP{8AWzdV$I8|ij&l2*&06zu%cLkdz<}2qJ9w;c-L>Y|!M*zMl^pT9@?KR<@ zB=o5v_)_`ZbWTAzC+chm;0>Wfv#*vI{J&rkeI_FQcEt0EuPjhd>^(lG;s0f(L<%Zb zS!P#|tWH$_1^q8U{FA7@i?6(?px6!KOAoWUb3{Zb>tpmFS)b8yR*U#=bG)&HGj@>| z_E=#6b|J-*xy}ZN!Ks(*XPT3dhU!KEyHVK)$L}QMW${W)Nh&o;7HQQGkILHzdY8y6_ppW@@`aKz{*=t z`4Cn}CRlM1N0Wnnb)K)==8nI|X}IbqB@{EpUorj?H%vk4j_ zx=}IbP${|W@Omz@i1@Jc^^Q{JiI<9W`5@`ykW9DDqpz8S2~9VVy|BwbYopxMhP(Lg#i05QZ=5uwHA?vG&v zTQR6zl!6ap;Fw@$^_zUWFwt~;XtUECqODz5`Y6%1)mI@h3dSh@eya-*s}5)I2pUcZ z;rxiuOZ1y3Y5bIlE&By+>Z~@U*A|^N5^c_Sd3-vEHT%&jBSe(lGqEE=u%r)K4M47i zB6UPweZED73Jpo@f(m=V)pR&~1_y1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mV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_gps.png b/app/src/main/res/drawable-xhdpi/ic_action_gps.png new file mode 100644 index 0000000000000000000000000000000000000000..896f73d3ba1f4e2d06c1fe24939a4ce3ab77bb5f GIT binary patch literal 1145 zcmV-<1cv*GP)MdVay``$OtZ;Xg2!oe2+wc`vI5))BtiMWaa>Bk&vGP*?$4A{c=75$O;@M5xl^K zjz^eD(i}Zm&q=^#f5kCqfuuo=`icNcf|bzdWx!)a`V1*z4C-zL{N}`jsA=a(s@r22 zaOg!(4?5}@mE=u!$Tg|_4d=_pJlulyoRu(SN@*E7O55|#eF(y>oMNfOgu*$7!Z}4b z5p0ac0m~TN$iJHbPZVXb0%J-lDA<)|^bQf7 z1Pn3^?v|XN6gY0jIjImOW%n^;By|$-nWEquAYWo`%0|oNE^ejr-FG=z#k0+oQq-t_71eUO*#m8M+<%u^WJN0e^(?LC|Vae zt%HCqir@{2=zOV>fD2KI#8%oqZ&S6pTBqPdb^pWfFAW@mG&_g`M+~20Dtn!Vgus|7 z0|blOCI(UW~_7I@4gp!F}VVjyhnTBKSaJ-iAg3RwW9dw2`(L zguG%HRV|oTrKuPqU%yhItH#N;ktLvlA$-h58?Az*gq}%8GgPXpBm6>9@Rb~rx;ROa zK}te?0p3B_=kDk{4;W?`*r9NsqOu)G7ul~M)) zWK>dSA>-?x>b#h_QMSl1dd2~n?U=XMuxy^f2C7I=)&j$(Srezi<&0I3_2ZTnpV4F) zU%%9p(oxO}j#>|$k1;A#f)SI7^8x#uyZ>5`oIhmPuq%_9+#2wV!~TiM?Lcmz1iGue zT7oYG*W)v?*+JnpX^!(Af!GrFItYo{Pm&@#+$>4la@}|X#d{#pWBD2QZbIH zEKhRePR!7{bRdI|H1e#V4y+g#H4|}$S)k0iD+6o(VMZ%0gDl=k532SEK_sIBPnPEK zj4{I~WVY}wk_5(b>%NZgFGfNFLIOep9y$RHx60rf)LY>Qhv(xzK{5Nz*{eRp00000 LNkvXXu0mjf_e=hY literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_refresh.png b/app/src/main/res/drawable-xhdpi/ic_action_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..6c9b809d389e11bc38b6cf730142e8c25c106dd4 GIT binary patch literal 832 zcmV-G1Hb%7Fc+i913|{;Xd_{bL zEV>#9qU$UF)A}`(mu0GFc4oS^W$J_9Y1yf+ucvEjx+e%!DwRs5QmIrb5j7f(wO|-b zfc?Zc*aA8;ic$0_;ZAT6RKODW1y&i%Z_mLkun%-3h&KaDJ|sQ>Zh$YAgroQb=0INy z$*;E600i#>^Prw0@n*h(D`0($m;-+T&X`#Q{ia$I1N0;?zdee%d~SkS=C_jM%ts|(1E)bx3)k%h7wEr9 z?h-Kr%9cTxS-fnDV#Sfz-y8!UTc0L=_n?O%W)2Qf|exZ;Ze z^OnYC$WhE0FYW-U-gRcpk9m;1a|5{9FME=_I|Jy&=5t8Ek1pQ85+?7|fCEgx6CNe+ z)PM@J_Pabv-l+jgA;BJdmb@DSXeTFZGvlOZ$vZP(m|FwFVs`i&64olnDiPGWdy@=fzGjmg|G)r{ybPBwU zxOT;d?yv*gkFiZ4xv}plZ5)Z@QVCDU1`v7Xc$V>5qu%EuPJb=KIi~2&m{O8wW|!i2)bkjU`Zu_W@f=(&j%_2 zbTI^QWdJY$Ft14KECEF2`38UiU;soM0E6n&0MI=IUOLq2Wl0YJ52|u0gf^l8z%30v zRk1js8^D-HPF@;%0C1KKy@DQEe$RrwdjRNn@cB4Q0KN#PN6-XR4)sF6BrCI@P^DP7 zoP@T-@Tg=D0FK@SSh6m&20*Vov>9;S-oY8bppQW4m0pDwplu&^w33|34gegaL&p*U z&>p}zlw+}fA;!K8gb}W9zz}ri(s4?FdR*)uK{1cu$$vNJNw5~$b?E$O3HyAPH))Uj zhb0fN+x4lJw4b)IT_nGu$pqmrZu5{#N!zzJwu7Ncg&hE7NZR&=762SQfCj{8&iar# zNgq=-wqNgSJ3Gj)08L=uTx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7BBkrajR4xF#H@->1t=lL7yf?m80YF>;cyIhQ1pr+Fz+1y} zL467UdIf-eqw-KT2H;N$06ubzLS_d53S5q{Frb&9qoAtfX(YkH!S^X>N&x_V_X!Th zsc_+Q5ojIgB=Rf zaM`$C3A?Lkpa4KY3uwW_B^;zZ6OqZB0PJIUP$Cux08q$M592$3f_{0FSC8L*BrX81 zxM(CCJYUd^DF&(_;jHEa4X{qf75rV3(Ey-;V$dIl4TQftgyVgoOT3nQI*kTaISy*x406;;@KzD7<(fgf@1Gu09y|Ix$ZU)r`1^_L>-YfclnjJh{ zafLFzfVTSWlI8;7g98@#Q7XVIO(bzzH(#?wK9-+7cU(=jM zK#NQV(5$$@p4uJZn6MvbM@h#&SCYTznTxzpm;7`|Z~+iejPXeaBSGDh7kkUtFl9lR z1#R?jCu_zdn9UieHyZ%xgzIJmpwErVL)V4a650&UcH^V7t|6$dhKw*uMq`dOz zvea|5BZr@m7KDy(cf6r!3A&dO4txUE|B;h*I_| zkdQ-q*{#5Bsz5qD04)>%{!}2Jx}tRVvgICp7^}wk>+6}nM{>j}aLfb%@(L3HAOHk_PXJ1(A2k)g7 + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_custom_location.xml b/app/src/main/res/layout/activity_custom_location.xml index e902b13..c5b87ed 100644 --- a/app/src/main/res/layout/activity_custom_location.xml +++ b/app/src/main/res/layout/activity_custom_location.xml @@ -1,31 +1,83 @@ - + + + + - + + android:layout_height="wrap_content" + android:orientation="vertical"> + + + + + + + - - + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index df4a556..de579af 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -54,7 +54,8 @@ + android:id="@+id/all_set_container" + tools:ignore="UselessParent"> + android:text="@string/title_permission_calendar"/> - - + + + + - - - + + + + - + + + + - - - + + + + - + + + + + android:paddingTop="12dp" + android:paddingBottom="12dp" + android:paddingLeft="32dp" + android:paddingRight="32dp" + android:clickable="true" + android:focusable="true" + android:background="?android:attr/selectableItemBackground" + android:gravity="center_vertical" + android:id="@+id/action_calendar_app" + android:orientation="vertical"> + + + + android:text="@string/title_permission_location"/> - - + + + + - - - + + + + - + + + + + android:paddingTop="12dp" + android:paddingBottom="12dp" + android:paddingLeft="32dp" + android:paddingRight="32dp" + android:clickable="true" + android:focusable="true" + android:background="?android:attr/selectableItemBackground" + android:gravity="center_vertical" + android:id="@+id/action_weather_app" + android:orientation="vertical"> + + + - - - - - - - - - - - - - - + + android:src="@drawable/ic_action_refresh"/> diff --git a/app/src/main/res/layout/custom_location_item.xml b/app/src/main/res/layout/custom_location_item.xml index 99cafe2..6d41d9f 100644 --- a/app/src/main/res/layout/custom_location_item.xml +++ b/app/src/main/res/layout/custom_location_item.xml @@ -5,4 +5,5 @@ android:layout_height="?android:attr/actionBarSize" android:gravity="center_vertical" android:padding="16dp" + android:textColor="@android:color/primary_text_light" style="@style/AnotherWidget.Settings.Title"/> \ No newline at end of file diff --git a/app/src/main/res/layout/the_widget.xml b/app/src/main/res/layout/the_widget.xml index ffd834a..a40a484 100644 --- a/app/src/main/res/layout/the_widget.xml +++ b/app/src/main/res/layout/the_widget.xml @@ -16,6 +16,7 @@ android:layout_height="wrap_content" android:lines="1" android:maxLines="1" + android:text="@string/loading_text" style="@style/AnotherWidget.Title" /> 24 Ore Località Meteo Geolocalizzazione + Aggiorna + Eventi Visibili + Eventi non Visibili + Meteo Visibile + Meteo non Visibile + 3 Ore dopo + 6 Ore dopo + 12 Ore dopo + 24 Ore dopo + 3 Giorni dopo + 7 Giorni dopo + Vedi eventi al massimo fino a + g + Errore apertura URL: Link copiato negli appunti. + Caricamento... + Errore apertura App. + La data apre + Il meteo apre + App Predefinita + Scegli Applicazione \ 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 b3712bb..f67012d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,4 +49,25 @@ 24 Hours Custom Location Geolocation + Refresh + Events are Visible + Events are not Visible + Weather Info are Visible + Weather Info are not Visible + 3 Hours later + 6 Hours later + 12 Hours later + 24 Hours later + 3 Days later + 7 Days later + See events at most until + d + toolbar + Error opening URL: Link copied to clipboard. + Loading Data... + Error opening App. + Tap on date opens + Tap on weather opens + Default App + Choose Application diff --git a/app/src/main/res/xml/the_widget_info.xml b/app/src/main/res/xml/the_widget_info.xml index 6b20927..4a62b5a 100644 --- a/app/src/main/res/xml/the_widget_info.xml +++ b/app/src/main/res/xml/the_widget_info.xml @@ -4,6 +4,7 @@ android:initialLayout="@layout/the_widget" android:minHeight="128dp" android:minWidth="300dp" + android:configure="com.tommasoberlose.anotherwidget.ui.activity.MainActivity" android:minResizeHeight="40dp" android:minResizeWidth="250dp" android:previewImage="@drawable/widget_preview" diff --git a/build.gradle b/build.gradle index 0a25535..ee06b7e 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://maven.fabric.io/public' } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-beta7' + classpath 'com.android.tools.build:gradle:3.0.0-rc1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'io.fabric.tools:gradle:1.+'