From 7ddcb04f23a5196be5ce1e2c9802bce97275e784 Mon Sep 17 00:00:00 2001 From: Tommaso Berlose Date: Sun, 15 Oct 2017 22:51:12 +0200 Subject: [PATCH] Relase version 1.1 --- app/build.gradle | 4 +- app/release/output.json | 2 +- app/src/main/AndroidManifest.xml | 14 +- .../anotherwidget/object/AppInfoSavedEvent.kt | 9 ++ .../anotherwidget/object/Constants.kt | 4 + .../anotherwidget/receiver/UpdatesReceiver.kt | 2 +- .../anotherwidget/receiver/WeatherReceiver.kt | 6 +- .../ui/activity/ChooseApplicationActivity.kt | 19 +-- .../anotherwidget/ui/activity/MainActivity.kt | 38 +++--- .../ui/activity/WeatherProviderActivity.kt | 35 ++++- .../ui/adapter/ApplicationInfoAdapter.kt | 12 +- .../anotherwidget/ui/widget/TheWidget.kt | 2 +- .../anotherwidget/util/CalendarUtil.kt | 4 +- .../tommasoberlose/anotherwidget/util/Util.kt | 78 ++++++++++- .../anotherwidget/util/WeatherUtil.kt | 8 +- .../main/res/drawable-hdpi/ic_action_info.png | Bin 0 -> 874 bytes .../main/res/drawable-mdpi/ic_action_info.png | Bin 0 -> 548 bytes .../res/drawable-xhdpi/ic_action_info.png | Bin 0 -> 1113 bytes .../res/drawable-xxhdpi/ic_action_info.png | Bin 0 -> 1877 bytes .../res/layout/activity_weather_provider.xml | 124 ++++++++++++++++-- .../main/res/layout/provider_info_layout.xml | 47 +++++++ app/src/main/res/values-it-rIT/strings.xml | 16 ++- app/src/main/res/values/strings.xml | 16 ++- 23 files changed, 379 insertions(+), 61 deletions(-) create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/object/AppInfoSavedEvent.kt create mode 100644 app/src/main/res/drawable-hdpi/ic_action_info.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_info.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_info.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_info.png create mode 100644 app/src/main/res/layout/provider_info_layout.xml diff --git a/app/build.gradle b/app/build.gradle index d0d7c1c..74b413b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "com.tommasoberlose.anotherwidget" minSdkVersion 19 targetSdkVersion 26 - versionCode 11 - versionName "1.0" + versionCode 12 + versionName "1.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/release/output.json b/app/release/output.json index 53a2cf9..a4ed11c 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":11},"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":12},"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 39acf35..9283100 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -53,10 +53,15 @@ android:exported="false"> - + + + + + + - + + + + + + - 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 { @@ -80,6 +73,16 @@ class ChooseApplicationActivity : AppCompatActivity() { finish() } + @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) + fun saveApp(e: AppInfoSavedEvent) { + val pm = packageManager + val resultIntent = Intent() + resultIntent.putExtra(Constants.RESULT_APP_NAME, pm.getApplicationLabel(e.app).toString()) + resultIntent.putExtra(Constants.RESULT_APP_PACKAGE, e.app.packageName) + setResult(Activity.RESULT_OK, resultIntent) + finish() + } + public override fun onStart() { super.onStart() EventBus.getDefault().register(this) 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 1053fc8..d17dbee 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 @@ -50,6 +50,10 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) Fabric.with(this, Crashlytics()) + if (intent.extras?.containsKey(Constants.ACTION_EXTRA_OPEN_WEATHER_PROVIDER) == true) { + startActivityForResult(Intent(this, WeatherProviderActivity::class.java), Constants.WEATHER_PROVIDER_REQUEST_CODE) + } + val extras = intent.extras if (extras != null) { mAppWidgetId = extras.getInt( @@ -129,7 +133,7 @@ class MainActivity : AppCompatActivity() { override fun onResume() { super.onResume() val filter = IntentFilter() - filter.addAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); + filter.addAction(Constants.ACTION_SOMETHING_APPENED); registerReceiver(receiver, filter); updateUI() } @@ -143,18 +147,14 @@ class MainActivity : AppCompatActivity() { grantResults: IntArray) { when (requestCode) { Constants.CALENDAR_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) { - CalendarUtil.updateEventList(this) + sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) updateAppWidget() updateSettings() } Constants.LOCATION_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) { val SP = PreferenceManager.getDefaultSharedPreferences(this) - if (SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals("")) { - startActivityForResult(Intent(this, WeatherProviderActivity::class.java), Constants.WEATHER_PROVIDER_REQUEST_CODE) - } else { - WeatherUtil.updateWeather(this) - updateAppWidget() - } + sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) + updateAppWidget() updateSettings() } } @@ -179,8 +179,8 @@ class MainActivity : AppCompatActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { val SP = PreferenceManager.getDefaultSharedPreferences(this) if (requestCode == Constants.RESULT_CODE_CUSTOM_LOCATION && resultCode == Activity.RESULT_OK) { - updateSettings() - WeatherUtil.updateWeather(this) + sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) + updateSettings() } 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)) @@ -188,7 +188,6 @@ class MainActivity : AppCompatActivity() { .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)) @@ -196,7 +195,6 @@ class MainActivity : AppCompatActivity() { .commit() Util.updateWidget(this) updateSettings() - updateAppWidget() } else if (requestCode == Constants.WEATHER_PROVIDER_REQUEST_CODE && resultCode == Activity.RESULT_OK) { sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) updateSettings() @@ -277,7 +275,7 @@ class MainActivity : AppCompatActivity() { if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) { weather.visibility = View.VISIBLE calendar_weather.visibility = View.VISIBLE - val currentTemp = String.format(Locale.getDefault(), "%.0f °%s", SP.getFloat(Constants.PREF_WEATHER_TEMP, 0f), SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F")) + val currentTemp = String.format(Locale.getDefault(), "%.0f °%s", SP.getFloat(Constants.PREF_WEATHER_TEMP, 0f), SP.getString(Constants.PREF_WEATHER_REAL_TEMP_UNIT, "F")) weather_icon.visibility = View.VISIBLE @@ -309,9 +307,9 @@ class MainActivity : AppCompatActivity() { SP.edit() .putBoolean(Constants.PREF_SHOW_EVENTS, false) .commit() + sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) updateSettings() updateAppWidget() - Util.updateWidget(this) } show_events_label.text = getString(R.string.show_events_visible) } else { @@ -321,9 +319,9 @@ class MainActivity : AppCompatActivity() { SP.edit() .putBoolean(Constants.PREF_SHOW_EVENTS, true) .commit() + sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE)) updateSettings() updateAppWidget() - Util.updateWidget(this) } else { ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.READ_CALENDAR), Constants.CALENDAR_REQUEST_CODE) } @@ -337,9 +335,9 @@ class MainActivity : AppCompatActivity() { SP.edit() .putBoolean(Constants.PREF_SHOW_WEATHER, false) .commit() + sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) updateSettings() updateAppWidget() - Util.updateWidget(this) } show_weather_label.text = getString(R.string.show_weather_visible) } else { @@ -349,9 +347,9 @@ class MainActivity : AppCompatActivity() { SP.edit() .putBoolean(Constants.PREF_SHOW_WEATHER, true) .commit() + sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE)) updateSettings() updateAppWidget() - Util.updateWidget(this) } else { ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), Constants.LOCATION_REQUEST_CODE) } @@ -376,9 +374,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() + Util.updateWidget(this) updateSettings() updateAppWidget() - Util.updateWidget(this) } val now = Calendar.getInstance() @@ -389,9 +387,9 @@ class MainActivity : AppCompatActivity() { date_format_label.text = dateStringValue 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) + updateAppWidget() + updateSettings() } label_weather_refresh_period.text = getString(Util.getRefreshPeriodString(SP.getInt(Constants.PREF_WEATHER_REFRESH_PERIOD, 1))) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/WeatherProviderActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/WeatherProviderActivity.kt index 509162e..ec89fb3 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/WeatherProviderActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activity/WeatherProviderActivity.kt @@ -6,15 +6,23 @@ import android.app.AlertDialog import android.content.ClipboardManager import android.content.Context import android.content.DialogInterface +import android.os.Build import android.support.v7.app.AppCompatActivity import android.os.Bundle import android.preference.PreferenceManager +import android.support.design.widget.BottomSheetDialog import android.text.Editable +import android.text.Html import android.text.TextWatcher import android.view.View import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.`object`.Constants +import com.tommasoberlose.anotherwidget.util.CalendarUtil +import com.tommasoberlose.anotherwidget.util.Util +import com.tommasoberlose.anotherwidget.util.WeatherUtil import kotlinx.android.synthetic.main.activity_weather_provider.* +import kotlinx.android.synthetic.main.main_menu_layout.view.* +import kotlinx.android.synthetic.main.provider_info_layout.view.* class WeatherProviderActivity : AppCompatActivity() { @@ -29,6 +37,9 @@ class WeatherProviderActivity : AppCompatActivity() { api_key.setText(clipboard.primaryClip.getItemAt(0).text) } + Util.collapse(button_container) + api_key.setText(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "")) + action_save.setOnClickListener { SP.edit() .putString(Constants.PREF_WEATHER_PROVIDER_API_KEY, api_key.text.toString()) @@ -40,9 +51,9 @@ class WeatherProviderActivity : AppCompatActivity() { api_key.addTextChangedListener(object: TextWatcher { override fun afterTextChanged(text: Editable?) { if (text.toString().equals("") || text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) { - action_save.animate().scaleY(-2f).start() + Util.collapse(button_container) } else { - action_save.animate().scaleY(0f).start() + Util.expand(button_container) } } @@ -52,15 +63,31 @@ class WeatherProviderActivity : AppCompatActivity() { override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { } }) + + action_open_provider.setOnClickListener { + Util.openURI(this, "https://home.openweathermap.org/users/sign_up") + } + + action_open_info_text.setOnClickListener { + val mBottomSheetDialog: BottomSheetDialog = BottomSheetDialog(this) + val provView: View = layoutInflater.inflate(R.layout.provider_info_layout, null) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + provView.text.text = Html.fromHtml(getString(R.string.api_key_info_text), Html.FROM_HTML_MODE_LEGACY) + } else { + provView.text.text = Html.fromHtml(getString(R.string.api_key_info_text)) + } + mBottomSheetDialog.setContentView(provView) + mBottomSheetDialog.show(); + } } override fun onBackPressed() { val SP = PreferenceManager.getDefaultSharedPreferences(this) if (api_key.text.toString().equals("") || !api_key.text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) { AlertDialog.Builder(this) - .setTitle(getString(R.string.error_weather_api_key)) + .setMessage(getString(R.string.error_weather_api_key)) .setNegativeButton(android.R.string.cancel, null) - .setPositiveButton(android.R.string.ok, DialogInterface.OnClickListener { _,_ -> + .setPositiveButton(android.R.string.yes, DialogInterface.OnClickListener { _,_ -> super.onBackPressed() }) .show() diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapter/ApplicationInfoAdapter.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapter/ApplicationInfoAdapter.kt index 1baae55..764a087 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapter/ApplicationInfoAdapter.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapter/ApplicationInfoAdapter.kt @@ -3,6 +3,7 @@ package com.tommasoberlose.anotherwidget.ui.adapter import android.content.Context import android.content.pm.ApplicationInfo import android.support.v7.widget.RecyclerView +import android.util.EventLog import android.util.Log import android.view.LayoutInflater import android.view.View @@ -10,6 +11,8 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import com.tommasoberlose.anotherwidget.R +import com.tommasoberlose.anotherwidget.`object`.AppInfoSavedEvent +import org.greenrobot.eventbus.EventBus import java.io.File /** @@ -26,11 +29,16 @@ class ApplicationInfoAdapter (private val context: Context, private var mDataset override fun onBindViewHolder(holder: ViewHolder, position: Int) { val pm = context.packageManager - holder.text.text = pm.getApplicationLabel(mDataset[position]).toString() + val app = mDataset[position] + holder.text.text = pm.getApplicationLabel(app).toString() try { - holder.icon.setImageDrawable(mDataset[position].loadIcon(pm)) + holder.icon.setImageDrawable(app.loadIcon(pm)) } catch (ignore: Exception) { } + + holder.view.setOnClickListener { + EventBus.getDefault().post(AppInfoSavedEvent(app)) + } } override fun getItemCount(): Int { 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 fbe1348..328a31d 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 @@ -163,7 +163,7 @@ class TheWidget : AppWidgetProvider() { 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) - val temp = String.format(Locale.getDefault(), "%.0f °%s", SP.getFloat(Constants.PREF_WEATHER_TEMP, 0f), SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F")) + val temp = String.format(Locale.getDefault(), "%.0f °%s", SP.getFloat(Constants.PREF_WEATHER_TEMP, 0f), SP.getString(Constants.PREF_WEATHER_REAL_TEMP_UNIT, "F")) views.setViewVisibility(R.id.weather_icon, View.VISIBLE) 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 21b04d5..d402cd4 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/CalendarUtil.kt @@ -9,6 +9,8 @@ import android.net.Uri import android.preference.PreferenceManager import android.provider.CalendarContract import android.util.Log +import android.widget.Toast +import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.`object`.CalendarSelector import com.tommasoberlose.anotherwidget.`object`.Constants import com.tommasoberlose.anotherwidget.`object`.Event @@ -121,7 +123,7 @@ object CalendarUtil { calendarCursor.moveToNext() } } else { - Log.d("AW", "No calendar") + Toast.makeText(context, R.string.error_no_calendar, Toast.LENGTH_SHORT).show() } calendarCursor.close() 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 83f8f14..d7b247d 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/Util.kt @@ -29,6 +29,10 @@ import android.content.ComponentName import android.preference.PreferenceManager import android.provider.Settings import android.util.Log +import android.view.View +import android.view.animation.Animation +import android.view.animation.Transformation +import android.widget.LinearLayout import android.widget.Toast import com.tommasoberlose.anotherwidget.`object`.Constants @@ -51,6 +55,7 @@ object Util { update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds) update.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE context.sendBroadcast(update) + context.sendBroadcast(Intent(Constants.ACTION_SOMETHING_APPENED)) } fun showNotification(context: Context) { @@ -246,8 +251,6 @@ object Util { } } - - fun showLocationNotification(context: Context, show: Boolean) { val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; @@ -270,6 +273,28 @@ object Util { } + fun showWeatherNotification(context: Context, show: Boolean) { + val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager; + + if (show) { + val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Settings") + .setSmallIcon(R.drawable.ic_stat_name) + .setColor(ContextCompat.getColor(context, R.color.colorPrimary)) + .setContentTitle(context.getString(R.string.settings_weather_provider_api_key_title)) + .setContentText(context.getString(R.string.settings_weather_provider_api_key_subtitle_not_set)) + .setAutoCancel(true); + + val intent: Intent = Intent(context, MainActivity::class.java); + intent.putExtra(Constants.ACTION_EXTRA_OPEN_WEATHER_PROVIDER, true) + val pi: PendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); + mBuilder.setContentIntent(pi); + mNotificationManager.notify(2, mBuilder.build()); + } else { + mNotificationManager.cancel(2); + } + + } + fun sendEmail(context: Context) { val i:Intent = Intent(Intent.ACTION_SEND) i.type = "message/rfc822" @@ -282,4 +307,53 @@ object Util { } } + fun expand(v: View) { + if (v.visibility != View.VISIBLE) { + v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT) + val targetHeight = v.getMeasuredHeight() + + v.layoutParams.height = 0 + v.visibility = View.VISIBLE + val a = object : Animation() { + protected override fun applyTransformation(interpolatedTime: Float, t: Transformation) { + v.layoutParams.height = if (interpolatedTime == 1f) + LinearLayout.LayoutParams.WRAP_CONTENT + else + (targetHeight * interpolatedTime).toInt() + v.requestLayout() + } + + override fun willChangeBounds(): Boolean { + return true + } + } + + a.duration = (targetHeight / v.context.resources.displayMetrics.density).toLong() + v.startAnimation(a) + } + } + + fun collapse(v: View) { + if (v.visibility != View.GONE) { + val initialHeight = v.getMeasuredHeight() + + val a = object : Animation() { + protected override fun applyTransformation(interpolatedTime: Float, t: Transformation) { + if (interpolatedTime == 1f) { + v.visibility = View.GONE + } else { + v.layoutParams.height = initialHeight - (initialHeight * interpolatedTime).toInt() + v.requestLayout() + } + } + + override fun willChangeBounds(): Boolean { + return true + } + } + + a.duration = (initialHeight / v.context.resources.displayMetrics.density).toLong() + v.startAnimation(a) + } + } } 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 31f1fda..e14bffa 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/util/WeatherUtil.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/util/WeatherUtil.kt @@ -20,8 +20,7 @@ import android.support.v4.content.ContextCompat.startActivity import android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS import android.content.Intent import android.location.LocationManager - - +import android.util.Log /** @@ -73,7 +72,9 @@ object WeatherUtil { override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) { } }) - } else { + } + + if (networkEnabled) { getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER)) locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, object : LocationListener { override fun onLocationChanged(location: Location) { @@ -129,6 +130,7 @@ object WeatherUtil { SP.edit() .putFloat(Constants.PREF_WEATHER_TEMP, currentWeather.weather.temperature.temp) .putString(Constants.PREF_WEATHER_ICON, currentWeather.weather.currentCondition.icon) + .putString(Constants.PREF_WEATHER_REAL_TEMP_UNIT, SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F")) .commit() Util.updateWidget(context) } diff --git a/app/src/main/res/drawable-hdpi/ic_action_info.png b/app/src/main/res/drawable-hdpi/ic_action_info.png new file mode 100644 index 0000000000000000000000000000000000000000..9bb3891a13030fde5b6e3054244ba88754ed932f GIT binary patch literal 874 zcmV-w1C{)VP)CV$?wfYHZpugLVO%cWk%Y=PG znedHp58U9lJ^V-fH`NV>4-+;B6++VxmxOgfDG9@e2-}3Zh2b1R#}=Uwm+{ktTTSDB z13Lc|Ave`Y!+pH>j%K_I|yi-beMPlb*@xQ&!+<8y?MiidtB%oFkk z`toq*QlayRkahXyWyU`cRs>B((48TyDRSw^$xV=wcM1j>b9lqA6il`iRq>1@=F6R+ zK2Y+hBqye96&59IbD?W|s0ycb!wgPTB5ro-@3`NDe^9qJ;TUI)W2S z@Q1UaV*V0%#U9rYTxCML33j`O#(9VeXdOO|9pGWKrz3P`d~I?)*$^_8I(RsjbrLvS zyc#w|BuX7%dIILaP22Gl^i^a0o3~8BNGt?BgKVC-Z%gO6?tj_=5khwkLdcZ^fut{L z8$x}A&rE16K?lr|7(&NP=uLtSEHGR4Z5pYa1RXfADP)sO=({NeI_ib;j8L>&i2=ej z6P!)Jfq7;_MSDi3KW;MNFEO{%X>2>fHf)%9|AO$u6fDK)z=~v`88%Iz_e_asZC@I+ z5~Aq*0&aC35VVc)HT>*t&$5VAC6ifEL$(jM@Qj@1GfR?5OgKMe+s?k0tW`egIAQUu z5>_@%)(K2URs2D+a5~owC(UP!VrA2e96AbGJ&`CEIk6ORwV1{Sj|Yi+)*RUO+PCPmI#Po=_Ui9KVsMwp5-bn{n*Z_`rNgw3LBwF!f z3`KWrs6WHXW)*{q?{(`zCH9|JDqU@C@BHuQFD$J9WK4Vr2><{907*qoM6N<$g8g@h Ax&QzG literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_info.png b/app/src/main/res/drawable-mdpi/ic_action_info.png new file mode 100644 index 0000000000000000000000000000000000000000..a45cf77d85a242eabdd571594387cebfb035fbbd GIT binary patch literal 548 zcmV+<0^9wGP))axKz}SZ0g%xumM3b;#-ZxP*bzYL3 zkBO+k{3!7(1yL}mIi|hqp@coD9C4jVGnh0|=)~50VQv&U%*4dWc@|dtMwNE@RtLlP z4&|_6ccfJTJc7}>L$F!_u(k=>zDj6Ay}~~Bk_c?k)hSUDqMQfNNta+hc1&;wf{up4 zE0KEU(r`!QjtQzDXlNMJUIVOegTCSvfE7RhEvEoXOJEuRmLTu62xkEVuuv{S7QMkX zyzsFPg!vQ|+Ow+C|#3ytomigrR&xEQRC(=HG`Qma@G>yI`1tHc%O|?6Cwb!BM z2j`aC6qcoO9JZ*qv~+lNH~4wZ-*!^kOI}a06dO0WmTx)8M98nfTXYD`>KHa(YO+E9 mB_;Xns50U?dH!j2GyVWWTCWe~n2#U;0000 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_action_info.png b/app/src/main/res/drawable-xhdpi/ic_action_info.png new file mode 100644 index 0000000000000000000000000000000000000000..0b29c7b29ba84d305d11408fa2b2f8f00b46deae GIT binary patch literal 1113 zcmV-f1g86mP)ngJ4BbAwt9T!St;M36T)>VO=x?6(J2V6(mAXd{EK|SttT~brJkZ z3y~r!wfw06$Yz7n8nZRyG}q15cwAj&PIc$0PBF?fIn%1{Wb-d1T+A${A73pFbvppV6Yu_ z0fT_B$%YpK#sG&34Y%S4E|mh)jBf)RXf)i4eL$-zZ++3B@+W`|z$#z`!9H&SP91X1 zXKXfr;7Y(w8cLp`k#RsZAVKfAG5%*O@O?k+xRM*H~$WBOQZbTfcG{tA*xGw5#WPB zI7?629?ZZTz_?9JD9|DJB_Z$}(4B!G+#}ds&Z`#IF7UYL##@{~>D8)ANLUbsM^X<%m&xTSJUj3XP?K)Rwm3w~KB!0~IeMp@l9ZXY>2aWYf~YY@oRHin98lo{2hg!`@cJ2E?5E%2qriLYd&(ohHMbzRa%ZzT~g|F0M-XiIQ(5sNScYw zMAQcks3vr8bV72IAnEjh1LDM1xY#MtwysQ|*#W!^uo9X~|4M%K)r`(XW z5X+#)U-zda2pDq7$y(nYT5!)L*QlUDqfph} zx}H9x$?3D{LS@JGIzl9lItbMWVuJMmwS=wkQBhF^*LMX5xMh6Sj-NGdRb?s-MFiPF zG*#DFjS(HQgr8G3eSkc$#;u}ICI_a-4#8$g2Us6Kd&s1Lvti06K+56>Z>@~}zkyQR zo*pP}k7w;VB_Y2I3}`J_S=x4C^cFU0H2L9DHr+yNGp5D~ynMO57@fhX9mlKrvQRLB f5sY92L;v^-Dku8ozR5i^00000NkvXXu0mjf8#DNQ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_info.png b/app/src/main/res/drawable-xxhdpi/ic_action_info.png new file mode 100644 index 0000000000000000000000000000000000000000..f1020b1c848d3bcfd33cc7c665e12f330a5b164f GIT binary patch literal 1877 zcmV-b2demqP)5WhnObKLx-FAx4M;G5l_mlaN|r3*qi3v=VvG&qI)U+7y2^@M)H9AQO)&@(ARd@;R* zI$^eK7JMPh#8b^e&!mh|!YRTQn*_g|&<6YcF(jCVpV^l0(aT}Nct9&&1~H~*@Dm03 zCj1?QTZ){jZY&e76DspX_>F`&ngsO@Sl00OlY}F=Eck7NtAzJHgzz4b(Js5%WV~KM*E- zj7Kbhc&-S)3Xaz6B;O!DuO&n^jH`g~CH5PCWHG*{q4x_kz#76Uj}u!YT!I;i8W>{~ zi=;aXMTmt}9p;rk>2V`8DE?o7V-~(-$YWSM9=b09Hs6blogy4CvErFugoyoLdo)M! zun1o`x_cg0{m+Do5Prc4WKvTe9CIuT1Ml&$)9eg$-Ua!oA3b~t7lR(~NoJh=58-qU zh0!8cwZz;f90_WW!s)(c3{vb=kB7nDdkk5dm`X?*cgjet4KdA5b1n&gjS||Jrs%rS z1RgOv%5YZV-#au2r5Gvg^-!!@+3*P|MqaAHl<>u|;Y-GqY^TimUemqd3W)-uIMm4`iy5UAc-VNYNJ6k( z5laXsYcey`pps!P!|_BdQa}OY{G&@HL)jT`d&DxrL4PKhJW^?QS0pLf-4-gKPLhgG zDe(jJN4{a~{)#MAKr!l$GRbD2iQLcah^2($uS~LOQNctOa-FwW0as+9xe9OptAxoh z!_miQBG%skagzrlIBd!!n-RYZ3Q;DQiAk-&2^&8Tkc?-qEE4i{aS#c(Nr|UV7@Tn6 zJK;6ssg@{U%vXSdPkKgj;9g;|0uqwa_(@;2L&yOwNa{LEELK1{7Gb8GP~5Kq7M%jJ zR=})Z1vnEFunCem;bqI6@J`)Mm=lK9Sge3LiEJMG4MWAo=e~r=QHvGOB$3S>6-<7T zF!|nM1zeWMrbh*nvl1pZEmpv=L^iD|n0zZ?^1JXAwkZGs%A7Pc>oa;&b`KSQc{z1n4TXcSYF~$lIDeABDPyq)Rw6Y=%?Kltpi!r#r(Xcg|W5PdeNE`v ztYta=dXF6+$3wS>;FPC5_I~aUvIQiXiVt{fD*h_SR-3X3edSRJ=>*<6-Kp#~eoLHl zUtpYZtXFDS6A3fnOPKOFv9uz(be*h0@VjuMe<6$UO@wykZ{QOiWHHHfwDeFM^yBES z(8oALf1};V;*R=wIO1Ly0|!oY)aSFe{}SqsZi)&#v`nbMsZ<5>QYH8~0fmY4>+^_c zrg4usTmB!=7d1CuUczVJ%-k_&^LWD|@J_?)9HJ%X$w)pB{K9ZZ-;P<&1PHiefkbNTxuB5ZaC<7CYwl5o`Vh%JQU&30xFQeAj~Mub+ss24-Y%V3uAx!1SC zlGyzo%(=&T3@D=%VPv1eFJlF{n_k%W5+`ZCLMm}T;Vf?I+(%LDByMjm;;TtNY5N?# zE&5^JM5~=LCrNb*DZs_S^kdHHjad3o=fb>uhR~5CM~)mha^%R7BlYwjWPGXTc?!@$ P00000NkvXXu0mjfhxT&9 literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_weather_provider.xml b/app/src/main/res/layout/activity_weather_provider.xml index 223e90b..e4b84e7 100644 --- a/app/src/main/res/layout/activity_weather_provider.xml +++ b/app/src/main/res/layout/activity_weather_provider.xml @@ -50,6 +50,9 @@ android:layout_width="match_parent" android:layout_height="?android:attr/actionBarSize" android:orientation="horizontal" + android:descendantFocusability="beforeDescendants" + android:focusable="true" + android:focusableInTouchMode="true" android:gravity="center_vertical"> - + android:layout_height="wrap_content" + android:orientation="vertical" + android:id="@+id/button_container"> + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/provider_info_layout.xml b/app/src/main/res/layout/provider_info_layout.xml new file mode 100644 index 0000000..8d2e9a3 --- /dev/null +++ b/app/src/main/res/layout/provider_info_layout.xml @@ -0,0 +1,47 @@ + + + + + + + + + \ 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 36bfd8c..d2c3dc0 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -62,7 +62,7 @@ Vedi eventi al massimo fino a g Errore apertura URL: Link copiato negli appunti. - Caricamento... + Caricamento… Errore apertura App. La data apre Il meteo apre @@ -75,9 +75,21 @@ Riaccendi la localizzazione per avere il meteo aggiornato. Feedback AW Feedback - Invia email... + Invia email… Errore invio mail. Chiave API OpenWeather Il provider non è configurato correttamente, vuoi comunque uscire? Salva + Nessun calendario trovato. + Cosa fare + Toms + Registrati su OpenWeather + Apri OpenWeather.com + Registra un account gratuito su OpenWeather.com in pochi minuti. + Accedi alle chiavi API nelle impostazioni e copia la chiave di default. + Aggiungi la chiave all\'applicazione in questa sezione e, una volta che la chiave sarà attivata, apparirà il meteo. + Copia la chiave API + Configura l\'App + Ciao a tutti. +
Però a causa del successo dell\'applicazione, sicuramente oltre ogni mia aspettativa, il provider del meteo non riesce a supportare il numero di richieste che arrivano (a causa dell\'utilizzo di un account gratuito).

Sono costretto a chiedervi di registrarvi su OpenWeather.com; l\'operazione richiederà solo alcuni minuti e dopo non avrete più problemi con la fruizione delle informazioni sul meteo!

Mi dispiace per l\'inconveniente ma continuate a supportarmi!!]]>
\ 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 c633c7a..917f43a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -64,7 +64,7 @@ d toolbar Error opening URL: Link copied to clipboard. - Loading Data... + Loading Data… Error opening App. Tap on date opens Tap on weather opens @@ -77,9 +77,21 @@ Turn on the localization to get the updated weather. Feedback AW Feedback - Send email... + Send email… Error sending email. OpenWeather API Key The provider is not configured correctly, do you still want to go back? Save + No calendars found. + What to Do + Toms +
Due to its great success, surely beyond all my expectations, the weather provider fails to support all the requests that arrive (simply because it is free and therefore limited).

I have to ask each of you to personally register an account on OpenWeather; the operation will take only a few minutes, and when your key has been activated, you will not have any problems with the weather.

I\'m sorry for the inconvenience, keep supporting me!]]>
+ Register an OpenWeather Account + Register a free account on OpenWeather. It will take just a few minutes. + Copy your API Key + Access the API keys menu from your account settings and copy the default key. + Add the key to the app + Enter the key in this section and save it. Once the key is activated the weather will be visible. + Hi Everyone! + Go to OpenWeather.com