Updated UI, New Settings and Bug Fixes

This commit is contained in:
Tommaso Berlose 2017-10-07 17:45:42 +02:00
parent ad20ea1778
commit 666bb4dcd9
64 changed files with 622 additions and 378 deletions

View File

@ -13,7 +13,7 @@ android {
applicationId "com.tommasoberlose.anotherwidget"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@ -23,6 +23,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
@ -33,9 +36,12 @@ dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.survivingwithandroid:weatherlib:1.6.0'
compile 'com.survivingwithandroid:weatherlib_volleyclient:1.6.0'
compile 'com.mcxiaoke.volley:library:1.0.6@aar'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.heinrichreimersoftware:material-intro:1.6.2'
kapt 'com.android.databinding:compiler:2.3.3'
}

View File

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":2},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]

View File

@ -16,7 +16,9 @@
android:theme="@style/AppTheme">
<activity
android:name=".ui.activity.MainActivity"
android:launchMode="singleInstance">
android:launchMode="singleInstance"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -60,6 +62,11 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name=".ui.activity.SplashActivity"
android:theme="@style/Theme.Intro"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -11,8 +11,10 @@ object Constants {
val CALENDAR_REQUEST_CODE = 1
val LOCATION_REQUEST_CODE = 2
val PREF_FIRST_STEP = "PREF_FIRST_STEP"
val PREF_WEATHER_ICON = "PREF_WEATHER_ICON"
val PREF_WEATHER_TEMP = "PREF_WEATHER_TEMP"
val PREF_WEATHER_TEMP_UNIT = "PREF_WEATHER_TEMP_UNIT"
val dateFormat = SimpleDateFormat("EEEE, MMM d", Locale.getDefault())
val hourFormat = SimpleDateFormat("HH:mm", Locale.getDefault())

View File

@ -1,14 +1,19 @@
package com.tommasoberlose.anotherwidget.ui.activity
import android.Manifest
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.pm.PackageManager
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.appwidget.AppWidgetManager
import android.content.Intent
import android.content.ComponentName
import android.content.*
import android.preference.PreferenceManager
import android.provider.CalendarContract
import android.support.v4.content.ContextCompat
import android.view.View
import android.widget.RemoteViews
import android.widget.Toast
import com.tommasoberlose.anotherwidget.`object`.Constants
import com.tommasoberlose.anotherwidget.R
@ -17,15 +22,30 @@ import com.tommasoberlose.anotherwidget.ui.widget.TheWidget
import com.tommasoberlose.anotherwidget.util.UpdatesReceiver
import com.tommasoberlose.anotherwidget.util.WeatherReceiver
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.the_widget.*
import java.util.*
import java.util.concurrent.TimeUnit
import android.content.Intent
import android.content.BroadcastReceiver
class MainActivity : AppCompatActivity() {
private val receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
updateUI()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
receiver
// TODO Util.showIntro(this)
action_support.setOnClickListener(object: View.OnClickListener {
override fun onClick(p0: View?) {
@ -33,31 +53,30 @@ class MainActivity : AppCompatActivity() {
}
})
action_rate.setOnClickListener(object: View.OnClickListener {
override fun onClick(p0: View?) {
Util.openURI(this@MainActivity, "")
}
})
action_share.setOnClickListener(object: View.OnClickListener {
override fun onClick(p0: View?) {
Util.share(this@MainActivity)
}
})
action_github.setOnClickListener(object: View.OnClickListener {
action_project.setOnClickListener(object: View.OnClickListener {
override fun onClick(p0: View?) {
Util.openURI(this@MainActivity, "https://github.com/tommasoberlose/another-widget")
}
})
}
override fun onResume() {
super.onResume()
val filter = IntentFilter()
filter.addAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
registerReceiver(receiver, filter);
updateUI()
Util.updateWidget(this)
}
override fun onPause() {
unregisterReceiver(receiver);
super.onPause();
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>,
@ -80,6 +99,7 @@ class MainActivity : AppCompatActivity() {
no_calendar_permission_container.visibility= View.GONE
no_location_permission_container.visibility= View.GONE
all_set_container.visibility = View.GONE
updateSettings()
if (!Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR)) {
no_calendar_permission_container.visibility = View.VISIBLE
@ -100,7 +120,94 @@ class MainActivity : AppCompatActivity() {
all_set_container.visibility = View.VISIBLE
}
}
updateAppWidget()
Util.updateWidget(this)
}
internal fun updateAppWidget() {
widget_bg.setImageDrawable(Util.getCurrentWallpaper(this))
updateCalendarView()
updateLocationView()
}
fun updateCalendarView() {
val now = Calendar.getInstance()
val calendarLayout = Util.checkGrantedPermission(this, Manifest.permission.READ_CALENDAR)
empty_layout.visibility = View.VISIBLE
calendar_layout.visibility = View.GONE
empty_date.text = String.format("%s%s", Constants.dateFormat.format(now.time)[0].toUpperCase(), Constants.dateFormat.format(now.time).substring(1))
if (calendarLayout) {
val eventList = Util.getNextEvent(this)
if (eventList.isNotEmpty()) {
val difference = eventList[0].startDate - now.timeInMillis
if (difference > 1000 * 60) {
var time = ""
val hour = TimeUnit.MILLISECONDS.toHours(difference)
if (hour > 0) {
time = hour.toString() + getString(R.string.h_code)
}
val minutes = TimeUnit.MILLISECONDS.toMinutes(difference - hour * 3600 * 1000)
if (minutes > 0) {
time += " " + minutes + getString(R.string.min_code)
}
next_event.text = String.format("%s %s %s", eventList[0].title, getString(R.string.in_code), time)
} else {
next_event.text = String.format("%s", eventList[0].title)
}
next_event_date.text = String.format("%s - %s", Constants.hourFormat.format(eventList[0].startDate), Constants.hourFormat.format(eventList[0].endDate))
empty_layout.visibility = View.GONE
calendar_layout.visibility = View.VISIBLE
}
}
}
fun updateLocationView() {
val locationLayout = Util.checkGrantedPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
val SP = PreferenceManager.getDefaultSharedPreferences(this)
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"))
weather_icon.visibility = View.VISIBLE
empty_weather_icon.visibility = View.VISIBLE
val icon: String = SP.getString(Constants.PREF_WEATHER_ICON, "")
if (icon.equals("")) {
weather_icon.visibility = View.GONE
empty_weather_icon.visibility = View.GONE
} else {
weather_icon.setImageResource(Util.getWeatherIconResource(icon))
empty_weather_icon.setImageResource(Util.getWeatherIconResource(icon))
}
temp.text = currentTemp
calendar_temp.text = currentTemp
} else {
weather.visibility = View.GONE
calendar_weather.visibility = View.GONE
}
}
fun updateSettings() {
val SP = PreferenceManager.getDefaultSharedPreferences(this)
temp_unit.text = if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("F")) getString(R.string.fahrenheit) else getString(R.string.celsius)
action_change_unit.setOnClickListener(object: View.OnClickListener {
@SuppressLint("ApplySharedPref")
override fun onClick(p0: View?) {
SP.edit().putString(Constants.PREF_WEATHER_TEMP_UNIT, if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("F")) "C" else "F").commit()
Util.getWeather(this@MainActivity)
updateSettings()
}
})
}
}

