Multiple bug fixes
This commit is contained in:
parent
748249fed5
commit
170add3073
@ -17,7 +17,7 @@ android {
|
||||
applicationId "com.tommasoberlose.anotherwidget"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 25
|
||||
versionCode 27
|
||||
versionName "1.3"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":24},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":27},"path":"app-release.apk","properties":{"packageId":"com.tommasoberlose.anotherwidget","split":"","minSdkVersion":"19"}}]
|
@ -7,6 +7,7 @@ import android.content.Intent
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
import android.icu.text.LocaleDisplayNames
|
||||
import android.os.Build
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||
@ -39,8 +40,12 @@ class UpdatesReceiver : BroadcastReceiver() {
|
||||
fun setUpdates(context: Context) {
|
||||
CalendarUtil.updateEventList(context)
|
||||
removeUpdates(context)
|
||||
context.startService(Intent(context, CrocodileService::class.java))
|
||||
/*
|
||||
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(Intent(context, CrocodileService::class.java))
|
||||
} else {
|
||||
context.startService(Intent(context, CrocodileService::class.java))
|
||||
}*/
|
||||
|
||||
val now = Calendar.getInstance()
|
||||
now.set(Calendar.MILLISECOND, 0)
|
||||
now.set(Calendar.SECOND, 0)
|
||||
@ -49,7 +54,7 @@ class UpdatesReceiver : BroadcastReceiver() {
|
||||
val i = Intent(context, UpdatesReceiver::class.java)
|
||||
i.action = Constants.ACTION_TIME_UPDATE
|
||||
val pi = PendingIntent.getBroadcast(context, 0, i, 0)
|
||||
am.setRepeating(AlarmManager.RTC_WAKEUP, now.timeInMillis, (1000 * 60).toLong(), pi) */
|
||||
am.setRepeating(AlarmManager.RTC_WAKEUP, now.timeInMillis, (1000 * 60).toLong(), pi)
|
||||
}
|
||||
|
||||
fun removeUpdates(context: Context) {
|
||||
|
@ -23,6 +23,7 @@ import android.content.BroadcastReceiver
|
||||
import com.tommasoberlose.anotherwidget.util.CalendarUtil
|
||||
import com.tommasoberlose.anotherwidget.util.WeatherUtil
|
||||
import android.content.DialogInterface
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.Drawable
|
||||
@ -180,7 +181,18 @@ class MainActivity : AppCompatActivity() {
|
||||
updateSettings()
|
||||
updateAppWidget()
|
||||
updateClockView()
|
||||
widget_bitmap.setImageBitmap(Util.getBitmapFromView(main_layout))
|
||||
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val displayMetrics = Resources.getSystem().displayMetrics
|
||||
var height = Util.convertDpToPixel(120f, this).toInt()
|
||||
if (SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) {
|
||||
height += Util.convertSpToPixels(SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f), this).toInt() + Util.convertDpToPixel(8f, this).toInt()
|
||||
}
|
||||
if (SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) + SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) > 50) {
|
||||
height += Util.convertDpToPixel(24f, this).toInt()
|
||||
}
|
||||
widget_bitmap.setImageBitmap(Util.getBitmapFromView(main_layout, displayMetrics.widthPixels, height - Util.convertDpToPixel(32f, this).toInt()))
|
||||
widget.layoutParams.height = height + Util.convertDpToPixel(16f, this).toInt()
|
||||
}
|
||||
|
||||
|
||||
@ -349,8 +361,14 @@ class MainActivity : AppCompatActivity() {
|
||||
calendar_temp.setTextSize(TypedValue.COMPLEX_UNIT_SP, SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f))
|
||||
time.setTextSize(TypedValue.COMPLEX_UNIT_SP, SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f))
|
||||
|
||||
second_row_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
second_row_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
second_row_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f
|
||||
second_row_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f
|
||||
|
||||
weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f
|
||||
weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f
|
||||
|
||||
empty_weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f
|
||||
empty_weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f
|
||||
|
||||
multiple_events.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
multiple_events.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
|
@ -41,29 +41,49 @@ class SupportDevActivity : AppCompatActivity(), BillingProcessor.IBillingHandler
|
||||
val lunch = bp!!.getPurchaseListingDetails("donation_lunch")
|
||||
val dinner = bp!!.getPurchaseListingDetails("donation_dinner")
|
||||
|
||||
import_donation_coffee.text = coffee.priceText
|
||||
action_donation_coffee.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_coffee")
|
||||
if (coffee != null) {
|
||||
import_donation_coffee.text = coffee.priceText
|
||||
action_donation_coffee.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_coffee")
|
||||
}
|
||||
} else {
|
||||
action_donation_coffee.visibility = View.GONE
|
||||
}
|
||||
|
||||
import_donation_donuts.text = donuts.priceText
|
||||
action_donation_donuts.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_donuts")
|
||||
if (donuts != null) {
|
||||
import_donation_donuts.text = donuts.priceText
|
||||
action_donation_donuts.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_donuts")
|
||||
}
|
||||
} else {
|
||||
action_donation_donuts.visibility = View.GONE
|
||||
}
|
||||
|
||||
import_donation_breakfast.text = breakfast.priceText
|
||||
action_donation_breakfast.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_breakfast")
|
||||
if (breakfast != null) {
|
||||
import_donation_breakfast.text = breakfast.priceText
|
||||
action_donation_breakfast.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_breakfast")
|
||||
}
|
||||
} else {
|
||||
action_donation_breakfast.visibility = View.GONE
|
||||
}
|
||||
|
||||
import_donation_lunch.text = lunch.priceText
|
||||
action_donation_lunch.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_lunch")
|
||||
if (lunch != null) {
|
||||
import_donation_lunch.text = lunch.priceText
|
||||
action_donation_lunch.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_lunch")
|
||||
}
|
||||
} else {
|
||||
action_donation_lunch.visibility = View.GONE
|
||||
}
|
||||
|
||||
import_donation_dinner.text = dinner.priceText
|
||||
action_donation_dinner.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_dinner")
|
||||
if (dinner != null) {
|
||||
import_donation_dinner.text = dinner.priceText
|
||||
action_donation_dinner.setOnClickListener {
|
||||
bp!!.purchase(this, "donation_dinner")
|
||||
}
|
||||
} else {
|
||||
action_donation_dinner.visibility = View.GONE
|
||||
}
|
||||
|
||||
products_list.visibility = View.VISIBLE
|
||||
|
@ -44,9 +44,11 @@ import android.text.style.RelativeSizeSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.TypedValue
|
||||
import android.widget.LinearLayout
|
||||
import com.tommasoberlose.anotherwidget.ui.view.CustomTypefaceSpan
|
||||
import kotlinx.android.synthetic.main.the_widget.*
|
||||
import kotlinx.android.synthetic.main.the_widget.view.*
|
||||
import kotlinx.android.synthetic.main.the_widget_sans.view.*
|
||||
|
||||
|
||||
/**
|
||||
@ -85,11 +87,17 @@ class TheWidget : AppWidgetProvider() {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val displayMetrics = Resources.getSystem().displayMetrics
|
||||
val widgetInfo = appWidgetManager.getAppWidgetInfo(appWidgetId)
|
||||
var height = widgetInfo.minHeight
|
||||
var height = Util.convertDpToPixel(80f, context).toInt()
|
||||
val width = displayMetrics.widthPixels
|
||||
if (widgetInfo != null) {
|
||||
height = widgetInfo.minHeight
|
||||
}
|
||||
if (SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) {
|
||||
height += Util.convertSpToPixels(SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f), context).toInt() + Util.convertDpToPixel(8f, context).toInt()
|
||||
}
|
||||
val width = displayMetrics.widthPixels
|
||||
if (SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) > 30 && SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) > 22) {
|
||||
height += Util.convertDpToPixel(24f, context).toInt()
|
||||
}
|
||||
|
||||
generateWidgetView(context, appWidgetId, appWidgetManager, width - Util.convertDpToPixel(16f, context).toInt(), height)
|
||||
}
|
||||
@ -228,7 +236,13 @@ class TheWidget : AppWidgetProvider() {
|
||||
} else {
|
||||
views.setTextViewText(R.id.next_event_date, dateStringValue)
|
||||
}
|
||||
views.setOnClickPendingIntent(R.id.next_event_date, pIntent)
|
||||
|
||||
if (SP.getBoolean(Constants.PREF_SHOW_NEXT_EVENT, false) && CalendarUtil.getEventsCount(context) > 1) {
|
||||
val multipleIntent = PendingIntent.getBroadcast(context, widgetID, Intent(Constants.ACTION_GO_TO_NEXT_EVENT), 0)
|
||||
views.setOnClickPendingIntent(R.id.next_event_date, multipleIntent)
|
||||
} else {
|
||||
views.setOnClickPendingIntent(R.id.next_event_date, pIntent)
|
||||
}
|
||||
}
|
||||
|
||||
views.setViewVisibility(R.id.empty_layout, View.GONE)
|
||||
@ -279,25 +293,24 @@ class TheWidget : AppWidgetProvider() {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (!SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) {
|
||||
views.setViewVisibility(R.id.time, View.GONE)
|
||||
views.setViewVisibility(R.id.bottom_divider, View.VISIBLE)
|
||||
} else {
|
||||
views.setViewVisibility(R.id.bottom_divider, View.GONE)
|
||||
val now = Calendar.getInstance()
|
||||
if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) {
|
||||
val textBadHour = SpannableString(Constants.badHourFormat.format(now.timeInMillis).replace(" ", ""))
|
||||
textBadHour.setSpan(RelativeSizeSpan(0.4f), textBadHour.length - 2,
|
||||
textBadHour.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE)
|
||||
|
||||
views.setTextViewText(R.id.time, textBadHour)
|
||||
} else {
|
||||
views.setTextViewText(R.id.time, Constants.goodHourFormat.format(now.timeInMillis))
|
||||
}
|
||||
|
||||
val clockPIntent = PendingIntent.getActivity(context, widgetID, Util.getClockIntent(context), 0)
|
||||
views.setOnClickPendingIntent(R.id.time, clockPIntent)
|
||||
views.setViewVisibility(R.id.time, View.VISIBLE)
|
||||
}
|
||||
val now = Calendar.getInstance()
|
||||
|
||||
|
||||
|
||||
if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) {
|
||||
val textBadHour = SpannableString(Constants.badHourFormat.format(now.timeInMillis).replace(" ", ""))
|
||||
textBadHour.setSpan(RelativeSizeSpan(0.4f), textBadHour.length - 2,
|
||||
textBadHour.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE)
|
||||
|
||||
views.setTextViewText(R.id.time, textBadHour)
|
||||
} else {
|
||||
views.setTextViewText(R.id.time, Constants.goodHourFormat.format(now.timeInMillis))
|
||||
}
|
||||
|
||||
val clockPIntent = PendingIntent.getActivity(context, widgetID, Util.getClockIntent(context), 0)
|
||||
views.setOnClickPendingIntent(R.id.time, clockPIntent)
|
||||
|
||||
return views
|
||||
}
|
||||
@ -402,8 +415,14 @@ class TheWidget : AppWidgetProvider() {
|
||||
v.calendar_temp.setTextSize(TypedValue.COMPLEX_UNIT_SP, SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f))
|
||||
v.time.setTextSize(TypedValue.COMPLEX_UNIT_SP, SP.getFloat(Constants.PREF_TEXT_CLOCK_SIZE, 90f))
|
||||
|
||||
v.second_row_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
v.second_row_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
v.second_row_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f
|
||||
v.second_row_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 18f
|
||||
|
||||
v.weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f
|
||||
v.weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 20f
|
||||
|
||||
v.empty_weather_icon.scaleX = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f
|
||||
v.empty_weather_icon.scaleY = SP.getFloat(Constants.PREF_TEXT_MAIN_SIZE, 24f) / 24f
|
||||
|
||||
v.multiple_events.scaleX = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
v.multiple_events.scaleY = SP.getFloat(Constants.PREF_TEXT_SECOND_SIZE, 16f) / 16f
|
||||
@ -487,17 +506,17 @@ class TheWidget : AppWidgetProvider() {
|
||||
if (!SP.getBoolean(Constants.PREF_SHOW_CLOCK, false)) {
|
||||
v.time.visibility = View.GONE
|
||||
} else {
|
||||
v.time.visibility = View.VISIBLE
|
||||
}
|
||||
val now = Calendar.getInstance()
|
||||
if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) {
|
||||
val textBadHour = SpannableString(Constants.badHourFormat.format(now.timeInMillis).replace(" ", ""))
|
||||
textBadHour.setSpan(RelativeSizeSpan(0.4f), textBadHour.length - 2,
|
||||
textBadHour.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
val now = Calendar.getInstance()
|
||||
if (SP.getString(Constants.PREF_HOUR_FORMAT, "12").equals("12")) {
|
||||
val textBadHour = SpannableString(Constants.badHourFormat.format(now.timeInMillis).replace(" ", ""))
|
||||
textBadHour.setSpan(RelativeSizeSpan(0.4f), textBadHour.length - 2,
|
||||
textBadHour.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
|
||||
v.time.text = textBadHour
|
||||
} else {
|
||||
v.time.text = Constants.goodHourFormat.format(now.timeInMillis)
|
||||
v.time.text = textBadHour
|
||||
} else {
|
||||
v.time.text = Constants.goodHourFormat.format(now.timeInMillis)
|
||||
}
|
||||
v.time.visibility = View.VISIBLE
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
@ -58,19 +58,22 @@ object CalendarUtil {
|
||||
resetNextEventData(context)
|
||||
} else {
|
||||
val provider = CalendarProvider(context)
|
||||
val instances = provider.getInstances(now.timeInMillis, limit.timeInMillis).list
|
||||
for (instance in instances) {
|
||||
val e = provider.getEvent(instance.eventId)
|
||||
if (e != null && (SP.getBoolean(Constants.PREF_CALENDAR_ALL_DAY, false) || !e.allDay) && !(SP.getString(Constants.PREF_CALENDAR_FILTER, "").contains(" " + e.calendarId + ",")) && (SP.getBoolean(Constants.PREF_SHOW_DECLINED_EVENTS, true) || !e.selfAttendeeStatus.equals(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED))) {
|
||||
if (e.allDay) {
|
||||
val start = Calendar.getInstance()
|
||||
start.timeInMillis = instance.begin
|
||||
val end = Calendar.getInstance()
|
||||
end.timeInMillis = instance.end
|
||||
instance.begin = start.timeInMillis - start.timeZone.getOffset(start.timeInMillis)
|
||||
instance.end = end.timeInMillis - end.timeZone.getOffset(end.timeInMillis)
|
||||
val data = provider.getInstances(now.timeInMillis, limit.timeInMillis)
|
||||
if (data != null) {
|
||||
val instances = data.list
|
||||
for (instance in instances) {
|
||||
val e = provider.getEvent(instance.eventId)
|
||||
if (e != null && instance.begin <= limit.timeInMillis && (SP.getBoolean(Constants.PREF_CALENDAR_ALL_DAY, false) || !e.allDay) && !(SP.getString(Constants.PREF_CALENDAR_FILTER, "").contains(" " + e.calendarId + ",")) && (SP.getBoolean(Constants.PREF_SHOW_DECLINED_EVENTS, true) || !e.selfAttendeeStatus.equals(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED))) {
|
||||
if (e.allDay) {
|
||||
val start = Calendar.getInstance()
|
||||
start.timeInMillis = instance.begin
|
||||
val end = Calendar.getInstance()
|
||||
end.timeInMillis = instance.end
|
||||
instance.begin = start.timeInMillis - start.timeZone.getOffset(start.timeInMillis)
|
||||
instance.end = end.timeInMillis - end.timeZone.getOffset(end.timeInMillis)
|
||||
}
|
||||
eventList.add(Event(e.id.toInt(), e.title, instance.begin, instance.end, e.calendarId.toInt(), e.allDay, e.eventLocation ?: ""))
|
||||
}
|
||||
eventList.add(Event(e.id.toInt(), e.title, instance.begin, instance.end, e.calendarId.toInt(), e.allDay, e.eventLocation?: ""))
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +91,7 @@ object CalendarUtil {
|
||||
event1.startDate.compareTo(event.startDate)
|
||||
}
|
||||
})
|
||||
eventList.reverse()
|
||||
saveEvents(context, eventList)
|
||||
saveNextEventData(context, eventList[0])
|
||||
}
|
||||
@ -105,8 +109,12 @@ object CalendarUtil {
|
||||
return calendarList
|
||||
}
|
||||
val provider = CalendarProvider(context)
|
||||
return provider.calendars.list
|
||||
|
||||
val data = provider.calendars
|
||||
if (data != null) {
|
||||
return data.list
|
||||
} else {
|
||||
return calendarList
|
||||
}
|
||||
}
|
||||
|
||||
fun saveEvents(context: Context, eventList: ArrayList<Event>) {
|
||||
@ -120,6 +128,11 @@ object CalendarUtil {
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
fun resetNextEventData(context: Context) {
|
||||
Realm.init(context)
|
||||
val db = Realm.getDefaultInstance()
|
||||
db.executeTransaction {
|
||||
db.where(Event::class.java).findAll().deleteAllFromRealm()
|
||||
}
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
SP.edit()
|
||||
.remove(Constants.PREF_NEXT_EVENT_ID)
|
||||
@ -151,7 +164,24 @@ object CalendarUtil {
|
||||
nextEvent
|
||||
} else {
|
||||
val eventList = db.where(Event::class.java).findAll()
|
||||
eventList[0]?: Event()
|
||||
|
||||
if (eventList.isNotEmpty()) {
|
||||
eventList.sortWith(Comparator { event: Event, event1: Event ->
|
||||
if (event.allDay && event1.allDay) {
|
||||
event.startDate.compareTo(event1.startDate)
|
||||
} else if (event.allDay) {
|
||||
1
|
||||
} else if (event1.allDay) {
|
||||
-1
|
||||
} else {
|
||||
event1.startDate.compareTo(event.startDate)
|
||||
}
|
||||
})
|
||||
eventList.reverse()
|
||||
eventList[0] ?: Event()
|
||||
} else {
|
||||
Event()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,27 +192,45 @@ object CalendarUtil {
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val eventList = db.where(Event::class.java).findAll()
|
||||
|
||||
var found = false
|
||||
for (e in eventList) {
|
||||
if (e.id == SP.getInt(Constants.PREF_NEXT_EVENT_ID, 0)) {
|
||||
if (eventList.indexOf(e) < eventList.size - 1) {
|
||||
SP.edit()
|
||||
.putInt(Constants.PREF_NEXT_EVENT_ID, eventList[eventList.indexOf(e) + 1]?.id ?: 0)
|
||||
.commit()
|
||||
if (eventList.isNotEmpty()) {
|
||||
/*
|
||||
eventList.sortWith(Comparator { event: Event, event1: Event ->
|
||||
if (event.allDay && event1.allDay) {
|
||||
event.startDate.compareTo(event1.startDate)
|
||||
} else if (event.allDay) {
|
||||
1
|
||||
} else if (event1.allDay) {
|
||||
-1
|
||||
} else {
|
||||
SP.edit()
|
||||
.putInt(Constants.PREF_NEXT_EVENT_ID, eventList[0]?.id ?: 0)
|
||||
.commit()
|
||||
event1.startDate.compareTo(event.startDate)
|
||||
}
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
eventList.reverse()*/
|
||||
|
||||
if (!found) {
|
||||
SP.edit()
|
||||
.putInt(Constants.PREF_NEXT_EVENT_ID, eventList[0]?.id ?: 0)
|
||||
.commit()
|
||||
var found = false
|
||||
for (e in eventList) {
|
||||
if (e.id == SP.getInt(Constants.PREF_NEXT_EVENT_ID, 0)) {
|
||||
if (eventList.indexOf(e) < eventList.size - 1) {
|
||||
SP.edit()
|
||||
.putInt(Constants.PREF_NEXT_EVENT_ID, eventList[eventList.indexOf(e) + 1]?.id ?: 0)
|
||||
.commit()
|
||||
} else {
|
||||
SP.edit()
|
||||
.putInt(Constants.PREF_NEXT_EVENT_ID, eventList[0]?.id ?: 0)
|
||||
.commit()
|
||||
}
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
SP.edit()
|
||||
.putInt(Constants.PREF_NEXT_EVENT_ID, eventList[0]?.id ?: 0)
|
||||
.commit()
|
||||
}
|
||||
} else {
|
||||
resetNextEventData(context)
|
||||
}
|
||||
|
||||
context.sendBroadcast(Intent(Constants.ACTION_TIME_UPDATE))
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.tommasoberlose.anotherwidget.util
|
||||
|
||||
import android.app.Notification
|
||||
import android.app.PendingIntent
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
@ -7,7 +9,12 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||
import android.content.IntentFilter
|
||||
import android.os.Build
|
||||
import android.support.v4.app.NotificationCompat
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.util.Log
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.ui.activity.MainActivity
|
||||
|
||||
|
||||
class CrocodileService : Service() {
|
||||
@ -42,6 +49,18 @@ class CrocodileService : Service() {
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(this, "Settings")
|
||||
.setSmallIcon(R.drawable.ic_stat_name)
|
||||
.setPriority(Notification.PRIORITY_MIN)
|
||||
.setColor(ContextCompat.getColor(this, R.color.colorPrimary))
|
||||
.setContentTitle(this.getString(R.string.background_service_title))
|
||||
.setContentText(this.getString(R.string.background_service_subtitle))
|
||||
.setAutoCancel(true);
|
||||
startForeground(5, mBuilder.build())
|
||||
}
|
||||
|
||||
return Service.START_NOT_STICKY
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,7 @@ object Util {
|
||||
|
||||
if (SP.getString(Constants.PREF_CALENDAR_APP_PACKAGE, "").equals("")) {
|
||||
val calIntent = Intent(Intent.ACTION_MAIN)
|
||||
calIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR)
|
||||
return calIntent
|
||||
} else if (SP.getString(Constants.PREF_CALENDAR_APP_PACKAGE, "").equals("_")) {
|
||||
@ -266,10 +267,12 @@ object Util {
|
||||
return try {
|
||||
val intent: Intent = pm.getLaunchIntentForPackage(SP.getString(Constants.PREF_CALENDAR_APP_PACKAGE, ""))
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
val calIntent = Intent(Intent.ACTION_MAIN)
|
||||
calIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
calIntent.addCategory(Intent.CATEGORY_APP_CALENDAR)
|
||||
calIntent
|
||||
}
|
||||
@ -281,6 +284,7 @@ object Util {
|
||||
if (SP.getString(Constants.PREF_WEATHER_APP_PACKAGE, "").equals("")) {
|
||||
val weatherIntent: Intent = Intent(Intent.ACTION_VIEW)
|
||||
weatherIntent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
weatherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity")
|
||||
weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
||||
return weatherIntent
|
||||
@ -291,10 +295,12 @@ object Util {
|
||||
return try {
|
||||
val intent: Intent = pm.getLaunchIntentForPackage(SP.getString(Constants.PREF_WEATHER_APP_PACKAGE, ""))
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent
|
||||
} catch (e: Exception) {
|
||||
val weatherIntent: Intent = Intent(Intent.ACTION_VIEW)
|
||||
weatherIntent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
weatherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
weatherIntent.data = Uri.parse("dynact://velour/weather/ProxyActivity")
|
||||
weatherIntent.component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
||||
weatherIntent
|
||||
@ -308,6 +314,7 @@ object Util {
|
||||
val uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, e.id.toLong())
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
.setData(uri)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.putExtra("beginTime", e.startDate);
|
||||
intent.putExtra("endTime", e.endDate);
|
||||
return intent
|
||||
@ -318,11 +325,13 @@ object Util {
|
||||
return try {
|
||||
val intent: Intent = pm.getLaunchIntentForPackage(SP.getString(Constants.PREF_EVENT_APP_PACKAGE, ""))
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent
|
||||
} catch (ex: Exception) {
|
||||
val uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, e.id.toLong())
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
.setData(uri)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
intent.putExtra("beginTime", e.startDate);
|
||||
intent.putExtra("endTime", e.endDate);
|
||||
intent
|
||||
@ -334,7 +343,7 @@ object Util {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (SP.getString(Constants.PREF_CLOCK_APP_PACKAGE, "").equals("")) {
|
||||
val clockIntent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
|
||||
clockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
clockIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
return clockIntent
|
||||
} else if (SP.getString(Constants.PREF_CLOCK_APP_PACKAGE, "").equals("_")) {
|
||||
return Intent()
|
||||
@ -556,7 +565,12 @@ object Util {
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
fun updateSettingsByDefault(context: Context) {
|
||||
context.startService(Intent(context, CrocodileService::class.java))
|
||||
try {
|
||||
context.startService(Intent(context, CrocodileService::class.java))
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val editor = SP.edit()
|
||||
if (SP.contains(Constants.PREF_SHOW_EVENT_LOCATION)) {
|
||||
|
@ -80,7 +80,7 @@ object WeatherUtil {
|
||||
|
||||
Awareness.SnapshotApi.getWeather(mGoogleApiClient)
|
||||
.setResultCallback({ weatherResult ->
|
||||
if (weatherResult.status.isSuccess) {
|
||||
if (weatherResult.status.isSuccess && weatherResult.weather != null) {
|
||||
val weather: Weather = weatherResult.weather
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
SP.edit()
|
||||
|
@ -81,200 +81,204 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:id="@+id/loader"
|
||||
android:layout_margin="16dp"/>
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/products_list"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_coffee"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/products_list"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_coffee"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_coffee"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_coffee"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_coffee"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_donuts"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_coffee"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_donuts"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_donuts"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_donuts"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_donuts"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_breakfast"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_donuts"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_breakfast"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_breakfast"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_breakfast"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_breakfast"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_lunch"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_breakfast"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_lunch"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_lunch"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_lunch"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_lunch"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_dinner"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_lunch"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_dinner"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_donation_dinner"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:text="@string/donation_dinner"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textAppearance="?android:textAppearanceButton"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_dinner"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="@color/black_10"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="@color/black_50"
|
||||
android:id="@+id/import_donation_dinner"
|
||||
android:textSize="12sp"/>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
<android.support.v7.widget.CardView
|
||||
|
@ -34,6 +34,7 @@
|
||||
android:gravity="right"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/loading_text"
|
||||
android:includeFontPadding="false"
|
||||
style="@style/AnotherWidget.Title"/>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
@ -49,6 +50,7 @@
|
||||
android:layout_marginEnd="8dp"
|
||||
android:id="@+id/divider1"
|
||||
android:text="@string/divider"
|
||||
android:includeFontPadding="false"
|
||||
style="@style/AnotherWidget.Subtitle"/>
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
@ -61,6 +63,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/AnotherWidget.Date.Big"
|
||||
android:ellipsize="marquee"
|
||||
android:includeFontPadding="false"
|
||||
android:id="@+id/temp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@ -86,6 +89,7 @@
|
||||
android:lines="1"
|
||||
android:gravity="right"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/AnotherWidget.Title" />
|
||||
<LinearLayout
|
||||
@ -97,6 +101,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:includeFontPadding="false"
|
||||
style="@style/AnotherWidget.Title" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@ -112,8 +117,8 @@
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:id="@+id/second_row_icon"
|
||||
@ -124,6 +129,7 @@
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/AnotherWidget.Subtitle" />
|
||||
</LinearLayout>
|
||||
@ -146,6 +152,7 @@
|
||||
android:layout_marginEnd="8dp"
|
||||
android:id="@+id/divider2"
|
||||
android:text="@string/divider"
|
||||
android:includeFontPadding="false"
|
||||
style="@style/AnotherWidget.Subtitle"/>
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
@ -159,6 +166,7 @@
|
||||
android:layout_marginStart="4dp"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:includeFontPadding="false"
|
||||
android:id="@+id/calendar_temp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -11,11 +11,18 @@
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:alpha="0"
|
||||
android:layout_centerInParent="true">
|
||||
<include layout="@layout/the_widget"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/intent_container" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/bottom_divider"
|
||||
android:orientation="vertical" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
@ -149,4 +149,6 @@
|
||||
<string name="donation_dinner">Una Cena Costosa</string>
|
||||
<string name="donation_breakfast">Una Colazione Inglese</string>
|
||||
<string name="donation_lunch">Una Pranzo Veloce</string>
|
||||
<string name="background_service_title">Another Widget è attivo</string>
|
||||
<string name="background_service_subtitle">AW è attivo in background</string>
|
||||
</resources>
|
@ -154,4 +154,6 @@
|
||||
<string name="donation_dinner">An Expensive Dinner</string>
|
||||
<string name="donation_breakfast">An English Breakfast</string>
|
||||
<string name="donation_lunch">A Quick Lunch</string>
|
||||
<string name="background_service_title">Another Widget is Running</string>
|
||||
<string name="background_service_subtitle">AW is running in the background</string>
|
||||
</resources>
|
||||
|
@ -3,10 +3,10 @@
|
||||
android:initialKeyguardLayout="@layout/the_widget"
|
||||
android:initialLayout="@layout/the_widget"
|
||||
android:minHeight="80dp"
|
||||
android:minWidth="380dp"
|
||||
android:minWidth="300dp"
|
||||
android:configure="com.tommasoberlose.anotherwidget.ui.activity.MainActivity"
|
||||
android:minResizeHeight="60dp"
|
||||
android:minResizeWidth="380dp"
|
||||
android:minResizeWidth="300dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="vertical"
|
||||
android:updatePeriodMillis="60000"
|
||||
|
@ -3,9 +3,9 @@
|
||||
android:initialKeyguardLayout="@layout/the_widget"
|
||||
android:initialLayout="@layout/the_widget"
|
||||
android:minHeight="80dp"
|
||||
android:minWidth="380dp"
|
||||
android:minWidth="300dp"
|
||||
android:minResizeHeight="60dp"
|
||||
android:minResizeWidth="380dp"
|
||||
android:minResizeWidth="300dp"
|
||||
android:previewImage="@drawable/widget_preview"
|
||||
android:resizeMode="vertical"
|
||||
android:updatePeriodMillis="60000"
|
||||
|
Loading…
x
Reference in New Issue
Block a user