Browse Source

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

yattoz 4 years ago
parent
commit
691edeee17

+ 2 - 1
app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt View File

122
         RadioAlarm.instance.setNextAlarm(c = this) // this checks the preferenceStore before actually setting an alarm, don't worry.
122
         RadioAlarm.instance.setNextAlarm(c = this) // this checks the preferenceStore before actually setting an alarm, don't worry.
123
 
123
 
124
         // initialize programmatically accessible colors
124
         // initialize programmatically accessible colors
125
-        colorBlue = ResourcesCompat.getColor(resources, R.color.bluereq, null)
125
+        colorBlue = ResourcesCompat.getColor(resources, R.color.rblue, null)
126
         colorWhited = ResourcesCompat.getColor(resources, R.color.whited, null)
126
         colorWhited = ResourcesCompat.getColor(resources, R.color.whited, null)
127
         colorGreenList = (ResourcesCompat.getColorStateList(resources, R.color.button_green, null))
127
         colorGreenList = (ResourcesCompat.getColorStateList(resources, R.color.button_green, null))
128
         colorRedList = (ResourcesCompat.getColorStateList(resources, R.color.button_red, null))
128
         colorRedList = (ResourcesCompat.getColorStateList(resources, R.color.button_red, null))
129
         colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null))
129
         colorGreenListCompat = (ResourcesCompat.getColorStateList(resources, R.color.button_green_compat, null))
130
+        colorAccent = (ResourcesCompat.getColor(resources, R.color.colorAccent, null))
130
 
131
 
131
         // Post-UI Launch
132
         // Post-UI Launch
132
         if (PlayerStore.instance.isInitialized)
133
         if (PlayerStore.instance.isInitialized)

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/Values.kt View File

21
 
21
 
22
 var colorBlue: Int = 0
22
 var colorBlue: Int = 0
23
 var colorWhited: Int = 0
23
 var colorWhited: Int = 0
24
+var colorAccent : Int = 0
24
 var colorGreenList: ColorStateList? = ColorStateList.valueOf(0)
25
 var colorGreenList: ColorStateList? = ColorStateList.valueOf(0)
25
 var colorRedList: ColorStateList? = ColorStateList.valueOf(0)
26
 var colorRedList: ColorStateList? = ColorStateList.valueOf(0)
26
 var colorGreenListCompat : ColorStateList? = ColorStateList.valueOf(0)
27
 var colorGreenListCompat : ColorStateList? = ColorStateList.valueOf(0)
27
-
28
 lateinit var preferenceStore : SharedPreferences
28
 lateinit var preferenceStore : SharedPreferences

+ 14 - 10
app/src/main/java/fr/forum_thalie/tsumugi/ui/programme/ProgrammeAdapter.kt View File

1
 package fr.forum_thalie.tsumugi.ui.programme
1
 package fr.forum_thalie.tsumugi.ui.programme
2
 
2
 
3
 import android.annotation.SuppressLint
3
 import android.annotation.SuppressLint
4
+import android.util.TypedValue
4
 import android.view.LayoutInflater
5
 import android.view.LayoutInflater
5
 import android.view.ViewGroup
6
 import android.view.ViewGroup
6
 import android.widget.TextView
7
 import android.widget.TextView
7
 import androidx.constraintlayout.widget.ConstraintLayout
8
 import androidx.constraintlayout.widget.ConstraintLayout
9
+import androidx.core.widget.TextViewCompat
8
 import androidx.recyclerview.widget.RecyclerView
10
 import androidx.recyclerview.widget.RecyclerView
9
-import fr.forum_thalie.tsumugi.R
10
-import fr.forum_thalie.tsumugi.colorBlue
11
+import fr.forum_thalie.tsumugi.*
11
 import fr.forum_thalie.tsumugi.planning.Planning
12
 import fr.forum_thalie.tsumugi.planning.Planning
12
 import fr.forum_thalie.tsumugi.planning.Programme
13
 import fr.forum_thalie.tsumugi.planning.Programme
13
-import fr.forum_thalie.tsumugi.weekdays
14
-import fr.forum_thalie.tsumugi.weekdaysSundayFirst
15
 import java.util.*
14
 import java.util.*
16
 import kotlin.collections.ArrayList
15
 import kotlin.collections.ArrayList
17
 
16
 
46
         programmeName.text = dataSet[position].title
45
         programmeName.text = dataSet[position].title
47
         programmeEnd.text = dataSet[position].end()
46
         programmeEnd.text = dataSet[position].end()
48
 
47
 