View File

@ -0,0 +1,41 @@
package com.tommasoberlose.anotherwidget.ui.activity
import android.Manifest
import android.os.Bundle
import com.tommasoberlose.anotherwidget.R
import com.heinrichreimersoftware.materialintro.app.IntroActivity
import com.heinrichreimersoftware.materialintro.slide.SimpleSlide
class SplashActivity : IntroActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
isButtonNextVisible = true
isButtonBackVisible = false
isButtonCtaVisible = false
buttonCtaTintMode = BUTTON_CTA_TINT_MODE_TEXT
addSlide(SimpleSlide.Builder()
.title(R.string.app_name)
.background(R.color.colorPrimary)
.backgroundDark(R.color.colorPrimaryDark)
.build())
addSlide(SimpleSlide.Builder()
.title(R.string.title_permission_calendar)
.description(R.string.description_permission_calendar)
.background(R.color.colorPrimary)
.backgroundDark(R.color.colorPrimaryDark)
.permission(Manifest.permission.READ_CALENDAR)
.build())
addSlide(SimpleSlide.Builder()
.title(R.string.title_permission_location)
.description(R.string.description_permission_location)
.background(R.color.colorPrimary)
.backgroundDark(R.color.colorPrimaryDark)
.permission(Manifest.permission.ACCESS_COARSE_LOCATION)
.build())
}
}

