Compare commits

...

18 Commits

Author SHA1 Message Date
94825808f4 Update the UI 2020-05-22 18:51:42 +02:00
0d2287dbdf Fix #144 2020-05-22 18:30:38 +02:00
9e40586456 Merge branch 'master' of github.com:tommasoberlose/another-widget 2020-05-22 18:20:29 +02:00
4d75f4ca0c Fix #150 2020-05-22 18:20:08 +02:00
0859632803 Merge pull request #147 from Drumber/master
Added German translation (values-de)
2020-05-22 17:14:24 +02:00
47562b35ca Merge pull request #146 from zmni/translation
Update Indonesian translation
2020-05-22 17:14:19 +02:00
0f4f02ea28 Merge pull request #138 from Moutony/patch-10
Update strings.xml (values-fr) - May 20 version
2020-05-22 17:14:12 +02:00
31cf950eee Update ui 2020-05-22 17:13:06 +02:00
f230d300ee fixed minor spelling mistakes 2020-05-21 18:10:55 +02:00
c610857056 Added German translation (values-de) 2020-05-21 17:26:01 +02:00
770040ad93 Fix #136, fix #142 2020-05-21 13:30:15 +02:00
f784817296 Update Indonesian translation 2020-05-21 05:03:57 +07:00
ec1c25cb4c Bugfixes 2020-05-20 20:53:22 +02:00
e1d2f5a782 Update the UI 2020-05-20 20:46:21 +02:00
6e8c6cf055 Update strings.xml 2020-05-20 20:04:11 +02:00
68b5997e8d Update strings.xml 2020-05-20 19:47:53 +02:00
56b21be946 Update stings.xml (values-fr) - Glance
I translated the Glance explanations (line 145).
I shortened the "title-show-glance" (line 133) because it was oddly long (see screenshot)
2020-05-20 18:37:58 +02:00
fdc02b2cef Update strings.xml
I translated the Glance explanations.
2020-05-20 18:06:40 +02:00
84 changed files with 1062 additions and 379 deletions

Binary file not shown.

View File

@ -18,8 +18,8 @@ android {
applicationId "com.tommasoberlose.anotherwidget" applicationId "com.tommasoberlose.anotherwidget"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 29 targetSdkVersion 29
versionCode 100 versionCode 101
versionName "2.0.11" versionName "2.0.12"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

Binary file not shown.

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,24 @@
package com.tommasoberlose.anotherwidget.components
import android.content.Context
import android.graphics.Rect
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.widget.ScrollView
class FixedFocusScrollView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
) : ScrollView(context, attrs, defStyle) {
var isScrollable = true
override fun scrollTo(x: Int, y: Int) {
if (isScrollable) {
super.scrollTo(x, y)
}
}
}

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

@ -0,0 +1,21 @@
package com.tommasoberlose.anotherwidget.components
import android.view.View
import android.widget.CompoundButton
class MenuItem (
val icon: Int,
val getIcon: (() -> Int)? = null,
val title: String,
val label: String = "",
val getLabel: (() -> String)? = null,
val isEnabled: (() -> Boolean) = fun (): Boolean { return true },
val onClick: View.OnClickListener? = null,
val onLongClick: View.OnLongClickListener? = null,
val showToggle: Boolean = false,
val toggleValue: (() -> Boolean) = fun (): Boolean { return false },
val onToggle: CompoundButton.OnCheckedChangeListener? = null,
val showPermission: (() -> Boolean) = fun (): Boolean { return false },
val onPermissionClickListener: View.OnClickListener? = null,
val render: ((view: View) -> Unit)? = null
)

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
@ -24,106 +31,8 @@ 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> {
@ -145,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

@ -1,6 +1,7 @@
package com.tommasoberlose.anotherwidget.helpers package com.tommasoberlose.anotherwidget.helpers
import android.content.Context import android.content.Context
import android.util.Log
import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.db.EventRepository import com.tommasoberlose.anotherwidget.db.EventRepository
import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Constants
@ -80,13 +81,14 @@ object GlanceProviderHelper {
fun showGlanceProviders(context: Context): Boolean { fun showGlanceProviders(context: Context): Boolean {
val eventRepository = EventRepository(context) val eventRepository = EventRepository(context)
BatteryHelper.updateBatteryInfo(context) BatteryHelper.updateBatteryInfo(context)
val showGlance = Preferences.showGlance && eventRepository.getEventsCount() == 0 && (
val showGlance = Preferences.showGlance && (eventRepository.getEventsCount() == 0 || !Preferences.showEvents) && (
(Preferences.showNextAlarm && AlarmHelper.getNextAlarm(context) != "") || (Preferences.showNextAlarm && AlarmHelper.getNextAlarm(context) != "") ||
(MediaPlayerHelper.isSomeonePlaying(context)) || (MediaPlayerHelper.isSomeonePlaying(context)) ||
(Preferences.showBatteryCharging && Preferences.isCharging || Preferences.isBatteryLevelLow) || (Preferences.showBatteryCharging && Preferences.isCharging || Preferences.isBatteryLevelLow) ||
(Preferences.customNotes.isNotEmpty()) || (Preferences.customNotes.isNotEmpty()) ||
(Preferences.showDailySteps && Preferences.googleFitSteps > 0) (Preferences.showDailySteps && Preferences.googleFitSteps > 0)
) )
eventRepository.close() eventRepository.close()
return showGlance return showGlance
} }

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,132 @@
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()
}
}

View File

