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 0000000..9bb3891
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_info.png differ
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 0000000..a45cf77
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_info.png differ
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 0000000..0b29c7b
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_info.png differ
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 0000000..f1020b1
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_info.png differ
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