View File

@ -68,156 +68,86 @@ class TheWidget : AppWidgetProvider() {
}
fun updateCalendarView(context: Context, views: RemoteViews, widgetID: Int): RemoteViews {
val now = Calendar.getInstance()
val calendarLayout = Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR)
val now = Calendar.getInstance()
val calendarLayout = Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR)
views.setViewVisibility(R.id.empty_layout, View.VISIBLE)
views.setViewVisibility(R.id.calendar_layout, View.GONE)
views.setTextViewText(R.id.empty_date, Constants.dateFormat.format(now.time))
views.setViewVisibility(R.id.empty_layout, View.VISIBLE)
views.setViewVisibility(R.id.calendar_layout, View.GONE)
views.setTextViewText(R.id.empty_date, Constants.dateFormat.format(now.time))
val calIntent = Intent(Intent.ACTION_MAIN)
calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR)
val calPIntent = PendingIntent.getActivity(context, widgetID, calIntent, 0)
views.setOnClickPendingIntent(R.id.main_layout, calPIntent)
val calIntent = Intent(Intent.ACTION_MAIN)
calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR)
val calPIntent = PendingIntent.getActivity(context, widgetID, calIntent, 0)
views.setOnClickPendingIntent(R.id.main_layout, calPIntent)
if (calendarLayout) {
val eventList = Util.getNextEvent(context)
if (calendarLayout) {
val eventList = Util.getNextEvent(context)
if (eventList.isNotEmpty()) {
val difference = eventList[0].startDate - now.timeInMillis
if (eventList.isNotEmpty()) {
val difference = eventList[0].startDate - now.timeInMillis
if (difference > 1000 * 60) {
var time = ""
val hour = TimeUnit.MILLISECONDS.toHours(difference)
if (hour > 0) {
time = hour.toString() + "h"
}
val minutes = TimeUnit.MILLISECONDS.toMinutes(difference - hour * 3600 * 1000)
if (minutes > 0) {
time += " " + minutes + "min"
if (difference > 1000 * 60) {
var time = ""
val hour = TimeUnit.MILLISECONDS.toHours(difference)
if (hour > 0) {
time = hour.toString() + context.getString(R.string.h_code)
}
val minutes = TimeUnit.MILLISECONDS.toMinutes(difference - hour * 3600 * 1000)
if (minutes > 0) {
time += " " + minutes + context.getString(R.string.min_code)
}
views.setTextViewText(R.id.next_event, String.format("%s %s %s", eventList[0].title, context.getString(R.string.in_code), time))
} else {
views.setTextViewText(R.id.next_event, String.format("%s", eventList[0].title))
}
views.setTextViewText(R.id.next_event_date, String.format("%s - %s", Constants.hourFormat.format(eventList[0].startDate), Constants.hourFormat.format(eventList[0].endDate)))
views.setTextViewText(R.id.next_event, String.format("%s in %s", eventList[0].title, time))
} else {
views.setTextViewText(R.id.next_event, String.format("%s", eventList[0].title))
views.setViewVisibility(R.id.empty_layout, View.GONE)
views.setViewVisibility(R.id.calendar_layout, View.VISIBLE)
val builder = CalendarContract.CONTENT_URI.buildUpon()
builder.appendPath("time")
ContentUris.appendId(builder, eventList[0].startDate)
val intent = Intent(Intent.ACTION_VIEW)
.setData(builder.build())
val pIntent = PendingIntent.getActivity(context, widgetID, intent, 0)
views.setOnClickPendingIntent(R.id.main_layout, pIntent)
}
views.setTextViewText(R.id.next_event_date, String.format("%s - %s", Constants.hourFormat.format(eventList[0].startDate), Constants.hourFormat.format(eventList[0].endDate)))
views.setViewVisibility(R.id.empty_layout, View.GONE)
views.setViewVisibility(R.id.calendar_layout, View.VISIBLE)
val builder = CalendarContract.CONTENT_URI.buildUpon()
builder.appendPath("time")
ContentUris.appendId(builder, eventList[0].startDate)
val intent = Intent(Intent.ACTION_VIEW)
.setData(builder.build())
val pIntent = PendingIntent.getActivity(context, widgetID, intent, 0)
views.setOnClickPendingIntent(R.id.main_layout, pIntent)
}
return views
}
return views
}
fun updateLocationView(context: Context, views: RemoteViews): RemoteViews {
val locationLayout = Util.checkGrantedPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION)
fun updateLocationView(context: Context, views: RemoteViews): RemoteViews {
val locationLayout = Util.checkGrantedPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION)
val SP = PreferenceManager.getDefaultSharedPreferences(context)
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 °C", SP.getFloat(Constants.PREF_WEATHER_TEMP, 0f))
val SP = PreferenceManager.getDefaultSharedPreferences(context)
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"))
views.setViewVisibility(R.id.weather_icon, View.VISIBLE)
views.setViewVisibility(R.id.empty_weather_icon, View.VISIBLE)
when (SP.getString(Constants.PREF_WEATHER_ICON, "")) {
"01d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.clear_day)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.clear_day)
}
"02d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.partly_cloudy)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.partly_cloudy)
}
"03d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.mostly_cloudy)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.mostly_cloudy)
}
"04d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.cloudy_weather)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.cloudy_weather)
}
"09d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.storm_weather_day)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.storm_weather_day)
}
"10d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.rainy_day)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.rainy_day)
}
"11d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.thunder_day)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.thunder_day)
}
"13d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.snow_day)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.snow_day)
}
"50d" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.haze_day)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.haze_day)
}
"01n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.clear_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.clear_night)
}
"02n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.partly_cloudy_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.partly_cloudy_night)
}
"03n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.mostly_cloudy_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.mostly_cloudy_night)
}
"04n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.cloudy_weather)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.cloudy_weather)
}
"09n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.storm_weather_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.storm_weather_night)
}
"10n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.rainy_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.rainy_night)
}
"11n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.thunder_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.thunder_night)
}
"13n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.snow_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.snow_night)
}
"50n" -> {
views.setImageViewResource(R.id.weather_icon, R.drawable.haze_night)
views.setImageViewResource(R.id.empty_weather_icon, R.drawable.haze_night)
}
else -> {
views.setViewVisibility(R.id.weather_icon, View.VISIBLE)
views.setViewVisibility(R.id.empty_weather_icon, View.VISIBLE)
val icon: String = SP.getString(Constants.PREF_WEATHER_ICON, "")
if (icon.equals("")) {
views.setViewVisibility(R.id.weather_icon, View.GONE)
views.setViewVisibility(R.id.empty_weather_icon, View.GONE)
} else {
views.setImageViewResource(R.id.weather_icon, Util.getWeatherIconResource(icon))
views.setImageViewResource(R.id.empty_weather_icon, Util.getWeatherIconResource(icon))
}
}
views.setTextViewText(R.id.temp, temp)
views.setTextViewText(R.id.calendar_temp, temp)
} else {
views.setViewVisibility(R.id.weather, View.GONE)
views.setViewVisibility(R.id.calendar_weather, View.GONE)
}
return views
views.setTextViewText(R.id.temp, temp)
views.setTextViewText(R.id.calendar_temp, temp)
} else {
views.setViewVisibility(R.id.weather, View.GONE)
views.setViewVisibility(R.id.calendar_weather, View.GONE)
}
return views
}
}
}