@ -32,9 +32,11 @@ import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.helpers.CalendarHelper import com.tommasoberlose.anotherwidget.helpers.CalendarHelper
import com.tommasoberlose.anotherwidget.helpers.DateHelper import com.tommasoberlose.anotherwidget.helpers.DateHelper
import com.tommasoberlose.anotherwidget.helpers.IntentHelper
import com.tommasoberlose.anotherwidget.helpers.SettingsStringHelper import com.tommasoberlose.anotherwidget.helpers.SettingsStringHelper
import com.tommasoberlose.anotherwidget.ui.activities.CustomDateActivity import com.tommasoberlose.anotherwidget.ui.activities.CustomDateActivity
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.isDefaultSet
import com.tommasoberlose.anotherwidget.utils.toast import com.tommasoberlose.anotherwidget.utils.toast
import kotlinx.android.synthetic.main.fragment_calendar_settings.* import kotlinx.android.synthetic.main.fragment_calendar_settings.*
import kotlinx.android.synthetic.main.fragment_calendar_settings.scrollView import kotlinx.android.synthetic.main.fragment_calendar_settings.scrollView
@ -74,6 +76,11 @@ class CalendarTabFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
show_all_day_toggle.isChecked = Preferences.calendarAllDay
show_declined_events_toggle.isChecked = Preferences.showDeclinedEvents
show_diff_time_toggle.isChecked = Preferences.showDiffTime
show_multiple_events_toggle.isChecked = Preferences.showNextEvent
setupListener() setupListener()
} }
@ -82,6 +89,7 @@ class CalendarTabFragment : Fragment() {
viewModel: MainViewModel viewModel: MainViewModel
) { ) {
binding.isCalendarEnabled = Preferences.showEvents binding.isCalendarEnabled = Preferences.showEvents
binding.isDiffEnabled = Preferences.showDiffTime || !Preferences.showEvents
viewModel.showEvents.observe(viewLifecycleOwner, Observer { viewModel.showEvents.observe(viewLifecycleOwner, Observer {
maintainScrollPosition { maintainScrollPosition {
@ -92,8 +100,10 @@ class CalendarTabFragment : Fragment() {
} else { } else {
CalendarHelper.removeEventUpdatesAndroidN(requireContext()) CalendarHelper.removeEventUpdatesAndroidN(requireContext())
} }
binding.isDiffEnabled = Preferences.showDiffTime || !it
} }
checkReadEventsPermission() checkReadEventsPermission()
updateCalendar()
}) })
viewModel.calendarAllDay.observe(viewLifecycleOwner, Observer { viewModel.calendarAllDay.observe(viewLifecycleOwner, Observer {
@ -101,14 +111,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)
} }
checkReadEventsPermission()
}) })
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)
} }
checkReadEventsPermission()
}) })
viewModel.secondRowInformation.observe(viewLifecycleOwner, Observer { viewModel.secondRowInformation.observe(viewLifecycleOwner, Observer {
@ -120,6 +128,7 @@ class CalendarTabFragment : Fragment() {
viewModel.showDiffTime.observe(viewLifecycleOwner, Observer { viewModel.showDiffTime.observe(viewLifecycleOwner, Observer {
maintainScrollPosition { maintainScrollPosition {
show_diff_time_label?.text = if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible) show_diff_time_label?.text = if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
binding.isDiffEnabled = it || !Preferences.showEvents
} }
}) })
@ -138,7 +147,7 @@ class CalendarTabFragment : Fragment() {
maintainScrollPosition { maintainScrollPosition {
show_until_label?.text = getString(SettingsStringHelper.getShowUntilString(it)) show_until_label?.text = getString(SettingsStringHelper.getShowUntilString(it))
} }
checkReadEventsPermission() updateCalendar()
}) })
viewModel.showNextEvent.observe(viewLifecycleOwner, Observer { viewModel.showNextEvent.observe(viewLifecycleOwner, Observer {
@ -150,7 +159,18 @@ class CalendarTabFragment : Fragment() {
viewModel.calendarAppName.observe(viewLifecycleOwner, Observer { viewModel.calendarAppName.observe(viewLifecycleOwner, Observer {
maintainScrollPosition { maintainScrollPosition {
calendar_app_label?.text = if (it != "") it else getString(R.string.default_calendar_app) calendar_app_label?.text = when {
Preferences.clockAppName != "" -> Preferences.clockAppName
else -> {
if (IntentHelper.getCalendarIntent(requireContext()).isDefaultSet(requireContext())) {
getString(
R.string.default_calendar_app
)
} else {
getString(R.string.nothing)
}
}
}
} }
}) })
@ -222,7 +242,7 @@ class CalendarTabFragment : Fragment() {
dialog.addOnMultipleSelectItemListener { values -> dialog.addOnMultipleSelectItemListener { values ->
CalendarHelper.filterCalendar(calendarSelectorList.map { it.id }.filter { !values.contains(it) }) CalendarHelper.filterCalendar(calendarSelectorList.map { it.id }.filter { !values.contains(it) })
checkReadEventsPermission() updateCalendar()
}.show() }.show()
} else { } else {
activity?.toast(getString(R.string.calendar_settings_list_error)) activity?.toast(getString(R.string.calendar_settings_list_error))
@ -231,50 +251,54 @@ class CalendarTabFragment : Fragment() {
action_show_all_day.setOnClickListener { action_show_all_day.setOnClickListener {
if (Preferences.showEvents) { if (Preferences.showEvents) {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_all_day_title)).setSelectedValue(Preferences.calendarAllDay) show_all_day_toggle.isChecked = !show_all_day_toggle.isChecked
.addItem(getString(R.string.settings_visible), true) }
.addItem(getString(R.string.settings_not_visible), false) }
.addOnSelectItemListener { value ->
Preferences.calendarAllDay = value show_all_day_toggle.setOnCheckedChangeListener { _, isChecked ->
}.show() if (Preferences.showEvents) {
Preferences.calendarAllDay = isChecked
} }
} }
action_show_declined_events.setOnClickListener { action_show_declined_events.setOnClickListener {
if (Preferences.showEvents) { if (Preferences.showEvents) {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_show_declined_events_title)).setSelectedValue(Preferences.showDeclinedEvents) show_declined_events_toggle.isChecked = !show_declined_events_toggle.isChecked
.addItem(getString(R.string.settings_visible), true) }
.addItem(getString(R.string.settings_not_visible), false) }
.addOnSelectItemListener { value ->
Preferences.showDeclinedEvents = value show_declined_events_toggle.setOnCheckedChangeListener { _, isChecked ->
}.show() if (Preferences.showEvents) {
Preferences.showDeclinedEvents = isChecked
} }
} }
action_show_multiple_events.setOnClickListener { action_show_multiple_events.setOnClickListener {
if (Preferences.showEvents) { if (Preferences.showEvents) {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_show_multiple_events_title)).setSelectedValue(Preferences.showNextEvent) show_multiple_events_toggle.isChecked = !show_multiple_events_toggle.isChecked
.addItem(getString(R.string.settings_visible), true) }
.addItem(getString(R.string.settings_not_visible), false) }
.addOnSelectItemListener { value ->
Preferences.showNextEvent = value show_multiple_events_toggle.setOnCheckedChangeListener { _, isChecked ->
}.show() if (Preferences.showEvents) {
Preferences.showNextEvent = isChecked
} }
} }
action_show_diff_time.setOnClickListener { action_show_diff_time.setOnClickListener {
if (Preferences.showEvents) { if (Preferences.showEvents) {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_show_diff_time_title)).setSelectedValue(Preferences.showDiffTime) show_diff_time_toggle.isChecked = !show_diff_time_toggle.isChecked
.addItem(getString(R.string.settings_visible), true) }
.addItem(getString(R.string.settings_not_visible), false) }
.addOnSelectItemListener { value ->
Preferences.showDiffTime = value show_diff_time_toggle.setOnCheckedChangeListener { _, isChecked ->
}.show() if (Preferences.showEvents) {
Preferences.showDiffTime = isChecked
} }
} }
action_widget_update_frequency.setOnClickListener { action_widget_update_frequency.setOnClickListener {
if (Preferences.showEvents) { if (Preferences.showEvents && Preferences.showDiffTime) {
BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_widget_update_frequency_title), message = getString(R.string.settings_widget_update_frequency_subtitle)).setSelectedValue(Preferences.widgetUpdateFrequency) BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_widget_update_frequency_title), message = getString(R.string.settings_widget_update_frequency_subtitle)).setSelectedValue(Preferences.widgetUpdateFrequency)
.addItem(getString(R.string.settings_widget_update_frequency_high), Constants.WidgetUpdateFrequency.HIGH.value) .addItem(getString(R.string.settings_widget_update_frequency_high), Constants.WidgetUpdateFrequency.HIGH.value)
.addItem(getString(R.string.settings_widget_update_frequency_default), Constants.WidgetUpdateFrequency.DEFAULT.value) .addItem(getString(R.string.settings_widget_update_frequency_default), Constants.WidgetUpdateFrequency.DEFAULT.value)
@ -329,7 +353,6 @@ class CalendarTabFragment : Fragment() {
if (activity?.checkGrantedPermission(Manifest.permission.READ_CALENDAR) == true) { if (activity?.checkGrantedPermission(Manifest.permission.READ_CALENDAR) == true) {
show_events_label?.text = if (showEvents) getString(R.string.show_events_visible) else getString(R.string.show_events_not_visible) show_events_label?.text = if (showEvents) getString(R.string.show_events_visible) else getString(R.string.show_events_not_visible)
read_calendar_permission_alert?.isVisible = false read_calendar_permission_alert?.isVisible = false
CalendarHelper.updateEventList(requireContext())
} else { } else {
show_events_label?.text = if (showEvents) getString(R.string.description_permission_calendar) else getString(R.string.show_events_not_visible) show_events_label?.text = if (showEvents) getString(R.string.description_permission_calendar) else getString(R.string.show_events_not_visible)
read_calendar_permission_alert?.isVisible = showEvents read_calendar_permission_alert?.isVisible = showEvents
@ -339,6 +362,12 @@ class CalendarTabFragment : Fragment() {
} }
} }
private fun updateCalendar() {
if (activity?.checkGrantedPermission(Manifest.permission.READ_CALENDAR) == true) {
CalendarHelper.updateEventList(requireContext())
}
}
private fun requirePermission() { private fun requirePermission() {
Dexter.withContext(requireContext()) Dexter.withContext(requireContext())
.withPermissions( .withPermissions(
@ -386,11 +415,11 @@ class CalendarTabFragment : Fragment() {
} }
private fun maintainScrollPosition(callback: () -> Unit) { private fun maintainScrollPosition(callback: () -> Unit) {
val scrollPosition = scrollView.scrollY scrollView.isScrollable = false
callback.invoke() callback.invoke()
lifecycleScope.launch { lifecycleScope.launch {
delay(200) delay(200)
scrollView.smoothScrollTo(0, scrollPosition) scrollView.isScrollable = true
} }
} }
} }

View File

@ -8,6 +8,8 @@ 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.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -21,6 +23,7 @@ import com.chibatching.kotpref.bulk
import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.components.BottomSheetColorPicker import com.tommasoberlose.anotherwidget.components.BottomSheetColorPicker
import com.tommasoberlose.anotherwidget.components.BottomSheetMenu import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
import com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
import com.tommasoberlose.anotherwidget.databinding.FragmentClockSettingsBinding import com.tommasoberlose.anotherwidget.databinding.FragmentClockSettingsBinding
import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Constants
import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.global.Preferences
@ -29,9 +32,11 @@ import com.tommasoberlose.anotherwidget.helpers.AlarmHelper
import com.tommasoberlose.anotherwidget.helpers.ColorHelper import com.tommasoberlose.anotherwidget.helpers.ColorHelper
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toHexValue import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toHexValue
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue
import com.tommasoberlose.anotherwidget.helpers.IntentHelper
import com.tommasoberlose.anotherwidget.ui.activities.ChooseApplicationActivity import com.tommasoberlose.anotherwidget.ui.activities.ChooseApplicationActivity
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.utils.isDefaultSet
import kotlinx.android.synthetic.main.fragment_clock_settings.* import kotlinx.android.synthetic.main.fragment_clock_settings.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
@ -48,6 +53,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)
@ -59,7 +65,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)
@ -72,6 +78,8 @@ class ClockTabFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
ampm_indicator_toggle.isChecked = Preferences.showAMPMIndicator
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
val lazyColors = requireContext().resources.getIntArray(R.array.material_colors) val lazyColors = requireContext().resources.getIntArray(R.array.material_colors)
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
@ -86,6 +94,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
@ -147,8 +156,18 @@ class ClockTabFragment : Fragment() {
viewModel.clockAppName.observe(viewLifecycleOwner, Observer { viewModel.clockAppName.observe(viewLifecycleOwner, Observer {
maintainScrollPosition { maintainScrollPosition {
clock_app_label?.text = clock_app_label?.text = when {
if (Preferences.clockAppName != "") Preferences.clockAppName else getString(R.string.default_clock_app) Preferences.clockAppName != "" -> Preferences.clockAppName
else -> {
if (IntentHelper.getClockIntent(requireContext()).isDefaultSet(requireContext())) {
getString(
R.string.default_clock_app
)
} else {
getString(R.string.nothing)
}
}
}
} }
}) })
} }
@ -167,57 +186,88 @@ class ClockTabFragment : Fragment() {
} }
action_clock_text_size.setOnClickListener { action_clock_text_size.setOnClickListener {
val dialog = BottomSheetMenu<Float>(requireContext(), header = getString(R.string.settings_clock_text_size_title)).setSelectedValue(Preferences.clockTextSize) if (Preferences.showClock) {
(46 downTo 12).filter { it % 2 == 0 }.forEach { val dialog = BottomSheetMenu<Float>(
dialog.addItem("${it}sp", it.toFloat()) requireContext(),
header = getString(R.string.settings_clock_text_size_title)
).setSelectedValue(Preferences.clockTextSize)
(46 downTo 12).filter { it % 2 == 0 }.forEach {
dialog.addItem("${it}sp", it.toFloat())
}
dialog.addOnSelectItemListener { value ->
Preferences.clockTextSize = value
}.show()
} }
dialog.addOnSelectItemListener { value ->
Preferences.clockTextSize = value
}.show()
} }
action_ampm_indicator_size.setOnClickListener { action_ampm_indicator_size.setOnClickListener {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_ampm_indicator_title)).setSelectedValue(Preferences.showAMPMIndicator) if (Preferences.showClock) {
.addItem(getString(R.string.settings_visible), true) ampm_indicator_toggle.isChecked = !ampm_indicator_toggle.isChecked
.addItem(getString(R.string.settings_not_visible), false) }
.addOnSelectItemListener { value -> }
Preferences.showAMPMIndicator = value
}.show() ampm_indicator_toggle.setOnCheckedChangeListener { _, isChecked ->
if (Preferences.showClock) {
Preferences.showAMPMIndicator = isChecked
}
} }
action_clock_text_color.setOnClickListener { action_clock_text_color.setOnClickListener {
BottomSheetColorPicker(requireContext(), if (Preferences.showClock) {
colors = colors, BottomSheetColorPicker(requireContext(),
header = getString(R.string.settings_font_color_title), colors = colors,
getSelected = ColorHelper::getClockFontColorRgb, header = getString(R.string.settings_font_color_title),
onColorSelected = { color: Int -> getSelected = ColorHelper::getClockFontColorRgb,
val colorString = Integer.toHexString(color) onColorSelected = { color: Int ->
Preferences.clockTextColor = "#" + if (colorString.length > 6) colorString.substring(2) else colorString val colorString = Integer.toHexString(color)
}, Preferences.clockTextColor =
showAlphaSelector = true, "#" + if (colorString.length > 6) colorString.substring(2) else colorString
alpha = Preferences.clockTextAlpha.toIntValue(), },
onAlphaChangeListener = { alpha -> showAlphaSelector = true,
Preferences.clockTextAlpha = alpha.toHexValue() alpha = Preferences.clockTextAlpha.toIntValue(),
} onAlphaChangeListener = { alpha ->
).show() Preferences.clockTextAlpha = alpha.toHexValue()
}
).show()
}
} }
action_clock_bottom_margin_size.setOnClickListener { action_clock_bottom_margin_size.setOnClickListener {
BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_clock_bottom_margin_title)).setSelectedValue(Preferences.clockBottomMargin) if (Preferences.showClock) {
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_none), Constants.ClockBottomMargin.NONE.value) BottomSheetMenu<Int>(
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_small), Constants.ClockBottomMargin.SMALL.value) requireContext(),
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_medium), Constants.ClockBottomMargin.MEDIUM.value) header = getString(R.string.settings_clock_bottom_margin_title)
.addItem(getString(R.string.settings_clock_bottom_margin_subtitle_large), Constants.ClockBottomMargin.LARGE.value) ).setSelectedValue(Preferences.clockBottomMargin)
.addOnSelectItemListener { value -> .addItem(
Preferences.clockBottomMargin = value getString(R.string.settings_clock_bottom_margin_subtitle_none),
}.show() Constants.ClockBottomMargin.NONE.value
)
.addItem(
getString(R.string.settings_clock_bottom_margin_subtitle_small),
Constants.ClockBottomMargin.SMALL.value
)
.addItem(
getString(R.string.settings_clock_bottom_margin_subtitle_medium),
Constants.ClockBottomMargin.MEDIUM.value
)
.addItem(
getString(R.string.settings_clock_bottom_margin_subtitle_large),
Constants.ClockBottomMargin.LARGE.value
)
.addOnSelectItemListener { value ->
Preferences.clockBottomMargin = value
}.show()
}
} }
action_clock_app.setOnClickListener { action_clock_app.setOnClickListener {
if (Preferences.showClock) { if (Preferences.showClock) {
startActivityForResult(Intent(requireContext(), ChooseApplicationActivity::class.java), if (Preferences.showClock) {
RequestCode.CLOCK_APP_REQUEST_CODE.code startActivityForResult(
) Intent(requireContext(), ChooseApplicationActivity::class.java),
RequestCode.CLOCK_APP_REQUEST_CODE.code
)
}
} }
} }
} }
@ -232,12 +282,17 @@ 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) {
val scrollPosition = scrollView.scrollY scrollView.isScrollable = false
callback.invoke() callback.invoke()
lifecycleScope.launch { lifecycleScope.launch {
delay(200) delay(200)
scrollView.smoothScrollTo(0, scrollPosition) scrollView.isScrollable = true
} }
} }
} }

