incheckning
50fbf6742e
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"planning": [
|
||||
{
|
||||
"title": "Musique Classique",
|
||||
"periodicity": "1111111",
|
||||
"hour_begin": "6:00",
|
||||
"hour_end": "7:00"
|
||||
},
|
||||
{
|
||||
"title": "Jeux Vidéos Matin",
|
||||
"periodicity": "1111100",
|
||||
"hour_begin": "09:00",
|
||||
"hour_end": "10:30"
|
||||
},
|
||||
{
|
||||
"title": "Anime Matin",
|
||||
"periodicity": "1111100",
|
||||
"hour_begin": "10:30",
|
||||
"hour_end": "12:00"
|
||||
},
|
||||
{
|
||||
"title": "Jeux Vidéos Aprem'",
|
||||
"periodicity": "1111111",
|
||||
"hour_begin": "14:00",
|
||||
"hour_end": "15:30"
|
||||
},
|
||||
{
|
||||
"title": "Anime Aprem'",
|
||||
"periodicity": "1111111",
|
||||
"hour_begin": "15:30",
|
||||
"hour_end": "17:00"
|
||||
},
|
||||
{
|
||||
"title": "Jeux Vidéos Soirée",
|
||||
"periodicity": "1111100",
|
||||
"hour_begin": "19:00",
|
||||
"hour_end": "20:00"
|
||||
},
|
||||
{
|
||||
"title": "Anime Soirée",
|
||||
"periodicity": "1111100",
|
||||
"hour_begin": "20:00",
|
||||
"hour_end": "21:00"
|
||||
},
|
||||
{
|
||||
"title": "Anime Nuit",
|
||||
"periodicity": "1111111",
|
||||
"hour_begin": "00:00",
|
||||
"hour_end": "01:00"
|
||||
},
|
||||
{
|
||||
"title": "Jeux Vidéos Nuit",
|
||||
"periodicity": "1111111",
|
||||
"hour_begin": "01:00",
|
||||
"hour_end": "02:00"
|
||||
},
|
||||
{
|
||||
"title": "Programmation nocturne",
|
||||
"periodicity": "1111111",
|
||||
"hour_begin": "02:00",
|
||||
"hour_end": "06:00"
|
||||
}
|
||||
],
|
||||
"regular_programme" : "Programmation habituelle",
|
||||
"timezone": "GMT+1"
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ class BootBroadcastReceiver : BroadcastReceiver(){
|
|||
RadioAlarm.instance.setNextAlarm(context) // schedule next alarm
|
||||
}
|
||||
|
||||
if (arg1.getStringExtra("action") == "fr.forum_thalie.tsumugi.${Actions.PLAY_OR_FALLBACK.name}" )
|
||||
if (arg1.getStringExtra("action") == "$tag.${Actions.PLAY_OR_FALLBACK.name}" )
|
||||
{
|
||||
RadioAlarm.instance.setNextAlarm(context) // schedule next alarm
|
||||
if (PlayerStore.instance.streamerName.value.isNullOrBlank())
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import fr.forum_thalie.tsumugi.playerstore.PlayerStore
|
|||
import java.util.Timer
|
||||
import android.view.MenuItem
|
||||
import fr.forum_thalie.tsumugi.alarm.RadioAlarm
|
||||
import fr.forum_thalie.tsumugi.planning.Planning
|
||||
|
||||
|
||||
/* Log to file import
|
||||
|
|
@ -37,8 +38,11 @@ class MainActivity : BaseActivity() {
|
|||
val bottomNavigationView : BottomNavigationView = findViewById(R.id.bottom_nav)
|
||||
|
||||
//val navGraphIds = listOf(R.navigation.home, R.navigation.list, R.navigation.form)
|
||||
val navGraphIds = listOf(R.navigation.navigation_nowplaying, R.navigation.navigation_songs,
|
||||
R.navigation.navigation_news)
|
||||
val navGraphIds = listOf(
|
||||
R.navigation.navigation_nowplaying,
|
||||
R.navigation.navigation_songs,
|
||||
R.navigation.navigation_news,
|
||||
R.navigation.navigation_programme)
|
||||
|
||||
// Setup the bottom navigation view with a list of navigation graphs
|
||||
val controller = bottomNavigationView.setupWithNavController(
|
||||
|
|
@ -118,11 +122,12 @@ class MainActivity : BaseActivity() {
|
|||
RadioAlarm.instance.setNextAlarm(c = this) // this checks the preferenceStore before actually setting an alarm, don't worry.
|
||||
|
||||
// initialize programmatically accessible colors
|
||||
colorBlue = ResourcesCompat.getColor(resources, R.color.bluereq, null)
|
||||
colorBlue = ResourcesCompat.getColor(resources, R.color.rblue, null)
|
||||
colorWhited = ResourcesCompat.getColor(resources, R.color.whited, null)
|
||||
colorGreenList = (ResourcesCompat.getColorStateList(resources, R.color.button_green, null))
|
||||
colorRedList = (ResourcesCompat.getColorStateList(resources, R.color.button_red, null))
|
||||
colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null))
|
||||
colorAccent = (ResourcesCompat.getColor(resources, R.color.colorAccent, null))
|
||||
|
||||
// Post-UI Launch
|
||||
if (PlayerStore.instance.isInitialized)
|
||||
|
|
@ -155,6 +160,9 @@ class MainActivity : BaseActivity() {
|
|||
isTimerStarted = true
|
||||
}
|
||||
|
||||
// fetch program
|
||||
Planning.instance.parseUrl(/* getString(R.string.planning_url) */ context = this)
|
||||
|
||||
// initialize the UI
|
||||
setTheme(R.style.AppTheme)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.google.android.exoplayer2.*
|
|||
import com.google.android.exoplayer2.metadata.icy.*
|
||||
import fr.forum_thalie.tsumugi.alarm.RadioAlarm
|
||||
import fr.forum_thalie.tsumugi.alarm.RadioSleeper
|
||||
import fr.forum_thalie.tsumugi.planning.Planning
|
||||
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
|
||||
import java.util.*
|
||||
import kotlin.math.exp
|
||||
|
|
@ -129,6 +130,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
|||
PlayerStore.instance.updateLp()
|
||||
}
|
||||
nowPlayingNotification.update(this)
|
||||
Planning.instance.checkProgramme()
|
||||
}
|
||||
|
||||
private val streamerPictureObserver = Observer<Bitmap> {
|
||||
|
|
|
|||
|
|
@ -2,14 +2,27 @@ package fr.forum_thalie.tsumugi
|
|||
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.ColorStateList
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
const val tag = "fr.forum_thalie.tsumugi"
|
||||
const val noConnectionValue = "No connection"
|
||||
const val noConnectionValue = "Arrêté."
|
||||
const val streamDownValue = "Tsumugi est HS !"
|
||||
val weekdaysArray : Array<String> = arrayOf( "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche")
|
||||
|
||||
val weekdays = ArrayList<String>().apply { weekdaysArray.forEach { add(it) } }
|
||||
val weekdaysSundayFirst = ArrayList<String>().apply {
|
||||
weekdays.forEach {
|
||||
add(it)
|
||||
}
|
||||
val lastDay = last()
|
||||
removeAt(size - 1)
|
||||
add(0, lastDay)
|
||||
}
|
||||
|
||||
var colorBlue: Int = 0
|
||||
var colorWhited: Int = 0
|
||||
var colorAccent : Int = 0
|
||||
var colorGreenList: ColorStateList? = ColorStateList.valueOf(0)
|
||||
var colorRedList: ColorStateList? = ColorStateList.valueOf(0)
|
||||
var colorGreenListCompat : ColorStateList? = ColorStateList.valueOf(0)
|
||||
|
||||
lateinit var preferenceStore : SharedPreferences
|
||||
|
|
@ -10,6 +10,7 @@ import fr.forum_thalie.tsumugi.BootBroadcastReceiver
|
|||
import androidx.preference.PreferenceManager
|
||||
import fr.forum_thalie.tsumugi.*
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class RadioAlarm {
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ class RadioAlarm {
|
|||
|
||||
val alarmManager = c.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
alarmIntent = Intent(c, BootBroadcastReceiver::class.java).let { intent ->
|
||||
intent.putExtra("action", "fr.forum_thalie.tsumugi.${Actions.PLAY_OR_FALLBACK.name}")
|
||||
intent.putExtra("action", "$tag.${Actions.PLAY_OR_FALLBACK.name}")
|
||||
PendingIntent.getBroadcast(c, 0, intent, 0)
|
||||
}
|
||||
val showIntent = Intent(c, ParametersActivity::class.java).let { intent ->
|
||||
|
|
@ -60,7 +61,7 @@ class RadioAlarm {
|
|||
val hourOfDay = time / 60 //time is in minutes
|
||||
val minute = time % 60
|
||||
|
||||
val fullWeekOrdered = arrayListOf("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
|
||||
val fullWeekOrdered = weekdaysSundayFirst //Sunday --> Saturday
|
||||
val selectedDays = arrayListOf<Int>()
|
||||
for (item in fullWeekOrdered)
|
||||
{
|
||||
|
|
@ -100,7 +101,7 @@ class RadioAlarm {
|
|||
{
|
||||
val alarmManager = c.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
alarmIntent = Intent(c, BootBroadcastReceiver::class.java).let { intent ->
|
||||
intent.putExtra("action", "fr.forum_thalie.tsumugi.${Actions.PLAY_OR_FALLBACK.name}")
|
||||
intent.putExtra("action", "$tag.${Actions.PLAY_OR_FALLBACK.name}")
|
||||
PendingIntent.getBroadcast(c, 0, intent, 0)
|
||||
}
|
||||
val showIntent = Intent(c, ParametersActivity::class.java).let { intent ->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package fr.forum_thalie.tsumugi.planning
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import fr.forum_thalie.tsumugi.Async
|
||||
import fr.forum_thalie.tsumugi.R
|
||||
import fr.forum_thalie.tsumugi.weekdays
|
||||
import org.json.JSONObject
|
||||
import java.io.IOException
|
||||
import java.net.URL
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class Planning {
|
||||
|
||||
val programmes: ArrayList<Programme> = ArrayList()
|
||||
private var regularProgramme: String? = null
|
||||
val currentProgramme: MutableLiveData<String> = MutableLiveData()
|
||||
val isDataFetched: MutableLiveData<Boolean> = MutableLiveData()
|
||||
|
||||
var timeZone: TimeZone = Calendar.getInstance().timeZone
|
||||
|
||||
private fun findCurrentProgramme(): String
|
||||
{
|
||||
programmes.forEach {
|
||||
if (it.isCurrent())
|
||||
return it.title
|
||||
}
|
||||
return regularProgramme ?: "—"
|
||||
}
|
||||
|
||||
fun checkProgramme()
|
||||
{
|
||||
val newProgramme = findCurrentProgramme()
|
||||
if (currentProgramme.value != newProgramme)
|
||||
currentProgramme.value = newProgramme
|
||||
}
|
||||
|
||||
fun parseUrl(url: String? = null, context: Context? = null)
|
||||
{
|
||||
val scrape : (Any?) -> String = {
|
||||
if (url.isNullOrEmpty() && context != null)
|
||||
{
|
||||
val json: String
|
||||
try {
|
||||
val inputStream = context.assets.open("planning_example.json")
|
||||
val size = inputStream.available()
|
||||
val buffer = ByteArray(size)
|
||||
inputStream.use { it.read(buffer) }
|
||||
json = String(buffer)
|
||||
json
|
||||
} catch (ioException: IOException) {
|
||||
ioException.printStackTrace()
|
||||
""
|
||||
}
|
||||
}
|
||||
else
|
||||
URL(url).readText()
|
||||
|
||||
}
|
||||
val post : (parameter: Any?) -> Unit = {
|
||||
val result = JSONObject(it as String)
|
||||
if (result.has("planning"))
|
||||
{
|
||||
val programList = result.getJSONArray("planning")
|
||||
for (i in 0 until programList.length())
|
||||
{
|
||||
val item = programList[i] as JSONObject
|
||||
var periodicityDec = item.getInt("periodicity")
|
||||
var periodicity = 0b0000000
|
||||
var po = 1000000
|
||||
for (j in 0 until weekdays.size)
|
||||
{
|
||||
if (periodicityDec / (po) > 0)
|
||||
{
|
||||
periodicityDec -= po
|
||||
periodicity += 1 shl (weekdays.size-1 - j)
|
||||
}
|
||||
po /= 10
|
||||
}
|
||||
val hourBeginS = item.getString("hour_begin").split(":")
|
||||
val hourBegin = hourBeginS.first().toInt()*60 + hourBeginS.last().toInt()
|
||||
val hourEndS = item.getString("hour_end").split(":")
|
||||
val hourEnd = hourEndS.first().toInt()* 60 + hourEndS.last().toInt()
|
||||
val title = item.getString("title")
|
||||
programmes.add(Programme(title, periodicity, hourBegin, hourEnd))
|
||||
}
|
||||
}
|
||||
regularProgramme = if (result.has("regular_programme"))
|
||||
result.getString("regular_programme")
|
||||
else
|
||||
context?.getString(R.string.regular_programme)
|
||||
|
||||
timeZone = if (result.has("timezone"))
|
||||
TimeZone.getTimeZone(result.getString("timezone"))
|
||||
else
|
||||
Calendar.getInstance().timeZone
|
||||
|
||||
isDataFetched.value = true
|
||||
}
|
||||
Async(scrape, post)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val instance by lazy {
|
||||
Planning()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package fr.forum_thalie.tsumugi.planning
|
||||
|
||||
import android.util.Log
|
||||
import fr.forum_thalie.tsumugi.tag
|
||||
import fr.forum_thalie.tsumugi.weekdays
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class Programme (val title: String, private val periodicity: Int, private val hourBegin: Int, private val hourEnd: Int) {
|
||||
|
||||
fun isThisDay(day: Int): Boolean {
|
||||
|
||||
// 0 (Monday) to 5 (Saturday) + 6 (Sunday)
|
||||
|
||||
// this translates to "true" when:
|
||||
// - the currentDay is flagged in the "periodicity" bit array
|
||||
// OR
|
||||
// - Yesterday is flagged in the "periodicity" bit array AND the program does span over 2 days (night programs).
|
||||
// We'll check a after this whether the current hour is within the span.
|
||||
return (((0b1000000 shr day) and (periodicity)) != 0)
|
||||
}
|
||||
|
||||
fun isCurrent(): Boolean {
|
||||
val now = Calendar.getInstance(Planning.instance.timeZone)
|
||||
val currentDay =
|
||||
if (now.get(Calendar.DAY_OF_WEEK) - 1 == 0) 6 else now.get(Calendar.DAY_OF_WEEK) - 2
|
||||
// 0 (Monday) to 5 (Saturday) + 6 (Sunday)
|
||||
|
||||
// this translates to "true" when:
|
||||
// - the currentDay is flagged in the "periodicity" bit array
|
||||
// OR
|
||||
// - Yesterday is flagged in the "periodicity" bit array AND the program does span over 2 days (night programs).
|
||||
// We'll check a after this whether the current hour is within the span.
|
||||
val isToday: Boolean = (((0b1000000 shr currentDay) and (periodicity)) != 0)
|
||||
val isSpanningOverNight =
|
||||
(((0b1000000 shr ((currentDay - 1) % 7) and (periodicity)) != 0) && hourEnd < hourBegin)
|
||||
|
||||
Log.d(tag, "$title is today: $isToday or spanning $isSpanningOverNight")
|
||||
// shr = shift-right. It's a binary mask.
|
||||
|
||||
// if the program started yesterday, and spanned over night, it means that there could be a chance that it's still active.
|
||||
// we only need to check if the end time has been reached.
|
||||
if (isSpanningOverNight) {
|
||||
return (now.get(Calendar.HOUR_OF_DAY) * 60 + now.get(Calendar.MINUTE) < hourEnd)
|
||||
}
|
||||
|
||||
// if the program is today, we need to check if we're in the hour span.
|
||||
if (isToday) {
|
||||
val hasBegun =
|
||||
(now.get(Calendar.HOUR_OF_DAY) * 60 + now.get(Calendar.MINUTE) >= hourBegin)
|
||||
val hasNotEnded =
|
||||
(now.get(Calendar.HOUR_OF_DAY) * 60 + now.get(Calendar.MINUTE) < hourEnd) || hourEnd < hourBegin
|
||||
return (hasBegun && hasNotEnded)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Title: $title, time info (periodicity, begin, end): $periodicity, $hourBegin, $hourEnd"
|
||||
}
|
||||
|
||||
private val offset1 = (Planning.instance.timeZone.getOffset(System.currentTimeMillis())) / (60*1000)
|
||||
private val offset2 = (Calendar.getInstance().timeZone.getOffset(System.currentTimeMillis())) / (60*1000)
|
||||
|
||||
fun begin(): String {
|
||||
val hourBeginTZCorrect = hourBegin // + offset1 - offset2
|
||||
return "%02d:%02d".format(hourBeginTZCorrect/60, hourBeginTZCorrect%60)
|
||||
}
|
||||
|
||||
fun end(): String {
|
||||
val hourEndTZCorrect = hourEnd // + offset1 - offset2
|
||||
return "%02d:%02d".format(hourEndTZCorrect/60, hourEndTZCorrect%60)
|
||||
}
|
||||
|
||||
/*
|
||||
fun days(): String {
|
||||
val res = ArrayList<String>()
|
||||
for (i in 0 until weekdays.size) {
|
||||
if (((0b1000000 shr i) and (periodicity)) != 0)
|
||||
{
|
||||
res.add(weekdays[i])
|
||||
}
|
||||
}
|
||||
return res.toString().drop(1).dropLast(1) // drop '[' and ']'
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
init {
|
||||
Log.d(tag, this.toString())
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import android.os.Bundle
|
|||
import android.util.Log
|
||||
import androidx.core.content.edit
|
||||
import androidx.preference.*
|
||||
import fr.forum_thalie.tsumugi.*
|
||||
import fr.forum_thalie.tsumugi.R
|
||||
import fr.forum_thalie.tsumugi.alarm.RadioAlarm
|
||||
import java.util.*
|
||||
|
|
@ -18,6 +19,9 @@ class AlarmFragment : PreferenceFragmentCompat() {
|
|||
val alarmDays = findPreference<MultiSelectListPreference>("alarmDays")
|
||||
val snoozeDuration = findPreference<ListPreference>("snoozeDuration")
|
||||
|
||||
alarmDays?.entries = weekdaysArray
|
||||
alarmDays?.entryValues = weekdaysArray
|
||||
alarmDays?.setDefaultValue(weekdaysArray)
|
||||
|
||||
fun updateIsWakingUpSummary(preference: SwitchPreferenceCompat?, newValue: Boolean? = true, forceTime: Int? = null, forceDays: Set<String>? = null)
|
||||
{
|
||||
|
|
@ -26,15 +30,13 @@ class AlarmFragment : PreferenceFragmentCompat() {
|
|||
calendar.timeInMillis = dateLong
|
||||
if (newValue == true && calendar.timeInMillis > 0)
|
||||
{
|
||||
val fullWeekOrdered = arrayListOf("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
|
||||
preference?.summary = "Next alarm on ${fullWeekOrdered[calendar.get(Calendar.DAY_OF_WEEK) - 1]} " +
|
||||
"at ${if (calendar.get(Calendar.HOUR_OF_DAY) < 10) "0" else ""}${calendar.get(Calendar.HOUR_OF_DAY)}" +
|
||||
":${if (calendar.get(Calendar.MINUTE) < 10) "0" else ""}${calendar.get(Calendar.MINUTE)}"
|
||||
val fullWeekOrdered = weekdaysSundayFirst
|
||||
preference?.summary = getString(R.string.next_alarm) + " ${fullWeekOrdered[calendar.get(Calendar.DAY_OF_WEEK) - 1]} ${if (calendar.get(Calendar.HOUR_OF_DAY) < 10) "0" else ""}${calendar.get(Calendar.HOUR_OF_DAY)}:${if (calendar.get(Calendar.MINUTE) < 10) "0" else ""}${calendar.get(Calendar.MINUTE)}"
|
||||
} else if (newValue == true)
|
||||
preference?.summary = "Select at least one day"
|
||||
preference?.summary = getString(R.string.select_one_day)
|
||||
else
|
||||
{
|
||||
preference?.summary = "No alarm set"
|
||||
preference?.summary = getString(R.string.no_alarm_set)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,17 +78,15 @@ class AlarmFragment : PreferenceFragmentCompat() {
|
|||
|
||||
fun updateDays(preference : MultiSelectListPreference?, newValue : Set<String>?)
|
||||
{
|
||||
Log.d(tag, newValue.toString())
|
||||
val listOfDays : String
|
||||
val fullWeek = context!!.resources.getStringArray(R.array.weekdays).toSet()
|
||||
val workingWeek = context!!.resources.getStringArray(R.array.weekdays).toSet().minusElement("Saturday").minusElement("Sunday")
|
||||
listOfDays = when (newValue) {
|
||||
val fullWeek = weekdays.toSet()
|
||||
val workingWeek = weekdays.toSet().minusElement(weekdays.last()).minusElement(weekdays.elementAt(weekdays.size - 2))
|
||||
val listOfDays = when (newValue) {
|
||||
fullWeek -> context!!.getString(R.string.every_day)
|
||||
workingWeek -> context!!.getString(R.string.working_days)
|
||||
else -> {
|
||||
// build ORDERED LIST of days... I don't know why the original one is in shambles!!
|
||||
val fullWeekOrdered = arrayListOf("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
|
||||
val selectedDays = arrayListOf<String>()
|
||||
val fullWeekOrdered = weekdays
|
||||
val selectedDays = ArrayList<String>()
|
||||
for (item in fullWeekOrdered) {
|
||||
if (newValue!!.contains(item))
|
||||
selectedDays.add(item)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package fr.forum_thalie.tsumugi.ui.songs
|
||||
package fr.forum_thalie.tsumugi.ui
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import androidx.fragment.app.FragmentManager
|
||||
|
||||
|
||||
class SongsPagerAdapter(f: FragmentManager, t: Int) : FragmentPagerAdapter(f, t){
|
||||
class APagerAdapter(f: FragmentManager, t: Int) : FragmentPagerAdapter(f, t){
|
||||
|
||||
private val fragmentList = ArrayList<Fragment>()
|
||||
private val fragmentTitleList = ArrayList<String>()
|
||||
|
|
@ -90,6 +90,7 @@ class NewsFragment : Fragment() {
|
|||
100
|
||||
|
||||
if (newsViewModel.screenRatio != newRatio) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||
newsViewModel.fetch((newsViewModel.root as SwipeRefreshLayout), viewAdapter, context!!)
|
||||
newsViewModel.screenRatio = newRatio
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ import com.google.android.material.snackbar.BaseTransientBottomBar
|
|||
import com.google.android.material.snackbar.Snackbar
|
||||
import fr.forum_thalie.tsumugi.*
|
||||
import fr.forum_thalie.tsumugi.alarm.RadioSleeper
|
||||
import fr.forum_thalie.tsumugi.planning.Planning
|
||||
import fr.forum_thalie.tsumugi.playerstore.PlayerStore
|
||||
import fr.forum_thalie.tsumugi.playerstore.Song
|
||||
import kotlinx.android.synthetic.main.fragment_nowplaying.*
|
||||
|
||||
|
||||
class NowPlayingFragment : Fragment() {
|
||||
|
|
@ -51,10 +53,11 @@ class NowPlayingFragment : Fragment() {
|
|||
val streamerPictureImageView: ImageView = root.findViewById(R.id.streamerPicture)
|
||||
|
||||
// Note: these values are not used in the generic app, but if you want to, you can use them.
|
||||
val songTitleNextText: TextView = root.findViewById(R.id.text_song_title_next)
|
||||
//val songArtistNextText: TextView = root.findViewById(R.id.text_song_artist_next)
|
||||
|
||||
/*
|
||||
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 listenersText : TextView = root.findViewById(R.id.listenersCount)
|
||||
*/
|
||||
|
||||
|
|
@ -86,11 +89,15 @@ class NowPlayingFragment : Fragment() {
|
|||
|
||||
|
||||
PlayerStore.instance.currentSong.title.observe(viewLifecycleOwner, Observer {
|
||||
songTitleText.text = it
|
||||
songTitleText.text = it
|
||||
})
|
||||
|
||||
Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer {
|
||||
songTitleNextText.text = it
|
||||
})
|
||||
|
||||
PlayerStore.instance.currentSong.artist.observe(viewLifecycleOwner, Observer {
|
||||
songArtistText.text = it
|
||||
songArtistText.text = it
|
||||
})
|
||||
|
||||
PlayerStore.instance.playbackState.observe(viewLifecycleOwner, Observer {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
package fr.forum_thalie.tsumugi.ui.programme
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.widget.TextViewCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import fr.forum_thalie.tsumugi.*
|
||||
import fr.forum_thalie.tsumugi.planning.Planning
|
||||
import fr.forum_thalie.tsumugi.planning.Programme
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class ProgrammeAdapter(private val dataSet: ArrayList<Programme>, private val day: String
|
||||
/*,
|
||||
context: Context,
|
||||
resource: Int,
|
||||
objects: ArrayList<Programme>*/
|
||||
) : RecyclerView.Adapter<ProgrammeAdapter.MyViewHolder>() /*ArrayAdapter<Song>(context, resource, objects)*/ {
|
||||
|
||||
class MyViewHolder(view: ConstraintLayout) : RecyclerView.ViewHolder(view)
|
||||
|
||||
// Create new views (invoked by the layout manager)
|
||||
override fun onCreateViewHolder(parent: ViewGroup,
|
||||
viewType: Int): MyViewHolder {
|
||||
// create a new view
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.programme_view, parent, false) as ConstraintLayout
|
||||
return MyViewHolder(
|
||||
view
|
||||
)
|
||||
}
|
||||
|
||||
// Replace the contents of a view (invoked by the layout manager)
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
|
||||
val programmeStart = holder.itemView.findViewById<TextView>(R.id.programme_start)
|
||||
val programmeEnd = holder.itemView.findViewById<TextView>(R.id.programme_end)
|
||||
val programmeName = holder.itemView.findViewById<TextView>(R.id.programme_name)
|
||||
|
||||
programmeStart.text = dataSet[position].begin()
|
||||
programmeName.text = dataSet[position].title
|
||||
programmeEnd.text = dataSet[position].end()
|
||||
|
||||
val color = if (dataSet[position].isCurrent() && (Calendar.getInstance(Planning.instance.timeZone).get(Calendar.DAY_OF_WEEK) - 1 == weekdaysSundayFirst.indexOf(day)))
|
||||
colorAccent
|
||||
else
|
||||
colorWhited
|
||||
|
||||
programmeStart.setTextColor(color)
|
||||
programmeEnd.setTextColor(color)
|
||||
programmeName.setTextColor(color)
|
||||
|
||||
//TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
|
||||
// programmeName,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
|
||||
}
|
||||
|
||||
// Return the size of your dataset (invoked by the layout manager)
|
||||
override fun getItemCount() = dataSet.size
|
||||
|
||||
|
||||
/*
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||
// create a new view
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.song_view, parent, false) as ConstraintLayout
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package fr.forum_thalie.tsumugi.ui.programme
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import fr.forum_thalie.tsumugi.R
|
||||
import fr.forum_thalie.tsumugi.planning.Planning
|
||||
import fr.forum_thalie.tsumugi.planning.Programme
|
||||
import fr.forum_thalie.tsumugi.weekdays
|
||||
|
||||
|
||||
class ProgrammeDayFragment : Fragment() {
|
||||
|
||||
private lateinit var recyclerView: RecyclerView
|
||||
private lateinit var viewAdapter: RecyclerView.Adapter<*>
|
||||
private lateinit var viewManager: RecyclerView.LayoutManager
|
||||
private val programmeOfTheDay: ArrayList<Programme> = ArrayList()
|
||||
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
// Inflate the layout for this fragment
|
||||
val viewModel: ProgrammeDayViewModel = ViewModelProviders.of(this).get(ProgrammeDayViewModel::class.java)
|
||||
viewModel.day = arguments?.getString("day") ?: ""
|
||||
|
||||
val root = inflater.inflate(R.layout.fragment_programme_day, container, false)
|
||||
Planning.instance.programmes.forEach {
|
||||
if (it.isThisDay(day = weekdays.indexOf(viewModel.day)))
|
||||
programmeOfTheDay.add(it)
|
||||
}
|
||||
viewManager = LinearLayoutManager(context)
|
||||
viewAdapter =
|
||||
ProgrammeAdapter(programmeOfTheDay, viewModel.day)
|
||||
recyclerView = root.findViewById<RecyclerView>(R.id.programme_recycler).apply {
|
||||
// use this setting to improve performance if you know that changes
|
||||
// in content do not change the layout size of the RecyclerView
|
||||
setHasFixedSize(true)
|
||||
layoutManager = viewManager
|
||||
adapter = viewAdapter
|
||||
}
|
||||
Planning.instance.currentProgramme.observe(viewLifecycleOwner, Observer<String> {
|
||||
programmeOfTheDay.clear()
|
||||
Planning.instance.programmes.forEach {
|
||||
if (it.isThisDay(day = weekdays.indexOf(viewModel.day)))
|
||||
programmeOfTheDay.add(it)
|
||||
}
|
||||
viewAdapter.notifyDataSetChanged()
|
||||
})
|
||||
|
||||
Planning.instance.isDataFetched.observe(viewLifecycleOwner, Observer<Boolean> {
|
||||
viewAdapter.notifyDataSetChanged()
|
||||
})
|
||||
return root
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(day: String): ProgrammeDayFragment {
|
||||
val args = Bundle()
|
||||
args.putString("day", day)
|
||||
val f = ProgrammeDayFragment()
|
||||
f.arguments = args
|
||||
return f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package fr.forum_thalie.tsumugi.ui.programme
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class ProgrammeDayViewModel: ViewModel() {
|
||||
var day: String = ""
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package fr.forum_thalie.tsumugi.ui.programme
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import fr.forum_thalie.tsumugi.R
|
||||
import fr.forum_thalie.tsumugi.planning.Planning
|
||||
import fr.forum_thalie.tsumugi.ui.APagerAdapter
|
||||
import fr.forum_thalie.tsumugi.weekdays
|
||||
import java.util.*
|
||||
|
||||
class ProgrammeFragment : Fragment() {
|
||||
|
||||
private lateinit var adapter : APagerAdapter
|
||||
private lateinit var root: View
|
||||
private lateinit var viewPager: ViewPager
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
|
||||
root = inflater.inflate(R.layout.fragment_programme, container, false)
|
||||
viewPager = root.findViewById(R.id.dayTabPager)
|
||||
adapter = APagerAdapter(childFragmentManager, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT)
|
||||
// You can add more fragments to the adapter, to display more information (for example with R/a/dio, queue, request, faves...)
|
||||
weekdays.forEach {
|
||||
adapter.addFragment(ProgrammeDayFragment.newInstance(it), it)
|
||||
}
|
||||
|
||||
viewPager.adapter = adapter
|
||||
val todaySundayFirst = Calendar.getInstance(Planning.instance.timeZone).get(Calendar.DAY_OF_WEEK) - 1
|
||||
viewPager.currentItem = (todaySundayFirst - 1)%7
|
||||
|
||||
val tabLayout : TabLayout = root.findViewById(R.id.dayTabLayout)
|
||||
tabLayout.setupWithViewPager(viewPager)
|
||||
Log.d(tag, "SongFragment view created")
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,11 +10,13 @@ import androidx.fragment.app.FragmentPagerAdapter
|
|||
import androidx.viewpager.widget.ViewPager
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import fr.forum_thalie.tsumugi.R
|
||||
import fr.forum_thalie.tsumugi.ui.APagerAdapter
|
||||
import fr.forum_thalie.tsumugi.ui.programme.ProgrammeDayFragment
|
||||
import fr.forum_thalie.tsumugi.ui.songs.queuelp.LastPlayedFragment
|
||||
|
||||
class SongsFragment : Fragment() {
|
||||
|
||||
private lateinit var adapter : SongsPagerAdapter
|
||||
private lateinit var adapter : APagerAdapter
|
||||
private lateinit var root: View
|
||||
private lateinit var viewPager: ViewPager
|
||||
|
||||
|
|
@ -26,9 +28,11 @@ class SongsFragment : Fragment() {
|
|||
|
||||
root = inflater.inflate(R.layout.fragment_songs, container, false)
|
||||
viewPager = root.findViewById(R.id.tabPager)
|
||||
adapter = SongsPagerAdapter(childFragmentManager, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT)
|
||||
adapter.addFragment(LastPlayedFragment.newInstance(), "last played")
|
||||
|
||||
adapter = APagerAdapter(
|
||||
childFragmentManager,
|
||||
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
||||
)
|
||||
adapter.addFragment(LastPlayedFragment.newInstance(), getString(R.string.lp))
|
||||
// You can add more fragments to the adapter, to display more information (for example with R/a/dio, queue, request, faves...)
|
||||
|
||||
viewPager.adapter = adapter
|
||||
|
|
@ -37,7 +41,6 @@ class SongsFragment : Fragment() {
|
|||
tabLayout.setupWithViewPager(viewPager)
|
||||
Log.d(tag, "SongFragment view created")
|
||||
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package fr.forum_thalie.tsumugi.ui.songs.queuelp
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -11,6 +12,7 @@ import fr.forum_thalie.tsumugi.R
|
|||
import fr.forum_thalie.tsumugi.colorBlue
|
||||
import fr.forum_thalie.tsumugi.colorWhited
|
||||
import fr.forum_thalie.tsumugi.playerstore.Song
|
||||
import fr.forum_thalie.tsumugi.tag
|
||||
import kotlinx.android.synthetic.main.song_view.view.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="#FFFFFF"
|
||||
android:alpha="0.8">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,3h-1L18,1h-2v2L8,3L8,1L6,1v2L5,3c-1.11,0 -1.99,0.9 -1.99,2L3,19c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,8h14v11zM7,10h5v5L7,15z"/>
|
||||
</vector>
|
||||
Binary file not shown.
|
Efter Bredd: | Höjd: | Storlek: 229 B |
Binary file not shown.
|
Efter Bredd: | Höjd: | Storlek: 144 B |
Binary file not shown.
|
Efter Bredd: | Höjd: | Storlek: 215 B |
Binary file not shown.
|
Efter Bredd: | Höjd: | Storlek: 313 B |
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
tools:context=".ui.songs.queuelp.LastPlayedFragment">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -30,18 +30,19 @@
|
|||
<ImageView
|
||||
android:id="@+id/streamerPicture"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|center_horizontal"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="dj-image"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintBottom_toTopOf="@id/imageLeftGuideline"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
app:layout_constraintStart_toStartOf="@id/imageGuideline"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/logo_roundsquare"
|
||||
android:layout_margin="8dp"
|
||||
tools:ignore="HardcodedText" />
|
||||
<!-- app:layout_constraintBottom_toTopOf="@id/imageLeftGuideline" -->
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/imageGuideline"
|
||||
|
|
@ -97,7 +98,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.80" />
|
||||
app:layout_constraintGuide_percent="0.95" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sleepInfo"
|
||||
|
|
@ -173,7 +174,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
>
|
||||
|
||||
<TextView
|
||||
|
|
@ -183,7 +184,7 @@
|
|||
android:layout_gravity="top"
|
||||
android:text="@string/up_next"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/whited"
|
||||
android:textColor="@color/whited3"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
@ -200,7 +201,8 @@
|
|||
android:textColor="@color/whited3"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/upNext" />
|
||||
app:layout_constraintTop_toBottomOf="@id/upNext"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_song_title_next"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/dayTabPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/dayTabLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabMode="scrollable"
|
||||
app:tabGravity="center"
|
||||
app:tabIndicatorFullWidth="true"
|
||||
android:paddingBottom="8dp"
|
||||
>
|
||||
<!--
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Last played" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Queue" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Request" />
|
||||
-->
|
||||
</com.google.android.material.tabs.TabLayout>
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="8dp"
|
||||
tools:context=".ui.programme.ProgrammeDayFragment">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/programme_recycler"
|
||||
android:scrollbars="vertical"
|
||||
>
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -4,7 +4,9 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp">
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/news_title"
|
||||
|
|
@ -76,6 +78,7 @@
|
|||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@id/news_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/hours"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/programme_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/programme_end"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/whited"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/programme_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/programme_start"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/programme_start"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/whited"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/programme_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="32sp"
|
||||
app:layout_constraintTop_toTopOf="@id/hours"
|
||||
app:layout_constraintBottom_toBottomOf="@id/hours"
|
||||
app:layout_constraintStart_toEndOf="@id/hours"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:textColor="@color/whited"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
>
|
||||
|
|
@ -17,7 +18,6 @@
|
|||
app:layout_constraintBottom_toTopOf="@id/divider"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="8dp"
|
||||
/>
|
||||
|
||||
<View
|
||||
|
|
|
|||
|
|
@ -16,5 +16,10 @@
|
|||
android:icon="@drawable/ic_newspaper"
|
||||
android:title="@string/title_news"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_programme"
|
||||
android:icon="@drawable/ic_programme"
|
||||
android:title="@string/programme"/>
|
||||
|
||||
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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:id="@+id/navigation_programme"
|
||||
app:startDestination="@id/fragment_programme"
|
||||
tools:ignore="UnusedNavigation">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/fragment_programme"
|
||||
android:name="fr.forum_thalie.tsumugi.ui.programme.ProgrammeFragment"
|
||||
android:label="@string/title_programme" />
|
||||
|
||||
</navigation>
|
||||
|
|
@ -1,15 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="weekdays">
|
||||
<item name="monday">Monday</item>
|
||||
<item name="tuesday">Tuesday</item>
|
||||
<item name="wednesday">Wednesday</item>
|
||||
<item name="thursday">Thursday</item>
|
||||
<item name="friday">Friday</item>
|
||||
<item name="saturday">Saturday</item>
|
||||
<item name="sunday">Sunday</item>
|
||||
</string-array>
|
||||
<string-array name="snoozeValues">
|
||||
<item name="0">@string/disable</item>
|
||||
<item name="1">1</item>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<color name="whited3">#999999</color>
|
||||
<color name="whited4">#999999</color>
|
||||
<color name="whited5">#7F7F7F</color>
|
||||
<color name="rblue">#3A7AAF</color>
|
||||
<color name="rblue">#4FC3F7</color>
|
||||
<color name="bluereq">#527a8e</color>
|
||||
<color name="blueTitle">#527a8e</color>
|
||||
<color name="reqButtonPressed">#5cb85c</color>
|
||||
|
|
@ -19,12 +19,12 @@
|
|||
<color name="reqButtonDisabled">#a15755</color>
|
||||
|
||||
<color name="seek_bar_background">#585858</color>
|
||||
<color name="seek_bar_progress">#DF4C3A</color>
|
||||
<color name="seek_bar_secondary_progress">#3A7AAF</color>
|
||||
<color name="seek_bar_progress">#f58b01</color>
|
||||
<color name="seek_bar_secondary_progress">#4FC3F7</color>
|
||||
|
||||
<color name="progress_bar_background">#585858</color>
|
||||
<color name="progress_bar_progress">#3A7AAF</color>
|
||||
<color name="progress_bar_secondary_progress">#DF4C3A</color>
|
||||
<color name="progress_bar_progress">#4FC3F7</color>
|
||||
<color name="progress_bar_secondary_progress">#f58b01</color>
|
||||
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<string name="title_queue_lp">Songs</string>
|
||||
<string name="title_chat">Chat</string>
|
||||
<string name="title_news">News</string>
|
||||
<string name="title_programme">Planning</string>
|
||||
|
||||
<string name="now_playing_notification_title_template">Now playing: %1$s</string>
|
||||
|
||||
|
|
@ -13,9 +14,8 @@
|
|||
<string name="STREAM_URL_RSTLSS">http://stream.radiosolution.fr/rstlss.mp3</string>
|
||||
|
||||
<string name="volume">Volume: </string>
|
||||
<string name="MAIN_API">https://r-a-d.io/api</string>
|
||||
|
||||
<string name="up_next">Up next:</string>
|
||||
<string name="up_next">Émission en cours :</string>
|
||||
<string name="now_streaming">Now streaming</string>
|
||||
<string name="error_webView">Error loading WebView. Try downloading Google Chrome on Google Play, or enabling it if you disabled it.</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
|
@ -43,5 +43,12 @@
|
|||
<string name="disable">Disable</string>
|
||||
<string name="website_url">https://tsumugi.forum-thalie.fr/</string>
|
||||
<string name="rss_url">https://tsumugi.forum-thalie.fr/?feed=rss2</string>
|
||||
<string name="planning_url">ADD SOME URL HERE</string>
|
||||
<string name="select_one_day">Select at least one day</string>
|
||||
<string name="no_alarm_set">No alarm set</string>
|
||||
<string name="next_alarm">Next alarm:</string>
|
||||
<string name="lp">Last played</string>
|
||||
<string name="programme">Planning</string>
|
||||
<string name="regular_programme">Programme régulier</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@
|
|||
app:iconSpaceReserved="false"
|
||||
app:title="Select days of the week"
|
||||
app:singleLineTitle="false"
|
||||
android:entries="@array/weekdays"
|
||||
android:entryValues="@array/weekdays"
|
||||
android:defaultValue="@array/weekdays"
|
||||
|
||||
/>
|
||||
|
||||
<ListPreference
|
||||
|
|
|
|||
Laddar…
Referens i nytt ärende