diff --git a/app/build.gradle b/app/build.gradle
index c6d9530..cb12d3d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -18,8 +18,8 @@ android {
applicationId "com.tommasoberlose.anotherwidget"
minSdkVersion 23
targetSdkVersion 29
- versionCode 79
- versionName "2.0.5"
+ versionCode 80
+ versionName "2.0.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 41a05f7..95c24f6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -139,6 +139,12 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt
index 12a4dd3..48ddf16 100755
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt
@@ -9,6 +9,7 @@ object Preferences : KotprefModel() {
var darkThemePreference by intPref(default = MODE_NIGHT_FOLLOW_SYSTEM)
+ // Calendar and weather
var showEvents by booleanPref(key = "PREF_SHOW_EVENTS", default = false)
var showWeather by booleanPref(key = "PREF_SHOW_WEATHER", default = false)
var weatherIcon by stringPref(key = "PREF_WEATHER_ICON", default = "")
@@ -48,6 +49,7 @@ object Preferences : KotprefModel() {
var clockTextColor by stringPref(default = "#FFFFFF")
var clockTextAlpha by stringPref(default = "FF")
+ // Global
var textMainSize by floatPref(key = "PREF_TEXT_MAIN_SIZE", default = 26f)
var textSecondSize by floatPref(key = "PREF_TEXT_SECOND_SIZE", default = 18f)
var clockTextSize by floatPref(key = "PREF_TEXT_CLOCK_SIZE", default = 90f)
@@ -64,9 +66,18 @@ object Preferences : KotprefModel() {
var customFontFile by stringPref(key = "PREF_CUSTOM_FONT_FILE")
var showNextEvent by booleanPref(key = "PREF_SHOW_NEXT_EVENT", default = true)
+ // Settings
var showWallpaper by booleanPref(default = true)
var showBigClockWarning by booleanPref(default = true)
var showWeatherWarning by booleanPref(default = true)
var showPreview by booleanPref(default = true)
var showXiaomiWarning by booleanPref(default = true)
+
+ // Music
+ var showMusic by booleanPref(default = false)
+ var mediaInfoFormat by stringPref(default = "")
+ var mediaPlayerTitle by stringPref(default = "")
+ var mediaPlayerAlbum by stringPref(default = "")
+ var mediaPlayerArtist by stringPref(default = "")
+ var mediaPlayerPackage by stringPref(default = "")
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt
index c12d429..0822ea1 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/IntentHelper.kt
@@ -160,4 +160,22 @@ object IntentHelper {
}
}
}
+
+ fun getMusicIntent(context: Context): Intent {
+ return when (Preferences.mediaPlayerPackage) {
+ "" -> {
+ Intent()
+ }
+ else -> {
+ val pm: PackageManager = context.packageManager
+ try {
+ pm.getLaunchIntentForPackage(Preferences.mediaPlayerPackage)!!.apply {
+ addCategory(Intent.CATEGORY_LAUNCHER)
+ }
+ } catch (e: Exception) {
+ Intent()
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt
new file mode 100644
index 0000000..baf5fc3
--- /dev/null
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt
@@ -0,0 +1,88 @@
+package com.tommasoberlose.anotherwidget.helpers
+
+import android.app.Notification
+import android.content.ComponentName
+import android.content.Context
+import android.media.MediaMetadata
+import android.media.session.MediaController
+import android.media.session.MediaSession
+import android.media.session.MediaSessionManager
+import android.media.session.PlaybackState
+import android.util.Log
+import androidx.core.app.NotificationManagerCompat
+import com.chibatching.kotpref.bulk
+import com.tommasoberlose.anotherwidget.global.Preferences
+import com.tommasoberlose.anotherwidget.receivers.MusicNotificationListener
+import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
+import java.lang.Exception
+
+object MediaPlayerHelper {
+ fun isSomeonePlaying(context: Context) = Preferences.showMusic && NotificationManagerCompat.getEnabledListenerPackages(context).contains(context.packageName) && Preferences.mediaPlayerTitle != ""
+
+ fun getMediaInfo(): String {
+ return if (Preferences.mediaPlayerArtist == "") {
+ Preferences.mediaPlayerTitle
+ } else {
+ "%s, %s".format(Preferences.mediaPlayerTitle, Preferences.mediaPlayerArtist)
+ }
+ }
+
+ fun updatePlayingMediaInfo(context: Context) {
+ if (NotificationManagerCompat.getEnabledListenerPackages(context).contains(context.packageName)) {
+ val list = try {
+ (context.getSystemService(Context.MEDIA_SESSION_SERVICE) as MediaSessionManager).getActiveSessions(
+ ComponentName(context.packageName, MusicNotificationListener::class.java.name)
+ )
+ } catch (ex: Exception) {
+ emptyList()
+ }
+
+ if (list.isNotEmpty()) {
+ var isSomeonePlaying = false
+ list.forEach { mc ->
+ val metadata = mc.metadata
+ val isPlaying =
+ mc.playbackState?.state == PlaybackState.STATE_PLAYING || mc.playbackState?.state == PlaybackState.STATE_CONNECTING
+
+ if (isPlaying) {
+ isSomeonePlaying = true
+ if (metadata != null) {
+ Preferences.bulk {
+ mediaPlayerTitle =
+ metadata.getText(MediaMetadata.METADATA_KEY_TITLE)?.toString()
+ ?: ""
+ mediaPlayerArtist =
+ metadata.getText(MediaMetadata.METADATA_KEY_ARTIST)?.toString()
+ ?: ""
+ mediaPlayerAlbum =
+ metadata.getText(MediaMetadata.METADATA_KEY_ALBUM)?.toString()
+ ?: ""
+ }
+ }
+
+ Preferences.mediaPlayerPackage = mc.packageName
+ }
+ }
+
+ if (!isSomeonePlaying) {
+ removeMediaInfo()
+ }
+
+ } else {
+ removeMediaInfo()
+ }
+ } else {
+ removeMediaInfo()
+ }
+ MainWidget.updateWidget(context)
+ }
+
+ private fun removeMediaInfo() {
+ Preferences.bulk {
+ remove(Preferences::mediaPlayerTitle)
+ remove(Preferences::mediaPlayerArtist)
+ remove(Preferences::mediaPlayerAlbum)
+ remove(Preferences::mediaPlayerPackage)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt
index 4d0ddcb..7e82590 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WeatherHelper.kt
@@ -5,6 +5,7 @@ import android.content.Context
import android.os.Build
import com.google.android.gms.location.LocationServices
import com.tommasoberlose.anotherwidget.R
+import com.tommasoberlose.anotherwidget.db.EventRepository
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.network.WeatherNetworkApi
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt
index 7e3c854..b4f3f18 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/WidgetHelper.kt
@@ -4,6 +4,8 @@ import android.appwidget.AppWidgetManager
import android.content.Context
import android.content.res.Configuration.ORIENTATION_PORTRAIT
import com.google.firebase.crashlytics.FirebaseCrashlytics
+import com.tommasoberlose.anotherwidget.db.EventRepository
+import com.tommasoberlose.anotherwidget.global.Preferences
object WidgetHelper {
class WidgetSizeProvider(
@@ -51,4 +53,11 @@ object WidgetHelper {
width to second * factor
}
}
+
+ fun showSpecialWeather(context: Context): Boolean {
+ return EventRepository(context).getEventsCount() == 0 && (
+ (Preferences.showNextAlarm && AlarmHelper.getNextAlarm(context) != "") ||
+ (MediaPlayerHelper.isSomeonePlaying(context))
+ )
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/MusicNotificationListener.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/MusicNotificationListener.kt
new file mode 100644
index 0000000..8780339
--- /dev/null
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/receivers/MusicNotificationListener.kt
@@ -0,0 +1,37 @@
+package com.tommasoberlose.anotherwidget.receivers
+
+import android.app.Notification
+import android.media.MediaMetadata
+import android.media.session.MediaController
+import android.media.session.MediaSession
+import android.media.session.PlaybackState
+import android.service.notification.NotificationListenerService
+import android.service.notification.StatusBarNotification
+import android.util.Log
+import com.chibatching.kotpref.bulk
+import com.tommasoberlose.anotherwidget.global.Preferences
+import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
+import com.tommasoberlose.anotherwidget.helpers.WidgetHelper
+import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
+
+
+class MusicNotificationListener : NotificationListenerService() {
+ override fun onListenerConnected() {
+ MediaPlayerHelper.updatePlayingMediaInfo(this)
+ super.onListenerConnected()
+ }
+
+ override fun onNotificationPosted(sbn: StatusBarNotification?) {
+ sbn?.notification?.extras?.let { bundle ->
+ bundle.getParcelable(Notification.EXTRA_MEDIA_SESSION)?.let {
+ MediaPlayerHelper.updatePlayingMediaInfo(this)
+ }
+ }
+ super.onNotificationPosted(sbn)
+ }
+
+ override fun onNotificationRemoved(sbn: StatusBarNotification?) {
+ MediaPlayerHelper.updatePlayingMediaInfo(this)
+ super.onNotificationRemoved(sbn)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapters/ViewPagerAdapter.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapters/ViewPagerAdapter.kt
index c91c660..7f40ae6 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapters/ViewPagerAdapter.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/adapters/ViewPagerAdapter.kt
@@ -8,13 +8,14 @@ import com.tommasoberlose.anotherwidget.ui.fragments.*
class ViewPagerAdapter(fragmentActivity: FragmentActivity) :
FragmentStateAdapter(fragmentActivity) {
- override fun getItemCount(): Int = 4
+ override fun getItemCount(): Int = 5
override fun createFragment(position: Int): Fragment {
return when (position) {
1 -> CalendarTabFragment.newInstance()
2 -> WeatherTabFragment.newInstance()
3 -> ClockTabFragment.newInstance()
+ 4 -> AtAGlanceTabFragment.newInstance()
else -> GeneralTabFragment.newInstance()
}
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AtAGlanceTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AtAGlanceTabFragment.kt
new file mode 100644
index 0000000..1f7edd8
--- /dev/null
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/AtAGlanceTabFragment.kt
@@ -0,0 +1,165 @@
+package com.tommasoberlose.anotherwidget.ui.fragments
+
+import android.app.AlarmManager
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.content.IntentFilter
+import android.content.pm.PackageManager
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.core.app.NotificationManagerCompat
+import androidx.core.view.isVisible
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.Observer
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.lifecycleScope
+import com.tommasoberlose.anotherwidget.R
+import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
+import com.tommasoberlose.anotherwidget.databinding.FragmentAtAGlanceSettingsBinding
+import com.tommasoberlose.anotherwidget.global.Preferences
+import com.tommasoberlose.anotherwidget.helpers.AlarmHelper
+import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
+import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
+import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
+import kotlinx.android.synthetic.main.fragment_at_a_glance_settings.*
+import kotlinx.android.synthetic.main.fragment_at_a_glance_settings.scrollView
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+import java.lang.Exception
+
+class AtAGlanceTabFragment : Fragment() {
+
+ companion object {
+ fun newInstance() = AtAGlanceTabFragment()
+ }
+
+ private lateinit var viewModel: MainViewModel
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+
+ viewModel = ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java)
+ val binding = DataBindingUtil.inflate(inflater, R.layout.fragment_at_a_glance_settings, container, false)
+
+ subscribeUi(binding, viewModel)
+
+ binding.lifecycleOwner = this
+ binding.viewModel = viewModel
+
+ return binding.root
+ }
+
+ override fun onActivityCreated(savedInstanceState: Bundle?) {
+ super.onActivityCreated(savedInstanceState)
+
+ setupListener()
+ updateNextAlarmWarningUi()
+ }
+
+ private fun subscribeUi(
+ binding: FragmentAtAGlanceSettingsBinding,
+ viewModel: MainViewModel
+ ) {
+
+ viewModel.showMusic.observe(viewLifecycleOwner, Observer {
+ checkNotificationPermission()
+ })
+
+ viewModel.showNextAlarm.observe(viewLifecycleOwner, Observer {
+ updateNextAlarmWarningUi()
+ })
+ }
+
+ private fun setupListener() {
+ action_show_music.setOnClickListener {
+ Preferences.showMusic = !Preferences.showMusic
+ }
+
+ action_show_next_alarm.setOnClickListener {
+ BottomSheetMenu(requireContext(), header = getString(R.string.settings_show_next_alarm_title)).setSelectedValue(Preferences.showNextAlarm)
+ .addItem(getString(R.string.settings_visible), true)
+ .addItem(getString(R.string.settings_not_visible), false)
+ .addOnSelectItemListener { value ->
+ Preferences.showNextAlarm = value
+ }.show()
+ }
+
+ }
+
+ private fun updateNextAlarmWarningUi() {
+ with(requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager) {
+ val alarm = nextAlarmClock
+ if (AlarmHelper.isAlarmProbablyWrong(requireContext()) && alarm != null && alarm.showIntent != null) {
+ val pm = requireContext().packageManager as PackageManager
+ val appNameOrPackage = try {
+ pm.getApplicationLabel(pm.getApplicationInfo(alarm.showIntent?.creatorPackage ?: "", 0))
+ } catch (e: Exception) {
+ alarm.showIntent?.creatorPackage ?: ""
+ }
+ show_next_alarm_warning.text = getString(R.string.next_alarm_warning).format(appNameOrPackage)
+ } else {
+ maintainScrollPosition {
+ show_next_alarm_label?.text = if (Preferences.showNextAlarm) getString(R.string.settings_visible) else getString(
+ R.string.settings_not_visible)
+ }
+ }
+ }
+ }
+
+ private val nextAlarmChangeBroadcastReceiver = object : BroadcastReceiver() {
+ override fun onReceive(context: Context?, intent: Intent?) {
+ updateNextAlarmWarningUi()
+ }
+ }
+
+ override fun onStart() {
+ super.onStart()
+ activity?.registerReceiver(nextAlarmChangeBroadcastReceiver, IntentFilter(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED))
+ }
+
+ override fun onStop() {
+ activity?.unregisterReceiver(nextAlarmChangeBroadcastReceiver)
+ super.onStop()
+ }
+
+ private fun checkNotificationPermission() {
+ if (NotificationManagerCompat.getEnabledListenerPackages(requireContext()).contains(requireContext().packageName)) {
+ notification_permission_alert?.isVisible = false
+ MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
+ show_music_label?.text = if (Preferences.showMusic) getString(R.string.settings_show_music_enabled_subtitle) else getString(R.string.settings_show_music_disabled_subtitle)
+ } else if (Preferences.showMusic) {
+ notification_permission_alert?.isVisible = true
+ show_music_label?.text = getString(R.string.settings_request_notification_access)
+ notification_permission_alert?.setOnClickListener {
+ activity?.startActivity(Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"))
+ }
+ } else {
+ show_music_label?.text = getString(R.string.settings_show_music_disabled_subtitle)
+ notification_permission_alert?.isVisible = false
+ }
+ }
+
+ private fun maintainScrollPosition(callback: () -> Unit) {
+ val scrollPosition = scrollView.scrollY
+ callback.invoke()
+ lifecycleScope.launch {
+ delay(200)
+ scrollView.smoothScrollTo(0, scrollPosition)
+ }
+ }
+
+ override fun onResume() {
+ super.onResume()
+ checkNotificationPermission()
+ }
+}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt
index 6c16cad..542f2e7 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt
@@ -79,7 +79,6 @@ class ClockTabFragment : Fragment() {
}
}
setupListener()
- updateNextAlarmWarningUi()
}
private fun subscribeUi(
@@ -138,10 +137,6 @@ class ClockTabFragment : Fragment() {
}
})
- viewModel.showNextAlarm.observe(viewLifecycleOwner, Observer {
- updateNextAlarmWarningUi()
- })
-
viewModel.clockAppName.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
clock_app_label?.text =
@@ -204,50 +199,6 @@ class ClockTabFragment : Fragment() {
)
}
}
-
- action_show_next_alarm.setOnClickListener {
- BottomSheetMenu(requireContext(), header = getString(R.string.settings_show_next_alarm_title)).setSelectedValue(Preferences.showNextAlarm)
- .addItem(getString(R.string.settings_visible), true)
- .addItem(getString(R.string.settings_not_visible), false)
- .addOnSelectItemListener { value ->
- Preferences.showNextAlarm = value
- }.show()
- }
- }
-
- private fun updateNextAlarmWarningUi() {
- with(requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager) {
- val alarm = nextAlarmClock
- if (AlarmHelper.isAlarmProbablyWrong(requireContext()) && alarm != null && alarm.showIntent != null) {
- val pm = requireContext().packageManager as PackageManager
- val appNameOrPackage = try {
- pm.getApplicationLabel(pm.getApplicationInfo(alarm.showIntent?.creatorPackage ?: "", 0))
- } catch (e: Exception) {
- alarm.showIntent?.creatorPackage ?: ""
- }
- show_next_alarm_warning.text = getString(R.string.next_alarm_warning).format(appNameOrPackage)
- } else {
- maintainScrollPosition {
- show_next_alarm_label?.text = if (Preferences.showNextAlarm) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
- }
- }
- }
- }
-
- private val nextAlarmChangeBroadcastReceiver = object : BroadcastReceiver() {
- override fun onReceive(context: Context?, intent: Intent?) {
- updateNextAlarmWarningUi()
- }
- }
-
- override fun onStart() {
- super.onStart()
- activity?.registerReceiver(nextAlarmChangeBroadcastReceiver, IntentFilter(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED))
- }
-
- override fun onStop() {
- activity?.unregisterReceiver(nextAlarmChangeBroadcastReceiver)
- super.onStop()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt
index 4ca4aac..05670cb 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt
@@ -15,6 +15,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.core.animation.addListener
+import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
@@ -84,6 +85,7 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
1 -> getString(R.string.settings_calendar_title)
2 -> getString(R.string.settings_weather_title)
3 -> getString(R.string.settings_clock_title)
+ 4 -> getString(R.string.settings_at_a_glance_title)
else -> ""
}
}.attach()
@@ -261,18 +263,7 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
}.start()
}
-
- // Calendar error indicator
- tabs?.getTabAt(1)?.orCreateBadge?.apply {
- backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
- badgeGravity = BadgeDrawable.TOP_END
- }?.isVisible = Preferences.showEvents && activity?.checkGrantedPermission(Manifest.permission.READ_CALENDAR) != true
-
- // Weather error indicator
- tabs?.getTabAt(2)?.orCreateBadge?.apply {
- backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
- badgeGravity = BadgeDrawable.TOP_END
- }?.isVisible = Preferences.showWeather && (Preferences.weatherProviderApi == "" || (Preferences.customLocationAdd == "" && activity?.checkGrantedPermission(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION) != true))
+ showErrorBadge()
}
@@ -301,8 +292,25 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
}
}
- override fun onDestroy() {
- super.onDestroy()
+ private fun showErrorBadge() {
+ // Calendar error indicator
+ tabs?.getTabAt(1)?.orCreateBadge?.apply {
+ backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
+ badgeGravity = BadgeDrawable.TOP_END
+ }?.isVisible = Preferences.showEvents && activity?.checkGrantedPermission(Manifest.permission.READ_CALENDAR) != true
+
+ // Weather error indicator
+ tabs?.getTabAt(2)?.orCreateBadge?.apply {
+ backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
+ badgeGravity = BadgeDrawable.TOP_END
+ }?.isVisible = Preferences.showWeather && (Preferences.weatherProviderApi == "" || (Preferences.customLocationAdd == "" && activity?.checkGrantedPermission(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) Manifest.permission.ACCESS_BACKGROUND_LOCATION else Manifest.permission.ACCESS_FINE_LOCATION) != true))
+
+
+ // Music error indicator
+ tabs?.getTabAt(4)?.orCreateBadge?.apply {
+ backgroundColor = ContextCompat.getColor(requireContext(), R.color.errorColorText)
+ badgeGravity = BadgeDrawable.TOP_END
+ }?.isVisible = Preferences.showMusic && !NotificationManagerCompat.getEnabledListenerPackages(requireContext()).contains(requireContext().packageName)
}
override fun onSharedPreferenceChanged(preferences: SharedPreferences, p1: String) {
@@ -314,6 +322,7 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
super.onResume()
Preferences.preferences.registerOnSharedPreferenceChangeListener(this)
EventBus.getDefault().register(this)
+ showErrorBadge()
}
override fun onPause() {
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt
index 3909452..2123691 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt
@@ -30,6 +30,7 @@ import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.activities.SupportDevActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.helpers.CalendarHelper
+import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
import com.tommasoberlose.anotherwidget.helpers.WeatherHelper
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.openURI
@@ -195,6 +196,7 @@ class SettingsFragment : Fragment() {
action_refresh_widget.setOnClickListener {
WeatherHelper.updateWeather(requireContext())
CalendarHelper.updateEventList(requireContext())
+ MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
}
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt
index 6a96136..8137797 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt
@@ -52,6 +52,10 @@ class MainViewModel : ViewModel() {
val showWeatherWarning = Preferences.asLiveData(Preferences::showWeatherWarning)
+ // Music
+ val showMusic = Preferences.asLiveData(Preferences::showMusic)
+ val mediaInfoFormat = Preferences.asLiveData(Preferences::mediaInfoFormat)
+
// Advanced Settings
val darkThemePreference = Preferences.asLiveData(Preferences::darkThemePreference)
val showWallpaper = Preferences.asLiveData(Preferences::showWallpaper)
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt
index 6784a22..c1a76f0 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/MainWidget.kt
@@ -12,6 +12,7 @@ import android.graphics.Color
import android.graphics.Typeface
import android.os.Bundle
import android.text.format.DateUtils
+import android.util.Log
import android.util.TypedValue
import android.view.View
import android.widget.ImageView
@@ -52,6 +53,7 @@ class MainWidget : AppWidgetProvider() {
override fun onEnabled(context: Context) {
CalendarHelper.updateEventList(context)
WeatherReceiver.setUpdates(context)
+ MediaPlayerHelper.updatePlayingMediaInfo(context)
if (Preferences.showEvents) {
CalendarHelper.setEventUpdatesAndroidN(context)
@@ -147,6 +149,7 @@ class MainWidget : AppWidgetProvider() {
views.setViewVisibility(R.id.empty_layout_rect, View.VISIBLE)
views.setViewVisibility(R.id.calendar_layout_rect, View.GONE)
views.setViewVisibility(R.id.second_row_rect, View.GONE)
+ views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE)
val calPIntent = PendingIntent.getActivity(
context,
@@ -278,6 +281,29 @@ class MainWidget : AppWidgetProvider() {
)
views.setViewVisibility(R.id.second_row_rect, View.VISIBLE)
+ views.setViewVisibility(R.id.empty_layout_rect, View.GONE)
+ views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE)
+ views.setOnClickPendingIntent(R.id.next_event_rect, calPIntent)
+ } else if (MediaPlayerHelper.isSomeonePlaying(context)) {
+ val musicIntent = PendingIntent.getActivity(
+ context,
+ widgetID,
+ IntentHelper.getMusicIntent(context),
+ 0
+ )
+ views.setOnClickPendingIntent(R.id.second_row_rect, musicIntent)
+
+ views.setImageViewBitmap(
+ R.id.next_event_rect,
+ BitmapHelper.getBitmapFromView(v.next_event, draw = false)
+ )
+
+ views.setImageViewBitmap(
+ R.id.second_row_rect,
+ BitmapHelper.getBitmapFromView(v.second_row, draw = false)
+ )
+ views.setViewVisibility(R.id.second_row_rect, View.VISIBLE)
+
views.setViewVisibility(R.id.empty_layout_rect, View.GONE)
views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE)
views.setOnClickPendingIntent(R.id.next_event_rect, calPIntent)
@@ -295,6 +321,7 @@ class MainWidget : AppWidgetProvider() {
if (Preferences.showWeather && Preferences.weatherIcon != "") {
views.setViewVisibility(R.id.weather_rect, View.VISIBLE)
views.setViewVisibility(R.id.calendar_weather_rect, View.VISIBLE)
+ views.setViewVisibility(R.id.special_weather_rect, View.VISIBLE)
val i = Intent(context, WidgetClickListenerReceiver::class.java)
i.action = Actions.ACTION_OPEN_WEATHER_INTENT
@@ -302,6 +329,7 @@ class MainWidget : AppWidgetProvider() {
views.setOnClickPendingIntent(R.id.weather_rect, weatherPIntent)
views.setOnClickPendingIntent(R.id.calendar_weather_rect, weatherPIntent)
+ views.setOnClickPendingIntent(R.id.special_weather_rect, weatherPIntent)
views.setImageViewBitmap(
R.id.weather_rect,
@@ -312,9 +340,21 @@ class MainWidget : AppWidgetProvider() {
R.id.calendar_weather_rect,
BitmapHelper.getBitmapFromView(v.calendar_weather, draw = false)
)
+
+ views.setImageViewBitmap(
+ R.id.special_weather_rect,
+ BitmapHelper.getBitmapFromView(v.calendar_weather, draw = false)
+ )
+
+ if (WidgetHelper.showSpecialWeather(context)) {
+ views.setViewVisibility(R.id.calendar_weather_rect, View.GONE)
+ } else {
+ views.setViewVisibility(R.id.special_weather_rect, View.GONE)
+ }
} else {
views.setViewVisibility(R.id.weather_rect, View.GONE)
views.setViewVisibility(R.id.calendar_weather_rect, View.GONE)
+ views.setViewVisibility(R.id.special_weather_rect, View.GONE)
}
} catch (ex: Exception) {
ex.printStackTrace()
@@ -391,6 +431,7 @@ class MainWidget : AppWidgetProvider() {
v.empty_layout.visibility = View.VISIBLE
v.calendar_layout.visibility = View.GONE
+ v.next_event_difference_time.visibility = View.GONE
v.action_next.isVisible = false
v.action_previous.isVisible = false
@@ -469,11 +510,22 @@ class MainWidget : AppWidgetProvider() {
v.next_event_date.text = AlarmHelper.getNextAlarm(context)
v.empty_layout.visibility = View.GONE
v.calendar_layout.visibility = View.VISIBLE
+ } else if (MediaPlayerHelper.isSomeonePlaying(context)) {
+ v.second_row_icon.setImageDrawable(
+ ContextCompat.getDrawable(
+ context,
+ R.drawable.round_music_note
+ )
+ )
+ v.next_event.text = DateHelper.getDateText(context, now)
+ v.next_event_date.text = MediaPlayerHelper.getMediaInfo()
+ v.empty_layout.visibility = View.GONE
+ v.calendar_layout.visibility = View.VISIBLE
}
// Color
- listOf(v.empty_date, v.divider1, v.temp, v.next_event, v.next_event_difference_time, v.next_event_date, v.divider2, v.calendar_temp).forEach {
+ listOf(v.empty_date, v.divider1, v.temp, v.next_event, v.next_event_difference_time, v.next_event_date, v.divider2, v.calendar_temp, v.divider3, v.special_temp).forEach {
it.setTextColor(ColorHelper.getFontColor())
}
@@ -484,13 +536,15 @@ class MainWidget : AppWidgetProvider() {
// Text Size
listOf>(
v.empty_date to Preferences.textMainSize,
- v.divider1 to Preferences.textMainSize,
+ v.divider1 to (Preferences.textMainSize - 2),
v.temp to Preferences.textMainSize,
v.next_event to Preferences.textMainSize,
v.next_event_difference_time to Preferences.textMainSize,
v.next_event_date to Preferences.textSecondSize,
- v.divider2 to Preferences.textSecondSize,
- v.calendar_temp to Preferences.textSecondSize
+ v.divider2 to (Preferences.textSecondSize - 2),
+ v.calendar_temp to Preferences.textSecondSize,
+ v.divider3 to (Preferences.textMainSize - 2),
+ v.special_temp to Preferences.textMainSize
).forEach {
it.first.setTextSize(TypedValue.COMPLEX_UNIT_SP, it.second)
}
@@ -511,6 +565,9 @@ class MainWidget : AppWidgetProvider() {
v.action_previous.scaleX = Preferences.textMainSize / 28f
v.action_previous.scaleY = Preferences.textMainSize / 28f
+ v.special_weather_icon.scaleX = Preferences.textMainSize / 20f
+ v.special_weather_icon.scaleY = Preferences.textMainSize / 20f
+
// Shadows
val shadowRadius = when (Preferences.textShadow) {
@@ -532,14 +589,14 @@ class MainWidget : AppWidgetProvider() {
else -> 0f
}
- listOf(v.empty_date, v.divider1, v.temp, v.next_event, v.next_event_difference_time, v.next_event_date, v.divider2, v.calendar_temp).forEach {
+ listOf(v.empty_date, v.divider1, v.temp, v.next_event, v.next_event_difference_time, v.next_event_date, v.divider2, v.calendar_temp, v.divider3, v.special_temp).forEach {
it.setShadowLayer(shadowRadius, 0f, shadowDy, shadowColor)
}
// Custom Font
if (Preferences.customFont == Constants.CUSTOM_FONT_PRODUCT_SANS) {
val productSans: Typeface = Typeface.createFromAsset(context.assets, "fonts/product_sans_regular.ttf")
- listOf(v.empty_date, v.divider1, v.temp, v.next_event, v.next_event_difference_time, v.next_event_date, v.divider2, v.calendar_temp).forEach {
+ listOf(v.empty_date, v.divider1, v.temp, v.next_event, v.next_event_difference_time, v.next_event_date, v.divider2, v.calendar_temp, v.divider3, v.special_temp).forEach {
it.typeface = productSans
}
}
@@ -548,24 +605,36 @@ class MainWidget : AppWidgetProvider() {
if (Preferences.showWeather && Preferences.weatherIcon != "") {
v.weather.visibility = View.VISIBLE
v.calendar_weather.visibility = View.VISIBLE
+ v.special_weather.visibility = View.VISIBLE
val currentTemp = String.format(Locale.getDefault(), "%.0f °%s", Preferences.weatherTemp, Preferences.weatherRealTempUnit)
val icon: String = Preferences.weatherIcon
if (icon == "") {
v.weather_icon.visibility = View.GONE
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.visibility = View.VISIBLE
v.empty_weather_icon.visibility = View.VISIBLE
+ v.special_weather_icon.visibility = View.VISIBLE
}
v.temp.text = currentTemp
v.calendar_temp.text = currentTemp
+ v.special_temp.text = currentTemp
+
+ if (WidgetHelper.showSpecialWeather(context)) {
+ v.calendar_weather.visibility = View.GONE
+ } else {
+ v.special_weather.visibility = View.GONE
+ }
} else {
v.weather.visibility = View.GONE
v.calendar_weather.visibility = View.GONE
+ v.special_weather.visibility = View.GONE
}
return v
diff --git a/app/src/main/res/drawable-hdpi/round_music_note.png b/app/src/main/res/drawable-hdpi/round_music_note.png
new file mode 100644
index 0000000..1d614c9
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_music_note.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_music_note_black_18.png b/app/src/main/res/drawable-hdpi/round_music_note_black_18.png
new file mode 100644
index 0000000..9fde6c7
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_music_note_black_18.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_music_note_black_24.png b/app/src/main/res/drawable-hdpi/round_music_note_black_24.png
new file mode 100644
index 0000000..cd6bdd1
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_music_note_black_24.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_music_note_black_36.png b/app/src/main/res/drawable-hdpi/round_music_note_black_36.png
new file mode 100644
index 0000000..6f1dffb
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_music_note_black_36.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_queue_music.png b/app/src/main/res/drawable-hdpi/round_queue_music.png
new file mode 100644
index 0000000..15b2615
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_queue_music.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_queue_music_black_18.png b/app/src/main/res/drawable-hdpi/round_queue_music_black_18.png
new file mode 100644
index 0000000..61bba81
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_queue_music_black_18.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_queue_music_black_24.png b/app/src/main/res/drawable-hdpi/round_queue_music_black_24.png
new file mode 100644
index 0000000..50d882d
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_queue_music_black_24.png differ
diff --git a/app/src/main/res/drawable-hdpi/round_queue_music_black_48.png b/app/src/main/res/drawable-hdpi/round_queue_music_black_48.png
new file mode 100644
index 0000000..09521a9
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/round_queue_music_black_48.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_music_note.png b/app/src/main/res/drawable-mdpi/round_music_note.png
new file mode 100644
index 0000000..f58eb50
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_music_note.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_music_note_black_18.png b/app/src/main/res/drawable-mdpi/round_music_note_black_18.png
new file mode 100644
index 0000000..b1f65f0
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_music_note_black_18.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_music_note_black_24.png b/app/src/main/res/drawable-mdpi/round_music_note_black_24.png
new file mode 100644
index 0000000..890661d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_music_note_black_24.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_music_note_black_36.png b/app/src/main/res/drawable-mdpi/round_music_note_black_36.png
new file mode 100644
index 0000000..cd6bdd1
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_music_note_black_36.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_queue_music.png b/app/src/main/res/drawable-mdpi/round_queue_music.png
new file mode 100644
index 0000000..50d882d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_queue_music.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_queue_music_black_18.png b/app/src/main/res/drawable-mdpi/round_queue_music_black_18.png
new file mode 100644
index 0000000..1f3322f
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_queue_music_black_18.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_queue_music_black_24.png b/app/src/main/res/drawable-mdpi/round_queue_music_black_24.png
new file mode 100644
index 0000000..9cee94b
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_queue_music_black_24.png differ
diff --git a/app/src/main/res/drawable-mdpi/round_queue_music_black_48.png b/app/src/main/res/drawable-mdpi/round_queue_music_black_48.png
new file mode 100644
index 0000000..2747e2e
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/round_queue_music_black_48.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_music_note.png b/app/src/main/res/drawable-xhdpi/round_music_note.png
new file mode 100644
index 0000000..42c93ba
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_music_note.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_music_note_black_18.png b/app/src/main/res/drawable-xhdpi/round_music_note_black_18.png
new file mode 100644
index 0000000..cd6bdd1
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_music_note_black_18.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_music_note_black_24.png b/app/src/main/res/drawable-xhdpi/round_music_note_black_24.png
new file mode 100644
index 0000000..f58eb50
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_music_note_black_24.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_music_note_black_36.png b/app/src/main/res/drawable-xhdpi/round_music_note_black_36.png
new file mode 100644
index 0000000..1d614c9
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_music_note_black_36.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_queue_music.png b/app/src/main/res/drawable-xhdpi/round_queue_music.png
new file mode 100644
index 0000000..09521a9
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_queue_music.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_queue_music_black_18.png b/app/src/main/res/drawable-xhdpi/round_queue_music_black_18.png
new file mode 100644
index 0000000..50d882d
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_queue_music_black_18.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_queue_music_black_24.png b/app/src/main/res/drawable-xhdpi/round_queue_music_black_24.png
new file mode 100644
index 0000000..2747e2e
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_queue_music_black_24.png differ
diff --git a/app/src/main/res/drawable-xhdpi/round_queue_music_black_48.png b/app/src/main/res/drawable-xhdpi/round_queue_music_black_48.png
new file mode 100644
index 0000000..90da09d
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/round_queue_music_black_48.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_music_note.png b/app/src/main/res/drawable-xxhdpi/round_music_note.png
new file mode 100644
index 0000000..d7b8d7d
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_music_note.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_music_note_black_18.png b/app/src/main/res/drawable-xxhdpi/round_music_note_black_18.png
new file mode 100644
index 0000000..6f1dffb
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_music_note_black_18.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_music_note_black_24.png b/app/src/main/res/drawable-xxhdpi/round_music_note_black_24.png
new file mode 100644
index 0000000..1d614c9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_music_note_black_24.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_music_note_black_36.png b/app/src/main/res/drawable-xxhdpi/round_music_note_black_36.png
new file mode 100644
index 0000000..5f5b818
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_music_note_black_36.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_queue_music.png b/app/src/main/res/drawable-xxhdpi/round_queue_music.png
new file mode 100644
index 0000000..6de1e89
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_queue_music.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_queue_music_black_18.png b/app/src/main/res/drawable-xxhdpi/round_queue_music_black_18.png
new file mode 100644
index 0000000..15b2615
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_queue_music_black_18.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_queue_music_black_24.png b/app/src/main/res/drawable-xxhdpi/round_queue_music_black_24.png
new file mode 100644
index 0000000..09521a9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_queue_music_black_24.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/round_queue_music_black_48.png b/app/src/main/res/drawable-xxhdpi/round_queue_music_black_48.png
new file mode 100644
index 0000000..8a1ad29
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/round_queue_music_black_48.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_music_note.png b/app/src/main/res/drawable-xxxhdpi/round_music_note.png
new file mode 100644
index 0000000..527c220
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_music_note.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_music_note_black_18.png b/app/src/main/res/drawable-xxxhdpi/round_music_note_black_18.png
new file mode 100644
index 0000000..1d614c9
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_music_note_black_18.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_music_note_black_24.png b/app/src/main/res/drawable-xxxhdpi/round_music_note_black_24.png
new file mode 100644
index 0000000..42c93ba
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_music_note_black_24.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_music_note_black_36.png b/app/src/main/res/drawable-xxxhdpi/round_music_note_black_36.png
new file mode 100644
index 0000000..d7b8d7d
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_music_note_black_36.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_queue_music.png b/app/src/main/res/drawable-xxxhdpi/round_queue_music.png
new file mode 100644
index 0000000..8a1ad29
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_queue_music.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_18.png b/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_18.png
new file mode 100644
index 0000000..09521a9
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_18.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_24.png b/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_24.png
new file mode 100644
index 0000000..90da09d
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_24.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_48.png b/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_48.png
new file mode 100644
index 0000000..f55476c
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/round_queue_music_black_48.png differ
diff --git a/app/src/main/res/drawable/round_music_note_24.xml b/app/src/main/res/drawable/round_music_note_24.xml
new file mode 100644
index 0000000..20ed3cc
--- /dev/null
+++ b/app/src/main/res/drawable/round_music_note_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/round_queue_music_24.xml b/app/src/main/res/drawable/round_queue_music_24.xml
new file mode 100644
index 0000000..23dd5f2
--- /dev/null
+++ b/app/src/main/res/drawable/round_queue_music_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/layout/fragment_at_a_glance_settings.xml b/app/src/main/res/layout/fragment_at_a_glance_settings.xml
new file mode 100644
index 0000000..41c4506
--- /dev/null
+++ b/app/src/main/res/layout/fragment_at_a_glance_settings.xml
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_clock_settings.xml b/app/src/main/res/layout/fragment_clock_settings.xml
index 51591c0..681c608 100644
--- a/app/src/main/res/layout/fragment_clock_settings.xml
+++ b/app/src/main/res/layout/fragment_clock_settings.xml
@@ -253,51 +253,6 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
The next alarm clock seems to be wrong.\nIt has been set by %s.
Settings
Clock text color
+ Music
+ Show current playing song
+ Playing song info visible
+ Playing song info hidden
+ Song info format
+ We need the notification access permission to check the current playing song.
+ At a Glance
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index a3d1c2d..26cf78d 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -188,4 +188,11 @@
The next alarm clock seems to be wrong.\nIt has been set by %s.
Settings
Clock text color
+ Music
+ Show current playing song
+ Playing song info visible
+ Playing song info hidden
+ Song info format
+ We need the notification access permission to check the current playing song.
+ At a Glance
\ No newline at end of file
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 64a4f7e..aeb2b07 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -187,4 +187,11 @@
La sveglia sembra impostata male.\nÈ stata impostata dall\'app %s.
Impostazioni
Colore orologio
+ Musica
+ Mostra brano in riproduzione
+ Visibile
+ Non visibile
+ Formato informazioni brano
+ Concedi all\'app il permesso di monitorare le notifiche, è necessario per poter mostrare il brano in riproduzione.
+ At a Glance
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 95441e6..d3c8b97 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -199,4 +199,11 @@
The next alarm clock seems to be wrong.\nIt has been set by %s.
Settings
Clock text color
+ At a Glance
+ Music
+ Show current playing song
+ Playing song info visible
+ Playing song info hidden
+ Song info format
+ We need the notification access permission to check the current playing song.
diff --git a/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml b/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml
index 49ff4c4..39df5fb 100644
--- a/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml
+++ b/tasksintegration/build/intermediates/bundle_manifest/debug/bundle-manifest/AndroidManifest.xml
@@ -3,8 +3,8 @@
xmlns:dist="http://schemas.android.com/apk/distribution"
featureSplit="tasksintegration"
package="com.tommasoberlose.anotherwidget"
- android:versionCode="78"
- android:versionName="2.0.5" >
+ android:versionCode="80"
+ android:versionName="2.0.6" >
+ android:versionCode="80"
+ android:versionName="2.0.6" >
+6 android:versionCode="80"
+7 android:versionName="2.0.6" >
8
9
+ android:versionCode="80"
+ android:versionName="2.0.6" >
+ android:versionCode="80"
+ android:versionName="2.0.6" >