This commit is contained in:
Tommaso Berlose 2020-05-21 13:30:15 +02:00
parent ec1c25cb4c
commit 770040ad93
15 changed files with 379 additions and 186 deletions

View File

@ -145,6 +145,11 @@
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<service
android:name=".services.UpdateCalendarJob"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"/>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,57 @@
package com.tommasoberlose.anotherwidget.components
import android.content.Context
import android.view.View
import android.widget.ImageView
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.WeatherHelper
import kotlinx.android.synthetic.main.bottom_sheet_menu.view.*
import kotlinx.android.synthetic.main.bottom_sheet_menu.view.header
import kotlinx.android.synthetic.main.fragment_weather_settings.*
import kotlinx.android.synthetic.main.icon_pack_menu_item.view.*
class IconPackSelector(context: Context, private val header: String? = null) : BottomSheetDialog(context, R.style.BottomSheetDialogTheme) {
override fun show() {
val view = View.inflate(context, R.layout.bottom_sheet_menu, null)
// Header
view.header.isVisible = header != null
view.header_text.text = header ?: ""
view.warning_text.isVisible = false
// Menu
for (item in Constants.WeatherIconPack.values()) {
val itemView = View.inflate(context, R.layout.icon_pack_menu_item, null)
itemView.label.text = context.getString(R.string.settings_weather_icon_pack_default).format(item.value + 1)
itemView.isSelected = item.value == Preferences.weatherIconPack
itemView.icon_1.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource("01d", item.value)))
itemView.icon_2.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource("01n", item.value)))
itemView.icon_3.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource("10d", item.value)))
itemView.icon_4.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource("09n", item.value)))
listOf<ImageView>(itemView.icon_1, itemView.icon_2, itemView.icon_3, itemView.icon_4).forEach {
if (item == Constants.WeatherIconPack.MINIMAL) {
it.setColorFilter(ContextCompat.getColor(context, R.color.colorPrimaryText))
} else {
it.setColorFilter(ContextCompat.getColor(context, android.R.color.transparent))
}
}
itemView.setOnClickListener {
Preferences.weatherIconPack = item.value
this.dismiss()
}
view.menu.addView(itemView)
}
setContentView(view)
super.show()
}
}

View File

@ -1,6 +1,7 @@
package com.tommasoberlose.anotherwidget.db package com.tommasoberlose.anotherwidget.db
import android.content.Context import android.content.Context
import android.provider.CalendarContract
import android.util.Log import android.util.Log
import com.chibatching.kotpref.bulk import com.chibatching.kotpref.bulk
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
@ -122,13 +123,18 @@ class EventRepository(val context: Context) {
MainWidget.updateWidget(context) MainWidget.updateWidget(context)
} }
fun getFutureEvents(): RealmResults<Event> { fun getFutureEvents(): List<Event> {
val now = Calendar.getInstance().timeInMillis val now = Calendar.getInstance().timeInMillis
realm.refresh() realm.refresh()
return realm.where(Event::class.java).greaterThan("endDate", now).findAll() return realm
.where(Event::class.java)
.greaterThan("endDate", now)
.findAll()
.filter { (Preferences.showDeclinedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED) }
.filter { (Preferences.calendarAllDay || !it.allDay) }
} }
private fun getEvents(): RealmResults<Event> { private fun getEvents(): List<Event> {
val now = Calendar.getInstance().timeInMillis val now = Calendar.getInstance().timeInMillis
val limit = Calendar.getInstance().apply { val limit = Calendar.getInstance().apply {
timeInMillis = now timeInMillis = now
@ -145,7 +151,13 @@ class EventRepository(val context: Context) {
} }
} }
realm.refresh() realm.refresh()
return realm.where(Event::class.java).greaterThan("endDate", now).lessThanOrEqualTo("startDate", limit.timeInMillis).findAll() return realm
.where(Event::class.java)
.greaterThan("endDate", now)
.lessThanOrEqualTo("startDate", limit.timeInMillis)
.findAll()
.filter { (Preferences.showDeclinedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED) }
.filter { (Preferences.calendarAllDay || !it.allDay) }
} }
fun getEventsCount(): Int = getEvents().size fun getEventsCount(): Int = getEvents().size

