Add next alarm, add weather provider personal key
This commit is contained in:
parent
4cbb5d702f
commit
fde3fdfab1
@ -41,7 +41,7 @@ dependencies {
|
||||
implementation 'com.mcxiaoke.volley:library:1.0.6@aar'
|
||||
implementation 'com.android.support:customtabs:26.1.0'
|
||||
implementation 'com.android.support:cardview-v7:26.1.0'
|
||||
kapt 'com.android.databinding:compiler:2.3.3'
|
||||
kapt 'com.android.databinding:compiler:3.0.0'
|
||||
implementation('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
|
||||
transitive = true;
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ object Constants {
|
||||
val PREF_TEXT_SHADOW = "PREF_TEXT_SHADOW"
|
||||
val PREF_SHOW_DIFF_TIME = "PREF_SHOW_DIFF_TIME"
|
||||
val PREF_SHOW_DECLINED_EVENTS = "PREF_SHOW_DECLINED_EVENTS"
|
||||
val PREF_OPEN_WEATHER_API_KEY = "PREF_OPEN_WEATHER_API_KEY"
|
||||
val PREF_SECOND_ROW_INFORMATION = "PREF_SECOND_ROW_INFORMATION"
|
||||
|
||||
val ACTION_EXTRA_OPEN_WEATHER_PROVIDER = "ACTION_EXTRA_OPEN_WEATHER_PROVIDER"
|
||||
|
||||
|
@ -30,6 +30,7 @@ import android.os.Build
|
||||
import android.support.design.widget.BottomSheetDialog
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.text.Html
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.widget.Toast
|
||||
import com.crashlytics.android.Crashlytics
|
||||
@ -121,7 +122,8 @@ class MainActivity : AppCompatActivity() {
|
||||
if (mAppWidgetId > 0) {
|
||||
addNewWidget()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +262,11 @@ class MainActivity : AppCompatActivity() {
|
||||
next_event_difference_time.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (!e.address.equals("") && SP.getBoolean(Constants.PREF_SHOW_EVENT_LOCATION, false)) {
|
||||
|
||||
if (SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0) == 2 && Util.getNextAlarm(this) != null) {
|
||||
second_row_icon.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_alarm))
|
||||
next_event_date.text = Util.getNextAlarm(this)
|
||||
} else if (!e.address.equals("") && SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0) == 1) {
|
||||
second_row_icon.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_action_location))
|
||||
next_event_date.text = e.address
|
||||
} else {
|
||||
@ -505,12 +511,16 @@ class MainActivity : AppCompatActivity() {
|
||||
updateAppWidget()
|
||||
}
|
||||
|
||||
show_location_label.text = if (SP.getBoolean(Constants.PREF_SHOW_EVENT_LOCATION, false)) getString(R.string.settings_show_location_subtitle_true) else getString(R.string.settings_show_location_subtitle_false)
|
||||
action_show_location.setOnClickListener {
|
||||
SP.edit().putBoolean(Constants.PREF_SHOW_EVENT_LOCATION, !SP.getBoolean(Constants.PREF_SHOW_EVENT_LOCATION, false)).commit()
|
||||
Util.updateWidget(this)
|
||||
second_row_info_label.text = getString(Util.getSecondRowInfoString(SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0)))
|
||||
action_second_row_info.setOnClickListener {
|
||||
SP.edit().putInt(Constants.PREF_SECOND_ROW_INFORMATION, when (SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0)) {
|
||||
0 -> 1
|
||||
1 -> 2
|
||||
2 -> 0
|
||||
else -> 0
|
||||
}).commit()
|
||||
updateSettings()
|
||||
updateAppWidget()
|
||||
sendBroadcast(Intent(Constants.ACTION_TIME_UPDATE))
|
||||
}
|
||||
|
||||
main_text_size_label.text = String.format("%.0f%s", SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f), "sp")
|
||||
@ -645,7 +655,10 @@ class MainActivity : AppCompatActivity() {
|
||||
label_weather_provider_api_key.text = getString(R.string.provider_google_awareness)
|
||||
alert_icon.visibility = View.GONE
|
||||
} else {
|
||||
if (SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "") == ("")) {
|
||||
if (SP.getString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, "") == ("")) {
|
||||
label_weather_provider_api_key.text = getString(R.string.settings_weather_provider_api_key_subtitle_not_set)
|
||||
alert_icon.visibility = View.VISIBLE
|
||||
} else {
|
||||
|
@ -41,7 +41,10 @@ class WeatherProviderActivity : AppCompatActivity() {
|
||||
|
||||
action_save.setOnClickListener {
|
||||
SP.edit()
|
||||
.putString(Constants.PREF_WEATHER_PROVIDER_API_KEY, api_key.text.toString())
|
||||
.putString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, api_key.text.toString())
|
||||
.commit()
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
@ -49,7 +52,11 @@ class WeatherProviderActivity : AppCompatActivity() {
|
||||
|
||||
api_key.addTextChangedListener(object: TextWatcher {
|
||||
override fun afterTextChanged(text: Editable?) {
|
||||
if (text.toString().equals("") || text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) {
|
||||
if (text.toString().equals("") || text.toString().equals(
|
||||
SP.getString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, ""))) {
|
||||
Util.collapse(button_container)
|
||||
} else {
|
||||
Util.expand(button_container)
|
||||
@ -98,12 +105,18 @@ class WeatherProviderActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
Util.collapse(button_container)
|
||||
api_key.setText(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))
|
||||
api_key.setText(SP.getString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, ""))
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
if (!SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS).equals(Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS) && (api_key.text.toString().equals("") || !api_key.text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "")))) {
|
||||
if (!SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS).equals(Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS) && (api_key.text.toString().equals("") || !api_key.text.toString().equals(SP.getString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, "")))) {
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(getString(R.string.error_weather_api_key))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
|
@ -29,6 +29,7 @@ import android.net.Uri
|
||||
import android.widget.TextClock
|
||||
import android.widget.TextView
|
||||
import android.content.ComponentName
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Color
|
||||
@ -37,6 +38,7 @@ import android.os.Bundle
|
||||
import android.support.v4.content.ContextCompat.startActivity
|
||||
import android.provider.CalendarContract.Events
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.TypedValue
|
||||
import kotlinx.android.synthetic.main.the_widget.*
|
||||
import kotlinx.android.synthetic.main.the_widget.view.*
|
||||
@ -48,6 +50,8 @@ import kotlinx.android.synthetic.main.the_widget.view.*
|
||||
class TheWidget : AppWidgetProvider() {
|
||||
|
||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
||||
Util.updateSettingsByDefault(context)
|
||||
|
||||
for (appWidgetId in appWidgetIds) {
|
||||
updateAppWidget(context, appWidgetManager, appWidgetId)
|
||||
}
|
||||
@ -73,13 +77,21 @@ class TheWidget : AppWidgetProvider() {
|
||||
|
||||
internal fun updateAppWidget(context: Context, appWidgetManager: AppWidgetManager,
|
||||
appWidgetId: Int) {
|
||||
val displayMetrics = Resources.getSystem().getDisplayMetrics()
|
||||
val height = displayMetrics.heightPixels
|
||||
val width = displayMetrics.widthPixels
|
||||
|
||||
val widgetInfo = appWidgetManager.getAppWidgetInfo(appWidgetId)
|
||||
generateWidgetView(context, appWidgetId, appWidgetManager, width - Util.convertDpToPixel(32f, context).toInt(), widgetInfo.minHeight)
|
||||
}
|
||||
|
||||
fun generateWidgetView(context: Context, appWidgetId: Int, appWidgetManager: AppWidgetManager, w: Int, h: Int) {
|
||||
var views = RemoteViews(context.packageName, R.layout.the_widget_sans)
|
||||
var v = View.inflate(context, R.layout.the_widget, null)
|
||||
v = updateCalendarViewByLayout(context, v)
|
||||
v = updateLocationViewByLayout(context, v)
|
||||
v = updateClockViewByLayout(context, v)
|
||||
views.setImageViewBitmap(R.id.bitmap_container, Util.getBitmapFromView(v))
|
||||
views.setImageViewBitmap(R.id.bitmap_container, Util.getBitmapFromView(v, w, h))
|
||||
|
||||
views = updateCalendarView(context, views, appWidgetId)
|
||||
views = updateLocationView(context, views, appWidgetId)
|
||||
@ -104,7 +116,6 @@ class TheWidget : AppWidgetProvider() {
|
||||
views.setTextViewTextSize(R.id.divider2, TypedValue.COMPLEX_UNIT_SP, SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f))
|
||||
views.setTextViewTextSize(R.id.calendar_temp, TypedValue.COMPLEX_UNIT_SP, SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f))
|
||||
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views)
|
||||
}
|
||||
|
||||
@ -138,7 +149,16 @@ class TheWidget : AppWidgetProvider() {
|
||||
views.setViewVisibility(R.id.next_event_difference_time, View.GONE)
|
||||
}
|
||||
|
||||
if (!e.address.equals("") && SP.getBoolean(Constants.PREF_SHOW_EVENT_LOCATION, false)) {
|
||||
if (SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0) == 2 && Util.getNextAlarm(context) != null) {
|
||||
val source = BitmapFactory.decodeResource(context.resources, R.drawable.ic_action_alarm);
|
||||
val result = Util.changeBitmapColor(source, Util.getFontColor(SP))
|
||||
views.setImageViewBitmap(R.id.second_row_icon, result)
|
||||
|
||||
views.setTextViewText(R.id.next_event_date, Util.getNextAlarm(context))
|
||||
|
||||
val clockIntent = PendingIntent.getActivity(context, widgetID, Util.getClockIntent(context), 0)
|
||||
views.setOnClickPendingIntent(R.id.next_event_date, clockIntent)
|
||||
} else if (e.address != "" && SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0) == 1) {
|
||||
|
||||
val source = BitmapFactory.decodeResource(context.resources, R.drawable.ic_action_location);
|
||||
val result = Util.changeBitmapColor(source, Util.getFontColor(SP))
|
||||
@ -257,6 +277,7 @@ class TheWidget : AppWidgetProvider() {
|
||||
if (SP.getBoolean(Constants.PREF_ITA_FORMAT_DATE, false)) {
|
||||
dateStringValue = Util.getCapWordString(Constants.itDateFormat.format(now.time))
|
||||
}
|
||||
|
||||
v.empty_date.text = dateStringValue
|
||||
|
||||
if (calendarLayout) {
|
||||
@ -271,7 +292,10 @@ class TheWidget : AppWidgetProvider() {
|
||||
v.next_event_difference_time.visibility = View.GONE
|
||||
}
|
||||
|
||||
if (!e.address.equals("") && SP.getBoolean(Constants.PREF_SHOW_EVENT_LOCATION, false)) {
|
||||
if (SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0) == 2 && Util.getNextAlarm(context) != null) {
|
||||
v.second_row_icon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_action_alarm))
|
||||
v.next_event_date.text = Util.getNextAlarm(context)
|
||||
} else if (!e.address.equals("") && SP.getInt(Constants.PREF_SECOND_ROW_INFORMATION, 0) == 1) {
|
||||
v.second_row_icon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_action_location))
|
||||
v.next_event_date.text = e.address
|
||||
} else {
|
||||
|
@ -2,10 +2,7 @@ package com.tommasoberlose.anotherwidget.util
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.app.WallpaperManager
|
||||
import android.app.*
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.*
|
||||
import android.content.pm.PackageManager
|
||||
@ -27,6 +24,7 @@ import android.support.annotation.StringRes
|
||||
import android.util.TypedValue
|
||||
import android.content.Intent
|
||||
import android.content.ComponentName
|
||||
import android.os.Build
|
||||
import android.preference.PreferenceManager
|
||||
import android.provider.AlarmClock
|
||||
import android.provider.CalendarContract
|
||||
@ -151,6 +149,22 @@ object Util {
|
||||
val measuredHeight = View.MeasureSpec.makeMeasureSpec(view.height, View.MeasureSpec.UNSPECIFIED)
|
||||
view.measure(measuredWidth, measuredHeight)
|
||||
view.layout(0,0, measuredWidth, measuredHeight)
|
||||
Log.d("AW", "W: " + view.measuredWidth +" - H: " + view.measuredHeight)
|
||||
val returnedBitmap = Bitmap.createBitmap(view.measuredWidth, view.measuredHeight, Bitmap.Config.ARGB_8888)
|
||||
//Bind a canvas to it
|
||||
val canvas = Canvas(returnedBitmap)
|
||||
// draw the view on the canvas
|
||||
view.draw(canvas)
|
||||
//return the bitmap
|
||||
return returnedBitmap
|
||||
}
|
||||
|
||||
fun getBitmapFromView(view: View, w: Int, h: Int): Bitmap {
|
||||
//Define a bitmap with the same size as the view
|
||||
val measuredWidth = View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY)
|
||||
val measuredHeight = View.MeasureSpec.makeMeasureSpec(h, View.MeasureSpec.EXACTLY)
|
||||
view.measure(measuredWidth, measuredHeight)
|
||||
view.layout(0,0, measuredWidth, measuredHeight)
|
||||
val returnedBitmap = Bitmap.createBitmap(view.measuredWidth, view.measuredHeight, Bitmap.Config.ARGB_8888)
|
||||
//Bind a canvas to it
|
||||
val canvas = Canvas(returnedBitmap)
|
||||
@ -212,6 +226,15 @@ object Util {
|
||||
}
|
||||
}
|
||||
|
||||
fun getSecondRowInfoString(info: Int): Int {
|
||||
return when (info) {
|
||||
0 -> R.string.settings_second_row_info_subtitle_0
|
||||
1 -> R.string.settings_second_row_info_subtitle_1
|
||||
2 -> R.string.settings_second_row_info_subtitle_2
|
||||
else -> R.string.settings_second_row_info_subtitle_0
|
||||
}
|
||||
}
|
||||
|
||||
fun getTextshadowString(shadow: Int): Int {
|
||||
return when (shadow) {
|
||||
0 -> R.string.settings_text_shadow_subtitle_none
|
||||
@ -510,4 +533,41 @@ object Util {
|
||||
|
||||
return resultBitmap;
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
fun updateSettingsByDefault(context: Context) {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val editor = SP.edit()
|
||||
if (SP.contains(Constants.PREF_SHOW_EVENT_LOCATION)) {
|
||||
editor.putInt(Constants.PREF_SECOND_ROW_INFORMATION, 1)
|
||||
editor.remove(Constants.PREF_SHOW_EVENT_LOCATION)
|
||||
}
|
||||
if (SP.contains(Constants.PREF_WEATHER_PROVIDER_API_KEY)) {
|
||||
editor.putString(Constants.PREF_OPEN_WEATHER_API_KEY, SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))
|
||||
editor.remove(Constants.PREF_WEATHER_PROVIDER_API_KEY)
|
||||
}
|
||||
editor.commit()
|
||||
}
|
||||
|
||||
fun getNextAlarm(context: Context): String? {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val am = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
val alarm = am.nextAlarmClock
|
||||
if (alarm != null) {
|
||||
val time = am.nextAlarmClock.triggerTime
|
||||
if (SP.getString(Constants.PREF_HOUR_FORMAT, "12") == "12") Constants.badHourFormat.format(time) else Constants.goodHourFormat.format(time)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
val time = Settings.System.getString(context.contentResolver,
|
||||
Settings.System.NEXT_ALARM_FORMATTED)
|
||||
return if (time != "") {
|
||||
time
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,36 +60,6 @@ object WeatherUtil {
|
||||
getCurrentWeather(context, locationResult.location)
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
var gpsEnabled = false
|
||||
var networkEnabled = false
|
||||
val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
try {
|
||||
gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
|
||||
try {
|
||||
networkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
|
||||
if (!gpsEnabled && !networkEnabled && SP.getBoolean(Constants.PREF_SHOW_WEATHER, true)) {
|
||||
Util.showLocationNotification(context, true)
|
||||
} else {
|
||||
if (gpsEnabled) {
|
||||
val gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER)
|
||||
if (gpsLocation != null) {
|
||||
getCurrentWeather(context, gpsLocation)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (networkEnabled) {
|
||||
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER))
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
} else {
|
||||
weatherNetworkRequest(context, SP.getString(Constants.PREF_CUSTOM_LOCATION_LAT, "").toDouble(), SP.getString(Constants.PREF_CUSTOM_LOCATION_LON, "").toDouble())
|
||||
@ -132,14 +102,20 @@ object WeatherUtil {
|
||||
|
||||
fun weatherNetworkRequest(context: Context, latitude: Double, longitude: Double) {
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (!SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals("")) {
|
||||
if (!SP.getString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, "").equals("")) {
|
||||
try {
|
||||
val config = WeatherConfig()
|
||||
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"
|
||||
config.maxResult = 1
|
||||
config.numDays = 1
|
||||
config.ApiKey = SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "")
|
||||
config.ApiKey = SP.getString(when (SP.getInt(Constants.PREF_WEATHER_PROVIDER, Constants.WEATHER_PROVIDER_GOOGLE_AWARENESS)) {
|
||||
Constants.WEATHER_PROVIDER_OPEN_WEATHER -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
else -> Constants.PREF_OPEN_WEATHER_API_KEY
|
||||
}, "")
|
||||
|
||||
val client = WeatherClient.ClientBuilder().attach(context)
|
||||
.httpClient(com.survivingwithandroid.weather.lib.client.volley.WeatherClientDefault::class.java)
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_action_alarm.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_action_alarm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_action_alarm.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_action_alarm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 720 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_alarm.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_action_alarm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_alarm.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_action_alarm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -504,17 +504,17 @@
|
||||
android:focusable="true"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_show_location"
|
||||
android:id="@+id/action_second_row_info"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:text="@string/settings_show_location_title"/>
|
||||
android:text="@string/settings_second_row_info_title"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/show_location_label"
|
||||
android:id="@+id/second_row_info_label"
|
||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
|
@ -98,9 +98,10 @@
|
||||
<string name="tomorrow">Domani</string>
|
||||
<string name="today">Oggi</string>
|
||||
<string name="settings_event_app_title">Gli eventi aprono</string>
|
||||
<string name="settings_show_location_title">Informazione Seconda Riga</string>
|
||||
<string name="settings_show_location_subtitle_false">Mostra orario evento</string>
|
||||
<string name="settings_show_location_subtitle_true">Mostra indirizzo evento invece dell\'orario</string>
|
||||
<string name="settings_second_row_info_title">Informazione Seconda Riga</string>
|
||||
<string name="settings_second_row_info_subtitle_0">Mostra orario evento</string>
|
||||
<string name="settings_second_row_info_subtitle_1">Mostra indirizzo evento invece dell\'orario</string>
|
||||
<string name="settings_second_row_info_subtitle_2">Mostra orario prossimo allarme</string>
|
||||
<string name="settings_font_color_title">Colore Testo</string>
|
||||
<string name="title_main_text_size">Dimensione Testo Prima Riga</string>
|
||||
<string name="title_second_text_size">Dimensione Testo Seconda Riga</string>
|
||||
|
@ -100,9 +100,10 @@
|
||||
<string name="tomorrow">Tomorrow</string>
|
||||
<string name="today">Today</string>
|
||||
<string name="settings_event_app_title">Tap on event opens</string>
|
||||
<string name="settings_show_location_title">Second Row Information</string>
|
||||
<string name="settings_show_location_subtitle_true">Show event address instead of time</string>
|
||||
<string name="settings_show_location_subtitle_false">Show event time</string>
|
||||
<string name="settings_second_row_info_title">Second Row Information</string>
|
||||
<string name="settings_second_row_info_subtitle_1">Show event address instead of time</string>
|
||||
<string name="settings_second_row_info_subtitle_0">Show event time</string>
|
||||
<string name="settings_second_row_info_subtitle_2">Show next alarm time</string>
|
||||
<string name="settings_font_color_title">Text Color</string>
|
||||
<string name="title_main_text_size">First Row Text Size</string>
|
||||
<string name="title_second_text_size">Second Row Text Size</string>
|
||||
|
13
app/src/main/res/xml-v21/the_widget_info.xml
Normal file
13
app/src/main/res/xml-v21/the_widget_info.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/the_widget"
|
||||
android:initialLayout="@layout/the_widget"
|
||||
android:minHeight="150dp"
|
||||
android:minWidth="400dp"
|
||||
android:configure="com.tommasoberlose.anotherwidget.ui.activity.MainActivity"
|
||||
android:minResizeHeight="150dp"
|
||||
android:minResizeWidth="400dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="vertical"
|
||||
android:updatePeriodMillis="60000"
|
||||
android:widgetCategory="home_screen" />
|
@ -2,12 +2,11 @@
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialKeyguardLayout="@layout/the_widget"
|
||||
android:initialLayout="@layout/the_widget"
|
||||
android:minHeight="128dp"
|
||||
android:minWidth="300dp"
|
||||
android:configure="com.tommasoberlose.anotherwidget.ui.activity.MainActivity"
|
||||
android:minResizeHeight="40dp"
|
||||
android:minResizeWidth="250dp"
|
||||
android:minHeight="150dp"
|
||||
android:minWidth="400dp"
|
||||
android:minResizeHeight="150dp"
|
||||
android:minResizeWidth="400dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="vertical|horizontal"
|
||||
android:resizeMode="vertical"
|
||||
android:updatePeriodMillis="60000"
|
||||
android:widgetCategory="home_screen" />
|
@ -8,7 +8,7 @@ buildscript {
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0-rc1'
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'io.fabric.tools:gradle:1.+'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user