View File

@ -67,6 +67,8 @@ class GeneralTabFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
show_dividers_toggle.isChecked = Preferences.showDividers
setupListener() setupListener()
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
val lazyColors = requireContext().resources.getIntArray(R.array.material_colors) val lazyColors = requireContext().resources.getIntArray(R.array.material_colors)
@ -186,15 +188,6 @@ class GeneralTabFragment : Fragment() {
}) })
} }
private fun maintainScrollPosition(callback: () -> Unit) {
val scrollPosition = scrollView.scrollY
callback.invoke()
lifecycleScope.launch {
delay(200)
scrollView.smoothScrollTo(0, scrollPosition)
}
}
private fun setupListener() { private fun setupListener() {
action_main_text_size.setOnClickListener { action_main_text_size.setOnClickListener {
val dialog = BottomSheetMenu<Float>(requireContext(), header = getString(R.string.title_main_text_size)).setSelectedValue(Preferences.textMainSize) val dialog = BottomSheetMenu<Float>(requireContext(), header = getString(R.string.title_main_text_size)).setSelectedValue(Preferences.textMainSize)
@ -319,12 +312,11 @@ class GeneralTabFragment : Fragment() {
} }
action_show_dividers.setOnClickListener { action_show_dividers.setOnClickListener {
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_show_dividers_title)).setSelectedValue(Preferences.showDividers) show_dividers_toggle.isChecked = !show_dividers_toggle.isChecked
.addItem(getString(R.string.settings_visible), true) }
.addItem(getString(R.string.settings_not_visible), false)
.addOnSelectItemListener { value -> show_dividers_toggle.setOnCheckedChangeListener { _, isChecked ->
Preferences.showDividers = value Preferences.showDividers = isChecked
}.show()
} }
} }
@ -346,4 +338,13 @@ class GeneralTabFragment : Fragment() {
} }
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
} }
private fun maintainScrollPosition(callback: () -> Unit) {
scrollView.isScrollable = false
callback.invoke()
lifecycleScope.launch {
delay(200)
scrollView.isScrollable = true
}
}
} }

View File

@ -373,11 +373,11 @@ class GlanceTabFragment : Fragment() {
} }
private fun maintainScrollPosition(callback: () -> Unit) { private fun maintainScrollPosition(callback: () -> Unit) {
val scrollPosition = scrollView.scrollY scrollView.isScrollable = false
callback.invoke() callback.invoke()
lifecycleScope.launch { lifecycleScope.launch {
delay(200) delay(200)
scrollView.smoothScrollTo(0, scrollPosition) scrollView.isScrollable = true
} }
} }

View File

@ -2,6 +2,8 @@ package com.tommasoberlose.anotherwidget.ui.fragments
import android.Manifest import android.Manifest
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProviderInfo
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.net.Uri import android.net.Uri
@ -14,7 +16,6 @@ import android.util.TypedValue
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.core.animation.addListener import androidx.core.animation.addListener
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
@ -36,7 +37,6 @@ import com.tommasoberlose.anotherwidget.helpers.BitmapHelper
import com.tommasoberlose.anotherwidget.helpers.ColorHelper import com.tommasoberlose.anotherwidget.helpers.ColorHelper
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.activities.SupportDevActivity
import com.tommasoberlose.anotherwidget.ui.adapters.ViewPagerAdapter import com.tommasoberlose.anotherwidget.ui.adapters.ViewPagerAdapter
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget

View File