View File

@ -1,8 +1,14 @@
package com.tommasoberlose.anotherwidget.helpers package com.tommasoberlose.anotherwidget.helpers
import android.Manifest import android.Manifest
import android.app.job.JobInfo
import android.app.job.JobParameters
import android.app.job.JobScheduler
import android.app.job.JobService
import android.content.ComponentName
import android.content.ContentUris import android.content.ContentUris
import android.content.Context import android.content.Context
import android.content.Intent
import android.provider.CalendarContract import android.provider.CalendarContract
import android.util.Log import android.util.Log
import com.tommasoberlose.anotherwidget.services.EventListenerJob import com.tommasoberlose.anotherwidget.services.EventListenerJob
@ -10,6 +16,7 @@ import com.tommasoberlose.anotherwidget.db.EventRepository
import com.tommasoberlose.anotherwidget.models.Event import com.tommasoberlose.anotherwidget.models.Event
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver
import com.tommasoberlose.anotherwidget.services.UpdateCalendarJob
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
@ -25,104 +32,7 @@ import kotlin.collections.ArrayList
object CalendarHelper { object CalendarHelper {
fun updateEventList(context: Context) { fun updateEventList(context: Context) {
val eventRepository = EventRepository(context) UpdateCalendarJob.enqueueWork(context, Intent())
if (Preferences.showEvents) {
val eventList = ArrayList<Event>()
val now = Calendar.getInstance()
val begin = Calendar.getInstance().apply {
set(Calendar.MILLISECOND, 0)
set(Calendar.SECOND, 0)
set(Calendar.MINUTE, 0)
set(Calendar.HOUR_OF_DAY, 0)
}
val limit = Calendar.getInstance().apply {
timeInMillis = begin.timeInMillis
add(Calendar.DAY_OF_YEAR, 2)
}
if (!context.checkGrantedPermission(
Manifest.permission.READ_CALENDAR
)
) {
eventRepository.resetNextEventData()
} else {
try {
val provider = CalendarProvider(context)
val data = provider.getInstances(begin.timeInMillis, limit.timeInMillis)
if (data != null) {
val instances = data.list
for (instance in instances) {
try {
val e = provider.getEvent(instance.eventId)
if (e != null && !e.deleted && instance.begin <= limit.timeInMillis && now.timeInMillis < instance.end && (Preferences.calendarAllDay || !e.allDay) && !getFilteredCalendarIdList().contains(
e.calendarId
) && (Preferences.showDeclinedEvents || e.selfAttendeeStatus.toInt() != 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(
instance.id,
e.id,
e.title ?: "",
instance.begin,
instance.end,
e.calendarId.toInt(),
e.allDay,
e.eventLocation ?: ""
)
)
}
} catch (ignored: Exception) {
}
}
}
if (eventList.isEmpty()) {
eventRepository.resetNextEventData()
eventRepository.clearEvents()
} else {
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()
eventRepository.saveEvents(
eventList
)
eventRepository.saveNextEventData(
eventList[0]
)
}
} catch (ignored: java.lang.Exception) {
}
}
} else {
eventRepository.resetNextEventData()
}
UpdatesReceiver.setUpdates(context)
MainWidget.updateWidget(context)
EventBus.getDefault().post(MainFragment.UpdateUiMessageEvent())
eventRepository.close()
} }
fun getCalendarList(context: Context): List<me.everything.providers.android.calendar.Calendar> { fun getCalendarList(context: Context): List<me.everything.providers.android.calendar.Calendar> {
@ -144,7 +54,8 @@ object CalendarHelper {
} }
fun getFilteredCalendarIdList(): List<Long> { fun getFilteredCalendarIdList(): List<Long> {
return Preferences.calendarFilter.split(",").map { it.replace(" ", "") }.filter { it != "" }.map { it.toLong() } return Preferences.calendarFilter.split(",").map { it.replace(" ", "") }
.filter { it != "" }.map { it.toLong() }
} }
fun filterCalendar(list: List<Long>) { fun filterCalendar(list: List<Long>) {

View File

@ -11,9 +11,11 @@ import android.provider.AlarmClock
import android.provider.CalendarContract import android.provider.CalendarContract
import android.provider.CalendarContract.Events import android.provider.CalendarContract.Events
import android.util.Log import android.util.Log
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.models.Event import com.tommasoberlose.anotherwidget.models.Event
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.toast
import java.util.* import java.util.*
@ -64,12 +66,8 @@ object IntentHelper {
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
} }
} catch (e: Exception) { } catch (e: Exception) {
Intent(Intent.ACTION_VIEW).apply { context.toast(context.getString(R.string.error_opening_app))
addCategory(Intent.CATEGORY_DEFAULT) Intent()
flags = Intent.FLAG_ACTIVITY_NEW_TASK
data = Uri.parse("dynact://velour/weather/ProxyActivity")
component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
}
} }
} }
} }
@ -98,10 +96,8 @@ object IntentHelper {
data = calendarUri data = calendarUri
} }
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() context.toast(context.getString(R.string.error_opening_app))
Intent(Intent.ACTION_VIEW).apply { Intent()
data = calendarUri
}
} }
} }
} }
@ -132,23 +128,33 @@ object IntentHelper {
} }
} }
} else { } else {
getCalendarIntent(context).apply { val calendarIntent = getCalendarIntent(context)
action = Intent.ACTION_VIEW if (calendarIntent.action == Intent.ACTION_VIEW) {
data = uri calendarIntent.apply {
if (!e.allDay) { data = uri
putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, e.startDate) if (!e.allDay) {
putExtra(CalendarContract.EXTRA_EVENT_END_TIME, e.endDate) putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, e.startDate)
} else { putExtra(CalendarContract.EXTRA_EVENT_END_TIME, e.endDate)
val start = Calendar.getInstance().apply { } else {
timeInMillis = e.startDate val start = Calendar.getInstance().apply {
timeInMillis = e.startDate
}
val end = Calendar.getInstance().apply {
timeInMillis = e.endDate
}
putExtra(
CalendarContract.EXTRA_EVENT_BEGIN_TIME,
start.timeInMillis + start.timeZone.getOffset(start.timeInMillis)
)
putExtra(
CalendarContract.EXTRA_EVENT_END_TIME,
end.timeInMillis + end.timeZone.getOffset(end.timeInMillis)
)
putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, 1)
} }
val end = Calendar.getInstance().apply {
timeInMillis = e.endDate
}
putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, start.timeInMillis + start.timeZone.getOffset(start.timeInMillis))
putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end.timeInMillis + end.timeZone.getOffset(end.timeInMillis))
putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, 1)
} }
} else {
Intent()
} }
} }
} }
@ -175,9 +181,8 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER) addCategory(Intent.CATEGORY_LAUNCHER)
} }
} catch (e: Exception) { } catch (e: Exception) {
Intent(AlarmClock.ACTION_SHOW_ALARMS).apply { context.toast(context.getString(R.string.error_opening_app))
flags = Intent.FLAG_ACTIVITY_NEW_TASK Intent()
}
} }
} }
} }
@ -199,6 +204,7 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER) addCategory(Intent.CATEGORY_LAUNCHER)
} }
} catch (e: Exception) { } catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent() Intent()
} }
} }
@ -212,6 +218,7 @@ object IntentHelper {
addCategory(Intent.CATEGORY_LAUNCHER) addCategory(Intent.CATEGORY_LAUNCHER)
} }
} catch (e: Exception) { } catch (e: Exception) {
context.toast(context.getString(R.string.error_opening_app))
Intent() Intent()
} }
} }