View File

@ -5,10 +5,11 @@ import android.annotation.SuppressLint
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.WallpaperManager
import android.appwidget.AppWidgetManager
import android.content.*
import android.content.pm.PackageManager
import android.database.Cursor
import android.graphics.drawable.Drawable
import android.location.Location
import android.location.LocationListener
import android.location.LocationManager
@ -16,26 +17,23 @@ import android.net.Uri
import android.os.Bundle
import android.preference.PreferenceManager
import android.provider.CalendarContract
import android.support.annotation.DrawableRes
import android.support.customtabs.CustomTabsIntent
import android.support.v4.app.NotificationCompat
import android.support.v4.content.ContextCompat
import android.util.Log
import com.survivingwithandroid.weather.lib.WeatherClient
import com.survivingwithandroid.weather.lib.WeatherConfig
import com.survivingwithandroid.weather.lib.exception.LocationProviderNotFoundException
import com.survivingwithandroid.weather.lib.exception.WeatherLibException
import com.survivingwithandroid.weather.lib.model.City
import com.survivingwithandroid.weather.lib.model.CurrentWeather
import com.survivingwithandroid.weather.lib.provider.forecastio.ForecastIOProviderType
import com.survivingwithandroid.weather.lib.provider.forecastio.ForecastIOWeatherProvider
import com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProviderType
import com.survivingwithandroid.weather.lib.provider.yahooweather.YahooProviderType
import com.survivingwithandroid.weather.lib.request.WeatherRequest
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.`object`.Constants
import com.tommasoberlose.anotherwidget.`object`.Event
import com.tommasoberlose.anotherwidget.ui.activity.MainActivity
import com.tommasoberlose.anotherwidget.ui.activity.SplashActivity
import com.tommasoberlose.anotherwidget.ui.widget.TheWidget
import java.util.ArrayList
@ -80,7 +78,7 @@ object Util {
for (j in 0 until eventCursor.count) {
val e = Event(eventCursor, instanceCursor)
if (e.endDate - now.timeInMillis > 1000 * 60 * 60) {
if (e.endDate - now.timeInMillis > 1000 * 60 * 30) {
eventList.add(e)
}
eventCursor.moveToNext()
@ -147,7 +145,7 @@ object Util {
try {
val config = WeatherConfig()
config.unitSystem = WeatherConfig.UNIT_SYSTEM.M
config.unitSystem = if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("C")) WeatherConfig.UNIT_SYSTEM.M else WeatherConfig.UNIT_SYSTEM.I
config.lang = "en" // If you want to use english
config.maxResult = 1 // Max number of cities retrieved
config.numDays = 1 // Max num of days in the forecast
@ -162,7 +160,6 @@ object Util {
client.getCurrentCondition(WeatherRequest(location.longitude, location.latitude), object : WeatherClient.WeatherEventListener {
@SuppressLint("ApplySharedPref")
override fun onWeatherRetrieved(currentWeather: CurrentWeather) {
Log.d("AW", "TEMP:" + currentWeather.weather.currentCondition.icon);
SP.edit()
.putFloat(Constants.PREF_WEATHER_TEMP, currentWeather.weather.temperature.temp)
.putString(Constants.PREF_WEATHER_ICON, currentWeather.weather.currentCondition.icon)
@ -235,4 +232,79 @@ object Util {
sendIntent.setType("text/plain");
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.action_share)));
}
fun showIntro(context: Context) {
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val firstTime: Boolean = SP.getBoolean(Constants.PREF_FIRST_STEP, true)
// TODO SP.edit().putBoolean(Constants.PREF_FIRST_STEP, false).apply()
if (firstTime) {
context.startActivity(Intent(context, SplashActivity::class.java))
}
}
fun getWeatherIconResource(icon: String): Int {
when (icon) {
"01d" -> {
return R.drawable.clear_day
}
"02d" -> {
return R.drawable.partly_cloudy
}
"03d" -> {
return R.drawable.mostly_cloudy
}
"04d" -> {
return R.drawable.cloudy_weather
}
"09d" -> {
return R.drawable.storm_weather_day
}
"10d" -> {
return R.drawable.rainy_day
}
"11d" -> {
return R.drawable.thunder_day
}
"13d" -> {
return R.drawable.snow_day
}
"50d" -> {
return R.drawable.haze_day
}
"01n" -> {
return R.drawable.clear_night
}
"02n" -> {
return R.drawable.partly_cloudy_night
}
"03n" -> {
return R.drawable.mostly_cloudy_night
}
"04n" -> {
return R.drawable.cloudy_weather
}
"09n" -> {
return R.drawable.storm_weather_night
}
"10n" -> {
return R.drawable.rainy_night
}
"11n" -> {
return R.drawable.thunder_night
}
"13n" -> {
return R.drawable.snow_night
}
"50n" -> {
return R.drawable.haze_night
}
else -> {
return -1
}
}
}
fun getCurrentWallpaper(context: Context): Drawable {
return WallpaperManager.getInstance(context).getDrawable();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,233 +1,262 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_background"
android:orientation="vertical"
tools:context="com.tommasoberlose.anotherwidget.ui.activity.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="48dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp"
android:id="@+id/toolbar"
android:layout_centerHorizontal="true"
android:gravity="center_vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/main_pre_title"
android:alpha="0.6"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:gravity="center_vertical"
style="@style/AnotherWidget.Main.Subtitle"
android:textAllCaps="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:gravity="center_vertical"
style="@style/AnotherWidget.Main.Title"
android:textAllCaps="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp"
android:layout_below="@+id/toolbar"
android:gravity="center"
android:layout_above="@+id/menu_container"
android:id="@+id/all_set_container">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Title"
android:gravity="start"
android:textStyle="bold"
android:text="@string/all_set_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Description"
android:alpha="0.9"
android:fontFamily="sans-serif"
android:text="@string/all_set_subtitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Button.Dark"
android:id="@+id/action_github"
android:layout_marginTop="16dp"
android:layout_gravity="center_horizontal"
android:text="@string/all_set_btn"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone"
android:id="@+id/no_calendar_permission_container"
android:background="@drawable/gradient_background"
android:orientation="vertical">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="14dp"
android:tint="@android:color/white"
android:background="@drawable/circle_background"
android:src="@drawable/ic_action_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Title"
android:paddingTop="16dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/title_permission_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Description"
android:paddingBottom="32dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/description_permission_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Button"
android:id="@+id/request_calendar"
android:text="@string/button_request_permission"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/no_location_permission_container"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="14dp"
android:tint="@android:color/white"
android:background="@drawable/circle_background"
android:src="@drawable/ic_action_location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Title"
android:paddingTop="16dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/title_permission_location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Description"
android:paddingBottom="32dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/description_permission_location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Button"
android:id="@+id/request_location"
android:text="@string/button_request_permission"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:baselineAligned="false"
android:id="@+id/menu_container"
android:background="@color/black_10"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:id="@+id/action_share"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_action_share"/>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="32dp"
android:id="@+id/toolbar"
android:gravity="center_vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_share"
style="@style/AnotherWidget.Main.Button.TabBar"
android:background="@android:color/transparent"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:id="@+id/action_rate"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_action_rate"/>
android:text="@string/main_pre_title"
android:alpha="0.6"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:gravity="center_vertical"
style="@style/AnotherWidget.Main.Subtitle"
android:textAllCaps="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_rate"
style="@style/AnotherWidget.Main.Button.TabBar"
android:background="@android:color/transparent"/>
android:text="@string/app_name"
android:gravity="center_vertical"
style="@style/AnotherWidget.Main.Title"
android:textAllCaps="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:id="@+id/action_support"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="128dp"
android:id="@+id/widget">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_action_gift"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_support"
style="@style/AnotherWidget.Main.Button.TabBar"
android:background="@android:color/transparent"/>
</LinearLayout>
</LinearLayout>
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:id="@+id/widget_bg"/>
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/the_widget"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/all_set_container">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:paddingTop="20dp"
android:paddingBottom="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_change_unit"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/settings_unit_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/temp_unit"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone"
android:id="@+id/no_calendar_permission_container"
android:layout_centerInParent="true"
android:orientation="vertical">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="14dp"
android:visibility="gone"
android:tint="@android:color/white"
android:background="@drawable/circle_background"
android:src="@drawable/ic_action_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Title"
android:paddingTop="16dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/title_permission_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Description"
android:paddingBottom="32dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/description_permission_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Button"
android:id="@+id/request_calendar"
android:text="@string/button_request_permission"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/no_location_permission_container"
android:layout_centerInParent="true"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="14dp"
android:visibility="gone"
android:tint="@android:color/white"
android:background="@drawable/circle_background"
android:src="@drawable/ic_action_location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Title"
android:paddingTop="16dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/title_permission_location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Description"
android:paddingBottom="32dp"
android:paddingRight="32dp"
android:paddingLeft="32dp"
android:text="@string/description_permission_location"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Main.Button"
android:id="@+id/request_location"
android:text="@string/button_request_permission"/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:baselineAligned="false"
android:id="@+id/menu_container"
android:background="@color/midnight_blue"
android:layout_gravity="bottom">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:id="@+id/action_share"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_action_sms"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_share"
style="@style/AnotherWidget.Main.Button.TabBar"
android:background="@android:color/transparent"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:id="@+id/action_project"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_action_code"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_project"
style="@style/AnotherWidget.Main.Button.TabBar"
android:background="@android:color/transparent"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:id="@+id/action_support"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_action_gift"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/action_support"
style="@style/AnotherWidget.Main.Button.TabBar"
android:background="@android:color/transparent"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -2,18 +2,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_layout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal"
android:id="@+id/empty_layout">
<TextView
android:id="@+id/empty_date"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="5"
style="@style/AnotherWidget.Title" />
<LinearLayout
android:orientation="horizontal"
@ -45,7 +44,7 @@
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
@ -58,7 +57,7 @@
android:layout_height="wrap_content"
style="@style/AnotherWidget.Title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Another Widget</string>
<string name="add_widget">Aggiungi Another Widget</string>
<string name="main_pre_title">Just</string>
<string name="button_request_permission">Concedi Accesso</string>
<string name="all_set_btn">Rimani Aggiornato</string>
<string name="all_set_title">Molto bene!</string>
<string name="action_support">Supporta</string>
<string name="action_rate">Valuta</string>
<string name="action_share">Condividi</string>
<string name="divider">|</string>
<string name="notification_title">Ottieni di più dal tuo widget</string>
<string name="title_permission_location">Controlla il Meteo</string>
<string name="title_permission_calendar">Controlla i tuoi Impegni</string>
<string name="notification_subtitle">Aggiungi gli eventi e il meteo al tuo widget.</string>
<string name="description_permission_calendar">Concedi l\'accesso al tuo calendario per vedere gli eventi.</string>
<string name="description_permission_location">Concedi l\'accesso alla tua posizione per vedere il meteo.</string>
<string name="all_set_subtitle">Hai completato la configurazione! Rimani aggiornato.</string>
<string name="action_about">Info</string>
<string name="h_code">ore</string>
<string name="min_code">min</string>
<string name="in_code">tra</string>
<string name="action_project">Progetto</string>
<string name="settings_unit_title">Unità di Misura</string>
<string name="settings_unit_subtitle">Modifica l\'unità di misura della temperatura</string>
</resources>

View File

@ -9,4 +9,6 @@
<color name="black_30">#48000000</color>
<color name="black_10">#1A000000</color>
<color name="white_80">#CCFFFFFF</color>
<color name="white_50">#80FFFFFF</color>
<color name="midnight_blue">#204A85</color>
</resources>

View File

@ -16,4 +16,13 @@
<string name="all_set_title">Good Job!</string>
<string name="all_set_subtitle">You have completed the configuration.\nWatch out for updates.</string>
<string name="all_set_btn">Stay up to date</string>
<string name="action_about">About</string>
<string name="h_code">h</string>
<string name="min_code">min</string>
<string name="in_code">in</string>
<string name="action_project">Project</string>
<string name="settings_unit_title">Unit of Measure</string>
<string name="settings_unit_subtitle">Choose the unit of temperature measurement</string>
<string name="fahrenheit" translatable="false">°F - Fahrenheit</string>
<string name="celsius" translatable="false">°C - Celsius</string>
</resources>

View File

@ -57,6 +57,18 @@
<item name="android:textSize">12sp</item>
</style>
<style name="AnotherWidget.Settings.Title" parent="TextAppearance.AppCompat.Medium">
<item name="android:textColor">@android:color/white</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="AnotherWidget.Settings.Subtitle" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">@android:color/white</item>
<item name="android:alpha">0.8</item>
</style>
<style name="AnotherWidget.Title" parent="TextAppearance.AppCompat.Medium">
<item name="android:textColor">@android:color/white</item>
<item name="android:padding">4dp</item>

View File

@ -4,7 +4,7 @@
android:initialLayout="@layout/the_widget"
android:minHeight="40dp"
android:minWidth="250dp"
android:previewImage="@drawable/example_appwidget_preview"
android:previewImage="@drawable/widget_preview"
android:resizeMode="horizontal"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen"></appwidget-provider>
android:updatePeriodMillis="60000"
android:widgetCategory="home_screen" />

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.4-3'
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
@ -19,6 +19,7 @@ allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}