浏览代码

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

yattoz 5 年前
父节点
当前提交
1f2fbfe4ae

+ 2 - 1
app/src/main/java/fr/forum_thalie/tsumugi/MainActivity.kt 查看文件

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

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/Values.kt 查看文件

@@ -21,8 +21,8 @@ val weekdaysSundayFirst = ArrayList<String>().apply {
21 21
 
22 22
 var colorBlue: Int = 0
23 23
 var colorWhited: Int = 0
24
+var colorAccent : Int = 0
24 25
 var colorGreenList: ColorStateList? = ColorStateList.valueOf(0)
25 26
 var colorRedList: ColorStateList? = ColorStateList.valueOf(0)
26 27
 var colorGreenListCompat : ColorStateList? = ColorStateList.valueOf(0)
27
-
28 28
 lateinit var preferenceStore : SharedPreferences

+ 14 - 10
app/src/main/java/fr/forum_thalie/tsumugi/ui/programme/ProgrammeAdapter.kt 查看文件

@@ -1,17 +1,16 @@
1 1
 package fr.forum_thalie.tsumugi.ui.programme
2 2
 
3 3
 import android.annotation.SuppressLint
4
+import android.util.TypedValue
4 5
 import android.view.LayoutInflater
5 6
 import android.view.ViewGroup
6 7
 import android.widget.TextView
7 8
 import androidx.constraintlayout.widget.ConstraintLayout
9
+import androidx.core.widget.TextViewCompat
8 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 12
 import fr.forum_thalie.tsumugi.planning.Planning
12 13
 import fr.forum_thalie.tsumugi.planning.Programme
13
-import fr.forum_thalie.tsumugi.weekdays
14
-import fr.forum_thalie.tsumugi.weekdaysSundayFirst
15 14
 import java.util.*
16 15
 import kotlin.collections.ArrayList
17 16
 
@@ -46,12 +45,17 @@ class ProgrammeAdapter(private val dataSet: ArrayList<Programme>, private val da
46 45
         programmeName.text = dataSet[position].title
47 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 61
     // Return the size of your dataset (invoked by the layout manager)

+ 50 - 24
app/src/main/res/layout/programme_view.xml 查看文件

@@ -4,49 +4,75 @@
4 4
     xmlns:app="http://schemas.android.com/apk/res-auto"
5 5
     android:orientation="vertical" android:layout_width="match_parent"
6 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 14
         android:layout_width="wrap_content"
14
-        android:layout_height="wrap_content"
15
+        android:layout_height="0dp"
15 16
         app:layout_constraintTop_toTopOf="parent"
17
+        app:layout_constraintBottom_toBottomOf="parent"
16 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 51
     <TextView
21 52
         android:id="@+id/programme_name"
22 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 59
         app:layout_constraintEnd_toEndOf="parent"
28
-        android:gravity="center"
29
-        android:textAlignment="center"
60
+        android:gravity="center_vertical"
30 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 71
     <View
44 72
         android:id="@+id/divider"
45 73
         android:layout_width="match_parent"
46 74
         android:layout_height="1dp"
47
-        android:layout_marginTop="8dp"
48 75
         android:background="?android:attr/listDivider"
49
-        app:layout_constraintTop_toBottomOf="@id/programme_end"
50 76
         app:layout_constraintStart_toStartOf="parent"
51 77
         app:layout_constraintBottom_toBottomOf="parent"
52 78
         app:layout_constraintEnd_toEndOf="parent"/>

+ 2 - 2
app/src/main/res/layout/song_view.xml 查看文件

@@ -5,8 +5,8 @@
5 5
     android:layout_width="match_parent"
6 6
     android:layout_height="wrap_content"
7 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 12
     <TextView

+ 5 - 5
app/src/main/res/values/colors.xml 查看文件

@@ -11,7 +11,7 @@
11 11
     <color name="whited3">#999999</color>
12 12
     <color name="whited4">#999999</color>
13 13
     <color name="whited5">#7F7F7F</color>
14
-    <color name="rblue">#3A7AAF</color>
14
+    <color name="rblue">#4FC3F7</color>
15 15
     <color name="bluereq">#527a8e</color>
16 16
     <color name="blueTitle">#527a8e</color>
17 17
     <color name="reqButtonPressed">#5cb85c</color>
@@ -19,12 +19,12 @@
19 19
     <color name="reqButtonDisabled">#a15755</color>
20 20
 
21 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 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 29
     <color name="white">#FFFFFF</color>
30 30
     <color name="black">#000000</color>