49
-        if (dataSet[position].isCurrent() && (Calendar.getInstance(Planning.instance.timeZone).get(Calendar.DAY_OF_WEEK) - 1 == weekdaysSundayFirst.indexOf(day)))
50
-        {
51
-            programmeStart.setTextColor(colorBlue)
52
-            programmeEnd.setTextColor(colorBlue)
53
-            programmeName.setTextColor(colorBlue)
54
-        }
48
+        val color =  if (dataSet[position].isCurrent() && (Calendar.getInstance(Planning.instance.timeZone).get(Calendar.DAY_OF_WEEK) - 1 == weekdaysSundayFirst.indexOf(day)))
49
+            colorAccent
50
+        else
51
+            colorWhited
52
+
53
+        programmeStart.setTextColor(color)
54
+        programmeEnd.setTextColor(color)
55
+        programmeName.setTextColor(color)
56
+
57
+        //TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
58
+        //    programmeName,8, 16, 2, TypedValue.COMPLEX_UNIT_SP)
55
     }
59
     }
56
 
60
 
57
     // Return the size of your dataset (invoked by the layout manager)
61
     // Return the size of your dataset (invoked by the layout manager)

+ 50 - 24
app/src/main/res/layout/programme_view.xml View File

4
     xmlns:app="http://schemas.android.com/apk/res-auto"
4
     xmlns:app="http://schemas.android.com/apk/res-auto"
5
     android:orientation="vertical" android:layout_width="match_parent"
5
     android:orientation="vertical" android:layout_width="match_parent"
6
     android:layout_height="wrap_content"
6
     android:layout_height="wrap_content"
7
-    android:layout_marginTop="8dp"
8
-    android:layout_marginStart="12dp"
9
-    android:layout_marginEnd="12dp">
7
+    android:layout_marginStart="8dp"
8
+    android:layout_marginEnd="8dp"
9
+    app:layout_constraintVertical_chainStyle="packed"
10
+    >
10
 
11
 
11
-    <TextView
12
-        android:id="@+id/programme_start"
12
+    <androidx.constraintlayout.widget.ConstraintLayout
13
+        android:id="@+id/hours"
13
         android:layout_width="wrap_content"
14
         android:layout_width="wrap_content"
14
-        android:layout_height="wrap_content"
15
+        android:layout_height="0dp"
15
         app:layout_constraintTop_toTopOf="parent"
16
         app:layout_constraintTop_toTopOf="parent"
17
+        app:layout_constraintBottom_toBottomOf="parent"
16
         app:layout_constraintStart_toStartOf="parent"
18
         app:layout_constraintStart_toStartOf="parent"
17
-        android:gravity="start"
18
-        />
19
+        android:layout_marginTop="8dp"
20
+        android:layout_marginBottom="8dp"
21
+        app:layout_constraintVertical_chainStyle="packed"
22
+        >
23
+        <TextView
24
+            android:id="@+id/programme_start"
25
+            android:layout_width="wrap_content"
26
+            android:layout_height="wrap_content"
27
+            app:layout_constraintStart_toStartOf="parent"
28
+            app:layout_constraintTop_toTopOf="parent"
29
+            app:layout_constraintBottom_toTopOf="@id/programme_end"
30
+            android:gravity="start"
31
+            android:textColor="@color/whited"
32
+            app:layout_constraintVertical_chainStyle="packed"
33
+            />
34
+
35
+        <TextView
36
+            android:id="@+id/programme_end"
37
+            android:layout_width="wrap_content"
38
+            android:layout_height="wrap_content"
39
+            app:layout_constraintTop_toBottomOf="@id/programme_start"
40
+            app:layout_constraintBottom_toBottomOf="parent"
41
+            app:layout_constraintStart_toStartOf="@id/programme_start"
42
+            android:gravity="start"
43
+            android:textColor="@color/whited"
44
+            app:layout_constraintVertical_chainStyle="packed"
45
+
46
+            />
47
+    </androidx.constraintlayout.widget.ConstraintLayout>
48
+
49
+
19
 
50
 
20
     <TextView
51
     <TextView
21
         android:id="@+id/programme_name"
52
         android:id="@+id/programme_name"
22
         android:layout_width="0dp"
53
         android:layout_width="0dp"
23
-        android:layout_height="0dp"
24
-        app:layout_constraintTop_toTopOf="@id/programme_start"
25
-        app:layout_constraintBottom_toBottomOf="@id/programme_end"
26
-        app:layout_constraintStart_toEndOf="@id/programme_start"
54
+        android:layout_height="wrap_content"
55
+        android:minHeight="32sp"
56
+        app:layout_constraintTop_toTopOf="@id/hours"
57
+        app:layout_constraintBottom_toBottomOf="@id/hours"
58
+        app:layout_constraintStart_toEndOf="@id/hours"
27
         app:layout_constraintEnd_toEndOf="parent"