@ -65,6 +65,8 @@ class SettingsFragment : Fragment() {
binding.lifecycleOwner = this binding.lifecycleOwner = this
binding.viewModel = viewModel binding.viewModel = viewModel
subscribeUi(viewModel)
return binding.root return binding.root
} }
@ -75,7 +77,8 @@ class SettingsFragment : Fragment() {
Navigation.findNavController(it).popBackStack() Navigation.findNavController(it).popBackStack()
} }
subscribeUi(viewModel) show_widget_preview_toggle.isChecked = Preferences.showPreview
show_wallpaper_toggle.isChecked = Preferences.showWallpaper
setupListener() setupListener()
@ -120,44 +123,26 @@ class SettingsFragment : Fragment() {
} }
private fun setupListener() { private fun setupListener() {
action_show_widget_preview.setOnClickListener { action_show_widget_preview.setOnClickListener {
maintainScrollPosition { show_widget_preview_toggle.isChecked = !show_widget_preview_toggle.isChecked
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.action_show_widget_preview)) }
.setSelectedValue(Preferences.showPreview)
.addItem( show_widget_preview_toggle.setOnCheckedChangeListener { _, isChecked ->
getString(R.string.settings_visible), Preferences.showPreview = isChecked
true
)
.addItem(
getString(R.string.settings_not_visible),
false
)
.addOnSelectItemListener { value ->
Preferences.showPreview = value
}.show()
}
} }
action_show_wallpaper.setOnClickListener { action_show_wallpaper.setOnClickListener {
maintainScrollPosition { }
BottomSheetMenu<Boolean>(requireContext(), header = getString(R.string.settings_title_show_wallpaper))
.setSelectedValue(Preferences.showWallpaper && activity?.checkGrantedPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == true) action_show_wallpaper.setOnClickListener {
.addItem( show_wallpaper_toggle.isChecked = !show_wallpaper_toggle.isChecked
getString(R.string.settings_visible), }
true
) show_wallpaper_toggle.setOnCheckedChangeListener { _, isChecked ->
.addItem( if (isChecked) {
getString(R.string.settings_not_visible), requirePermission()
false } else {
) Preferences.showWallpaper = isChecked
.addOnSelectItemListener { value ->
if (value) {
requirePermission()
} else {
Preferences.showWallpaper = value
}
}.show()
} }
} }
@ -211,11 +196,11 @@ class SettingsFragment : Fragment() {
} }
private fun maintainScrollPosition(callback: () -> Unit) { private fun maintainScrollPosition(callback: () -> Unit) {
val scrollPosition = scrollView.scrollY scrollView.isScrollable = false
callback.invoke() callback.invoke()
lifecycleScope.launch { lifecycleScope.launch {
delay(200) delay(200)
scrollView.smoothScrollTo(0, scrollPosition) scrollView.isScrollable = true
} }
} }
@ -226,8 +211,11 @@ class SettingsFragment : Fragment() {
).withListener(object: MultiplePermissionsListener { ).withListener(object: MultiplePermissionsListener {
override fun onPermissionsChecked(report: MultiplePermissionsReport?) { override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
report?.let { report?.let {
Preferences.showWallpaper = false if (report.areAllPermissionsGranted()) {
Preferences.showWallpaper = report.areAllPermissionsGranted() Preferences.showWallpaper = true
} else {
show_wallpaper_toggle?.isChecked = false
}
} }
} }
override fun onPermissionRationaleShouldBeShown( override fun onPermissionRationaleShouldBeShown(

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("01d"))) // 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()
} }
} }
@ -303,11 +298,11 @@ class WeatherTabFragment : Fragment() {
} }
private fun maintainScrollPosition(callback: () -> Unit) { private fun maintainScrollPosition(callback: () -> Unit) {
val scrollPosition = scrollView.scrollY scrollView.isScrollable = false
callback.invoke() callback.invoke()
lifecycleScope.launch { lifecycleScope.launch {
delay(200) delay(200)
scrollView.smoothScrollTo(0, scrollPosition) scrollView.isScrollable = true
} }
} }
} }

View File

@ -17,6 +17,7 @@ import android.util.TypedValue
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.RemoteViews import android.widget.RemoteViews
import android.widget.TextClock
import android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible

View File

