adjustments for layout. Use accent color to color current programme.

remotes/origin/devel
yattoz 2019-12-20 19:06:58 +01:00
parent 81f53966f0
commit 691edeee17
6 changed files with 77 additions and 46 deletions

View File

@ -122,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)

View File

@ -21,8 +21,8 @@ val weekdaysSundayFirst = ArrayList<String>().apply {
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

View File

@ -1,17 +1,16 @@
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.R
import fr.forum_thalie.tsumugi.colorBlue
import fr.forum_thalie.tsumugi.*
import fr.forum_thalie.tsumugi.planning.Planning
import fr.forum_thalie.tsumugi.planning.Programme
import fr.forum_thalie.tsumugi.weekdays
import fr.forum_thalie.tsumugi.weekdaysSundayFirst
import java.util.*
import kotlin.collections.ArrayList
@ -46,12 +45,17 @@ class ProgrammeAdapter(private val dataSet: ArrayList<Programme>, private val da
programmeName.text = dataSet[position].title
programmeEnd.text = dataSet[position].end()
if (dataSet[position].isCurrent() && (Calendar.getInstance(Planning.instance.timeZone).get(Calendar.DAY_OF_WEEK) - 1 == weekdaysSundayFirst.indexOf(day)))
{
programmeStart.setTextColor(colorBlue)
programmeEnd.setTextColor(colorBlue)
programmeName.setTextColor(colorBlue)
}
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)

View File

@ -4,30 +4,32 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp">
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_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/programme_end"
android:gravity="start"
/>
<TextView
android:id="@+id/programme_name"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="@id/programme_start"
app:layout_constraintBottom_toBottomOf="@id/programme_end"
app:layout_constraintStart_toEndOf="@id/programme_start"
app:layout_constraintEnd_toEndOf="parent"
android:gravity="center"
android:textAlignment="center"
android:textSize="16sp"
android:textColor="@color/whited"
app:layout_constraintVertical_chainStyle="packed"
/>
<TextView
@ -35,18 +37,42 @@
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:layout_marginTop="8dp"
android:background="?android:attr/listDivider"
app:layout_constraintTop_toBottomOf="@id/programme_end"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

View File

@ -5,8 +5,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
>
<TextView

View File

@ -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>