From 6db17ee8adfdca0dca5e4228cbe71b5a3894740f Mon Sep 17 00:00:00 2001
From: yattoz <12408848+yattoz@users.noreply.github.com>
Date: Tue, 10 Dec 2019 19:56:58 +0100
Subject: [PATCH] removed specific R/a/dio stuff
---
.../java/fr/forum_thalie/tsumugi/Actions.kt | 1 -
.../java/fr/forum_thalie/tsumugi/Async.kt | 1 +
.../forum_thalie/tsumugi/BaseNotification.kt | 2 +-
.../tsumugi/NowPlayingNotification.kt | 3 +-
.../java/fr/forum_thalie/tsumugi/Tickers.kt | 2 -
.../tsumugi/ui/news/NewsFragment.kt | 4 +-
.../ui/nowplaying/NowPlayingFragment.kt | 58 +++++++--------
.../tsumugi/ui/songs/SongsFragment.kt | 2 +-
app/src/main/res/layout/button_load_more.xml | 21 ------
app/src/main/res/layout/fragment_chat.xml | 42 -----------
.../main/res/layout/fragment_error_chat.xml | 20 ------
app/src/main/res/layout/fragment_request.xml | 72 -------------------
app/src/main/res/layout/request_song_view.xml | 72 -------------------
app/src/main/res/values/arrays.xml | 30 --------
app/src/main/res/values/strings.xml | 29 +-------
15 files changed, 32 insertions(+), 327 deletions(-)
delete mode 100644 app/src/main/res/layout/button_load_more.xml
delete mode 100644 app/src/main/res/layout/fragment_chat.xml
delete mode 100644 app/src/main/res/layout/fragment_error_chat.xml
delete mode 100644 app/src/main/res/layout/fragment_request.xml
delete mode 100644 app/src/main/res/layout/request_song_view.xml
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/Actions.kt b/app/src/main/java/fr/forum_thalie/tsumugi/Actions.kt
index fb017c3..ee6a7a5 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/Actions.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/Actions.kt
@@ -23,5 +23,4 @@ enum class ActionOpenParam {
SLEEP,
ALARM,
CUSTOMIZE,
- STREAMER_NOTIFICATION_SERVICE
}
\ No newline at end of file
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/Async.kt b/app/src/main/java/fr/forum_thalie/tsumugi/Async.kt
index 6488ad2..b174712 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/Async.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/Async.kt
@@ -23,6 +23,7 @@ class Async(val handler: (Any?) -> Any?, val post: (Any?) -> Unit = {},
ActionOnError.RESET -> resetPlayerStateOnNetworkError()
ActionOnError.NOTIFY -> return
}
+ e.printStackTrace()
}
private fun resetPlayerStateOnNetworkError() {
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/BaseNotification.kt b/app/src/main/java/fr/forum_thalie/tsumugi/BaseNotification.kt
index c236c7f..3e0a580 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/BaseNotification.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/BaseNotification.kt
@@ -23,7 +23,7 @@ abstract class BaseNotification(private val notificationChannelId: String,
// Define the notification in android's swipe-down menu
lateinit var notification: Notification
- protected lateinit var notificationManager: NotificationManager
+ private lateinit var notificationManager: NotificationManager
protected lateinit var builder: NotificationCompat.Builder
@RequiresApi(api = Build.VERSION_CODES.O)
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/NowPlayingNotification.kt b/app/src/main/java/fr/forum_thalie/tsumugi/NowPlayingNotification.kt
index 9e65a6f..2c8d0d4 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/NowPlayingNotification.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/NowPlayingNotification.kt
@@ -7,7 +7,6 @@ import android.support.v4.media.session.MediaSessionCompat
import android.support.v4.media.session.PlaybackStateCompat
import androidx.core.app.NotificationCompat
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
-import fr.forum_thalie.tsumugi.BootBroadcastReceiver
class NowPlayingNotification(
notificationChannelId: String,
@@ -27,7 +26,7 @@ class NowPlayingNotification(
// ###### NOW PLAYING NOTIFICATION ########
// ########################################
- lateinit var mediaStyle: androidx.media.app.NotificationCompat.DecoratedMediaCustomViewStyle
+ private lateinit var mediaStyle: androidx.media.app.NotificationCompat.DecoratedMediaCustomViewStyle
fun create(c: Context, m: MediaSessionCompat) {
super.create(c)
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/Tickers.kt b/app/src/main/java/fr/forum_thalie/tsumugi/Tickers.kt
index 40049a5..512c132 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/Tickers.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/Tickers.kt
@@ -1,7 +1,5 @@
package fr.forum_thalie.tsumugi
-import android.support.v4.media.session.PlaybackStateCompat
-import fr.forum_thalie.tsumugi.alarm.RadioSleeper
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
import java.util.*
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/ui/news/NewsFragment.kt b/app/src/main/java/fr/forum_thalie/tsumugi/ui/news/NewsFragment.kt
index 4c60b6c..4251167 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/ui/news/NewsFragment.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/ui/news/NewsFragment.kt
@@ -33,12 +33,12 @@ class NewsFragment : Fragment() {
if (!newsViewModel.isWebViewLoaded)
{
try {
- newsViewModel.root = inflater.inflate(R.layout.fragment_chat, container, false)
+ newsViewModel.root = inflater.inflate(R.layout.fragment_news, container, false)
newsViewModel.webView = newsViewModel.root.findViewById(R.id.news_webview)
newsViewModel.webViewNews = WebViewNews(newsViewModel.webView as WebView)
newsViewModel.webViewNews!!.start()
} catch (e: Exception) {
- newsViewModel.root = inflater.inflate(R.layout.fragment_error_chat, container, false)
+ newsViewModel.root = inflater.inflate(R.layout.fragment_error_webview, container, false)
}
newsViewModel.isWebViewLoaded = true
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt b/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt
index e92a6cc..3c62a53 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt
@@ -46,25 +46,44 @@ class NowPlayingFragment : Fragment() {
val seekBarVolume: SeekBar = root.findViewById(R.id.seek_bar_volume)
val volumeText: TextView = root.findViewById(R.id.volume_text)
val progressBar: ProgressBar = root.findViewById(R.id.progressBar)
+ val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon)
+
+ // Note: these values are not used in the generic app
val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture)
+ /*
val streamerNameText : TextView = root.findViewById(R.id.streamerName)
val songTitleNextText: TextView = root.findViewById(R.id.text_song_title_next)
val songArtistNextText: TextView = root.findViewById(R.id.text_song_artist_next)
- val volumeIconImage : ImageView = root.findViewById(R.id.volume_icon)
val listenersText : TextView = root.findViewById(R.id.listenersCount)
+ */
+ /*
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
streamerNameText,8, 20, 2, TypedValue.COMPLEX_UNIT_SP)
TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
listenersText,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
- /*
- TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
- songTitleText,4, 24, 2, TypedValue.COMPLEX_UNIT_SP)
- TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
- songArtistText,4, 24, 2, TypedValue.COMPLEX_UNIT_SP)
*/
+ /*
+ // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
+ // so I observe a dedicated Mutable that gets set when the queue is updated.
+ PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
+ val t = if (PlayerStore.instance.queue.size > 0) PlayerStore.instance.queue[0] else Song("No queue - ") // (it.peekFirst != null ? it.peekFirst : Song() )
+ songTitleNextText.text = t.title.value
+ songArtistNextText.text = t.artist.value
+ })
+
+ PlayerStore.instance.streamerName.observe(viewLifecycleOwner, Observer {
+ streamerNameText.text = it
+ })
+
+ PlayerStore.instance.listenersCount.observe(viewLifecycleOwner, Observer {
+ listenersText.text = "${getString(R.string.listeners)}: $it"
+ })
+ */
+
+
PlayerStore.instance.currentSong.title.observe(viewLifecycleOwner, Observer {
songTitleText.text = it
})
@@ -77,13 +96,6 @@ class NowPlayingFragment : Fragment() {
syncPlayPauseButtonImage(root)
})
- // trick : I can't observe the queue because it's an ArrayDeque that doesn't trigger any change...
- // so I observe a dedicated Mutable that gets set when the queue is updated.
- PlayerStore.instance.isQueueUpdated.observe(viewLifecycleOwner, Observer {
- val t = if (PlayerStore.instance.queue.size > 0) PlayerStore.instance.queue[0] else Song("No queue - ") // (it.peekFirst != null ? it.peekFirst : Song() )
- songTitleNextText.text = t.title.value
- songArtistNextText.text = t.artist.value
- })
fun volumeIcon(it: Int)
{
@@ -113,14 +125,6 @@ class NowPlayingFragment : Fragment() {
streamerPictureImageView.setImageBitmap(pic)
})
- PlayerStore.instance.streamerName.observe(viewLifecycleOwner, Observer {
- streamerNameText.text = it
- })
-
- PlayerStore.instance.listenersCount.observe(viewLifecycleOwner, Observer {
- listenersText.text = "${getString(R.string.listeners)}: $it"
- })
-
// fuck it, do it on main thread
PlayerStore.instance.currentTime.observe(viewLifecycleOwner, Observer {
val dd = (PlayerStore.instance.currentTime.value!! - PlayerStore.instance.currentSong.startTime.value!!).toInt()
@@ -173,18 +177,6 @@ class NowPlayingFragment : Fragment() {
PlayerStore.instance.isPlaying.value = PlayerStore.instance.playbackState.value == PlaybackStateCompat.STATE_STOPPED
}
- /*
- /* TODO : disabled volumeIconImage click listener, it creates weird behaviors when switching fragments.
- in particular, the mute state isn't retained when switching fragments, and it creates visual error
- (displaying the mute icon when it's not muted).
- So for the moment it's safer to disable it altogether.
- */
- volumeIconImage.setOnClickListener{
- PlayerStore.instance.isMuted.value = !PlayerStore.instance.isMuted.value!!
- }
-
- */
-
val setClipboardListener: View.OnLongClickListener = View.OnLongClickListener {
val text = PlayerStore.instance.currentSong.artist.value + " - " + PlayerStore.instance.currentSong.title.value
val clipboard = context!!.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
diff --git a/app/src/main/java/fr/forum_thalie/tsumugi/ui/songs/SongsFragment.kt b/app/src/main/java/fr/forum_thalie/tsumugi/ui/songs/SongsFragment.kt
index 2ebc21d..008f8c2 100644
--- a/app/src/main/java/fr/forum_thalie/tsumugi/ui/songs/SongsFragment.kt
+++ b/app/src/main/java/fr/forum_thalie/tsumugi/ui/songs/SongsFragment.kt
@@ -29,7 +29,7 @@ class SongsFragment : Fragment() {
adapter = SongsPagerAdapter(childFragmentManager, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT)
adapter.addFragment(LastPlayedFragment.newInstance(), "last played")
- //adapter.addFragment(QueueFragment.newInstance(), "queue")
+ // You can add more fragments to the adapter, to display more information (for example with R/a/dio, queue, request, faves...)
viewPager.adapter = adapter
diff --git a/app/src/main/res/layout/button_load_more.xml b/app/src/main/res/layout/button_load_more.xml
deleted file mode 100644
index 89b145d..0000000
--- a/app/src/main/res/layout/button_load_more.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_chat.xml b/app/src/main/res/layout/fragment_chat.xml
deleted file mode 100644
index 7c82252..0000000
--- a/app/src/main/res/layout/fragment_chat.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_error_chat.xml b/app/src/main/res/layout/fragment_error_chat.xml
deleted file mode 100644
index e7a813c..0000000
--- a/app/src/main/res/layout/fragment_error_chat.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_request.xml b/app/src/main/res/layout/fragment_request.xml
deleted file mode 100644
index 1c1e58b..0000000
--- a/app/src/main/res/layout/fragment_request.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/request_song_view.xml b/app/src/main/res/layout/request_song_view.xml
deleted file mode 100644
index fa43426..0000000
--- a/app/src/main/res/layout/request_song_view.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 344addc..969d1fd 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -1,21 +1,5 @@
-
- - "Every 5 minutes"
- - "Every 10 minutes"
- - "Every 15 minutes"
- - "Every 20 minutes"
- - "Every 25 minutes"
- - "Every 30 minutes"
-
-
- - 5
- - 10
- - 15
- - 20
- - 25
- - 30
-
- Monday
@@ -37,19 +21,5 @@
- 25
- 30
-
- - Every 5 seconds (faster update)
- - Every 10 seconds
- - Every 15 seconds
- - Every 20 seconds
- - Every 30 seconds (less battery-intensive)
-
-
- - 5
- - 10
- - 15
- - 20
- - 30
-
\ 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 eb4716b..93a0cb4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,12 +7,6 @@
Now playing: %1$s
-
- Share
- Reply
-
- New message: %1$s
-
radio_root_id
https://relay0.r-a-d.io/main.mp3
http://shelter.mahoro-net.org:8000/tsumugi
@@ -24,29 +18,13 @@
Up next:
Now streaming
Error loading WebView. Try downloading Google Chrome on Google Play, or enabling it if you disabled it.
- Load more results
- request
Settings
- Force data refresh
Submit a bug (GitHub)
https://github.com/yattoz/Tsumugi-app/issues/
- To display your favorite, set you IRC user name in Settings → Customize app behavior.
- .ra f
R/a/dio Stream Service
fr.forum_thalie.tsumugi.PLAYER_SERVICE
- Streamer Monitor Service
- fr.forum_thalie.tsumugi.STREAMER_NOTIFICATION_SERVICE
-
- New Streamer Notification
- fr.forum_thalie.tsumugi.STREAMER_NOTIFICATION_NEW
-
- This feature is EXPERIMENTAL.
- \nIt WILL consume your battery by polling the server regularly.
- \nUsing Twitter Push Notifications instead is largely recommended.
- \nThis polling should only be considered as the last resort for people not wanting to register on Twitter or phones without Google Play services.\n
- \n\nAre you sure you want to enable this?
Stay visible, can be closed with \"OK\" button
Disappear after some time
Every day
@@ -57,16 +35,11 @@
Split Now Playing screen in 2 blocks when device is horizontal
Keep the same layout when horizontal as in vertical
Sleep timer
- https://github.com/yattoz/Radio2/wiki/Help:-using-favorites-with-IRC
Disable
You need to restart the app to apply the changes for this setting.
-
- By disabling this, you won\'t see the song get updated in the app nor in the notification when the playback is stopped, but you may save some battery.
- \n\nYou need to restart the app to apply the changes for this setting.
-
+
Alarm
One minute before the end of the timer, the volume will gradually decrease.
Disable
- ed