diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt index 7e286c923..57ec5998d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt @@ -11,6 +11,7 @@ import android.view.ViewGroup import androidx.fragment.app.DialogFragment import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Timetable +import io.github.wulkanowy.utils.getThemeAttrColor import io.github.wulkanowy.utils.toFormattedString import kotlinx.android.synthetic.main.dialog_timetable.* import org.threeten.bp.LocalDateTime @@ -72,13 +73,22 @@ class TimetableDialog : DialogFragment() { private fun setInfo(info: String, teacher: String, canceled: Boolean, changes: Boolean) { when { - info.isNotBlank() -> timetableDialogChanges.text = when { - canceled && !changes -> "Lekcja odwołana: $info" - changes && teacher.isNotBlank() -> "Zastępstwo: $teacher" - changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalize()}" - else -> info.capitalize() - } - else -> { + info.isNotBlank() -> { + if (canceled) { + timetableDialogChangesTitle.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary)) + timetableDialogChanges.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary)) + } else { + timetableDialogChangesTitle.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange)) + timetableDialogChanges.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange)) + } + + timetableDialogChanges.text = when { + canceled && !changes -> "Lekcja odwołana: $info" + changes && teacher.isNotBlank() -> "Zastępstwo: $teacher" + changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalize()}" + else -> info.capitalize() + } + } else -> { timetableDialogChangesTitle.visibility = GONE timetableDialogChanges.visibility = GONE } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt index a580a417d..a64dee8d8 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableFragment.kt @@ -39,8 +39,6 @@ class TimetableFragment : BaseFragment(), TimetableView, MainView.MainChildView, override val titleStringId get() = R.string.timetable_title - override val roomString get() = getString(R.string.timetable_room) - override val isViewEmpty get() = timetableAdapter.isEmpty override val currentStackSize get() = (activity as? MainActivity)?.currentStackSize diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableItem.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableItem.kt index c721401f3..0991981df 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableItem.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableItem.kt @@ -11,11 +11,12 @@ import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.viewholders.FlexibleViewHolder import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.Timetable +import io.github.wulkanowy.utils.getThemeAttrColor import io.github.wulkanowy.utils.toFormattedString import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.item_timetable.* -class TimetableItem(val lesson: Timetable, private val roomText: String) : +class TimetableItem(val lesson: Timetable) : AbstractFlexibleItem() { override fun getLayoutRes() = R.layout.item_timetable @@ -26,16 +27,97 @@ class TimetableItem(val lesson: Timetable, private val roomText: String) : @SuppressLint("SetTextI18n") override fun bindViewHolder(adapter: FlexibleAdapter>, holder: ViewHolder, position: Int, payloads: MutableList?) { - holder.apply { - timetableItemNumber.text = lesson.number.toString() - timetableItemSubject.text = lesson.subject - timetableItemRoom.text = if (lesson.room.isNotBlank()) "$roomText ${lesson.room}" else "" - timetableItemTime.text = "${lesson.start.toFormattedString("HH:mm")} - ${lesson.end.toFormattedString("HH:mm")}" - timetableItemAlert.visibility = if (lesson.changes || lesson.canceled) VISIBLE else GONE + updateFields(holder) + + with(holder) { timetableItemSubject.paintFlags = if (lesson.canceled) timetableItemSubject.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG else timetableItemSubject.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv() } + + updateDescription(holder) + updateColors(holder) + } + + private fun updateFields(holder: ViewHolder) { + with(holder) { + timetableItemNumber.text = lesson.number.toString() + timetableItemSubject.text = lesson.subject + timetableItemRoom.text = lesson.room + timetableItemTeacher.text = lesson.teacher + timetableItemTimeStart.text = lesson.start.toFormattedString("HH:mm") + timetableItemTimeFinish.text = lesson.end.toFormattedString("HH:mm") + } + } + + private fun updateDescription(holder: ViewHolder) { + with(holder) { + if (lesson.info.isNotBlank() && !lesson.changes) { + updateDescriptionNoChanges(this) + } else { + timetableItemDescription.visibility = GONE + + timetableItemRoom.visibility = VISIBLE + timetableItemTeacher.visibility = VISIBLE + } + } + } + + private fun updateDescriptionNoChanges(holder: ViewHolder) { + with(holder) { + timetableItemDescription.visibility = VISIBLE + timetableItemDescription.text = lesson.info + + timetableItemRoom.visibility = GONE + timetableItemTeacher.visibility = GONE + + timetableItemDescription.setTextColor(holder.view.context.getThemeAttrColor( + if (lesson.canceled) R.attr.colorPrimary + else R.attr.colorTimetableChange + )) + } + } + + private fun updateColors(holder: ViewHolder) { + with(holder) { + if (lesson.canceled) { + timetableItemNumber.setTextColor(holder.view.context.getThemeAttrColor(R.attr.colorPrimary)) + timetableItemSubject.setTextColor(holder.view.context.getThemeAttrColor(R.attr.colorPrimary)) + } else { + updateNumberColor(this) + updateSubjectColor(this) + updateRoomColor(this) + updateTeacherColor(this) + } + } + } + + private fun updateNumberColor(holder: ViewHolder) { + holder.timetableItemNumber.setTextColor(holder.view.context.getThemeAttrColor( + if (lesson.changes || lesson.info.isNotBlank()) R.attr.colorTimetableChange + else android.R.attr.textColorPrimary + )) + } + + private fun updateSubjectColor(holder: ViewHolder) { + holder.timetableItemSubject.setTextColor(holder.view.context.getThemeAttrColor( + if (lesson.subjectOld.isNotBlank() && lesson.subjectOld != lesson.subject) R.attr.colorTimetableChange + else android.R.attr.textColorPrimary + )) + } + + private fun updateRoomColor(holder: ViewHolder) { + holder.timetableItemRoom.setTextColor(holder.view.context.getThemeAttrColor( + if (lesson.roomOld.isNotBlank() && lesson.roomOld != lesson.room) R.attr.colorTimetableChange + else android.R.attr.textColorSecondary + )) + } + + private fun updateTeacherColor(holder: ViewHolder) { + holder.timetableItemTeacher.setTextColor(holder.view.context.getThemeAttrColor( + if (lesson.teacherOld.isNotBlank() && lesson.teacherOld != lesson.teacher) R.attr.colorTimetableChange + else android.R.attr.textColorSecondary + )) } override fun equals(other: Any?): Boolean { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index 10e63b309..cea5bf2f5 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -109,7 +109,7 @@ class TimetablePresenter @Inject constructor( .flatMap { semesterRepository.getCurrentSemester(it) } .delay(200, MILLISECONDS) .flatMap { timetableRepository.getTimetable(it, currentDate, currentDate, forceRefresh) } - .map { items -> items.map { TimetableItem(it, view?.roomString.orEmpty()) } } + .map { items -> items.map { TimetableItem(it) } } .map { items -> items.sortedBy { it.lesson.number } } .subscribeOn(schedulers.backgroundThread) .observeOn(schedulers.mainThread) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt index 80a2f9b8e..84f28974f 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt @@ -5,8 +5,6 @@ import io.github.wulkanowy.ui.base.BaseView interface TimetableView : BaseView { - val roomString: String - val isViewEmpty: Boolean val currentStackSize: Int? diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonItem.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonItem.kt index 716903f55..fd6dc8a66 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonItem.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonItem.kt @@ -9,6 +9,7 @@ import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.viewholders.FlexibleViewHolder import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.CompletedLesson +import io.github.wulkanowy.utils.getThemeAttrColor import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.item_completed_lesson.* @@ -23,6 +24,10 @@ class CompletedLessonItem(val completedLesson: CompletedLesson) : AbstractFlexib override fun bindViewHolder(adapter: FlexibleAdapter>?, holder: CompletedLessonItem.ViewHolder?, position: Int, payloads: MutableList?) { holder?.apply { completedLessonItemNumber.text = completedLesson.number.toString() + completedLessonItemNumber.setTextColor(holder.contentView.context.getThemeAttrColor( + if (completedLesson.substitution.isNotEmpty()) R.attr.colorTimetableChange + else android.R.attr.textColorPrimary + )) completedLessonItemSubject.text = completedLesson.subject completedLessonItemTopic.text = completedLesson.topic completedLessonItemAlert.visibility = if (completedLesson.substitution.isNotEmpty()) VISIBLE else GONE diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt index a2591ac8d..fa989749a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetFactory.kt @@ -21,6 +21,7 @@ import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider.Co import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider.Companion.getStudentWidgetKey import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider.Companion.getThemeWidgetKey import io.github.wulkanowy.utils.SchedulersProvider +import io.github.wulkanowy.utils.getCompatColor import io.github.wulkanowy.utils.toFormattedString import io.reactivex.Maybe import org.threeten.bp.LocalDate @@ -40,6 +41,12 @@ class TimetableWidgetFactory( private var layoutId: Int? = null + private var primaryColor: Int? = null + + private var textColor: Int? = null + + private var timetableChangeColor: Int? = null + override fun getLoadingView() = null override fun hasStableIds() = true @@ -59,28 +66,40 @@ class TimetableWidgetFactory( val date = LocalDate.ofEpochDay(sharedPref.getLong(getDateWidgetKey(appWidgetId), 0)) val studentId = sharedPref.getLong(getStudentWidgetKey(appWidgetId), 0) - val savedTheme = sharedPref.getLong(getThemeWidgetKey(appWidgetId), 0) - layoutId = if (savedTheme == 0L) R.layout.item_widget_timetable else R.layout.item_widget_timetable_dark + updateTheme(appWidgetId) - lessons = try { - studentRepository.isStudentSaved() - .filter { true } - .flatMap { studentRepository.getSavedStudents().toMaybe() } - .flatMap { - val student = it.singleOrNull { student -> student.id == studentId } + updateLessons(date, studentId) + } + } - if (student != null) Maybe.just(student) - else Maybe.empty() - } - .flatMap { semesterRepository.getCurrentSemester(it).toMaybe() } - .flatMap { timetableRepository.getTimetable(it, date, date).toMaybe() } - .map { item -> item.sortedBy { it.number } } - .subscribeOn(schedulers.backgroundThread) - .blockingGet(emptyList()) - } catch (e: Exception) { - Timber.e(e, "An error has occurred in timetable widget factory") - emptyList() - } + private fun updateTheme(appWidgetId: Int) { + val savedTheme = sharedPref.getLong(getThemeWidgetKey(appWidgetId), 0) + layoutId = if (savedTheme == 0L) R.layout.item_widget_timetable else R.layout.item_widget_timetable_dark + + primaryColor = if (savedTheme == 0L) R.color.colorPrimary else R.color.colorPrimaryLight + textColor = if (savedTheme == 0L) android.R.color.black else android.R.color.white + timetableChangeColor = if (savedTheme == 0L) R.color.timetable_change_dark else R.color.timetable_change_light + } + + private fun updateLessons(date: LocalDate, studentId: Long) { + lessons = try { + studentRepository.isStudentSaved() + .filter { true } + .flatMap { studentRepository.getSavedStudents().toMaybe() } + .flatMap { + val student = it.singleOrNull { student -> student.id == studentId } + + if (student != null) Maybe.just(student) + else Maybe.empty() + } + .flatMap { semesterRepository.getCurrentSemester(it).toMaybe() } + .flatMap { timetableRepository.getTimetable(it, date, date).toMaybe() } + .map { item -> item.sortedBy { it.number } } + .subscribeOn(schedulers.backgroundThread) + .blockingGet(emptyList()) + } catch (e: Exception) { + Timber.e(e, "An error has occurred in timetable widget factory") + emptyList() } } @@ -93,34 +112,95 @@ class TimetableWidgetFactory( setTextViewText(R.id.timetableWidgetItemSubject, lesson.subject) setTextViewText(R.id.timetableWidgetItemNumber, lesson.number.toString()) - setTextViewText(R.id.timetableWidgetItemTime, lesson.start.toFormattedString("HH:mm") + - " - ${lesson.end.toFormattedString("HH:mm")}") + setTextViewText(R.id.timetableWidgetItemTimeStart, lesson.start.toFormattedString("HH:mm")) + setTextViewText(R.id.timetableWidgetItemTimeFinish, lesson.end.toFormattedString("HH:mm")) - if (lesson.room.isNotBlank()) { - setTextViewText(R.id.timetableWidgetItemRoom, "${context.getString(R.string.timetable_room)} ${lesson.room}") - } else setTextViewText(R.id.timetableWidgetItemRoom, "") - - if (lesson.info.isNotBlank()) { - setViewVisibility(R.id.timetableWidgetItemDescription, VISIBLE) - setTextViewText(R.id.timetableWidgetItemDescription, - with(lesson) { - when (true) { - canceled && !changes -> "Lekcja odwołana: ${lesson.info}" - changes && teacher.isNotBlank() -> "Zastępstwo: ${lesson.teacher}" - changes && teacher.isBlank() -> "Zastępstwo, ${lesson.info.decapitalize()}" - else -> info.capitalize() - } - }) - } else setViewVisibility(R.id.timetableWidgetItemDescription, GONE) + updateDescription(this, lesson) if (lesson.canceled) { - setInt(R.id.timetableWidgetItemSubject, "setPaintFlags", - STRIKE_THRU_TEXT_FLAG or ANTI_ALIAS_FLAG) + updateStylesCanceled(this) } else { - setInt(R.id.timetableWidgetItemSubject, "setPaintFlags", ANTI_ALIAS_FLAG) + updateStylesNotCanceled(this, lesson) } setOnClickFillInIntent(R.id.timetableWidgetItemContainer, Intent()) } } + + private fun updateDescription(remoteViews: RemoteViews, lesson: Timetable) { + with(remoteViews) { + if (lesson.info.isNotBlank() && !lesson.changes) { + setTextViewText(R.id.timetableWidgetItemDescription, lesson.info) + setViewVisibility(R.id.timetableWidgetItemDescription, VISIBLE) + setViewVisibility(R.id.timetableWidgetItemRoom, GONE) + setViewVisibility(R.id.timetableWidgetItemTeacher, GONE) + } else { + setViewVisibility(R.id.timetableWidgetItemDescription, GONE) + setViewVisibility(R.id.timetableWidgetItemRoom, VISIBLE) + setViewVisibility(R.id.timetableWidgetItemTeacher, VISIBLE) + } + } + } + + private fun updateStylesCanceled(remoteViews: RemoteViews) { + with(remoteViews) { + setInt(R.id.timetableWidgetItemSubject, "setPaintFlags", + STRIKE_THRU_TEXT_FLAG or ANTI_ALIAS_FLAG) + setTextColor(R.id.timetableWidgetItemNumber, context.getCompatColor(primaryColor!!)) + setTextColor(R.id.timetableWidgetItemSubject, context.getCompatColor(primaryColor!!)) + setTextColor(R.id.timetableWidgetItemDescription, context.getCompatColor(primaryColor!!)) + } + } + + private fun updateStylesNotCanceled(remoteViews: RemoteViews, lesson: Timetable) { + with(remoteViews) { + setInt(R.id.timetableWidgetItemSubject, "setPaintFlags", ANTI_ALIAS_FLAG) + setTextColor(R.id.timetableWidgetItemSubject, context.getCompatColor(textColor!!)) + setTextColor(R.id.timetableWidgetItemDescription, context.getCompatColor(timetableChangeColor!!)) + + updateNotCanceledLessonNumberColor(this, lesson) + updateNotCanceledSubjectColor(this, lesson) + + val teacherChange = lesson.teacherOld.isNotBlank() && lesson.teacher != lesson.teacherOld + updateNotCanceledRoom(this, lesson, teacherChange) + updateNotCanceledTeacher(this, lesson, teacherChange) + } + } + + private fun updateNotCanceledLessonNumberColor(remoteViews: RemoteViews, lesson: Timetable) { + remoteViews.setTextColor(R.id.timetableWidgetItemNumber, context.getCompatColor( + if (lesson.changes || (lesson.info.isNotBlank() && !lesson.canceled)) timetableChangeColor!! + else textColor!! + )) + } + + private fun updateNotCanceledSubjectColor(remoteViews: RemoteViews, lesson: Timetable) { + remoteViews.setTextColor(R.id.timetableWidgetItemSubject, context.getCompatColor( + if (lesson.subjectOld.isNotBlank() && lesson.subject != lesson.subjectOld) timetableChangeColor!! + else textColor!! + )) + } + + private fun updateNotCanceledRoom(remoteViews: RemoteViews, lesson: Timetable, teacherChange: Boolean) { + with(remoteViews) { + if (lesson.room.isNotBlank()) { + setTextViewText(R.id.timetableWidgetItemRoom, + if (teacherChange) lesson.room + else "${context.getString(R.string.timetable_room)} ${lesson.room}" + ) + + setTextColor(R.id.timetableWidgetItemRoom, context.getCompatColor( + if (lesson.roomOld.isNotBlank() && lesson.room != lesson.roomOld) timetableChangeColor!! + else textColor!! + )) + } else setTextViewText(R.id.timetableWidgetItemRoom, "") + } + } + + private fun updateNotCanceledTeacher(remoteViews: RemoteViews, lesson: Timetable, teacherChange: Boolean) { + remoteViews.setTextViewText(R.id.timetableWidgetItemTeacher, + if (teacherChange) lesson.teacher + else "" + ) + } } diff --git a/app/src/main/res/layout/dialog_lesson_completed.xml b/app/src/main/res/layout/dialog_lesson_completed.xml index 47d6219ac..31ca7dd3b 100644 --- a/app/src/main/res/layout/dialog_lesson_completed.xml +++ b/app/src/main/res/layout/dialog_lesson_completed.xml @@ -80,7 +80,7 @@ android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="@string/timetable_changes" - android:textColor="?colorPrimary" + android:textColor="?colorTimetableChange" android:textSize="17sp" /> diff --git a/app/src/main/res/layout/dialog_timetable.xml b/app/src/main/res/layout/dialog_timetable.xml index d94912faa..f3d4cf1ce 100644 --- a/app/src/main/res/layout/dialog_timetable.xml +++ b/app/src/main/res/layout/dialog_timetable.xml @@ -1,7 +1,8 @@ + android:layout_height="match_parent" + xmlns:tools="http://schemas.android.com/tools"> @@ -57,10 +58,11 @@ android:layout_height="wrap_content" android:layout_marginTop="3dp" android:text="@string/all_no_data" - android:textColor="?colorPrimary" + android:textColor="?colorTimetableChange" android:textIsSelectable="true" android:textSize="12sp" - android:visibility="gone" /> + android:visibility="gone" + tools:visibility="visible" /> + android:visibility="gone" + tools:visibility="visible" /> + android:visibility="gone" + tools:visibility="visible" /> @@ -31,8 +31,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" - android:layout_marginStart="10dp" - android:layout_marginLeft="10dp" + android:layout_marginStart="8dp" + android:layout_marginLeft="8dp" android:layout_marginEnd="40dp" android:layout_marginRight="40dp" android:layout_toStartOf="@id/completedLessonItemAlert" @@ -67,8 +67,8 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" - android:layout_marginTop="10dp" - android:tint="?colorPrimary" + android:layout_centerVertical="true" + android:tint="?colorTimetableChange" app:srcCompat="@drawable/ic_timetable_swap" tools:ignore="contentDescription" /> diff --git a/app/src/main/res/layout/item_timetable.xml b/app/src/main/res/layout/item_timetable.xml index 0072524a1..fcdae2e0a 100644 --- a/app/src/main/res/layout/item_timetable.xml +++ b/app/src/main/res/layout/item_timetable.xml @@ -1,26 +1,25 @@ + + + android:textSize="13sp" + tools:text="12:00" /> + android:textSize="13sp" + tools:text="22" + tools:visibility="gone" /> - + android:layout_alignBottom="@+id/timetableItemNumber" + android:layout_marginStart="10dp" + android:layout_marginLeft="10dp" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + android:layout_toEndOf="@id/timetableItemRoom" + android:layout_toRightOf="@id/timetableItemRoom" + android:maxLines="1" + android:ellipsize="end" + android:textColor="?android:textColorSecondary" + android:textSize="13sp" + tools:text="Agata Kowalska - Błaszczyk" + tools:visibility="gone" /> + + + diff --git a/app/src/main/res/layout/item_widget_timetable.xml b/app/src/main/res/layout/item_widget_timetable.xml index a700fcc01..c69bade8a 100644 --- a/app/src/main/res/layout/item_widget_timetable.xml +++ b/app/src/main/res/layout/item_widget_timetable.xml @@ -11,81 +11,120 @@ + android:background="@android:color/white" + android:paddingTop="6dp" + android:paddingBottom="6dp" + android:paddingLeft="6dp" + android:paddingStart="6dp" + android:paddingEnd="12dp" + android:paddingRight="12dp"> - - + tools:text="5" /> + android:layout_toEndOf="@id/timetableWidgetItemNumber" + android:layout_toRightOf="@id/timetableWidgetItemNumber" + android:layout_marginLeft="6dp" + android:layout_marginStart="6dp" + android:layout_alignTop="@id/timetableWidgetItemNumber" + android:maxLines="1" + android:textColor="@android:color/black" + android:textSize="13sp" + tools:text="11:11" /> + + + android:textSize="13sp" + tools:text="22" + tools:visibility="visible" /> + + + + + android:background="@color/colorWidgetBackground" + android:paddingTop="6dp" + android:paddingBottom="6dp" + android:paddingLeft="6dp" + android:paddingStart="6dp" + android:paddingEnd="12dp" + android:paddingRight="12dp"> - - + tools:text="5" /> + android:layout_toEndOf="@id/timetableWidgetItemNumber" + android:layout_toRightOf="@id/timetableWidgetItemNumber" + android:layout_marginLeft="6dp" + android:layout_marginStart="6dp" + android:layout_alignTop="@id/timetableWidgetItemNumber" + android:maxLines="1" + android:textColor="@android:color/white" + android:textSize="13sp" + tools:text="11:11" /> + + + android:textSize="13sp" + tools:text="22" + tools:visibility="visible" /> + + + + @color/colorPrimaryLight @color/colorPrimaryLight + @color/timetable_change_light @color/colorErrorLight @color/colorDividerInverse ?colorSurface diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index accd3f807..49cdd5b7e 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -1,4 +1,5 @@ + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a2bf9e006..6221ef99b 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -6,6 +6,9 @@ #ff5722 #e84853 + #ffd54f + #ff8f00 + #1f000000 #1fffffff diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8c693f734..07f28c682 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -6,6 +6,7 @@ @color/colorPrimary @color/colorPrimary @android:color/white + @color/timetable_change_dark @color/colorError @color/colorDivider ?android:textColorPrimary