@ -221,4 +221,13 @@ fun Context.checkIfFitInstalled(): Boolean {
} catch (e: Exception) { } catch (e: Exception) {
false false
} }
}
fun Intent.isDefaultSet(context: Context): Boolean {
val pm = context.packageManager
return try {
resolveActivity(pm) != null && resolveActivity(pm).packageName.isNotBlank()
} catch (ex: java.lang.Exception) {
false
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM16.5,16L8,16c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3h0.14c0.44,-1.73 1.99,-3 3.86,-3 2.21,0 4,1.79 4,4h0.5c1.38,0 2.5,1.12 2.5,2.5S17.88,16 16.5,16z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M5,5c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L6,4c-0.55,0 -1,0.45 -1,1zM7.41,14L9,14v5c0,0.55 0.45,1 1,1h4c0.55,0 1,-0.45 1,-1v-5h1.59c0.89,0 1.34,-1.08 0.71,-1.71L12.71,7.7c-0.39,-0.39 -1.02,-0.39 -1.41,0l-4.59,4.59c-0.63,0.63 -0.19,1.71 0.7,1.71z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -145,7 +145,7 @@
android:layout_height="40dp" android:layout_height="40dp"
android:padding="5dp" android:padding="5dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:src="@drawable/round_keyboard_capslock" android:src="@drawable/round_publish"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"

View File

@ -7,9 +7,12 @@
<variable <variable
name="isCalendarEnabled" name="isCalendarEnabled"
type="Boolean" /> type="Boolean" />
<variable
name="isDiffEnabled"
type="Boolean" />
</data> </data>
<ScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -39,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"
@ -158,7 +160,8 @@
android:src="@drawable/round_date_range" android:src="@drawable/round_date_range"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -174,6 +177,12 @@
android:id="@+id/all_day_label" android:id="@+id/all_day_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_all_day_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -195,7 +204,8 @@
android:src="@drawable/round_event_busy" android:src="@drawable/round_event_busy"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -211,6 +221,12 @@
android:id="@+id/show_declined_events_label" android:id="@+id/show_declined_events_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_declined_events_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -281,7 +297,8 @@
android:src="@drawable/round_timelapse" android:src="@drawable/round_timelapse"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -297,6 +314,12 @@
android:id="@+id/show_diff_time_label" android:id="@+id/show_diff_time_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_diff_time_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -307,6 +330,7 @@
android:paddingRight="8dp" android:paddingRight="8dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:alpha="@{isDiffEnabled ? 1f : 0.2f, default=1}"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical" android:gravity="center_vertical"
android:id="@+id/action_widget_update_frequency" android:id="@+id/action_widget_update_frequency"
@ -404,7 +428,8 @@
android:src="@drawable/round_code" android:src="@drawable/round_code"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -420,6 +445,12 @@
android:id="@+id/show_multiple_events_label" android:id="@+id/show_multiple_events_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_multiple_events_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -497,5 +528,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout> </layout>

View File

@ -7,8 +7,12 @@
<variable <variable
name="isClockVisible" name="isClockVisible"
type="Boolean" /> type="Boolean" />
<variable
name="is24Format"
type="Boolean" />
<import type="android.view.View" />
</data> </data>
<ScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -20,6 +24,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:focusable="true"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -76,9 +81,8 @@
<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/round_schedule" android:src="@drawable/alarm"/>
android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -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"
@ -230,7 +235,8 @@
android:scaleX="-1" android:scaleX="-1"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -246,6 +252,12 @@
android:id="@+id/ampm_indicator_label" android:id="@+id/ampm_indicator_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/ampm_indicator_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -356,5 +368,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout> </layout>

View File

@ -6,7 +6,7 @@
name="viewModel" name="viewModel"
type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" /> type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" />
</data> </data>
<ScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/scrollView" android:id="@+id/scrollView"
@ -334,7 +334,8 @@
android:rotation="90" android:rotation="90"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="8dp" android:paddingLeft="8dp"
@ -350,6 +351,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_dividers_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -392,5 +399,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout> </layout>

View File

@ -10,7 +10,7 @@
name="isGlanceVisible" name="isGlanceVisible"
type="Boolean" /> type="Boolean" />
</data> </data>
<ScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/scrollView" android:id="@+id/scrollView"
@ -39,8 +39,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_hourglass_empty" android:src="@drawable/menu"/>
android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -382,5 +381,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout> </layout>

View File

@ -49,7 +49,7 @@
tools:ignore="RelativeOverlap" /> tools:ignore="RelativeOverlap" />
</RelativeLayout> </RelativeLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<ScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/scrollView" android:id="@+id/scrollView"
@ -126,7 +126,8 @@
android:src="@drawable/round_compare" android:src="@drawable/round_compare"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -142,6 +143,12 @@
android:id="@+id/show_widget_preview_label" android:id="@+id/show_widget_preview_label"
style="@style/AnotherWidget.Settings.Subtitle" /> style="@style/AnotherWidget.Settings.Subtitle" />
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_widget_preview_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -163,7 +170,8 @@
android:src="@drawable/round_wallpaper" android:src="@drawable/round_wallpaper"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -179,6 +187,12 @@
android:id="@+id/show_wallpaper_label" android:id="@+id/show_wallpaper_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/show_wallpaper_toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -440,6 +454,6 @@
app:textAllCaps="false" /> app:textAllCaps="false" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</LinearLayout> </LinearLayout>
</layout> </layout>

View File

@ -8,7 +8,7 @@
name="isWeatherVisible" name="isWeatherVisible"
type="Boolean" /> type="Boolean" />
</data> </data>
<ScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -76,9 +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:src="@drawable/round_brightness_5" android:id="@+id/weather_icon_pack"
android:tint="@color/colorPrimaryText"/> android:src="@drawable/clear_day_3"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
@ -327,8 +327,7 @@
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:padding="12dp" android:padding="12dp"
android:id="@+id/weather_icon_pack" android:src="@drawable/round_cloud_circle"
android:src="@drawable/round_cloud_queue"
android:tint="@color/colorPrimaryText"/> android:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -399,5 +398,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout> </layout>

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>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="@string/filters_header"
android:textAlignment="viewStart"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textSize="16sp"
android:id="@+id/header"
android:textColor="@color/colorAccent"
android:textAppearance="@style/AnotherWidget.Settings.Header"
android:textAllCaps="false" />

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/container"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:id="@+id/icon"
android:src="@drawable/calendar"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:id="@+id/title"
android:text="@string/title_permission_calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/label"
android:text="@string/description_permission_calendar"
style="@style/AnotherWidget.Settings.Subtitle"/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="36dp"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:letterSpacing="0"
android:textAllCaps="false"
android:clickable="true"
android:layout_marginStart="-8dp"
android:layout_marginBottom="-8dp"
android:paddingBottom="0dp"
android:paddingTop="0dp"
android:focusable="true"
android:id="@+id/action_grant_permission"
android:textColor="@color/errorColorText"
android:text="@string/action_grant_permission"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:id="@+id/toggle"
android:buttonTint="@color/colorAccent" />
</LinearLayout>

View File

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Another Widget</string>
<string name="add_widget">Hinzufügen</string>
<!-- Display -->
<string name="settings_general_title">Anzeige</string>
<string name="divider" translatable="false">|</string>
<string name="settings_font_color_title">Schriftfarbe</string>
<string name="settings_secondary_font_color_title">Schriftfarbe</string>
<string name="settings_background_color_title">Hintergrundfarbe</string>
<string name="title_main_text_size">Schriftgröße</string>
<string name="title_second_text_size">Schriftgröße</string>
<string name="title_text_shadow">Textschatten</string>
<string name="settings_text_shadow_subtitle_none">Keinen</string>
<string name="settings_text_shadow_subtitle_low">Niedrig</string>
<string name="settings_text_shadow_subtitle_high">Hoch</string>
<string name="settings_custom_font_title">Widget Schriftart</string>
<string name="custom_font_subtitle_0">System Schirftart</string>
<string name="custom_font_subtitle_1">Product Sans</string>
<string name="custom_date_format">Datumsformat</string>
<string name="alpha">Alpha</string>
<string name="transparent">Transparent</string>
<string name="settings_show_dividers_title">Texttrennlinien anzeigen</string>
<string name="first_row_header">Erste Zeile</string>
<string name="second_row_header">Zweite Zeile</string>
<string name="global_style_header">Widget</string>
<string name="action_capitalize_the_date">Datum groß schreiben</string>
<string name="settings_date_format_title">Datumsformat</string>
<!-- Calendar -->
<string name="settings_calendar_title">Kalender</string>
<string name="title_permission_calendar">Termine anzeigen</string>
<string name="description_permission_calendar">Erlaube den Zugriff auf Ihren Kalender, um Termine im Widget anzuzeigen.</string>
<string name="settings_filter_calendar_title">Termine filtern</string>
<string name="settings_filter_calendar_subtitle">Kalender Sichtbarkeit ändern</string>
<string name="settings_all_day_title">Ganztägige Termine</string>
<string name="main_calendar">Benutzer Kalender</string>
<string name="calendar_settings_list_error">Fehler beim Laden der Kalenderliste</string>
<string name="all_day">Ganztägiger Termin</string>
<string name="show_events_visible">Termine sind sichtbar</string>
<string name="show_events_not_visible">Termine sind ausgeblendet</string>
<string name="settings_show_until_subtitle_6">30 Minuten vorher</string>
<string name="settings_show_until_subtitle_7">1 Stunde vorher</string>
<string name="settings_show_until_subtitle_0">3 Stunden vorher</string>
<string name="settings_show_until_subtitle_1">6 Stunden vorher</string>
<string name="settings_show_until_subtitle_2">12 Stunden vorher</string>
<string name="settings_show_until_subtitle_3">24 Stunden vorher</string>
<string name="settings_show_until_subtitle_4">3 Tage vorher</string>
<string name="settings_show_until_subtitle_5">7 Tage vorher</string>
<string name="settings_show_until_title">Zeige Termine mindestends</string>
<string name="day_char">T</string>
<string name="settings_calendar_app_title">Standard Kalender App</string>
<string name="error_no_calendar">Keine Kalender gefunden.</string>
<string name="tomorrow">morgen</string>
<string name="today">heute</string>
<string name="settings_event_app_title">Klick auf den Termin öffnet</string>
<string name="settings_second_row_info_title">Termininformation</string>
<string name="settings_second_row_info_subtitle_0">Zeit des Termins</string>
<string name="settings_show_diff_time_title">Zeit bis zum Termin</string>
<string name="settings_show_declined_events_title">Abgesagte Termine</string>
<string name="default_event_app">Termindetails</string>
<string name="default_calendar_app">Standard Kalender App</string>
<string name="settings_show_multiple_events_title">Schalter für mehrere Termine</string>
<string name="soon">bald</string>
<string name="now">jetzt</string>
<string name="settings_widget_update_frequency_subtitle">Hohe Aktualisierungshäufigkeit verursacht mehr Batterieverbrauch</string>
<string name="settings_widget_update_frequency_low">Niedrig</string>
<string name="settings_widget_update_frequency_default">Standard</string>
<string name="settings_widget_update_frequency_high">Hoch</string>
<string name="filters_header">Filter</string>
<string name="event_detail_header">Termindetail</string>
<!-- Weather -->
<string name="settings_weather_title">Wetter</string>
<string name="title_permission_location">Wetter anzeige</string>
<string name="description_permission_location">Erlaube Standortzugriff, um\nWetterinformationen im Widget anzuzeigen.</string>
<string name="settings_unit_title">Messeinheit</string>
<string name="fahrenheit" translatable="false">°F - Fahrenheit</string>
<string name="celsius" translatable="false">°C - Celsius</string>
<string name="settings_weather_refresh_period_title">Aktualisierungsrate</string>
<string name="settings_weather_refresh_period_subtitle_0">30 Minuten</string>
<string name="settings_weather_refresh_period_subtitle_1">1 Stunde</string>
<string name="settings_weather_refresh_period_subtitle_2">3 Stunden</string>
<string name="settings_weather_refresh_period_subtitle_3">6 Stunden</string>
<string name="settings_weather_refresh_period_subtitle_4">12 Stunden</string>
<string name="settings_weather_refresh_period_subtitle_5">24 Stunden</string>
<string name="settings_custom_location_title">Standort</string>
<string name="custom_location_gps">GPS-Standort verwenden</string>
<string name="show_weather_visible">Wetterinfos sind sichtbar</string>
<string name="show_weather_not_visible">Wetterinfos sind ausgeblendet</string>
<string name="settings_weather_app_title">Klick aufs Wetter öffnet</string>
<string name="settings_weather_provider_api_key_title">Wetter-API-Schlüssel</string>
<string name="settings_weather_provider_api_key_subtitle_all_set">Der Wetteranbieter ist korrekt konfiguriert</string>
<string name="settings_weather_provider_api_key_subtitle_not_set">Der Wetteranbieter muss konfiguriert werden</string>
<string name="api_key_hint">OpenWeather API Schlüssel</string>
<string name="default_weather_app">Google Weather</string>
<string name="weather_warning">Google Awareness Wetter ist veraltet. Es wird nun ein OpenWeather API-Schlüssel benötigt, um das Wetter im Widget anzuzeigen.</string>
<string name="api_key_title_1">OpenWeather Konto registrieren</string>
<string name="api_key_title_2">API-Schlüssel kopieren</string>
<string name="api_key_subtitle_2">Gehe in die Kontoeinstellungen und kopiere den Standardschlüssel im API-Schlüsselmenü.</string>
<string name="api_key_subtitle_3">Füge den Schlüssel in das obere Feld ein und speicher ihn. Sobald der Schlüssel aktiviert ist, wird das Wetter sichtbar sein.</string>
<string name="action_open_provider">Öffne OpenWeatherMap.com</string>
<string name="api_key_info_all_set">Es kann bis zu zehn Minuten dauern, bis der API-Schlüssel aktiviert ist. Das Wetter wird aktualisiert, sobald es verfügbar ist..</string>
<string name="settings_weather_icon_pack_title">Icon Pack</string>
<string name="settings_weather_icon_pack_default">Icon Pack %d</string>
<!-- Clock -->
<string name="settings_clock_title">Uhr</string>
<string name="settings_clock_app_title">Klick auf die Uhr öffnet</string>
<string name="title_show_clock">Uhr anzeigen</string>
<string name="show_clock_visible">Uhr ist sichtbar</string>
<string name="show_clock_not_visible">Uhr ist nicht sichtbar</string>
<string name="settings_clock_text_size_title">Schriftgröße</string>
<string name="default_clock_app">Standard Uhr App</string>
<string name="settings_clock_bottom_margin_title">Unterer Rand der Uhr</string>
<string name="settings_clock_bottom_margin_subtitle_none">Keinen</string>
<string name="settings_clock_bottom_margin_subtitle_small">Klein</string>
<string name="settings_clock_bottom_margin_subtitle_medium">Mittel</string>
<string name="settings_clock_bottom_margin_subtitle_large">Groß</string>
<string name="clock_warning">Aufgrund technischer Einschränkungen hat die Uhr nicht die benutzerdefinierte Schriftart und Textschatten, die im Abschnitt Anzeige eingestellt sind.</string>
<string name="settings_clock_text_color_title">Schriftfarbe</string>
<string name="settings_ampm_indicator_title">Zeige AM/PM</string>
<string name="clock_text_header">Uhr Textstil</string>
<!-- Glance -->
<string name="settings_show_next_alarm_title">Nächster Wecker</string>
<string name="next_alarm_warning">Der nächste Wecker scheint falsch zu sein.\nEr wurde durch %s festgelegt.</string>
<string name="settings_at_a_glance_title">Überblick</string>
<string name="settings_show_music_title">Aktuell spielendes Lied</string>
<string name="settings_request_notification_access">Wir benötigen Zugriff auf die Benachrichtigungen, um auf das aktuell abgespielte Lied zugreifen zu können.</string>
<string name="settings_request_fitness_access">Wir benötigen ein paar Berechtigungen, um die täglichen Schritte von Google Fit zu erhalten.</string>
<string name="title_show_glance">Informationen auf einen Blick anzeigen</string>
<string name="description_show_glance_visible">Dienst ist aktiviert</string>
<string name="description_show_glance_not_visible">Dienst ist deaktiviert</string>
<string name="settings_sort_glance_providers_title">Priorität der Datenquelle</string>
<string name="settings_custom_notes_title">Benutzerdefinierte Notizen</string>
<string name="settings_low_battery_level_title">Akku</string>
<string name="settings_daily_steps_title">Tägliche Schritte</string>
<string name="battery_low_warning">Niedriger Akkustand</string>
<string name="daily_steps_counter">%d Schritte bis jetzt</string>
<string name="charging">Aufladen</string>
<string name="providers">Anbieter</string>
<string name="glance_info">Überblick Informationen sind nur dann sichtbar, wenn keine Termine angeueigt werden und wenn einige Bedingungen erfüllt sind.</string>
<!-- Settings -->
<string name="action_share">Teilen</string>
<string name="action_rate">App bewerten</string>
<string name="action_support">Unterstütze mich</string>
<string name="action_feedback">Feedback</string>
<string name="action_about">Über</string>
<string name="action_refresh_widget">Widget aktualisieren</string>
<string name="toolbar_transition_name" translatable="false">toolbar</string>
<string name="error_opening_uri">Fehler beim Öffnen der URL: Link in Zwischenablage kopiert.</string>
<string name="loading_text">Daten werden geladen…</string>
<string name="error_opening_app">Fehler beim Öffnen der App.</string>
<string name="default_name">Standard-App</string>
<string name="action_save">Speichern</string>
<string name="settings_visible">Sichtbar</string>
<string name="settings_not_visible">Ausgeblendet</string>
<string name="support_translations_title">Hilf beim Übersetzen</string>
<string name="support_translations_subtitle">Öffne eine neue Pull-Request auf GitHub</string>
<string name="support_website_title">Meine anderen Projekte anschauen</string>
<string name="support_website_subtitle">Gleicher Entwickler, viele Möglichkeiten</string>
<string name="error">Ups, da ist etwas schief gelaufen!</string>
<string name="settings_theme_title">Thema</string>
<string name="support_main_subtitle">Entwickler brauchen immer viel Kaffee</string>
<string name="settings_subtitle_dark_theme_light">Hell</string>
<string name="settings_subtitle_dark_theme_dark">Dunkel</string>
<string name="settings_subtitle_dark_theme_by_battery_saver">Durch Energiesparmodus festgelegt</string>
<string name="settings_subtitle_dark_theme_follow_system">Dem Systemthema folgen</string>
<string name="settings_subtitle_dark_theme_default">Standard</string>
<string name="search">Suchen</string>
<string name="settings_app_version_title">App Version</string>
<string name="settings_title_show_wallpaper">Hintergrundbild anzeigen</string>
<string name="support_refresh_widget_subtitle">Neustart des Widget Dienstes erzwingen</string>
<string name="settings_feedback_subtitle">Dies ist ein Open-Source-Projekt, du kannst gerne helfen.</string>
<string name="settings_feedback_title">Feedback und Vorschläge</string>
<string name="xiaomi_manufacturer" translatable="false">xiaomi</string>
<string name="xiaomi_warning_title">Xiaomi Geräte</string>
<string name="xiaomi_warning_message">Aktiviere die Berechtigung zum Anzeigen von Popup-Fenstern, wenn die App im Hintergrund ausgeführt wird, untert \"Andere Berechtigungen\" in den App-Einstellungen. Andernfalls kann beim Klicken auf das Widget keine Anwendung geöffnet werden.</string>
<string name="action_ignore">Ignorieren</string>
<string name="action_grant_permission">Berechtigung erlauben</string>
<string name="settings_title">Einstellungen</string>
<string name="style_header">Stil</string>
<string name="actions_header">Aktionen</string>
<string name="provider_header">Konfiguration</string>
<string name="appearance_header">Erscheinungsbild</string>
<string name="preferences_header">Präferenzen</string>
<!-- Activities -->
<string name="action_choose_application">Anwendung auswählen</string>
<string name="support_main_title">Den Entwickler unterstützen</string>
<string name="thanks">Danke für Ihre Unterstützung!</string>
<string name="donation_coffee">Ein italienischer Kaffee</string>
<string name="donation_donuts">Ein paar glasierte Donuts</string>
<string name="donation_dinner">Ein teures Abendessendinner</string>
<string name="donation_breakfast">Ein englisches Frühstück</string>
<string name="donation_lunch">Ein schnelles Mittagessen</string>
<string name="action_show_widget_preview">Widget Vorschau anzeigen</string>
<string name="support_dev_subtitle">Dies ist ein Ein-Entwickler-Projekt, \nalso vielen Dank für die Unterstützung!</string>
<string name="settings_title_integrations">Integrationen</string>
<string name="label_count_installed_integrations">%d installierte Integrationen</string>
<string name="settings_second_row_info_subtitle_1">Ort des Termins</string>
<string name="settings_widget_update_frequency_title">Zeit bis zum nächten Termin Aktualisierungshäufigkeit</string>
<string name="api_key_subtitle_1">Registriere ein Konto bei OpenWeather. Es dauert nur wenige Minuten.</string>
<string name="api_key_title_3">Schlüssel in die App eingeben</string>
<string name="settings_sort_glance_providers_subtitle">Wichtigkeit der Datenprovider ändern</string>
</resources>

View File

@ -126,11 +126,11 @@
<!-- Glance --> <!-- Glance -->
<string name="settings_show_next_alarm_title">Prochaine alarme</string> <string name="settings_show_next_alarm_title">Prochaine alarme</string>
<string name="next_alarm_warning">La prochaine alarme semble erronée.\nElle a été définie par %s.</string> <string name="next_alarm_warning">La prochaine alarme semble erronée.\nElle a été définie par %s.</string>
<string name="settings_at_a_glance_title">Coup d\'œil</string> <string name="settings_at_a_glance_title">Coups d\'œil</string>
<string name="settings_show_music_title">Musique en cours de lecture</string> <string name="settings_show_music_title">Musique en cours de lecture</string>
<string name="settings_request_notification_access">Nous avons besoin d\'accéder aux notifications pour vérifier la musique en cours de lecture</string> <string name="settings_request_notification_access">Nous avons besoin d\'accéder aux notifications pour vérifier la musique en cours de lecture</string>
<string name="settings_request_fitness_access">Nous avons besoin de quelques autorisations pour obtenir vos nombres de pas quotidiens depuis Google Fit</string> <string name="settings_request_fitness_access">Nous avons besoin de quelques autorisations pour obtenir vos nombres de pas quotidiens depuis Google Fit</string>
<string name="title_show_glance">Afficher les infos en un coup d\'œil</string> <string name="title_show_glance">Afficher les coups d\'œil</string>
<string name="description_show_glance_visible">Services activés</string> <string name="description_show_glance_visible">Services activés</string>
<string name="description_show_glance_not_visible">Services désactivés</string> <string name="description_show_glance_not_visible">Services désactivés</string>
<string name="settings_sort_glance_providers_title">Priorité des sources de données</string> <string name="settings_sort_glance_providers_title">Priorité des sources de données</string>
@ -140,9 +140,9 @@
<string name="settings_daily_steps_title">Nombre de pas quotidiens</string> <string name="settings_daily_steps_title">Nombre de pas quotidiens</string>
<string name="battery_low_warning">Batterie faible</string> <string name="battery_low_warning">Batterie faible</string>
<string name="daily_steps_counter">%d pas jusqu\à présent</string> <string name="daily_steps_counter">%d pas jusqu\à présent</string>
<string name="charging">En charge</string> <string name="charging">Batterie en charge</string>
<string name="providers">Fournisseurs</string> <string name="providers">Fournisseurs</string>
<string name="glance_info">Glance info will show up only when there are no events displayed and only when a few conditions are verified.</string> <string name="glance_info">Les coups d\'œil n\'apparaîtront que si aucun événement n\'est affiché et uniquement lorsque quelques conditions sont vérifiées.</string>
<!-- Settings --> <!-- Settings -->
<string name="action_share">Partager</string> <string name="action_share">Partager</string>
@ -177,9 +177,9 @@
<string name="settings_feedback_subtitle">Ce projet est open-source, n\'hésitez pas à aider</string> <string name="settings_feedback_subtitle">Ce projet est open-source, n\'hésitez pas à aider</string>
<string name="settings_feedback_title">Commentaires et suggestions</string> <string name="settings_feedback_title">Commentaires et suggestions</string>
<string name="xiaomi_warning_title">Appareils Xiaomi</string> <string name="xiaomi_warning_title">Appareils Xiaomi</string>
<string name="xiaomi_warning_message">Veuillez activer l\'option "Afficher des fenêtres pop-up pendant que vous parcourez en arrière-plan" dans la section "Autres autorisations" des paramètres de l\'application. Sinon, vous ne pourrez ouvrir aucune application en tapant sur le widget.</string> <string name="xiaomi_warning_message">Veuillez activer l\'option \'\'Afficher des fenêtres pop-up pendant que vous parcourez en arrière-plan\'\' dans la section \'\'Autres autorisations\'\' des paramètres de l\'application.\nSinon, vous ne pourrez ouvrir aucune application en tapant sur le widget.</string>
<string name="action_ignore">Ignorer</string> <string name="action_ignore">Ignorer</string>
<string name="action_grant_permission">Aller dans Paramètres</string> <string name="action_grant_permission">Ouvrir les Paramètres</string>
<string name="settings_title">Paramètres</string> <string name="settings_title">Paramètres</string>
<string name="style_header">Style</string> <string name="style_header">Style</string>
<string name="actions_header">Actions</string> <string name="actions_header">Actions</string>

View File

@ -5,14 +5,14 @@
<!-- Display --> <!-- Display -->
<string name="settings_general_title">Tampilan</string> <string name="settings_general_title">Tampilan</string>
<string name="divider" translatable="false">|</string>
<string name="settings_font_color_title">Warna teks</string> <string name="settings_font_color_title">Warna teks</string>
<string name="settings_secondary_font_color_title">Warna teks</string> <string name="settings_secondary_font_color_title">Warna teks</string>
<string name="settings_background_color_title">Warna latar belakang</string> <string name="settings_background_color_title">Warna latar belakang</string>
<string name="title_main_text_size">Ukuran teks</string> <string name="title_main_text_size">Ukuran teks</string>
<string name="title_second_text_size">Ukuran teks</string> <string name="title_second_text_size">Ukuran teks</string>
<string name="title_text_shadow">Bayangan teks</string> <string name="title_text_shadow">Bayangan teks</string>
<string name="settings_text_shadow_subtitle_none">Tidak ada</string> <string name="settings_text_shadow_subtitle_none">Nihil</string>
<string name="settings_text_shadow_subtitle_low">Rendah</string> <string name="settings_text_shadow_subtitle_low">Rendah</string>
<string name="settings_text_shadow_subtitle_high">Tinggi</string> <string name="settings_text_shadow_subtitle_high">Tinggi</string>
<string name="settings_custom_font_title">Fon widget</string> <string name="settings_custom_font_title">Fon widget</string>
@ -21,7 +21,7 @@
<string name="custom_date_format">Format tanggal khusus</string> <string name="custom_date_format">Format tanggal khusus</string>
<string name="alpha">Alpha</string> <string name="alpha">Alpha</string>
<string name="transparent">Transparan</string> <string name="transparent">Transparan</string>
<string name="settings_show_dividers_title">Tampilkan pemisah teks</string> <string name="settings_show_dividers_title">Pemisah teks</string>
<string name="first_row_header">Baris pertama</string> <string name="first_row_header">Baris pertama</string>
<string name="second_row_header">Baris kedua</string> <string name="second_row_header">Baris kedua</string>
<string name="global_style_header">Widget</string> <string name="global_style_header">Widget</string>
@ -30,9 +30,9 @@
<!-- Calendar --> <!-- Calendar -->
<string name="settings_calendar_title">Kalender</string> <string name="settings_calendar_title">Kalender</string>
<string name="title_permission_calendar">Tampilkan acara anda</string> <string name="title_permission_calendar">Tampilkan acara</string>
<string name="description_permission_calendar">Berikan izin untuk mengakses kalender anda\nuntuk menampilkan acara di widget.</string> <string name="description_permission_calendar">Berikan izin untuk mengakses kalender anda\nuntuk menampilkan acara di widget.</string>
<string name="settings_filter_calendar_title">Saring acara</string> <string name="settings_filter_calendar_title">Filter acara</string>
<string name="settings_filter_calendar_subtitle">Ubah visibilitas kalender</string> <string name="settings_filter_calendar_subtitle">Ubah visibilitas kalender</string>
<string name="settings_all_day_title">Acara seharian</string> <string name="settings_all_day_title">Acara seharian</string>
<string name="main_calendar">Kalender akun</string> <string name="main_calendar">Kalender akun</string>
@ -65,12 +65,12 @@
<string name="settings_show_multiple_events_title">Pengalih beberapa acara</string> <string name="settings_show_multiple_events_title">Pengalih beberapa acara</string>
<string name="soon">segera</string> <string name="soon">segera</string>
<string name="now">sekarang</string> <string name="now">sekarang</string>
<string name="settings_widget_update_frequency_title">Rentang waktu frekuensi pembaruan</string> <string name="settings_widget_update_frequency_title">Frekuensi pembaruan</string>
<string name="settings_widget_update_frequency_subtitle">Frekuensi tinggi akan menyebabkan penggunaan baterai menjadi lebih tinggi</string> <string name="settings_widget_update_frequency_subtitle">Frekuensi tinggi akan menyebabkan penggunaan baterai menjadi lebih tinggi</string>
<string name="settings_widget_update_frequency_low">Rendah</string> <string name="settings_widget_update_frequency_low">Rendah</string>
<string name="settings_widget_update_frequency_default">Bawaan</string> <string name="settings_widget_update_frequency_default">Bawaan</string>
<string name="settings_widget_update_frequency_high">Tinggi</string> <string name="settings_widget_update_frequency_high">Tinggi</string>
<string name="filters_header">Saring</string> <string name="filters_header">Filter</string>
<string name="event_detail_header">Detail acara</string> <string name="event_detail_header">Detail acara</string>
<!-- Weather --> <!-- Weather -->
@ -78,6 +78,8 @@
<string name="title_permission_location">Tampilkan cuaca</string> <string name="title_permission_location">Tampilkan cuaca</string>
<string name="description_permission_location">Berikan izin akses ke lokasi anda\nuntuk menampilkan cuaca di widget.</string> <string name="description_permission_location">Berikan izin akses ke lokasi anda\nuntuk menampilkan cuaca di widget.</string>
<string name="settings_unit_title">Unit pengukuran</string> <string name="settings_unit_title">Unit pengukuran</string>
<string name="settings_weather_refresh_period_title">Frekuensi penyegaran</string> <string name="settings_weather_refresh_period_title">Frekuensi penyegaran</string>
<string name="settings_weather_refresh_period_subtitle_0">30 menit</string> <string name="settings_weather_refresh_period_subtitle_0">30 menit</string>
<string name="settings_weather_refresh_period_subtitle_1">1 jam</string> <string name="settings_weather_refresh_period_subtitle_1">1 jam</string>
@ -87,8 +89,8 @@
<string name="settings_weather_refresh_period_subtitle_5">24 jam</string> <string name="settings_weather_refresh_period_subtitle_5">24 jam</string>
<string name="settings_custom_location_title">Lokasi</string> <string name="settings_custom_location_title">Lokasi</string>
<string name="custom_location_gps">Gunakan geolokasi</string> <string name="custom_location_gps">Gunakan geolokasi</string>
<string name="show_weather_visible">Info acara ditampilkan</string> <string name="show_weather_visible">Info cuaca ditampilkan</string>
<string name="show_weather_not_visible">Info acara disembunyikan</string> <string name="show_weather_not_visible">Info cuaca disembunyikan</string>
<string name="settings_weather_app_title">Ketuk pada cuaca membuka</string> <string name="settings_weather_app_title">Ketuk pada cuaca membuka</string>
<string name="settings_weather_provider_api_key_title">Kunci API cuaca</string> <string name="settings_weather_provider_api_key_title">Kunci API cuaca</string>
<string name="settings_weather_provider_api_key_subtitle_all_set">Penyedia layanan cuaca dikonfigurasi dengan benar</string> <string name="settings_weather_provider_api_key_subtitle_all_set">Penyedia layanan cuaca dikonfigurasi dengan benar</string>
@ -110,41 +112,41 @@
<!-- Clock --> <!-- Clock -->
<string name="settings_clock_title">Jam</string> <string name="settings_clock_title">Jam</string>
<string name="settings_clock_app_title">Ketuk pada jam membuka</string> <string name="settings_clock_app_title">Ketuk pada jam membuka</string>
<string name="title_show_clock">Tampilkan Jam</string> <string name="title_show_clock">Tampilkan jam</string>
<string name="show_clock_visible">Jam ditampilkan</string> <string name="show_clock_visible">Jam ditampilkan</string>
<string name="show_clock_not_visible">Jam disembunyikan</string> <string name="show_clock_not_visible">Jam disembunyikan</string>
<string name="settings_clock_text_size_title">Ukuran teks</string> <string name="settings_clock_text_size_title">Ukuran teks</string>
<string name="default_clock_app">Aplikasi jam bawaan</string> <string name="default_clock_app">Aplikasi jam bawaan</string>
<string name="settings_clock_bottom_margin_title">Margin bawah jam</string> <string name="settings_clock_bottom_margin_title">Margin bawah jam</string>
<string name="settings_clock_bottom_margin_subtitle_none">Tidak ada</string> <string name="settings_clock_bottom_margin_subtitle_none">Nihil</string>
<string name="settings_clock_bottom_margin_subtitle_small">Kecil</string> <string name="settings_clock_bottom_margin_subtitle_small">Kecil</string>
<string name="settings_clock_bottom_margin_subtitle_medium">Sedang</string> <string name="settings_clock_bottom_margin_subtitle_medium">Sedang</string>
<string name="settings_clock_bottom_margin_subtitle_large">Besar</string> <string name="settings_clock_bottom_margin_subtitle_large">Besar</string>
<string name="clock_warning">Karena keterbatasan teknologi, jam tidak akan menerapkan fon khusus dan bayangan teks yang diatur dalam bagian pengaturan Tampilan.</string> <string name="clock_warning">Karena keterbatasan teknologi, jam tidak akan menerapkan fon khusus dan bayangan teks yang diatur dalam bagian pengaturan Tampilan.</string>
<string name="settings_clock_text_color_title">Warna teks</string> <string name="settings_clock_text_color_title">Warna teks</string>
<string name="settings_ampm_indicator_title">Tampilkan Indikator AM/PM</string> <string name="settings_ampm_indicator_title">Tampilkan AM/PM</string>
<string name="clock_text_header">Gaya teks jam</string> <string name="clock_text_header">Gaya teks jam</string>
<!-- Glance --> <!-- Glance -->
<string name="settings_show_next_alarm_title">Waktu alarm berikutnya</string> <string name="settings_show_next_alarm_title">Waktu alarm berikutnya</string>
<string name="next_alarm_warning">Waktu alarm berikutnya sepertinya salah.\nTelah disetel %s.</string> <string name="next_alarm_warning">Waktu alarm berikutnya sepertinya salah.\nTelah disetel %s.</string>
<string name="settings_at_a_glance_title">Sekilas</string> <string name="settings_at_a_glance_title">Sekilas</string>
<string name="settings_show_music_title">Lagu yang diputar saat ini</string> <string name="settings_show_music_title">Lagu yang diputar</string>
<string name="settings_request_notification_access">Membutuhkan izin akses notifikasi untuk menampilkan lagu yang saat ini diputar.</string> <string name="settings_request_notification_access">Membutuhkan izin akses notifikasi untuk menampilkan lagu yang saat ini diputar.</string>
<string name="settings_request_fitness_access">Membutuhkan beberapa izin untuk menampilkan jumlah langkah dari Google Fit.</string> <string name="settings_request_fitness_access">Membutuhkan beberapa izin untuk menampilkan jumlah langkah dari Google Fit.</string>
<string name="title_show_glance">Tampilkan di info sekilas</string> <string name="title_show_glance">Tampilkan info sekilas</string>
<string name="description_show_glance_visible">Layanan diaktifkan</string> <string name="description_show_glance_visible">Layanan diaktifkan</string>
<string name="description_show_glance_not_visible">Layanan dinonaktifkan</string> <string name="description_show_glance_not_visible">Layanan dinonaktifkan</string>
<string name="settings_sort_glance_providers_title">Prioritas sumber data</string> <string name="settings_sort_glance_providers_title">Prioritas sumber data</string>
<string name="settings_sort_glance_providers_subtitle">Ubah prioritas penyedia data</string> <string name="settings_sort_glance_providers_subtitle">Ubah prioritas penyedia data</string>
<string name="settings_custom_notes_title">Catatan khusus</string> <string name="settings_custom_notes_title">Catatan khusus</string>
<string name="settings_low_battery_level_title">Baterai</string> <string name="settings_low_battery_level_title">Level baterai</string>
<string name="settings_daily_steps_title">Langkah harian</string> <string name="settings_daily_steps_title">Langkah harian</string>
<string name="battery_low_warning">Level baterai rendah</string> <string name="battery_low_warning">Level baterai rendah</string>
<string name="daily_steps_counter">%d langkah sejauh ini</string> <string name="daily_steps_counter">%d langkah sejauh ini</string>
<string name="charging">Mengisi daya</string> <string name="charging">Mengisi daya</string>
<string name="providers">Penyedia</string> <string name="providers">Penyedia</string>
<string name="glance_info">Glance info will show up only when there are no events displayed and only when a few conditions are verified.</string> <string name="glance_info">Info sekilas hanya akan muncul ketika tidak ada acara yang ditampilkan dan hanya ketika beberapa kondisi diverifikasi.</string>
<!-- Settings --> <!-- Settings -->
<string name="action_share">Bagikan</string> <string name="action_share">Bagikan</string>
@ -153,6 +155,7 @@
<string name="action_feedback">Umpanbalik</string> <string name="action_feedback">Umpanbalik</string>
<string name="action_about">Tentang</string> <string name="action_about">Tentang</string>
<string name="action_refresh_widget">Segarkan widget</string> <string name="action_refresh_widget">Segarkan widget</string>
<string name="error_opening_uri">Terjadi kesalahan saat membuka URL: Tautan disalin ke papan klip.</string> <string name="error_opening_uri">Terjadi kesalahan saat membuka URL: Tautan disalin ke papan klip.</string>
<string name="loading_text">Memuat Data…</string> <string name="loading_text">Memuat Data…</string>
<string name="error_opening_app">Terjadi kesalahan saat membuka aplikasi.</string> <string name="error_opening_app">Terjadi kesalahan saat membuka aplikasi.</string>
@ -174,10 +177,11 @@
<string name="settings_subtitle_dark_theme_default">Bawaan</string> <string name="settings_subtitle_dark_theme_default">Bawaan</string>
<string name="search">Cari</string> <string name="search">Cari</string>
<string name="settings_app_version_title">Versi aplikasi</string> <string name="settings_app_version_title">Versi aplikasi</string>
<string name="settings_title_show_wallpaper">Tampilkan wallpaper</string> <string name="settings_title_show_wallpaper">Wallpaper</string>
<string name="support_refresh_widget_subtitle">Paksa mulai ulang layanan widget</string> <string name="support_refresh_widget_subtitle">Paksa mulai ulang layanan widget</string>
<string name="settings_feedback_subtitle">Ini adalah proyek sumber terbuka, jangan sungkan untuk membantu.</string> <string name="settings_feedback_subtitle">Ini adalah proyek sumber terbuka, jangan sungkan untuk membantu.</string>
<string name="settings_feedback_title">Umpanbalik dan permintaan fitur</string> <string name="settings_feedback_title">Umpanbalik dan permintaan fitur</string>
<string name="xiaomi_warning_title">Perangkat Xiaomi</string> <string name="xiaomi_warning_title">Perangkat Xiaomi</string>
<string name="xiaomi_warning_message">Berikan izin untuk menampilkan jendela pop-up saat berjalan di latar belakang di dalam bagian "Perizinan lainnya" di pengaturan aplikasi. Jika tidak, anda tidak akan bisa membuka aplikasi apapun saat mengetuk widget.</string> <string name="xiaomi_warning_message">Berikan izin untuk menampilkan jendela pop-up saat berjalan di latar belakang di dalam bagian "Perizinan lainnya" di pengaturan aplikasi. Jika tidak, anda tidak akan bisa membuka aplikasi apapun saat mengetuk widget.</string>
<string name="action_ignore">Abaikan</string> <string name="action_ignore">Abaikan</string>
@ -196,9 +200,9 @@
<string name="donation_coffee">Kopi italia</string> <string name="donation_coffee">Kopi italia</string>
<string name="donation_donuts">Donat yang nikmat</string> <string name="donation_donuts">Donat yang nikmat</string>
<string name="donation_dinner">Makan malam yang mewah</string> <string name="donation_dinner">Makan malam yang mewah</string>
<string name="donation_breakfast">Sarapan yang bersemangat</string> <string name="donation_breakfast">Sarapan yang semangat</string>
<string name="donation_lunch">Makan siang yang cepat</string> <string name="donation_lunch">Makan siang yang cepat</string>
<string name="action_show_widget_preview">Tampilkan pratinjau widget</string> <string name="action_show_widget_preview">Pratinjau widget</string>
<string name="support_dev_subtitle">Ini adalah proyek pengembang tunggal,\nterima kasih banyak untuk dukungannya!</string> <string name="support_dev_subtitle">Ini adalah proyek pengembang tunggal,\nterima kasih banyak untuk dukungannya!</string>
<string name="settings_title_integrations">Integrasi</string> <string name="settings_title_integrations">Integrasi</string>
<string name="label_count_installed_integrations">%d integrasi terpasang</string> <string name="label_count_installed_integrations">%d integrasi terpasang</string>

View File

@ -206,4 +206,5 @@
<string name="support_dev_subtitle">This is a single developer project,\nso thank you for the support!</string> <string name="support_dev_subtitle">This is a single developer project,\nso thank you for the support!</string>
<string name="settings_title_integrations">Integrations</string> <string name="settings_title_integrations">Integrations</string>
<string name="label_count_installed_integrations">%d installed integrations</string> <string name="label_count_installed_integrations">%d installed integrations</string>
<string name="nothing">Nothing</string>
</resources> </resources>