View File

@ -46,10 +46,10 @@ object WeatherHelper {
MainWidget.updateWidget(context) MainWidget.updateWidget(context)
} }
fun getWeatherIconResource(icon: String): Int { fun getWeatherIconResource(icon: String, style: Int = Preferences.weatherIconPack): Int {
return when (icon) { return when (icon) {
"01d" -> { "01d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.clear_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.clear_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_day_4
@ -57,7 +57,7 @@ object WeatherHelper {
} }
} }
"02d" -> { "02d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_3 Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_4
@ -65,7 +65,7 @@ object WeatherHelper {
} }
} }
"03d" -> { "03d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_3 Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_4
@ -73,7 +73,7 @@ object WeatherHelper {
} }
} }
"04d" -> { "04d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3 Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4
@ -81,7 +81,7 @@ object WeatherHelper {
} }
} }
"09d" -> { "09d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_day_4
@ -89,7 +89,7 @@ object WeatherHelper {
} }
} }
"10d" -> { "10d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_day_4
@ -97,7 +97,7 @@ object WeatherHelper {
} }
} }
"11d" -> { "11d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_day_4
@ -105,7 +105,7 @@ object WeatherHelper {
} }
} }
"13d" -> { "13d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.snow_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.snow_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_day_4
@ -113,7 +113,7 @@ object WeatherHelper {
} }
} }
"50d" -> { "50d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.haze_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_day_4
@ -121,7 +121,7 @@ object WeatherHelper {
} }
} }
"80d" -> { "80d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.windy_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.windy_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_day_4
@ -129,7 +129,7 @@ object WeatherHelper {
} }
} }
"81d" -> { "81d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_day_3 Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_day_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_day_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_day_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_day_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_day_4
@ -137,7 +137,7 @@ object WeatherHelper {
} }
} }
"82d" -> { "82d" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3 Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4
@ -148,7 +148,7 @@ object WeatherHelper {
"01n" -> { "01n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.clear_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.clear_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_night_4
@ -156,7 +156,7 @@ object WeatherHelper {
} }
} }
"02n" -> { "02n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_night_4
@ -164,7 +164,7 @@ object WeatherHelper {
} }
} }
"03n" -> { "03n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_night_4
@ -172,7 +172,7 @@ object WeatherHelper {
} }
} }
"04n" -> { "04n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3 Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4
@ -180,7 +180,7 @@ object WeatherHelper {
} }
} }
"09n" -> { "09n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_night_4
@ -188,7 +188,7 @@ object WeatherHelper {
} }
} }
"10n" -> { "10n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_night_4
@ -196,7 +196,7 @@ object WeatherHelper {
} }
} }
"11n" -> { "11n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_night_4
@ -204,7 +204,7 @@ object WeatherHelper {
} }
} }
"13n" -> { "13n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.snow_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.snow_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_night_4
@ -212,7 +212,7 @@ object WeatherHelper {
} }
} }
"50n" -> { "50n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.haze_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_night_4
@ -220,7 +220,7 @@ object WeatherHelper {
} }
} }
"80n" -> { "80n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.windy_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.windy_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_night_4
@ -228,7 +228,7 @@ object WeatherHelper {
} }
} }
"81n" -> { "81n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_night_3 Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_night_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_night_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_night_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_night_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_night_4
@ -236,7 +236,7 @@ object WeatherHelper {
} }
} }
"82n" -> { "82n" -> {
when (Preferences.weatherIconPack) { when (style) {
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3 Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2 Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4 Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4

View File

@ -1,5 +1,6 @@
package com.tommasoberlose.anotherwidget.models package com.tommasoberlose.anotherwidget.models
import android.provider.CalendarContract
import io.realm.RealmObject import io.realm.RealmObject
import java.util.Date import java.util.Date
@ -7,14 +8,17 @@ import java.util.Date
* Created by tommaso on 05/10/17. * Created by tommaso on 05/10/17.
*/ */
open class Event(var id: Long = 0, open class Event(
var eventID: Long = 0, var id: Long = 0,
var title: String = "", var eventID: Long = 0,
var startDate: Long = 0, var title: String = "",
var endDate: Long = 0, var startDate: Long = 0,
var calendarID: Int = 0, var endDate: Long = 0,
var allDay: Boolean = false, var calendarID: Int = 0,
var address: String = "") : RealmObject() { var allDay: Boolean = false,
var address: String = "",
var selfAttendeeStatus: Int = CalendarContract.Attendees.ATTENDEE_STATUS_NONE
) : RealmObject() {
override fun toString(): String { override fun toString(): String {
return "Event:\nEVENT ID: " + eventID + "\nTITLE: " + title + "\nSTART DATE: " + Date(startDate) + "\nEND DATE: " + Date(endDate) + "\nCAL ID: " + calendarID + "\nADDRESS: " + address return "Event:\nEVENT ID: " + eventID + "\nTITLE: " + title + "\nSTART DATE: " + Date(startDate) + "\nEND DATE: " + Date(endDate) + "\nCAL ID: " + calendarID + "\nADDRESS: " + address
} }

View File

@ -0,0 +1,134 @@
package com.tommasoberlose.anotherwidget.services
import android.Manifest
import android.content.Context
import android.content.Intent
import android.util.Log
import androidx.core.app.JobIntentService
import com.tommasoberlose.anotherwidget.db.EventRepository
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.CalendarHelper
import com.tommasoberlose.anotherwidget.models.Event
import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import me.everything.providers.android.calendar.CalendarProvider
import org.greenrobot.eventbus.EventBus
import java.util.*
import kotlin.Comparator
import kotlin.collections.ArrayList
class UpdateCalendarJob : JobIntentService() {
companion object {
val jobId = 1200
fun enqueueWork(context: Context, work: Intent) {
enqueueWork(context, UpdateCalendarJob::class.java, jobId, work)
}
}
override fun onHandleWork(intent: Intent) {
val eventRepository = EventRepository(this)
if (Preferences.showEvents) {
val eventList = ArrayList<Event>()
val now = Calendar.getInstance()
val begin = Calendar.getInstance().apply {
set(Calendar.MILLISECOND, 0)
set(Calendar.SECOND, 0)
set(Calendar.MINUTE, 0)
set(Calendar.HOUR_OF_DAY, 0)
}
val limit = Calendar.getInstance().apply {
timeInMillis = begin.timeInMillis
add(Calendar.DAY_OF_YEAR, 2)
}
if (!checkGrantedPermission(
Manifest.permission.READ_CALENDAR
)
) {
eventRepository.resetNextEventData()
} else {
try {
val provider = CalendarProvider(this)
val data = provider.getInstances(begin.timeInMillis, limit.timeInMillis)
if (data != null) {
val instances = data.list
for (instance in instances) {
try {
val e = provider.getEvent(instance.eventId)
if (e != null && !e.deleted && instance.begin <= limit.timeInMillis && now.timeInMillis < instance.end && !CalendarHelper.getFilteredCalendarIdList()
.contains(e.calendarId)
) {
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(
id = instance.id,
eventID = e.id,
title = e.title ?: "",
startDate = instance.begin,
endDate = instance.end,
calendarID = e.calendarId.toInt(),
allDay = e.allDay,
address = e.eventLocation ?: "",
selfAttendeeStatus = e.selfAttendeeStatus.toInt()
)
)
}
} catch (ignored: Exception) {
}
}
}
if (eventList.isEmpty()) {
eventRepository.resetNextEventData()
eventRepository.clearEvents()
} else {
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()
eventRepository.saveEvents(
eventList
)
eventRepository.saveNextEventData(
eventList[0]
)
}
} catch (ignored: java.lang.Exception) {
}
}
} else {
eventRepository.resetNextEventData()
}
UpdatesReceiver.setUpdates(this)
MainWidget.updateWidget(this)
EventBus.getDefault().post(MainFragment.UpdateUiMessageEvent())
eventRepository.close()
Log.d("ciao", "aggiornati")
}
}

View File

@ -109,14 +109,12 @@ class CalendarTabFragment : Fragment() {
all_day_label?.text = all_day_label?.text =
if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible) if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
} }
updateCalendar()
}) })
viewModel.showDeclinedEvents.observe(viewLifecycleOwner, Observer { viewModel.showDeclinedEvents.observe(viewLifecycleOwner, Observer {
maintainScrollPosition { maintainScrollPosition {
show_declined_events_label?.text = if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible) show_declined_events_label?.text = if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
} }
updateCalendar()
}) })
viewModel.secondRowInformation.observe(viewLifecycleOwner, Observer { viewModel.secondRowInformation.observe(viewLifecycleOwner, Observer {

View File

@ -8,6 +8,7 @@ import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
import android.text.format.DateFormat
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -49,6 +50,7 @@ class ClockTabFragment : Fragment() {
private lateinit var viewModel: MainViewModel private lateinit var viewModel: MainViewModel
private lateinit var colors: IntArray private lateinit var colors: IntArray
private lateinit var binding: FragmentClockSettingsBinding
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -60,7 +62,7 @@ class ClockTabFragment : Fragment() {
): View { ): View {
viewModel = ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java) viewModel = ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java)
val binding = DataBindingUtil.inflate<FragmentClockSettingsBinding>(inflater, R.layout.fragment_clock_settings, container, false) binding = DataBindingUtil.inflate<FragmentClockSettingsBinding>(inflater, R.layout.fragment_clock_settings, container, false)
subscribeUi(binding, viewModel) subscribeUi(binding, viewModel)
@ -89,6 +91,7 @@ class ClockTabFragment : Fragment() {
viewModel: MainViewModel viewModel: MainViewModel
) { ) {
binding.isClockVisible = Preferences.showClock binding.isClockVisible = Preferences.showClock
binding.is24Format = DateFormat.is24HourFormat(requireContext())
viewModel.showBigClockWarning.observe(viewLifecycleOwner, Observer { viewModel.showBigClockWarning.observe(viewLifecycleOwner, Observer {
large_clock_warning?.isVisible = it large_clock_warning?.isVisible = it
@ -266,6 +269,11 @@ class ClockTabFragment : Fragment() {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
} }
override fun onResume() {
binding.is24Format = DateFormat.is24HourFormat(requireContext())
super.onResume()
}
private fun maintainScrollPosition(callback: () -> Unit) { private fun maintainScrollPosition(callback: () -> Unit) {
scrollView.isScrollable = false scrollView.isScrollable = false
callback.invoke() callback.invoke()

View File

@ -25,6 +25,7 @@ import com.karumi.dexter.listener.PermissionRequest
import com.karumi.dexter.listener.multi.MultiplePermissionsListener import com.karumi.dexter.listener.multi.MultiplePermissionsListener
import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.components.BottomSheetMenu import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
import com.tommasoberlose.anotherwidget.components.IconPackSelector
import com.tommasoberlose.anotherwidget.databinding.FragmentWeatherSettingsBinding import com.tommasoberlose.anotherwidget.databinding.FragmentWeatherSettingsBinding
import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
@ -133,12 +134,12 @@ class WeatherTabFragment : Fragment() {
viewModel.weatherIconPack.observe(viewLifecycleOwner, Observer { viewModel.weatherIconPack.observe(viewLifecycleOwner, Observer {
maintainScrollPosition { maintainScrollPosition {
label_weather_icon_pack?.text = getString(R.string.settings_weather_icon_pack_default).format((it + 1)) label_weather_icon_pack?.text = getString(R.string.settings_weather_icon_pack_default).format((it + 1))
weather_icon_pack.setImageDrawable(ContextCompat.getDrawable(requireContext(), WeatherHelper.getWeatherIconResource("02d"))) // weather_icon_pack.setImageDrawable(ContextCompat.getDrawable(requireContext(), WeatherHelper.getWeatherIconResource("02d")))
if (it == Constants.WeatherIconPack.MINIMAL.value) { // if (it == Constants.WeatherIconPack.MINIMAL.value) {
weather_icon_pack.setColorFilter(ContextCompat.getColor(requireContext(), R.color.colorPrimaryText)) // weather_icon_pack.setColorFilter(ContextCompat.getColor(requireContext(), R.color.colorPrimaryText))
} else { // } else {
weather_icon_pack.setColorFilter(ContextCompat.getColor(requireContext(), android.R.color.transparent)) // weather_icon_pack.setColorFilter(ContextCompat.getColor(requireContext(), android.R.color.transparent))
} // }
} }
checkLocationPermission() checkLocationPermission()
}) })
@ -236,13 +237,7 @@ class WeatherTabFragment : Fragment() {
action_weather_icon_pack.setOnClickListener { action_weather_icon_pack.setOnClickListener {
if (Preferences.showWeather) { if (Preferences.showWeather) {
val dialog = BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_weather_icon_pack_title)).setSelectedValue(Preferences.weatherIconPack) IconPackSelector(requireContext(), header = getString(R.string.settings_weather_icon_pack_title)).show()
Constants.WeatherIconPack.values().forEach {
dialog.addItem(getString(R.string.settings_weather_icon_pack_default).format(it.value + 1), it.value)
}
dialog.addOnSelectItemListener { value ->
Preferences.weatherIconPack = value
}.show()
} }
} }

View File

@ -42,8 +42,7 @@
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:padding="12dp" android:padding="12dp"
android:src="@drawable/round_today" android:src="@drawable/calendar"/>
android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"

View File

@ -7,6 +7,10 @@
<variable <variable
name="isClockVisible" name="isClockVisible"
type="Boolean" /> type="Boolean" />
<variable
name="is24Format"
type="Boolean" />
<import type="android.view.View" />
</data> </data>
<com.tommasoberlose.anotherwidget.components.FixedFocusScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
@ -77,7 +81,7 @@
<ImageView <ImageView
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:padding="12dp" android:padding="10dp"
android:src="@drawable/alarm"/> android:src="@drawable/alarm"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
@ -218,6 +222,7 @@
android:paddingRight="8dp" android:paddingRight="8dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:visibility="@{is24Format ? View.GONE : View.VISIBLE, default=visible}"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical" android:gravity="center_vertical"
android:id="@+id/action_ampm_indicator_size" android:id="@+id/action_ampm_indicator_size"

View File

@ -76,10 +76,9 @@
<ImageView <ImageView
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:padding="12dp" android:padding="10dp"
android:id="@+id/weather_icon_pack" android:id="@+id/weather_icon_pack"
android:src="@drawable/round_brightness_5" android:src="@drawable/clear_day_3"/>
android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_marginBottom="16dp"
app:cardElevation="0dp"
app:cardBackgroundColor="@drawable/menu_background"
app:cardCornerRadius="8dp"
android:clickable="true"
android:focusable="true"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:duplicateParentState="true"
android:id="@+id/label"
android:textSize="16sp"
android:textStyle="bold"
android:text="Icon Pack 1"
android:textColor="@drawable/menu_text_color"
android:textAppearance="@style/AnotherWidget.Settings.Subtitle"
app:textAllCaps="false" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="4dp"
android:layout_marginEnd="8dp"
android:id="@+id/icon_1" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="4dp"
android:layout_marginEnd="8dp"
android:id="@+id/icon_2" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="4dp"
android:layout_marginEnd="8dp"
android:id="@+id/icon_3" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="4dp"
android:layout_marginEnd="8dp"
android:id="@+id/icon_4" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>