Release version 1.1
This commit is contained in:
parent
0ec3dcbadb
commit
c002a31a6d
@ -15,8 +15,8 @@ android {
|
|||||||
applicationId "com.tommasoberlose.anotherwidget"
|
applicationId "com.tommasoberlose.anotherwidget"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 11
|
versionCode 12
|
||||||
versionName "1.0"
|
versionName "1.1"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -1 +1 @@
|
|||||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":11},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]
|
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":12},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]
|
@ -53,10 +53,15 @@
|
|||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
|
||||||
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_TIME_UPDATE" />
|
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_TIME_UPDATE" />
|
||||||
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_CALENDAR_UPDATE" />
|
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_CALENDAR_UPDATE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||||
|
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
|
<data android:scheme="package" />
|
||||||
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.WeatherReceiver"
|
android:name=".receiver.WeatherReceiver"
|
||||||
@ -64,10 +69,15 @@
|
|||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
|
||||||
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_WEATHER_UPDATE" />
|
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_WEATHER_UPDATE" />
|
||||||
<action android:name="android.location.PROVIDERS_CHANGED" />
|
<action android:name="android.location.PROVIDERS_CHANGED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||||
|
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
|
<data android:scheme="package" />
|
||||||
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.tommasoberlose.anotherwidget.`object`
|
||||||
|
|
||||||
|
import android.content.pm.ApplicationInfo
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by tommaso on 15/10/17.
|
||||||
|
*/
|
||||||
|
class AppInfoSavedEvent(val app: ApplicationInfo) {
|
||||||
|
}
|
@ -26,6 +26,7 @@ object Constants {
|
|||||||
val PREF_WEATHER_ICON = "PREF_WEATHER_ICON"
|
val PREF_WEATHER_ICON = "PREF_WEATHER_ICON"
|
||||||
val PREF_WEATHER_TEMP = "PREF_WEATHER_TEMP"
|
val PREF_WEATHER_TEMP = "PREF_WEATHER_TEMP"
|
||||||
val PREF_WEATHER_TEMP_UNIT = "PREF_WEATHER_TEMP_UNIT"
|
val PREF_WEATHER_TEMP_UNIT = "PREF_WEATHER_TEMP_UNIT"
|
||||||
|
val PREF_WEATHER_REAL_TEMP_UNIT = "PREF_WEATHER_REAL_TEMP_UNIT"
|
||||||
val PREF_CALENDAR_ALL_DAY = "PREF_CALENDAR_ALL_DAY"
|
val PREF_CALENDAR_ALL_DAY = "PREF_CALENDAR_ALL_DAY"
|
||||||
val PREF_CALENDAR_FILTER = "PREF_CALENDAR_FILTER"
|
val PREF_CALENDAR_FILTER = "PREF_CALENDAR_FILTER"
|
||||||
|
|
||||||
@ -48,6 +49,8 @@ object Constants {
|
|||||||
val PREF_WEATHER_APP_PACKAGE = "PREF_WEATHER_APP_PACKAGE"
|
val PREF_WEATHER_APP_PACKAGE = "PREF_WEATHER_APP_PACKAGE"
|
||||||
val PREF_WEATHER_PROVIDER_API_KEY = "PREF_WEATHER_PROVIDER_API_KEY"
|
val PREF_WEATHER_PROVIDER_API_KEY = "PREF_WEATHER_PROVIDER_API_KEY"
|
||||||
|
|
||||||
|
val ACTION_EXTRA_OPEN_WEATHER_PROVIDER = "ACTION_EXTRA_OPEN_WEATHER_PROVIDER"
|
||||||
|
|
||||||
val itDateFormat = SimpleDateFormat("EEEE, d MMM")
|
val itDateFormat = SimpleDateFormat("EEEE, d MMM")
|
||||||
val engDateFormat = SimpleDateFormat("EEEE, MMM d")
|
val engDateFormat = SimpleDateFormat("EEEE, MMM d")
|
||||||
val goodHourFormat = SimpleDateFormat("HH:mm")
|
val goodHourFormat = SimpleDateFormat("HH:mm")
|
||||||
@ -56,4 +59,5 @@ object Constants {
|
|||||||
val ACTION_TIME_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_TIME_UPDATE"
|
val ACTION_TIME_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_TIME_UPDATE"
|
||||||
val ACTION_CALENDAR_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_CALENDAR_UPDATE"
|
val ACTION_CALENDAR_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_CALENDAR_UPDATE"
|
||||||
val ACTION_WEATHER_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_WEATHER_UPDATE"
|
val ACTION_WEATHER_UPDATE = "com.tommasoberlose.anotherwidget.action.ACTION_WEATHER_UPDATE"
|
||||||
|
val ACTION_SOMETHING_APPENED = "com.tommasoberlose.anotherwidget.action.ACTION_SOMETHING_APPENED"
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import java.util.*
|
|||||||
class UpdatesReceiver : BroadcastReceiver() {
|
class UpdatesReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED) || intent.action.equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
|
if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED) || intent.action.equals(Intent.ACTION_MY_PACKAGE_REPLACED) || intent.action.equals("android.intent.action.PACKAGE_REPLACED") || intent.action.equals("android.intent.action.PACKAGE_ADDED")) {
|
||||||
setUpdates(context)
|
setUpdates(context)
|
||||||
} else if (intent.action.equals(Constants.ACTION_TIME_UPDATE)) {
|
} else if (intent.action.equals(Constants.ACTION_TIME_UPDATE)) {
|
||||||
val e: Event = CalendarUtil.getNextEvent(context)
|
val e: Event = CalendarUtil.getNextEvent(context)
|
||||||
|
@ -16,7 +16,7 @@ import com.tommasoberlose.anotherwidget.util.WeatherUtil
|
|||||||
class WeatherReceiver : BroadcastReceiver() {
|
class WeatherReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED) || intent.action.equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
|
if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED) || intent.action.equals(Intent.ACTION_MY_PACKAGE_REPLACED) || intent.action.equals("android.intent.action.PACKAGE_REPLACED") || intent.action.equals("android.intent.action.PACKAGE_ADDED")) {
|
||||||
setUpdates(context)
|
setUpdates(context)
|
||||||
} else if (intent.action.equals(Constants.ACTION_WEATHER_UPDATE) || intent.action.equals("android.location.PROVIDERS_CHANGED")) {
|
} else if (intent.action.equals(Constants.ACTION_WEATHER_UPDATE) || intent.action.equals("android.location.PROVIDERS_CHANGED")) {
|
||||||
WeatherUtil.updateWeather(context)
|
WeatherUtil.updateWeather(context)
|
||||||
@ -28,6 +28,10 @@ class WeatherReceiver : BroadcastReceiver() {
|
|||||||
removeUpdates(context)
|
removeUpdates(context)
|
||||||
WeatherUtil.updateWeather(context)
|
WeatherUtil.updateWeather(context)
|
||||||
|
|
||||||
|
if (SP.getBoolean(Constants.PREF_SHOW_WEATHER, true)) {
|
||||||
|
Util.showWeatherNotification(context, SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals(""))
|
||||||
|
}
|
||||||
|
|
||||||
val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||||
val i = Intent(context, WeatherReceiver::class.java)
|
val i = Intent(context, WeatherReceiver::class.java)
|
||||||
i.action = Constants.ACTION_WEATHER_UPDATE
|
i.action = Constants.ACTION_WEATHER_UPDATE
|
||||||
|
@ -23,6 +23,7 @@ import android.support.v7.widget.LinearLayoutManager
|
|||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import com.tommasoberlose.anotherwidget.`object`.AppInfoSavedEvent
|
||||||
import com.tommasoberlose.anotherwidget.ui.adapter.ApplicationInfoAdapter
|
import com.tommasoberlose.anotherwidget.ui.adapter.ApplicationInfoAdapter
|
||||||
|
|
||||||
|
|
||||||
@ -47,14 +48,6 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
|||||||
adapter = ApplicationInfoAdapter(this, appListFiltered);
|
adapter = ApplicationInfoAdapter(this, appListFiltered);
|
||||||
list_view.setAdapter(adapter);
|
list_view.setAdapter(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 {
|
location.addTextChangedListener(object: TextWatcher {
|
||||||
override fun afterTextChanged(text: Editable?) {
|
override fun afterTextChanged(text: Editable?) {
|
||||||
Thread().run {
|
Thread().run {
|
||||||
@ -80,6 +73,16 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
|||||||
finish()
|
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() {
|
public override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
EventBus.getDefault().register(this)
|
EventBus.getDefault().register(this)
|
||||||
|
@ -50,6 +50,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
Fabric.with(this, Crashlytics())
|
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
|
val extras = intent.extras
|
||||||
if (extras != null) {
|
if (extras != null) {
|
||||||
mAppWidgetId = extras.getInt(
|
mAppWidgetId = extras.getInt(
|
||||||
@ -129,7 +133,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
val filter = IntentFilter()
|
val filter = IntentFilter()
|
||||||
filter.addAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
|
filter.addAction(Constants.ACTION_SOMETHING_APPENED);
|
||||||
registerReceiver(receiver, filter);
|
registerReceiver(receiver, filter);
|
||||||
updateUI()
|
updateUI()
|
||||||
}
|
}
|
||||||
@ -143,18 +147,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
grantResults: IntArray) {
|
grantResults: IntArray) {
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
Constants.CALENDAR_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) {
|
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()
|
updateAppWidget()
|
||||||
updateSettings()
|
updateSettings()
|
||||||
}
|
}
|
||||||
Constants.LOCATION_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) {
|
Constants.LOCATION_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) {
|
||||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
if (SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals("")) {
|
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
||||||
startActivityForResult(Intent(this, WeatherProviderActivity::class.java), Constants.WEATHER_PROVIDER_REQUEST_CODE)
|
|
||||||
} else {
|
|
||||||
WeatherUtil.updateWeather(this)
|
|
||||||
updateAppWidget()
|
updateAppWidget()
|
||||||
}
|
|
||||||
updateSettings()
|
updateSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,8 +179,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
if (requestCode == Constants.RESULT_CODE_CUSTOM_LOCATION && resultCode == Activity.RESULT_OK) {
|
if (requestCode == Constants.RESULT_CODE_CUSTOM_LOCATION && resultCode == Activity.RESULT_OK) {
|
||||||
|
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
||||||
updateSettings()
|
updateSettings()
|
||||||
WeatherUtil.updateWeather(this)
|
|
||||||
} else if (requestCode == Constants.CALENDAR_APP_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
|
} else if (requestCode == Constants.CALENDAR_APP_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
|
||||||
SP.edit()
|
SP.edit()
|
||||||
.putString(Constants.PREF_CALENDAR_APP_NAME, data.getStringExtra(Constants.RESULT_APP_NAME))
|
.putString(Constants.PREF_CALENDAR_APP_NAME, data.getStringExtra(Constants.RESULT_APP_NAME))
|
||||||
@ -188,7 +188,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
.commit()
|
.commit()
|
||||||
Util.updateWidget(this)
|
Util.updateWidget(this)
|
||||||
updateSettings()
|
updateSettings()
|
||||||
updateAppWidget()
|
|
||||||
} else if (requestCode == Constants.WEATHER_APP_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
|
} else if (requestCode == Constants.WEATHER_APP_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
|
||||||
SP.edit()
|
SP.edit()
|
||||||
.putString(Constants.PREF_WEATHER_APP_NAME, data.getStringExtra(Constants.RESULT_APP_NAME))
|
.putString(Constants.PREF_WEATHER_APP_NAME, data.getStringExtra(Constants.RESULT_APP_NAME))
|
||||||
@ -196,7 +195,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
.commit()
|
.commit()
|
||||||
Util.updateWidget(this)
|
Util.updateWidget(this)
|
||||||
updateSettings()
|
updateSettings()
|
||||||
updateAppWidget()
|
|
||||||
} else if (requestCode == Constants.WEATHER_PROVIDER_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
} else if (requestCode == Constants.WEATHER_PROVIDER_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
||||||
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
||||||
updateSettings()
|
updateSettings()
|
||||||
@ -277,7 +275,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) {
|
if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) {
|
||||||
weather.visibility = View.VISIBLE
|
weather.visibility = View.VISIBLE
|
||||||
calendar_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
|
weather_icon.visibility = View.VISIBLE
|
||||||
@ -309,9 +307,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
SP.edit()
|
SP.edit()
|
||||||
.putBoolean(Constants.PREF_SHOW_EVENTS, false)
|
.putBoolean(Constants.PREF_SHOW_EVENTS, false)
|
||||||
.commit()
|
.commit()
|
||||||
|
sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE))
|
||||||
updateSettings()
|
updateSettings()
|
||||||
updateAppWidget()
|
updateAppWidget()
|
||||||
Util.updateWidget(this)
|
|
||||||
}
|
}
|
||||||
show_events_label.text = getString(R.string.show_events_visible)
|
show_events_label.text = getString(R.string.show_events_visible)
|
||||||
} else {
|
} else {
|
||||||
@ -321,9 +319,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
SP.edit()
|
SP.edit()
|
||||||
.putBoolean(Constants.PREF_SHOW_EVENTS, true)
|
.putBoolean(Constants.PREF_SHOW_EVENTS, true)
|
||||||
.commit()
|
.commit()
|
||||||
|
sendBroadcast(Intent(Constants.ACTION_CALENDAR_UPDATE))
|
||||||
updateSettings()
|
updateSettings()
|
||||||
updateAppWidget()
|
updateAppWidget()
|
||||||
Util.updateWidget(this)
|
|
||||||
} else {
|
} else {
|
||||||
ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.READ_CALENDAR), Constants.CALENDAR_REQUEST_CODE)
|
ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.READ_CALENDAR), Constants.CALENDAR_REQUEST_CODE)
|
||||||
}
|
}
|
||||||
@ -337,9 +335,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
SP.edit()
|
SP.edit()
|
||||||
.putBoolean(Constants.PREF_SHOW_WEATHER, false)
|
.putBoolean(Constants.PREF_SHOW_WEATHER, false)
|
||||||
.commit()
|
.commit()
|
||||||
|
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
||||||
updateSettings()
|
updateSettings()
|
||||||
updateAppWidget()
|
updateAppWidget()
|
||||||
Util.updateWidget(this)
|
|
||||||
}
|
}
|
||||||
show_weather_label.text = getString(R.string.show_weather_visible)
|
show_weather_label.text = getString(R.string.show_weather_visible)
|
||||||
} else {
|
} else {
|
||||||
@ -349,9 +347,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
SP.edit()
|
SP.edit()
|
||||||
.putBoolean(Constants.PREF_SHOW_WEATHER, true)
|
.putBoolean(Constants.PREF_SHOW_WEATHER, true)
|
||||||
.commit()
|
.commit()
|
||||||
|
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
||||||
updateSettings()
|
updateSettings()
|
||||||
updateAppWidget()
|
updateAppWidget()
|
||||||
Util.updateWidget(this)
|
|
||||||
} else {
|
} else {
|
||||||
ActivityCompat.requestPermissions(this@MainActivity, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), Constants.LOCATION_REQUEST_CODE)
|
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)
|
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 {
|
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()
|
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()
|
updateSettings()
|
||||||
updateAppWidget()
|
updateAppWidget()
|
||||||
Util.updateWidget(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val now = Calendar.getInstance()
|
val now = Calendar.getInstance()
|
||||||
@ -389,9 +387,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
date_format_label.text = dateStringValue
|
date_format_label.text = dateStringValue
|
||||||
action_date_format.setOnClickListener {
|
action_date_format.setOnClickListener {
|
||||||
SP.edit().putBoolean(Constants.PREF_ITA_FORMAT_DATE, !SP.getBoolean(Constants.PREF_ITA_FORMAT_DATE, false)).commit()
|
SP.edit().putBoolean(Constants.PREF_ITA_FORMAT_DATE, !SP.getBoolean(Constants.PREF_ITA_FORMAT_DATE, false)).commit()
|
||||||
updateSettings()
|
|
||||||
updateAppWidget()
|
|
||||||
Util.updateWidget(this)
|
Util.updateWidget(this)
|
||||||
|
updateAppWidget()
|
||||||
|
updateSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
label_weather_refresh_period.text = getString(Util.getRefreshPeriodString(SP.getInt(Constants.PREF_WEATHER_REFRESH_PERIOD, 1)))
|
label_weather_refresh_period.text = getString(Util.getRefreshPeriodString(SP.getInt(Constants.PREF_WEATHER_REFRESH_PERIOD, 1)))
|
||||||
|
@ -6,15 +6,23 @@ import android.app.AlertDialog
|
|||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
|
import android.os.Build
|
||||||
import android.support.v7.app.AppCompatActivity
|
import android.support.v7.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
|
import android.support.design.widget.BottomSheetDialog
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
|
import android.text.Html
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.tommasoberlose.anotherwidget.R
|
import com.tommasoberlose.anotherwidget.R
|
||||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
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.activity_weather_provider.*
|
||||||
|
import kotlinx.android.synthetic.main.main_menu_layout.view.*
|
||||||
|
import kotlinx.android.synthetic.main.provider_info_layout.view.*
|
||||||
|
|
||||||
class WeatherProviderActivity : AppCompatActivity() {
|
class WeatherProviderActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@ -29,6 +37,9 @@ class WeatherProviderActivity : AppCompatActivity() {
|
|||||||
api_key.setText(clipboard.primaryClip.getItemAt(0).text)
|
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 {
|
action_save.setOnClickListener {
|
||||||
SP.edit()
|
SP.edit()
|
||||||
.putString(Constants.PREF_WEATHER_PROVIDER_API_KEY, api_key.text.toString())
|
.putString(Constants.PREF_WEATHER_PROVIDER_API_KEY, api_key.text.toString())
|
||||||
@ -40,9 +51,9 @@ class WeatherProviderActivity : AppCompatActivity() {
|
|||||||
api_key.addTextChangedListener(object: TextWatcher {
|
api_key.addTextChangedListener(object: TextWatcher {
|
||||||
override fun afterTextChanged(text: Editable?) {
|
override fun afterTextChanged(text: Editable?) {
|
||||||
if (text.toString().equals("") || text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) {
|
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 {
|
} 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) {
|
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() {
|
override fun onBackPressed() {
|
||||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
if (api_key.text.toString().equals("") || !api_key.text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) {
|
if (api_key.text.toString().equals("") || !api_key.text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) {
|
||||||
AlertDialog.Builder(this)
|
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)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setPositiveButton(android.R.string.ok, DialogInterface.OnClickListener { _,_ ->
|
.setPositiveButton(android.R.string.yes, DialogInterface.OnClickListener { _,_ ->
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
})
|
})
|
||||||
.show()
|
.show()
|
||||||
|
@ -3,6 +3,7 @@ package com.tommasoberlose.anotherwidget.ui.adapter
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ApplicationInfo
|
import android.content.pm.ApplicationInfo
|
||||||
import android.support.v7.widget.RecyclerView
|
import android.support.v7.widget.RecyclerView
|
||||||
|
import android.util.EventLog
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -10,6 +11,8 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.tommasoberlose.anotherwidget.R
|
import com.tommasoberlose.anotherwidget.R
|
||||||
|
import com.tommasoberlose.anotherwidget.`object`.AppInfoSavedEvent
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,11 +29,16 @@ class ApplicationInfoAdapter (private val context: Context, private var mDataset
|
|||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val pm = context.packageManager
|
val pm = context.packageManager
|
||||||
holder.text.text = pm.getApplicationLabel(mDataset[position]).toString()
|
val app = mDataset[position]
|
||||||
|
holder.text.text = pm.getApplicationLabel(app).toString()
|
||||||
try {
|
try {
|
||||||
holder.icon.setImageDrawable(mDataset[position].loadIcon(pm))
|
holder.icon.setImageDrawable(app.loadIcon(pm))
|
||||||
} catch (ignore: Exception) {
|
} catch (ignore: Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.view.setOnClickListener {
|
||||||
|
EventBus.getDefault().post(AppInfoSavedEvent(app))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
|
@ -163,7 +163,7 @@ class TheWidget : AppWidgetProvider() {
|
|||||||
if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) {
|
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.weather, View.VISIBLE)
|
||||||
views.setViewVisibility(R.id.calendar_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)
|
views.setViewVisibility(R.id.weather_icon, View.VISIBLE)
|
||||||
|
@ -9,6 +9,8 @@ import android.net.Uri
|
|||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import android.provider.CalendarContract
|
import android.provider.CalendarContract
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.widget.Toast
|
||||||
|
import com.tommasoberlose.anotherwidget.R
|
||||||
import com.tommasoberlose.anotherwidget.`object`.CalendarSelector
|
import com.tommasoberlose.anotherwidget.`object`.CalendarSelector
|
||||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||||
import com.tommasoberlose.anotherwidget.`object`.Event
|
import com.tommasoberlose.anotherwidget.`object`.Event
|
||||||
@ -121,7 +123,7 @@ object CalendarUtil {
|
|||||||
calendarCursor.moveToNext()
|
calendarCursor.moveToNext()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("AW", "No calendar")
|
Toast.makeText(context, R.string.error_no_calendar, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
calendarCursor.close()
|
calendarCursor.close()
|
||||||
|
@ -29,6 +29,10 @@ import android.content.ComponentName
|
|||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.Log
|
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 android.widget.Toast
|
||||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||||
|
|
||||||
@ -51,6 +55,7 @@ object Util {
|
|||||||
update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds)
|
update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds)
|
||||||
update.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
update.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||||
context.sendBroadcast(update)
|
context.sendBroadcast(update)
|
||||||
|
context.sendBroadcast(Intent(Constants.ACTION_SOMETHING_APPENED))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showNotification(context: Context) {
|
fun showNotification(context: Context) {
|
||||||
@ -246,8 +251,6 @@ object Util {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun showLocationNotification(context: Context, show: Boolean) {
|
fun showLocationNotification(context: Context, show: Boolean) {
|
||||||
val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager;
|
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) {
|
fun sendEmail(context: Context) {
|
||||||
val i:Intent = Intent(Intent.ACTION_SEND)
|
val i:Intent = Intent(Intent.ACTION_SEND)
|
||||||
i.type = "message/rfc822"
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,7 @@ import android.support.v4.content.ContextCompat.startActivity
|
|||||||
import android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS
|
import android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.location.LocationManager
|
import android.location.LocationManager
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +72,9 @@ object WeatherUtil {
|
|||||||
override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) {
|
override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (networkEnabled) {
|
||||||
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER))
|
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER))
|
||||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, object : LocationListener {
|
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, object : LocationListener {
|
||||||
override fun onLocationChanged(location: Location) {
|
override fun onLocationChanged(location: Location) {
|
||||||
@ -129,6 +130,7 @@ object WeatherUtil {
|
|||||||
SP.edit()
|
SP.edit()
|
||||||
.putFloat(Constants.PREF_WEATHER_TEMP, currentWeather.weather.temperature.temp)
|
.putFloat(Constants.PREF_WEATHER_TEMP, currentWeather.weather.temperature.temp)
|
||||||
.putString(Constants.PREF_WEATHER_ICON, currentWeather.weather.currentCondition.icon)
|
.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()
|
.commit()
|
||||||
Util.updateWidget(context)
|
Util.updateWidget(context)
|
||||||
}
|
}
|
||||||
|
BIN
app/src/main/res/drawable-hdpi/ic_action_info.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_action_info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 874 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_info.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_action_info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 548 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_info.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_action_info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_info.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_action_info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -50,6 +50,9 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
android:descendantFocusability="beforeDescendants"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@ -60,6 +63,8 @@
|
|||||||
android:inputType="textCapWords"
|
android:inputType="textCapWords"
|
||||||
android:id="@+id/api_key"
|
android:id="@+id/api_key"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
android:nextFocusUp="@id/api_key"
|
||||||
|
android:nextFocusLeft="@id/api_key"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:hint="@string/api_key_hint"/>
|
android:hint="@string/api_key_hint"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -70,16 +75,117 @@
|
|||||||
android:src="@drawable/ic_action_paste"
|
android:src="@drawable/ic_action_paste"
|
||||||
android:tint="@android:color/primary_text_light"/>
|
android:tint="@android:color/primary_text_light"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/button_container">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
android:text="@string/action_save"
|
android:text="@string/action_save"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:visibility="gone"
|
|
||||||
android:background="@color/colorAccent"
|
android:background="@color/colorAccent"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:id="@+id/action_save"
|
android:id="@+id/action_save"
|
||||||
style="@style/AnotherWidget.Main.Button"/>
|
style="@style/AnotherWidget.Main.Button"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</android.support.v7.widget.CardView>
|
||||||
|
<android.support.v7.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:layout_marginBottom="16dp">
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="center_vertical">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:text="@string/api_key_info_title"
|
||||||
|
android:gravity="start"
|
||||||
|
style="@style/AnotherWidget.Main.Title"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@android:color/primary_text_light"/>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/action_open_info_text"
|
||||||
|
android:tint="@android:color/primary_text_light"
|
||||||
|
android:src="@drawable/ic_action_info"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
style="@style/AnotherWidget.Settings.Title"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:text="@string/api_key_title_1"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@android:color/primary_text_light"
|
||||||
|
style="@style/AnotherWidget.Main.Subtitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:text="@string/api_key_subtitle_1"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
style="@style/AnotherWidget.Main.Button"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:id="@+id/action_open_provider"
|
||||||
|
android:text="@string/action_open_provider"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
style="@style/AnotherWidget.Settings.Title"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:text="@string/api_key_title_2"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@android:color/primary_text_light"
|
||||||
|
style="@style/AnotherWidget.Main.Subtitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:text="@string/api_key_subtitle_2"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
style="@style/AnotherWidget.Settings.Title"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:text="@string/api_key_title_3"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@android:color/primary_text_light"
|
||||||
|
style="@style/AnotherWidget.Main.Subtitle"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:text="@string/api_key_subtitle_3"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
47
app/src/main/res/layout/provider_info_layout.xml
Normal file
47
app/src/main/res/layout/provider_info_layout.xml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/api_key_info_start"
|
||||||
|
android:gravity="start"
|
||||||
|
style="@style/AnotherWidget.Main.Title"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@android:color/primary_text_light"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@android:color/primary_text_light"
|
||||||
|
style="@style/AnotherWidget.Main.Subtitle"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:id="@+id/text"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_gravity="end">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:id="@+id/action_open_info_text"
|
||||||
|
android:tint="@color/colorAccent"
|
||||||
|
android:src="@drawable/ic_action_aw"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
style="@style/AnotherWidget.Settings.Title"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:text="@string/signature"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
@ -62,7 +62,7 @@
|
|||||||
<string name="settings_show_until_title">Vedi eventi al massimo fino a</string>
|
<string name="settings_show_until_title">Vedi eventi al massimo fino a</string>
|
||||||
<string name="day_char">g</string>
|
<string name="day_char">g</string>
|
||||||
<string name="error_opening_uri">Errore apertura URL: Link copiato negli appunti.</string>
|
<string name="error_opening_uri">Errore apertura URL: Link copiato negli appunti.</string>
|
||||||
<string name="loading_text">Caricamento...</string>
|
<string name="loading_text">Caricamento…</string>
|
||||||
<string name="error_opening_app">Errore apertura App.</string>
|
<string name="error_opening_app">Errore apertura App.</string>
|
||||||
<string name="settings_calendar_app_title">La data apre</string>
|
<string name="settings_calendar_app_title">La data apre</string>
|
||||||
<string name="settings_weather_app_title">Il meteo apre</string>
|
<string name="settings_weather_app_title">Il meteo apre</string>
|
||||||
@ -75,9 +75,21 @@
|
|||||||
<string name="notification_gps_subtitle">Riaccendi la localizzazione per avere il meteo aggiornato.</string>
|
<string name="notification_gps_subtitle">Riaccendi la localizzazione per avere il meteo aggiornato.</string>
|
||||||
<string name="action_feedback">Feedback</string>
|
<string name="action_feedback">Feedback</string>
|
||||||
<string name="feedback_title">AW Feedback</string>
|
<string name="feedback_title">AW Feedback</string>
|
||||||
<string name="feedback_chooser_title">Invia email...</string>
|
<string name="feedback_chooser_title">Invia email…</string>
|
||||||
<string name="feedback_error">Errore invio mail.</string>
|
<string name="feedback_error">Errore invio mail.</string>
|
||||||
<string name="api_key_hint">Chiave API OpenWeather</string>
|
<string name="api_key_hint">Chiave API OpenWeather</string>
|
||||||
<string name="error_weather_api_key">Il provider non è configurato correttamente, vuoi comunque uscire?</string>
|
<string name="error_weather_api_key">Il provider non è configurato correttamente, vuoi comunque uscire?</string>
|
||||||
<string name="action_save">Salva</string>
|
<string name="action_save">Salva</string>
|
||||||
|
<string name="error_no_calendar">Nessun calendario trovato.</string>
|
||||||
|
<string name="api_key_info_title">Cosa fare</string>
|
||||||
|
<string name="signature">Toms</string>
|
||||||
|
<string name="api_key_title_1">Registrati su OpenWeather</string>
|
||||||
|
<string name="action_open_provider">Apri OpenWeather.com</string>
|
||||||
|
<string name="api_key_subtitle_1">Registra un account gratuito su OpenWeather.com in pochi minuti.</string>
|
||||||
|
<string name="api_key_subtitle_2">Accedi alle chiavi API nelle impostazioni e copia la chiave di default.</string>
|
||||||
|
<string name="api_key_subtitle_3">Aggiungi la chiave all\'applicazione in questa sezione e, una volta che la chiave sarà attivata, apparirà il meteo.</string>
|
||||||
|
<string name="api_key_title_2">Copia la chiave API</string>
|
||||||
|
<string name="api_key_title_3">Configura l\'App</string>
|
||||||
|
<string name="api_key_info_start">Ciao a tutti.</string>
|
||||||
|
<string name="api_key_info_text"><![CDATA[Another widget è e rimarrà gratuita e senza banner pubblicitari.<BR /><BR />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).<BR /><BR />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!<BR /><BR />Mi dispiace per l\'inconveniente ma continuate a supportarmi!!]]></string>
|
||||||
</resources>
|
</resources>
|
@ -64,7 +64,7 @@
|
|||||||
<string name="day_char">d</string>
|
<string name="day_char">d</string>
|
||||||
<string name="toolbar_transition_name" translatable="false">toolbar</string>
|
<string name="toolbar_transition_name" translatable="false">toolbar</string>
|
||||||
<string name="error_opening_uri">Error opening URL: Link copied to clipboard.</string>
|
<string name="error_opening_uri">Error opening URL: Link copied to clipboard.</string>
|
||||||
<string name="loading_text">Loading Data...</string>
|
<string name="loading_text">Loading Data…</string>
|
||||||
<string name="error_opening_app">Error opening App.</string>
|
<string name="error_opening_app">Error opening App.</string>
|
||||||
<string name="settings_calendar_app_title">Tap on date opens</string>
|
<string name="settings_calendar_app_title">Tap on date opens</string>
|
||||||
<string name="settings_weather_app_title">Tap on weather opens</string>
|
<string name="settings_weather_app_title">Tap on weather opens</string>
|
||||||
@ -77,9 +77,21 @@
|
|||||||
<string name="notification_gps_subtitle">Turn on the localization to get the updated weather.</string>
|
<string name="notification_gps_subtitle">Turn on the localization to get the updated weather.</string>
|
||||||
<string name="action_feedback">Feedback</string>
|
<string name="action_feedback">Feedback</string>
|
||||||
<string name="feedback_title">AW Feedback</string>
|
<string name="feedback_title">AW Feedback</string>
|
||||||
<string name="feedback_chooser_title">Send email...</string>
|
<string name="feedback_chooser_title">Send email…</string>
|
||||||
<string name="feedback_error">Error sending email.</string>
|
<string name="feedback_error">Error sending email.</string>
|
||||||
<string name="api_key_hint">OpenWeather API Key</string>
|
<string name="api_key_hint">OpenWeather API Key</string>
|
||||||
<string name="error_weather_api_key">The provider is not configured correctly, do you still want to go back?</string>
|
<string name="error_weather_api_key">The provider is not configured correctly, do you still want to go back?</string>
|
||||||
<string name="action_save">Save</string>
|
<string name="action_save">Save</string>
|
||||||
|
<string name="error_no_calendar">No calendars found.</string>
|
||||||
|
<string name="api_key_info_title">What to Do</string>
|
||||||
|
<string name="signature">Toms</string>
|
||||||
|
<string name="api_key_info_text"><![CDATA[Another Widget is a free application and will remain without banner ads.<BR /><BR />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).<BR /><BR />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.<BR /><BR />I\'m sorry for the inconvenience, keep supporting me!]]></string>
|
||||||
|
<string name="api_key_title_1">Register an OpenWeather Account</string>
|
||||||
|
<string name="api_key_subtitle_1">Register a free account on OpenWeather. It will take just a few minutes.</string>
|
||||||
|
<string name="api_key_title_2">Copy your API Key</string>
|
||||||
|
<string name="api_key_subtitle_2">Access the API keys menu from your account settings and copy the default key.</string>
|
||||||
|
<string name="api_key_title_3">Add the key to the app</string>
|
||||||
|
<string name="api_key_subtitle_3">Enter the key in this section and save it. Once the key is activated the weather will be visible.</string>
|
||||||
|
<string name="api_key_info_start">Hi Everyone!</string>
|
||||||
|
<string name="action_open_provider">Go to OpenWeather.com</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user