59
         app:layout_constraintEnd_toEndOf="parent"
28
-        android:gravity="center"
29
-        android:textAlignment="center"
60
+        android:gravity="center_vertical"
30
         android:textSize="16sp"
61
         android:textSize="16sp"
62
+        android:layout_marginStart="32dp"
63
+        android:layout_marginLeft="32dp"
64
+        android:textColor="@color/whited"
65
+        android:layout_marginTop="8dp"
66
+        android:layout_marginBottom="8dp"
31
         />
67
         />
32
 
68
 
33
-    <TextView
34
-        android:id="@+id/programme_end"
35
-        android:layout_width="wrap_content"
36
-        android:layout_height="wrap_content"
37
-        app:layout_constraintTop_toBottomOf="@id/programme_start"
38
-        app:layout_constraintStart_toStartOf="@id/programme_start"
39
-        android:gravity="start"
40
 
69
 
41
-        />
42
 
70
 
43
     <View
71
     <View
44
         android:id="@+id/divider"
72
         android:id="@+id/divider"
45
         android:layout_width="match_parent"
73
         android:layout_width="match_parent"
46
         android:layout_height="1dp"
74
         android:layout_height="1dp"
47
-        android:layout_marginTop="8dp"
48
         android:background="?android:attr/listDivider"
75
         android:background="?android:attr/listDivider"
49
-        app:layout_constraintTop_toBottomOf="@id/programme_end"
50
         app:layout_constraintStart_toStartOf="parent"
76
         app:layout_constraintStart_toStartOf="parent"
51
         app:layout_constraintBottom_toBottomOf="parent"
77
         app:layout_constraintBottom_toBottomOf="parent"
52
         app:layout_constraintEnd_toEndOf="parent"/>
78
         app:layout_constraintEnd_toEndOf="parent"/>

+ 2 - 2
app/src/main/res/layout/song_view.xml View File

5
     android:layout_width="match_parent"
5
     android:layout_width="match_parent"
6
     android:layout_height="wrap_content"
6
     android:layout_height="wrap_content"
7
     android:layout_marginTop="8dp"
7
     android:layout_marginTop="8dp"
8
-    android:layout_marginStart="12dp"
9
-    android:layout_marginEnd="12dp"
8
+    android:layout_marginStart="8dp"
9
+    android:layout_marginEnd="8dp"
10
     >
10
     >
11
 
11
 
12
     <TextView
12
     <TextView

+ 5 - 5
app/src/main/res/values/colors.xml View File

11
     <color name="whited3">#999999</color>
11
     <color name="whited3">#999999</color>
12
     <color name="whited4">#999999</color>
12
     <color name="whited4">#999999</color>
13
     <color name="whited5">#7F7F7F</color>
13
     <color name="whited5">#7F7F7F</color>
14
-    <color name="rblue">#3A7AAF</color>
14
+    <color name="rblue">#4FC3F7</color>
15
     <color name="bluereq">#527a8e</color>
15
     <color name="bluereq">#527a8e</color>
16
     <color name="blueTitle">#527a8e</color>
16
     <color name="blueTitle">#527a8e</color>
17
     <color name="reqButtonPressed">#5cb85c</color>
17
     <color name="reqButtonPressed">#5cb85c</color>
19
     <color name="reqButtonDisabled">#a15755</color>
19
     <color name="reqButtonDisabled">#a15755</color>
20
 
20
 
21
     <color name="seek_bar_background">#585858</color>
21
     <color name="seek_bar_background">#585858</color>
22
-    <color name="seek_bar_progress">#DF4C3A</color>
23
-    <color name="seek_bar_secondary_progress">#3A7AAF</color>
22
+    <color name="seek_bar_progress">#f58b01</color>
23
+    <color name="seek_bar_secondary_progress">#4FC3F7</color>
24
 
24
 
25
     <color name="progress_bar_background">#585858</color>
25
     <color name="progress_bar_background">#585858</color>
26
-    <color name="progress_bar_progress">#3A7AAF</color>
27
-    <color name="progress_bar_secondary_progress">#DF4C3A</color>
26
+    <color name="progress_bar_progress">#4FC3F7</color>
27
+    <color name="progress_bar_secondary_progress">#f58b01</color>
28
 
28
 
29
     <color name="white">#FFFFFF</color>
29
     <color name="white">#FFFFFF</color>
30
     <color name="black">#000000</color>
30
     <color name="black">#000000</color>