Merge and move google sans in the custom font activity
@ -38,6 +38,7 @@
|
||||
<activity android:name=".ui.activities.SupportDevActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
|
||||
<activity android:name=".ui.activities.CustomDateActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
|
||||
<activity android:name=".ui.activities.IntegrationsActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
|
||||
<activity android:name=".ui.activities.MusicPlayersFilterActivity" android:launchMode="singleInstance" android:screenOrientation="portrait" />
|
||||
|
||||
|
||||
<receiver android:name=".ui.widgets.MainWidget">
|
||||
|
@ -2,6 +2,7 @@ package com.tommasoberlose.anotherwidget.components
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
@ -9,6 +10,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import kotlinx.android.synthetic.main.bottom_sheet_menu.view.*
|
||||
import kotlinx.android.synthetic.main.bottom_sheet_menu_item.view.*
|
||||
import org.w3c.dom.Text
|
||||
|
||||
/**
|
||||
* [BottomSheetDialogFragment] that uses a custom
|
||||
@ -32,8 +34,8 @@ open class BottomSheetMenu<T>(context: Context, private val header: String? = nu
|
||||
return this
|
||||
}
|
||||
|
||||
fun addItem(title: String, value: T? = null): BottomSheetMenu<T> {
|
||||
items.add(MenuItem(title, value))
|
||||
fun addItem(title: String, value: T? = null, renderCallback: ((view: TextView) -> Unit)? = null): BottomSheetMenu<T> {
|
||||
items.add(MenuItem(title, value, renderCallback))
|
||||
return this
|
||||
}
|
||||
|
||||
@ -94,7 +96,10 @@ open class BottomSheetMenu<T>(context: Context, private val header: String? = nu
|
||||
) else ContextCompat.getColor(context, R.color.colorSecondaryText)
|
||||
)
|
||||
}
|
||||
|
||||
item.renderCallback?.invoke(itemView.label)
|
||||
}
|
||||
|
||||
view.menu.addView(itemView)
|
||||
} else {
|
||||
val itemView = View.inflate(context, R.layout.bottom_sheet_menu_divider, null)
|
||||
@ -106,6 +111,6 @@ open class BottomSheetMenu<T>(context: Context, private val header: String? = nu
|
||||
super.show()
|
||||
}
|
||||
|
||||
class MenuItem<T>(val title: String, val value: T? = null)
|
||||
class MenuItem<T>(val title: String, val value: T? = null, val renderCallback: ((view: TextView) -> Unit)? = null)
|
||||
|
||||
}
|
@ -32,10 +32,10 @@ class IconPackSelector(context: Context, private val header: String? = null) : B
|
||||
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)))
|
||||
itemView.icon_1.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource(context, "01d", item.value)))
|
||||
itemView.icon_2.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource(context, "01n", item.value)))
|
||||
itemView.icon_3.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource(context, "10d", item.value)))
|
||||
itemView.icon_4.setImageDrawable(ContextCompat.getDrawable(context, WeatherHelper.getWeatherIconResource(context, "09n", item.value)))
|
||||
|
||||
listOf<ImageView>(itemView.icon_1, itemView.icon_2, itemView.icon_3, itemView.icon_4).forEach {
|
||||
if (item == Constants.WeatherIconPack.MINIMAL) {
|
||||
|
@ -94,6 +94,7 @@ object Preferences : KotprefModel() {
|
||||
var customFont by intPref(key = "PREF_CUSTOM_FONT", default = Constants.CUSTOM_FONT_GOOGLE_SANS)
|
||||
var customFontFile by stringPref(default = "")
|
||||
var customFontName by stringPref(default = "")
|
||||
var customFontVariant by stringPref(default = "regular")
|
||||
var showNextEvent by booleanPref(key = "PREF_SHOW_NEXT_EVENT", default = true)
|
||||
|
||||
var showDividers by booleanPref(default = true)
|
||||
@ -122,6 +123,7 @@ object Preferences : KotprefModel() {
|
||||
var mediaPlayerAlbum by stringPref(default = "")
|
||||
var mediaPlayerArtist by stringPref(default = "")
|
||||
var mediaPlayerPackage by stringPref(default = "")
|
||||
var musicPlayersFilter by stringPref(default = "")
|
||||
|
||||
// Integrations
|
||||
var installedIntegrations by intPref(default = 0)
|
||||
|
@ -38,6 +38,8 @@ object MediaPlayerHelper {
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
emptyList<MediaController>()
|
||||
}.filter {
|
||||
Preferences.musicPlayersFilter == "" || isMusicPlayerAccepted(it.packageName)
|
||||
}
|
||||
|
||||
if (list.isNotEmpty()) {
|
||||
@ -89,4 +91,14 @@ object MediaPlayerHelper {
|
||||
remove(Preferences::mediaPlayerPackage)
|
||||
}
|
||||
}
|
||||
|
||||
fun isMusicPlayerAccepted(appPkg: String): Boolean = Preferences.musicPlayersFilter.contains(appPkg)
|
||||
|
||||
fun toggleMusicPlayerFilter(appPkg: String) {
|
||||
if (Preferences.musicPlayersFilter == "" || !Preferences.musicPlayersFilter.contains(appPkg)) {
|
||||
Preferences.musicPlayersFilter = Preferences.musicPlayersFilter.split(",").union(listOf(appPkg)).joinToString(separator = ",")
|
||||
} else {
|
||||
Preferences.musicPlayersFilter = Preferences.musicPlayersFilter.split(",").filter { it != appPkg }.joinToString(separator = ",")
|
||||
}
|
||||
}
|
||||
}
|
@ -56,10 +56,9 @@ object SettingsStringHelper {
|
||||
|
||||
fun getCustomFontLabel(context: Context, font: Int): String {
|
||||
return when (font) {
|
||||
0 -> context.getString(R.string.custom_font_subtitle_0)
|
||||
Constants.CUSTOM_FONT_GOOGLE_SANS -> context.getString(R.string.custom_font_subtitle_1)
|
||||
Constants.CUSTOM_FONT_DOWNLOADED -> Preferences.customFontName
|
||||
else -> context.getString(R.string.custom_font_subtitle_1)
|
||||
Constants.CUSTOM_FONT_GOOGLE_SANS -> context.getString(R.string.custom_font_subtitle_1) + " - ${getVariantLabel(context, Preferences.customFontVariant)}"
|
||||
Constants.CUSTOM_FONT_DOWNLOADED -> Preferences.customFontName + " - ${getVariantLabel(context, Preferences.customFontVariant)}"
|
||||
else -> context.getString(R.string.custom_font_subtitle_0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi
|
||||
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
|
||||
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
|
||||
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
|
||||
import com.tommasoberlose.anotherwidget.utils.isDarkTheme
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
|
||||
@ -46,14 +47,14 @@ object WeatherHelper {
|
||||
MainWidget.updateWidget(context)
|
||||
}
|
||||
|
||||
fun getWeatherIconResource(icon: String, style: Int = Preferences.weatherIconPack): Int {
|
||||
fun getWeatherIconResource(context: Context, icon: String, style: Int = Preferences.weatherIconPack): Int {
|
||||
return when (icon) {
|
||||
"01d" -> {
|
||||
when (style) {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.clear_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_day_4
|
||||
else -> R.drawable.clear_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.clear_day_5 else R.drawable.clear_day_5_light
|
||||
}
|
||||
}
|
||||
"02d" -> {
|
||||
@ -61,7 +62,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_4
|
||||
else -> R.drawable.partly_cloudy
|
||||
else -> if (context.isDarkTheme()) R.drawable.partly_cloudy_5 else R.drawable.partly_cloudy_5_light
|
||||
}
|
||||
}
|
||||
"03d" -> {
|
||||
@ -69,7 +70,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_4
|
||||
else -> R.drawable.mostly_cloudy
|
||||
else -> if (context.isDarkTheme()) R.drawable.mostly_cloudy_5 else R.drawable.mostly_cloudy_5_light
|
||||
}
|
||||
}
|
||||
"04d" -> {
|
||||
@ -77,7 +78,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4
|
||||
else -> R.drawable.cloudy_weather
|
||||
else -> if (context.isDarkTheme()) R.drawable.cloudy_weather_5 else R.drawable.cloudy_weather_5_light
|
||||
}
|
||||
}
|
||||
"09d" -> {
|
||||
@ -85,7 +86,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_day_4
|
||||
else -> R.drawable.storm_weather_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.storm_weather_day_5 else R.drawable.storm_weather_day_5_light
|
||||
}
|
||||
}
|
||||
"10d" -> {
|
||||
@ -93,7 +94,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_day_4
|
||||
else -> R.drawable.rainy_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.rainy_day_5 else R.drawable.rainy_day_5_light
|
||||
}
|
||||
}
|
||||
"11d" -> {
|
||||
@ -101,7 +102,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_day_4
|
||||
else -> R.drawable.thunder_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.thunder_day_5 else R.drawable.thunder_day_5_light
|
||||
}
|
||||
}
|
||||
"13d" -> {
|
||||
@ -109,7 +110,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.snow_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_day_4
|
||||
else -> R.drawable.snow_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.snow_day_5 else R.drawable.snow_day_5_light
|
||||
}
|
||||
}
|
||||
"50d" -> {
|
||||
@ -117,7 +118,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_day_4
|
||||
else -> R.drawable.haze_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.haze_day_5 else R.drawable.haze_day_5_light
|
||||
}
|
||||
}
|
||||
"80d" -> {
|
||||
@ -125,7 +126,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.windy_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_day_4
|
||||
else -> R.drawable.windy_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.windy_day_5 else R.drawable.windy_day_5_light
|
||||
}
|
||||
}
|
||||
"81d" -> {
|
||||
@ -133,7 +134,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_day_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_day_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_day_4
|
||||
else -> R.drawable.rain_snow_day
|
||||
else -> if (context.isDarkTheme()) R.drawable.rain_snow_day_5 else R.drawable.rain_snow_day_5_light
|
||||
}
|
||||
}
|
||||
"82d" -> {
|
||||
@ -141,7 +142,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4
|
||||
else -> R.drawable.haze_weather
|
||||
else -> if (context.isDarkTheme()) R.drawable.haze_weather_5 else R.drawable.haze_weather_5_light
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +153,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.clear_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.clear_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.clear_night_4
|
||||
else -> R.drawable.clear_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.clear_night_5 else R.drawable.clear_night_5_light
|
||||
}
|
||||
}
|
||||
"02n" -> {
|
||||
@ -160,7 +161,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.partly_cloudy_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.partly_cloudy_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.partly_cloudy_night_4
|
||||
else -> R.drawable.partly_cloudy_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.partly_cloudy_night_5 else R.drawable.partly_cloudy_night_5_light
|
||||
}
|
||||
}
|
||||
"03n" -> {
|
||||
@ -168,7 +169,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.mostly_cloudy_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.mostly_cloudy_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.mostly_cloudy_night_4
|
||||
else -> R.drawable.mostly_cloudy_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.mostly_cloudy_night_5 else R.drawable.mostly_cloudy_night_5_light
|
||||
}
|
||||
}
|
||||
"04n" -> {
|
||||
@ -176,7 +177,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.cloudy_weather_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.cloudy_weather_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.cloudy_weather_4
|
||||
else -> R.drawable.cloudy_weather
|
||||
else -> if (context.isDarkTheme()) R.drawable.cloudy_weather_5 else R.drawable.cloudy_weather_5_light
|
||||
}
|
||||
}
|
||||
"09n" -> {
|
||||
@ -184,7 +185,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.storm_weather_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.storm_weather_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.storm_weather_night_4
|
||||
else -> R.drawable.storm_weather_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.storm_weather_night_5 else R.drawable.storm_weather_night_5_light
|
||||
}
|
||||
}
|
||||
"10n" -> {
|
||||
@ -192,7 +193,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.rainy_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rainy_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rainy_night_4
|
||||
else -> R.drawable.rainy_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.rainy_night_5 else R.drawable.rainy_night_5_light
|
||||
}
|
||||
}
|
||||
"11n" -> {
|
||||
@ -200,7 +201,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.thunder_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.thunder_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.thunder_night_4
|
||||
else -> R.drawable.thunder_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.thunder_night_5 else R.drawable.thunder_night_5_light
|
||||
}
|
||||
}
|
||||
"13n" -> {
|
||||
@ -208,7 +209,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.snow_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.snow_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.snow_night_4
|
||||
else -> R.drawable.snow_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.snow_night_5 else R.drawable.snow_night_5_light
|
||||
}
|
||||
}
|
||||
"50n" -> {
|
||||
@ -216,7 +217,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_night_4
|
||||
else -> R.drawable.haze_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.haze_night_5 else R.drawable.haze_night_5_light
|
||||
}
|
||||
}
|
||||
"80n" -> {
|
||||
@ -224,7 +225,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.windy_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.windy_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.windy_night_4
|
||||
else -> R.drawable.windy_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.windy_night_5 else R.drawable.windy_night_5_light
|
||||
}
|
||||
}
|
||||
"81n" -> {
|
||||
@ -232,7 +233,7 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.rain_snow_night_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.rain_snow_night_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.rain_snow_night_4
|
||||
else -> R.drawable.rain_snow_night
|
||||
else -> if (context.isDarkTheme()) R.drawable.rain_snow_night_5 else R.drawable.rain_snow_night_5_light
|
||||
}
|
||||
}
|
||||
"82n" -> {
|
||||
@ -240,11 +241,11 @@ object WeatherHelper {
|
||||
Constants.WeatherIconPack.COOL.value -> R.drawable.haze_weather_3
|
||||
Constants.WeatherIconPack.MINIMAL.value -> R.drawable.haze_weather_2
|
||||
Constants.WeatherIconPack.GOOGLE_NEWS.value -> R.drawable.haze_weather_4
|
||||
else -> R.drawable.haze_weather
|
||||
else -> if (context.isDarkTheme()) R.drawable.haze_weather_5 else R.drawable.haze_weather_5_light
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
return R.drawable.unknown
|
||||
return if (context.isDarkTheme()) R.drawable.unknown_dark else R.drawable.unknown_light
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,19 +108,19 @@ class UpdateCalendarJob : JobIntentService() {
|
||||
|
||||
if (date.get(Calendar.DAY_OF_YEAR) == date1.get(Calendar.DAY_OF_YEAR) && date.get(Calendar.YEAR) == date1.get(Calendar.YEAR)) {
|
||||
if (event.allDay && event1.allDay) {
|
||||
event1.startDate.compareTo(event.startDate)
|
||||
event.startDate.compareTo(event1.startDate)
|
||||
} else if (event.allDay) {
|
||||
-1
|
||||
} else if (event1.allDay) {
|
||||
1
|
||||
} else if (event1.allDay) {
|
||||
-1
|
||||
} else {
|
||||
event1.startDate.compareTo(event.startDate)
|
||||
event.startDate.compareTo(event1.startDate)
|
||||
}
|
||||
} else {
|
||||
event1.startDate.compareTo(event.startDate)
|
||||
event.startDate.compareTo(event1.startDate)
|
||||
}
|
||||
})
|
||||
eventList.reverse()
|
||||
|
||||
eventRepository.saveEvents(
|
||||
eventList
|
||||
)
|
||||
|
@ -63,6 +63,31 @@ class CustomFontActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
adapter
|
||||
.register<String>(R.layout.list_item) { item, injector ->
|
||||
injector
|
||||
.text(R.id.text, item)
|
||||
.with<TextView>(R.id.text) {
|
||||
val googleSans: Typeface = when (Preferences.customFontVariant) {
|
||||
"100" -> Typeface.createFromAsset(this.assets, "fonts/google_sans_thin.ttf")
|
||||
"200" -> Typeface.createFromAsset(this.assets, "fonts/google_sans_light.ttf")
|
||||
"500" -> Typeface.createFromAsset(this.assets, "fonts/google_sans_medium.ttf")
|
||||
"700" -> Typeface.createFromAsset(this.assets, "fonts/google_sans_bold.ttf")
|
||||
"800" -> Typeface.createFromAsset(this.assets, "fonts/google_sans_black.ttf")
|
||||
else -> Typeface.createFromAsset(this.assets, "fonts/google_sans_regular.ttf")
|
||||
}
|
||||
it.typeface = googleSans
|
||||
}
|
||||
|
||||
injector.clicked(R.id.text) {
|
||||
val dialog = BottomSheetMenu<String>(this, header = item)
|
||||
listOf("100", "200", "regular", "500", "700", "800").forEachIndexed { index, s ->
|
||||
dialog.addItem(SettingsStringHelper.getVariantLabel(this, s), s)
|
||||
}
|
||||
dialog.addOnSelectItemListener { value ->
|
||||
saveGoogleSansFont(value)
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
.register<Font>(R.layout.list_item) { item, injector ->
|
||||
injector
|
||||
.text(R.id.text, item.fontFamily)
|
||||
@ -101,19 +126,20 @@ class CustomFontActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
injector.clicked(R.id.text) {
|
||||
if (item.fontVariants.size <= 1) {
|
||||
saveFont(item)
|
||||
} else {
|
||||
val dialog = BottomSheetMenu<Int>(this, header = item.fontFamily)
|
||||
item.fontVariants.filter { !it.contains("italic") }.forEachIndexed { index, s ->
|
||||
if (item.fontVariants.isEmpty()) {
|
||||
dialog.addItem(SettingsStringHelper.getVariantLabel(this, "regular"), -1)
|
||||
} else {
|
||||
item.fontVariants.filter { !it.contains("italic") }
|
||||
.forEachIndexed { index, s ->
|
||||
dialog.addItem(SettingsStringHelper.getVariantLabel(this, s), index)
|
||||
}
|
||||
}
|
||||
dialog.addOnSelectItemListener { value ->
|
||||
saveFont(item, value)
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
.attachTo(list_view)
|
||||
|
||||
setupListener()
|
||||
@ -146,13 +172,33 @@ class CustomFontActivity : AppCompatActivity() {
|
||||
filterJob = lifecycleScope.launch(Dispatchers.IO) {
|
||||
if (list != null && list.isNotEmpty()) {
|
||||
delay(200)
|
||||
val filteredList: List<Font> = if (search == null || search == "") {
|
||||
list
|
||||
val filteredList: List<Any> = if (search == null || search == "") {
|
||||
listOf(getString(R.string.custom_font_subtitle_1)) + list.distinctBy { it.fontFamily }
|
||||
} else {
|
||||
list.filter {
|
||||
(listOf(getString(R.string.custom_font_subtitle_1)) + list.distinctBy { it.fontFamily }).filter {
|
||||
when (it) {
|
||||
is Font -> {
|
||||
it.fontFamily.contains(search, true)
|
||||
}
|
||||
}.distinctBy { it.fontFamily }
|
||||
is String -> {
|
||||
it.contains(search, ignoreCase = true)
|
||||
}
|
||||
else -> {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}.sortedWith { el1, el2 ->
|
||||
if (el1 is Font && el2 is Font) {
|
||||
el1.fontFamily.compareTo(el2.fontFamily)
|
||||
} else if (el1 is Font && el2 is String) {
|
||||
el1.fontFamily.compareTo(el2)
|
||||
} else if (el1 is String && el2 is Font) {
|
||||
el1.compareTo(el2.fontFamily)
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
adapter.updateData(filteredList)
|
||||
loader.visibility = View.INVISIBLE
|
||||
@ -172,7 +218,20 @@ class CustomFontActivity : AppCompatActivity() {
|
||||
Preferences.blockingBulk {
|
||||
customFont = Constants.CUSTOM_FONT_DOWNLOADED
|
||||
customFontName = font.fontFamily
|
||||
customFontFile = if (variantPos != null) font.getQueryString(variantPos) else font.queryString
|
||||
customFontFile = if (variantPos != null && variantPos > -1) font.getQueryString(variantPos) else font.queryString
|
||||
customFontVariant = if (variantPos != null && variantPos > -1) font.fontVariants[variantPos] else "regular"
|
||||
}
|
||||
setResult(Activity.RESULT_OK, resultIntent)
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun saveGoogleSansFont(variant: String) {
|
||||
val resultIntent = Intent()
|
||||
Preferences.blockingBulk {
|
||||
customFont = Constants.CUSTOM_FONT_GOOGLE_SANS
|
||||
customFontName = ""
|
||||
customFontFile = ""
|
||||
customFontVariant = variant
|
||||
}
|
||||
setResult(Activity.RESULT_OK, resultIntent)
|
||||
finish()
|
||||
|
@ -0,0 +1,141 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.activities
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.bumptech.glide.Glide
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityChooseApplicationBinding
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityMusicPlayersFilterBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.ChooseApplicationViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.MusicPlayersFilterViewModel
|
||||
import kotlinx.android.synthetic.main.activity_choose_application.*
|
||||
import kotlinx.android.synthetic.main.activity_choose_application.list_view
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
import kotlin.Comparator as Comparator1
|
||||
|
||||
|
||||
class MusicPlayersFilterActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var adapter: SlimAdapter
|
||||
private lateinit var viewModel: MusicPlayersFilterViewModel
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
viewModel = ViewModelProvider(this).get(MusicPlayersFilterViewModel::class.java)
|
||||
val binding = DataBindingUtil.setContentView<ActivityMusicPlayersFilterBinding>(this, R.layout.activity_music_players_filter)
|
||||
|
||||
list_view.setHasFixedSize(true)
|
||||
val mLayoutManager = LinearLayoutManager(this)
|
||||
list_view.layoutManager = mLayoutManager
|
||||
|
||||
adapter = SlimAdapter.create()
|
||||
adapter
|
||||
.register<ResolveInfo>(R.layout.application_info_layout) { item, injector ->
|
||||
injector
|
||||
.text(R.id.text, item.loadLabel(viewModel.pm))
|
||||
.with<ImageView>(R.id.icon) {
|
||||
Glide
|
||||
.with(this)
|
||||
.load(item.loadIcon(viewModel.pm))
|
||||
.centerCrop()
|
||||
.into(it)
|
||||
}
|
||||
.visible(R.id.checkBox)
|
||||
.clicked(R.id.item) {
|
||||
toggleApp(item)
|
||||
adapter.notifyItemRangeChanged(0, adapter.data.size)
|
||||
}
|
||||
.clicked(R.id.checkBox) {
|
||||
toggleApp(item)
|
||||
adapter.notifyItemRangeChanged(0, adapter.data.size)
|
||||
}
|
||||
.checked(R.id.checkBox, MediaPlayerHelper.isMusicPlayerAccepted(item.activityInfo.packageName))
|
||||
}
|
||||
.attachTo(list_view)
|
||||
|
||||
setupListener()
|
||||
subscribeUi(binding, viewModel)
|
||||
|
||||
search.requestFocus()
|
||||
}
|
||||
|
||||
private var filterJob: Job? = null
|
||||
|
||||
private fun subscribeUi(binding: ActivityMusicPlayersFilterBinding, viewModel: MusicPlayersFilterViewModel) {
|
||||
binding.viewModel = viewModel
|
||||
|
||||
viewModel.appList.observe(this, Observer {
|
||||
updateList(list = it)
|
||||
loader.visibility = View.INVISIBLE
|
||||
})
|
||||
|
||||
viewModel.searchInput.observe(this, Observer { search ->
|
||||
updateList(search = search)
|
||||
})
|
||||
|
||||
viewModel.musicPlayersFilter.observe(this, {
|
||||
updateList()
|
||||
})
|
||||
}
|
||||
|
||||
private fun updateList(list: List<ResolveInfo>? = viewModel.appList.value, search: String? = viewModel.searchInput.value) {
|
||||
loader.visibility = View.VISIBLE
|
||||
filterJob?.cancel()
|
||||
filterJob = lifecycleScope.launch(Dispatchers.IO) {
|
||||
if (list != null && list.isNotEmpty()) {
|
||||
delay(200)
|
||||
val filteredList: List<ResolveInfo> = if (search == null || search == "") {
|
||||
list
|
||||
} else {
|
||||
list.filter {
|
||||
it.loadLabel(viewModel.pm).contains(search, true)
|
||||
}
|
||||
}.sortedWith { app1, app2 ->
|
||||
if (MediaPlayerHelper.isMusicPlayerAccepted(app1.activityInfo.packageName) && MediaPlayerHelper.isMusicPlayerAccepted(app2.activityInfo.packageName)) {
|
||||
app1.loadLabel(viewModel.pm).toString().compareTo(app2.loadLabel(viewModel.pm).toString(), ignoreCase = true)
|
||||
} else if (MediaPlayerHelper.isMusicPlayerAccepted(app1.activityInfo.packageName)) {
|
||||
-1
|
||||
} else if (MediaPlayerHelper.isMusicPlayerAccepted(app2.activityInfo.packageName)) {
|
||||
1
|
||||
} else {
|
||||
app1.loadLabel(viewModel.pm).toString().compareTo(app2.loadLabel(viewModel.pm).toString(), ignoreCase = true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
adapter.updateData(filteredList)
|
||||
loader.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupListener() {
|
||||
action_back.setOnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleApp(app: ResolveInfo) {
|
||||
MediaPlayerHelper.toggleMusicPlayerFilter(app.activityInfo.packageName)
|
||||
}
|
||||
}
|
@ -302,6 +302,13 @@ class GeneralTabFragment : Fragment() {
|
||||
}
|
||||
})
|
||||
|
||||
viewModel.customFontVariant.observe(viewLifecycleOwner, Observer {
|
||||
maintainScrollPosition {
|
||||
custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
|
||||
MainWidget.updateWidget(requireContext())
|
||||
}
|
||||
})
|
||||
|
||||
viewModel.showDividers.observe(viewLifecycleOwner, Observer {
|
||||
maintainScrollPosition {
|
||||
show_dividers_label?.text =
|
||||
@ -481,11 +488,14 @@ class GeneralTabFragment : Fragment() {
|
||||
|
||||
action_custom_font.setOnClickListener {
|
||||
val dialog = BottomSheetMenu<Int>(requireContext(), header = getString(R.string.settings_custom_font_title)).setSelectedValue(Preferences.customFont)
|
||||
(0..1).forEach {
|
||||
dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), it), it)
|
||||
dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), 0), 0)
|
||||
|
||||
if (Preferences.customFont == Constants.CUSTOM_FONT_GOOGLE_SANS) {
|
||||
dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), Constants.CUSTOM_FONT_GOOGLE_SANS), Constants.CUSTOM_FONT_GOOGLE_SANS)
|
||||
}
|
||||
|
||||
if (Preferences.customFontFile != "") {
|
||||
dialog.addItem(Preferences.customFontName, Constants.CUSTOM_FONT_DOWNLOADED)
|
||||
dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont), Constants.CUSTOM_FONT_DOWNLOADED)
|
||||
}
|
||||
dialog.addItem(getString(R.string.action_custom_font_to_search), Constants.CUSTOM_FONT_DOWNLOAD_NEW)
|
||||
dialog.addOnSelectItemListener { value ->
|
||||
@ -499,6 +509,7 @@ class GeneralTabFragment : Fragment() {
|
||||
customFont = value
|
||||
customFontFile = ""
|
||||
customFontName = ""
|
||||
customFontVariant = ""
|
||||
}
|
||||
}
|
||||
}.show()
|
||||
|
@ -44,6 +44,7 @@ import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
|
||||
import com.tommasoberlose.anotherwidget.receivers.ActivityDetectionReceiver
|
||||
import com.tommasoberlose.anotherwidget.receivers.ActivityDetectionReceiver.Companion.FITNESS_OPTIONS
|
||||
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
|
||||
import com.tommasoberlose.anotherwidget.ui.activities.MusicPlayersFilterActivity
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
|
||||
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
|
||||
import com.tommasoberlose.anotherwidget.utils.checkIfFitInstalled
|
||||
@ -136,6 +137,9 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
})
|
||||
|
||||
viewModel.musicPlayersFilter.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun setupListener() {
|
||||
@ -242,6 +246,10 @@ class GlanceTabFragment : Fragment() {
|
||||
CustomNotesDialog(requireContext()).show()
|
||||
}
|
||||
}
|
||||
|
||||
action_filter_music_players.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), MusicPlayersFilterActivity::class.java))
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNextAlarmWarningUi() {
|
||||
|
@ -26,6 +26,7 @@ class MainViewModel : ViewModel() {
|
||||
val customFont = Preferences.asLiveData(Preferences::customFont)
|
||||
val customFontFile = Preferences.asLiveData(Preferences::customFontFile)
|
||||
val customFontName = Preferences.asLiveData(Preferences::customFontName)
|
||||
val customFontVariant = Preferences.asLiveData(Preferences::customFontVariant)
|
||||
val secondRowInformation = Preferences.asLiveData(Preferences::secondRowInformation)
|
||||
val showDividers = Preferences.asLiveData(Preferences::showDividers)
|
||||
val secondRowTopMargin = Preferences.asLiveData(Preferences::secondRowTopMargin)
|
||||
@ -77,6 +78,7 @@ class MainViewModel : ViewModel() {
|
||||
val showBatteryCharging = Preferences.asLiveData(Preferences::showBatteryCharging)
|
||||
val showDailySteps = Preferences.asLiveData(Preferences::showDailySteps)
|
||||
val customInfo = Preferences.asLiveData(Preferences::customNotes)
|
||||
val musicPlayersFilter = Preferences.asLiveData(Preferences::musicPlayersFilter)
|
||||
|
||||
// Advanced Settings
|
||||
val darkThemePreference = Preferences.asLiveData(Preferences::darkThemePreference)
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.*
|
||||
import com.chibatching.kotpref.livedata.asLiveData
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class MusicPlayersFilterViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
val pm: PackageManager by lazy { application.packageManager }
|
||||
val appList: MutableLiveData<List<ResolveInfo>> = MutableLiveData()
|
||||
val searchInput: MutableLiveData<String> = MutableLiveData("")
|
||||
var musicPlayersFilter = Preferences.asLiveData(Preferences::musicPlayersFilter)
|
||||
|
||||
init {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val mainIntent = Intent(Intent.ACTION_MAIN, null).apply {
|
||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
}
|
||||
|
||||
val app = application.packageManager.queryIntentActivities(mainIntent, 0)
|
||||
val sortedApp = app.sortedWith(Comparator { app1: ResolveInfo, app2: ResolveInfo ->
|
||||
app1.loadLabel(pm).toString().compareTo(app2.loadLabel(pm).toString())
|
||||
})
|
||||
withContext(Dispatchers.Main) {
|
||||
appList.postValue(sortedApp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -507,6 +507,8 @@ class MainWidget : AppWidgetProvider() {
|
||||
val eventRepository = EventRepository(context)
|
||||
val v = View.inflate(context, R.layout.the_widget, null)
|
||||
|
||||
v.loader.isVisible = false
|
||||
|
||||
val now = Calendar.getInstance().apply {
|
||||
set(Calendar.SECOND, 0)
|
||||
set(Calendar.MILLISECOND, 0)
|
||||
@ -841,8 +843,15 @@ class MainWidget : AppWidgetProvider() {
|
||||
|
||||
// Custom Font
|
||||
if (Preferences.customFont == Constants.CUSTOM_FONT_GOOGLE_SANS) {
|
||||
val googleSans: Typeface =
|
||||
Typeface.createFromAsset(context.assets, "fonts/google_sans_regular.ttf")
|
||||
val googleSans: Typeface = when (Preferences.customFontVariant) {
|
||||
"100" -> Typeface.createFromAsset(context.assets, "fonts/google_sans_thin.ttf")
|
||||
"200" -> Typeface.createFromAsset(context.assets, "fonts/google_sans_light.ttf")
|
||||
"500" -> Typeface.createFromAsset(context.assets, "fonts/google_sans_medium.ttf")
|
||||
"700" -> Typeface.createFromAsset(context.assets, "fonts/google_sans_bold.ttf")
|
||||
"800" -> Typeface.createFromAsset(context.assets, "fonts/google_sans_black.ttf")
|
||||
else -> Typeface.createFromAsset(context.assets, "fonts/google_sans_regular.ttf")
|
||||
}
|
||||
|
||||
listOf<TextView>(
|
||||
v.empty_date,
|
||||
v.divider1,
|
||||
@ -892,17 +901,9 @@ class MainWidget : AppWidgetProvider() {
|
||||
v.empty_weather_icon.visibility = View.GONE
|
||||
v.special_weather_icon.visibility = View.GONE
|
||||
} else {
|
||||
v.weather_icon.setImageResource(WeatherHelper.getWeatherIconResource(icon))
|
||||
v.empty_weather_icon.setImageResource(
|
||||
WeatherHelper.getWeatherIconResource(
|
||||
icon
|
||||
)
|
||||
)
|
||||
v.special_weather_icon.setImageResource(
|
||||
WeatherHelper.getWeatherIconResource(
|
||||
icon
|
||||
)
|
||||
)
|
||||
v.weather_icon.setImageResource(WeatherHelper.getWeatherIconResource(context, icon))
|
||||
v.empty_weather_icon.setImageResource(WeatherHelper.getWeatherIconResource(context, icon))
|
||||
v.special_weather_icon.setImageResource(WeatherHelper.getWeatherIconResource(context, icon))
|
||||
v.weather_icon.visibility = View.VISIBLE
|
||||
v.empty_weather_icon.visibility = View.VISIBLE
|
||||
v.special_weather_icon.visibility = View.VISIBLE
|
||||
|
BIN
app/src/main/res/drawable-hdpi/round_radio.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
app/src/main/res/drawable-hdpi/round_radio_white_18.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
app/src/main/res/drawable-hdpi/round_radio_white_36.png
Normal file
After Width: | Height: | Size: 493 B |
BIN
app/src/main/res/drawable-hdpi/round_radio_white_48.png
Normal file
After Width: | Height: | Size: 595 B |
BIN
app/src/main/res/drawable-mdpi/round_radio.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
app/src/main/res/drawable-mdpi/round_radio_white_18.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
app/src/main/res/drawable-mdpi/round_radio_white_36.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
app/src/main/res/drawable-mdpi/round_radio_white_48.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
app/src/main/res/drawable-xhdpi/round_radio.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
app/src/main/res/drawable-xhdpi/round_radio_white_18.png
Normal file
After Width: | Height: | Size: 345 B |
BIN
app/src/main/res/drawable-xhdpi/round_radio_white_36.png
Normal file
After Width: | Height: | Size: 595 B |
BIN
app/src/main/res/drawable-xhdpi/round_radio_white_48.png
Normal file
After Width: | Height: | Size: 772 B |
BIN
app/src/main/res/drawable-xxhdpi/round_radio.png
Normal file
After Width: | Height: | Size: 595 B |
BIN
app/src/main/res/drawable-xxhdpi/round_radio_white_18.png
Normal file
After Width: | Height: | Size: 493 B |
BIN
app/src/main/res/drawable-xxhdpi/round_radio_white_36.png
Normal file
After Width: | Height: | Size: 869 B |
BIN
app/src/main/res/drawable-xxhdpi/round_radio_white_48.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/round_radio.png
Normal file
After Width: | Height: | Size: 772 B |
BIN
app/src/main/res/drawable-xxxhdpi/round_radio_white_18.png
Normal file
After Width: | Height: | Size: 595 B |
BIN
app/src/main/res/drawable-xxxhdpi/round_radio_white_36.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/round_radio_white_48.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable/clear_day_5.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable/clear_day_5_light.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable/clear_night_5.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable/clear_night_5_light.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable/cloudy_weather_5.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable/cloudy_weather_5_light.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable/haze_day_5.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable/haze_day_5_light.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable/haze_night_5.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/drawable/haze_night_5_light.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable/haze_weather_5.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable/haze_weather_5_light.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/drawable/mostly_cloudy_5.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/drawable/mostly_cloudy_5_light.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/main/res/drawable/mostly_cloudy_night_5.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable/mostly_cloudy_night_5_light.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_5.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_5_light.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_night_5.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_night_5_light.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable/rain_snow_5.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/drawable/rain_snow_5_light.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/rain_snow_day_5.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/drawable/rain_snow_day_5_light.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/rain_snow_night_5.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/drawable/rain_snow_night_5_light.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/rainy_day_5.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable/rainy_day_5_light.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable/rainy_night_5.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable/rainy_night_5_light.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/rainy_weather_5.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable/rainy_weather_5_light.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
10
app/src/main/res/drawable/round_radio_24.xml
Normal 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="M3.24,6.15C2.51,6.43 2,7.17 2,8v12c0,1.1 0.9,2 2,2h16c1.11,0 2,-0.9 2,-2L22,8c0,-1.1 -0.9,-2 -2,-2L8.3,6l7.43,-3c0.46,-0.19 0.68,-0.71 0.49,-1.17 -0.19,-0.46 -0.71,-0.68 -1.17,-0.49L3.24,6.15zM7,20c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM20,12h-2v-1c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v1L4,12L4,9c0,-0.55 0.45,-1 1,-1h14c0.55,0 1,0.45 1,1v3z"/>
|
||||
</vector>
|
BIN
app/src/main/res/drawable/showcase_5.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable/showcase_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/snow_day_5.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable/snow_day_5_light.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/drawable/snow_night_5.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable/snow_night_5_light.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/drawable/snow_weather_5.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable/snow_weather_5_light.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable/storm_weather_5.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/storm_weather_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/storm_weather_day_5.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable/storm_weather_day_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/storm_weather_night_5.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/drawable/storm_weather_night_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/thunder_day_5.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable/thunder_day_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/thunder_night_5.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable/thunder_night_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/thunder_weather_5.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/thunder_weather_5_light.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/unknown_dark.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable/unknown_light.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable/windy_day_5.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/windy_day_5_light.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable/windy_night_5.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/windy_night_5_light.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable/windy_weather_5.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/windy_weather_5_light.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
113
app/src/main/res/layout/activity_music_players_filter.xml
Normal file
@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.MusicPlayersFilterViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
tools:context="com.tommasoberlose.anotherwidget.ui.activities.MusicPlayersFilterActivity">
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="0dp"
|
||||
android:id="@+id/toolbar"
|
||||
app:cardBackgroundColor="@color/colorPrimary">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="10dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_centerVertical="true"
|
||||
android:id="@+id/action_back"
|
||||
android:layout_alignParentLeft="true"
|
||||
app:tint="@color/colorPrimaryText"
|
||||
android:src="@drawable/round_arrow_back" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="@string/settings_music_players_filter_title"
|
||||
android:gravity="center"
|
||||
style="@style/AnotherWidget.Main.Title"/>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="10dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:layout_centerVertical="true"
|
||||
android:id="@+id/action_filter"
|
||||
android:layout_alignParentRight="true"
|
||||
android:visibility="gone"
|
||||
app:tint="@color/colorPrimaryText"
|
||||
android:src="@drawable/round_filter_list" />
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardBackgroundColor="@color/colorPrimary">
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="@color/colorPrimaryDark"
|
||||
app:cardCornerRadius="9dp"
|
||||
app:cardElevation="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:inputType="textCapWords"
|
||||
android:textColor="@color/colorPrimaryText"
|
||||
android:textColorHint="@color/colorSecondaryText"
|
||||
android:textAlignment="viewStart"
|
||||
android:id="@+id/search"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:gravity="center_vertical|start"
|
||||
android:hint="@string/search"
|
||||
android:text="@={viewModel.searchInput}"
|
||||
android:autofillHints="" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@color/colorAccent"
|
||||
android:layout_marginTop="-7dp"
|
||||
android:id="@+id/loader"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/list_view" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
@ -26,7 +26,8 @@
|
||||
tools:ignore="HardcodedText" />
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|start"
|
||||
android:paddingEnd="24dp"
|
||||
@ -36,4 +37,10 @@
|
||||
android:ellipsize="end"
|
||||
android:textColor="@color/colorPrimaryText"
|
||||
style="@style/AnotherWidget.Settings.Title"/>
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/checkBox"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
@ -86,7 +86,7 @@
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
app:tint="@color/colorPrimaryText"
|
||||
android:src="@drawable/round_alarm"/>
|
||||
android:src="@drawable/round_schedule"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
|
@ -338,7 +338,7 @@
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:padding="11dp"
|
||||
android:src="@drawable/round_flip_to_front"
|
||||
app:tint="@color/colorPrimaryText"/>
|
||||
<LinearLayout
|
||||
@ -359,6 +359,43 @@
|
||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_filter_music_players"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/round_radio"
|
||||
app:tint="@color/colorPrimaryText"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
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:text="@string/settings_music_players_filter_title"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_music_players_filter_subtitle"
|
||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|