added a dark theme, see #15

* the app now needs sdkversion 23 now an min
This commit is contained in:
Jannik 2019-06-24 22:41:45 +02:00
parent 01db6bb451
commit a055f59cc8
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
17 changed files with 271 additions and 163 deletions

View File

@ -10,10 +10,10 @@ android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
applicationId "org.mosad.seil0.projectlaogai" applicationId "org.mosad.seil0.projectlaogai"
minSdkVersion 21 minSdkVersion 23
targetSdkVersion 28 targetSdkVersion 28
versionCode 13 versionCode 14
versionName "0.4.90" versionName "0.4.91"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "build_time", buildTime() resValue "string", "build_time", buildTime()
setProperty("archivesBaseName", "projectlaogai-$versionName") setProperty("archivesBaseName", "projectlaogai-$versionName")
@ -37,7 +37,7 @@ dependencies {
implementation 'org.jetbrains.anko:anko-commons:0.10.8' implementation 'org.jetbrains.anko:anko-commons:0.10.8'
implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0' implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.google.code.gson:gson:2.8.5'

View File

@ -61,26 +61,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// load mensa, timetable and color // load mensa, timetable and color
load() load()
initAesthetic()
// If we haven't set any defaults, do that now
if (Aesthetic.isFirstTime) {
// this is executed on the first app start, use this to show tutorial etc.
Aesthetic.config {
colorPrimary(Color.BLACK)
colorPrimaryDark(Color.BLACK)
colorAccent(Color.parseColor("#3F51B5"))
apply()
}
SettingsFragment().selectCourse(this)
} else {
Aesthetic.config {
colorPrimary(cColorPrimary)
colorPrimaryDark(cColorPrimary)
colorAccent(cColorAccent)
apply()
}
}
//init home fragment //init home fragment
val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction() val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
@ -146,6 +127,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
fragmentTransaction.commit() fragmentTransaction.commit()
drawer_layout.closeDrawer(GravityCompat.START) drawer_layout.closeDrawer(GravityCompat.START)
return true return true
} }
@ -208,4 +190,28 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
println("startup completed in $startupTime ms") println("startup completed in $startupTime ms")
} }
private fun initAesthetic() {
// If we haven't set any defaults, do that now
if (Aesthetic.isFirstTime) {
// this is executed on the first app start, use this to show tutorial etc.
Aesthetic.config {
activityTheme(R.style.AppTheme)
colorPrimary(Color.BLACK)
colorPrimaryDark(Color.BLACK)
colorAccent(Color.parseColor("#3f51b5"))
apply()
}
SettingsFragment().selectCourse(this)
} else {
Aesthetic.config {
// activityTheme(R.style.AppTheme_Light)
colorPrimary(cColorPrimary)
colorPrimaryDark(cColorPrimary)
colorAccent(cColorAccent)
apply()
}
}
}
} }

View File

@ -37,6 +37,10 @@ class CacheController(cont: Context) {
private val context = cont private val context = cont
init {
// TODO move cache check here
}
companion object { companion object {
var coursesList = ArrayList<Course>() var coursesList = ArrayList<Course>()
var timetables = ArrayList<TimetableWeek>() var timetables = ArrayList<TimetableWeek>()

View File

@ -60,7 +60,7 @@ class HomeFragment : Fragment() {
val view: View = inflater.inflate(R.layout.fragment_home, container, false) val view: View = inflater.inflate(R.layout.fragment_home, container, false)
addMensaMenu().get() addMensaMenu().get()
addTimeTable() addTimeTable().get()
// Inflate the layout for this fragment // Inflate the layout for this fragment
return view return view
@ -75,42 +75,48 @@ class HomeFragment : Fragment() {
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
val mensaCardView = DayCardView(context!!) val mensaCardView = DayCardView(context!!)
uiThread { uiThread {
if (cal.get(Calendar.HOUR_OF_DAY) < 15) { if (isAdded) {
dayMeals = mensaMenu.currentWeek.days[NotRetardedCalendar().getDayOfWeekIndex()].meals if (cal.get(Calendar.HOUR_OF_DAY) < 15) {
mensaCardView.setDayHeading(resources.getString(R.string.today_date, formatter.format(cal.time))) dayMeals = mensaMenu.currentWeek.days[NotRetardedCalendar().getDayOfWeekIndex()].meals
} else { mensaCardView.setDayHeading(activity!!.resources.getString(R.string.today_date, formatter.format(cal.time)))
dayMeals = mensaMenu.currentWeek.days[NotRetardedCalendar().getTomorrowWeekIndex()].meals } else {
cal.add(Calendar.DATE, 1) dayMeals = mensaMenu.currentWeek.days[NotRetardedCalendar().getTomorrowWeekIndex()].meals
mensaCardView.setDayHeading(resources.getString(R.string.tomorrow_date, formatter.format(cal.time))) cal.add(Calendar.DATE, 1)
} mensaCardView.setDayHeading(activity!!.resources.getString(R.string.tomorrow_date, formatter.format(cal.time)))
if (dayMeals.size >= 2) {
// get the index of the first meal, not a "Schneller Teller"
loop@ for ((i, meal) in dayMeals.withIndex()) {
if (meal.heading.contains("Essen")) {
val meal1Layout = MealLinearLayout(context)
meal1Layout.setMeal(dayMeals[i])
mensaCardView.getLinLayoutDay().addView(meal1Layout)
val meal2Layout = MealLinearLayout(context)
meal2Layout.setMeal(dayMeals[i + 1])
meal2Layout.disableDivider()
mensaCardView.getLinLayoutDay().addView(meal2Layout)
break@loop
}
} }
} else { if (dayMeals.size >= 2) {
mensaCardView.getLinLayoutDay().addView(getNoCard(resources.getString(R.string.mensa_closed))) // get the index of the first meal, not a "Schneller Teller"
loop@ for ((i, meal) in dayMeals.withIndex()) {
if (meal.heading.contains("Essen")) {
val meal1Layout = MealLinearLayout(context)
meal1Layout.setMeal(dayMeals[i])
mensaCardView.getLinLayoutDay().addView(meal1Layout)
val meal2Layout = MealLinearLayout(context)
meal2Layout.setMeal(dayMeals[i + 1])
meal2Layout.disableDivider()
mensaCardView.getLinLayoutDay().addView(meal2Layout)
break@loop
}
}
} else {
mensaCardView.getLinLayoutDay().addView(getNoCard(resources.getString(R.string.mensa_closed)))
}
linLayout_Home.addView(mensaCardView)
} }
linLayout_Home.addView(mensaCardView)
} }
} }
/** /**
@ -123,29 +129,30 @@ class HomeFragment : Fragment() {
uiThread { uiThread {
if (timetables.isNotEmpty() && dayIndex < 6) { if (isAdded) {
if (timetables.isNotEmpty() && dayIndex < 6) {
// first check the current day // first check the current day
dayCardView = addDayTimetable(timetables[0].days[dayIndex]) dayCardView = addDayTimetable(timetables[0].days[dayIndex])
dayCardView.setDayHeading(resources.getString(R.string.today_date, formatter.format(cal.time))) dayCardView.setDayHeading(resources.getString(R.string.today_date, formatter.format(cal.time)))
// if there are no lessons try to find the next day with a lesson // if there are no lessons try to find the next day with a lesson
if (dayCardView.getLinLayoutDay().childCount <= 1) if (dayCardView.getLinLayoutDay().childCount <= 1)
dayCardView = findNextDay(0, dayIndex + 1) dayCardView = findNextDay(0, dayIndex + 1)
linLayout_Home.addView(dayCardView) linLayout_Home.addView(dayCardView)
} else if (dayIndex == 6) { } else if (dayIndex == 6) {
// if that's the case it's sunday // if that's the case it's sunday
dayCardView = findNextDay(1, 0) dayCardView = findNextDay(1, 0)
linLayout_Home.addView(dayCardView) linLayout_Home.addView(dayCardView)
} else { } else {
MaterialDialog(context!!) MaterialDialog(context!!)
.title(R.string.error) .title(R.string.error)
.message(R.string.timetable_error) .message(R.string.timetable_error)
.show() .show()
// TODO log the error and send feedback // TODO log the error and send feedback
}
} }
} }
} }

View File

@ -50,6 +50,7 @@ import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.course
import org.mosad.seil0.projectlaogai.controller.TCoRAPIController import org.mosad.seil0.projectlaogai.controller.TCoRAPIController
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
import java.util.* import java.util.*
import android.util.TypedValue
/** /**
* The settings controller class * The settings controller class
@ -87,6 +88,14 @@ class SettingsFragment : Fragment() {
txtView_Course.text = cCourse.courseName txtView_Course.text = cCourse.courseName
txtView_AboutDesc.text = resources.getString(R.string.about_version, BuildConfig.VERSION_NAME, getString(R.string.build_time)) txtView_AboutDesc.text = resources.getString(R.string.about_version, BuildConfig.VERSION_NAME, getString(R.string.build_time))
switch_buffet.isChecked = cShowBuffet // init switch switch_buffet.isChecked = cShowBuffet // init switch
val outValue = TypedValue()
activity!!.theme.resolveAttribute(R.attr.themeName, outValue, true)
if (outValue.string == "dark") {
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryDark, activity!!.theme))
} else {
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryLight, activity!!.theme))
}
} }
/** /**
@ -95,6 +104,19 @@ class SettingsFragment : Fragment() {
private fun initActions() { private fun initActions() {
linLayoutUser.setOnClickListener { linLayoutUser.setOnClickListener {
// open a new dialog // open a new dialog
// TODO move and save
// val outValue = TypedValue()
// activity!!.theme.resolveAttribute(R.attr.themeName, outValue, true)
// if (outValue.string == "dark") {
// Aesthetic.config {
// activityTheme(R.style.AppTheme_Light)
// }
// } else {
// Aesthetic.config {
// activityTheme(R.style.AppTheme_Dark)
// }
// }
} }
linLayoutCourse.setOnClickListener { linLayoutCourse.setOnClickListener {

View File

@ -22,7 +22,6 @@
package org.mosad.seil0.projectlaogai.fragments package org.mosad.seil0.projectlaogai.fragments
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -94,17 +93,15 @@ class TimeTableFragment : Fragment() {
.show() .show()
} }
// TODO only works with android m(23) or higher
// hide the btnCardValue if the user is scrolling down // hide the btnCardValue if the user is scrolling down
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { scrollViewTimetable.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
scrollViewTimetable.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY -> if (scrollY > oldScrollY) {
if (scrollY > oldScrollY) { faBtnAddLesson.hide()
faBtnAddLesson.hide() } else {
} else { faBtnAddLesson.show()
faBtnAddLesson.show()
}
} }
} }
} }
} }

View File

@ -3,9 +3,7 @@
<item android:drawable="@color/colorPrimary"/> <item android:drawable="@color/colorPrimary"/>
<!--TODO when minAPI is 23 use this--> <item android:gravity="center" android:width="144dp" android:height="144dp">
<!--<item android:gravity="center" android:width="144dp" android:height="144dp">-->
<item android:gravity="center">
<bitmap <bitmap
android:gravity="fill_horizontal|fill_vertical" android:gravity="fill_horizontal|fill_vertical"
android:src="@mipmap/ic_laogai_icon_splash"/> android:src="@mipmap/ic_laogai_icon_splash"/>

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" app:cardUseCompatPadding="true" android:layout_height="wrap_content" app:cardUseCompatPadding="true"
app:cardElevation="5dp" app:cardBackgroundColor="@color/themeSecondary" app:cardElevation="5dp" app:cardBackgroundColor="?themeSecondary"
> >
<LinearLayout <LinearLayout

View File

@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".fragments.HomeFragment"> tools:context=".fragments.HomeFragment"
android:background="?themePrimary">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".fragments.MensaFragment"> tools:context=".fragments.MensaFragment"
android:background="?themePrimary">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -12,13 +13,13 @@
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/scrollView_Mensa"> android:layout_height="match_parent"
android:id="@+id/scrollView_Mensa">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="false" android:animateLayoutChanges="false"
android:background="@color/themePrimary"
android:id="@+id/linLayout_Mensa"/> android:id="@+id/linLayout_Mensa"/>
</ScrollView> </ScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".fragments.SettingsFragment"> tools:context=".fragments.SettingsFragment"
android:background="?themePrimary">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -12,14 +14,19 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" app:layout_constraintTop_toTopOf="parent" android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"
android:background="@android:color/background_light"> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="9dp" android:id="@+id/cardView_Info" app:cardElevation="5dp" android:layout_marginTop="9dp"
app:cardUseCompatPadding="true"> android:id="@+id/cardView_Info"
app:cardElevation="5dp"
app:cardUseCompatPadding="true"
app:cardBackgroundColor="?themeSecondary">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -27,24 +34,33 @@
<TextView <TextView
android:text="@string/info" android:text="@string/info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_Info" android:layout_height="wrap_content"
android:id="@+id/txtView_Info"
android:typeface="sans" android:typeface="sans"
android:textSize="18sp" android:textStyle="bold" android:fontFamily="sans-serif" android:textSize="18sp"
android:layout_margin="7dp" android:textColor="?colorAccent"/> android:textStyle="bold"
android:fontFamily="sans-serif"
android:layout_margin="7dp"
android:textColor="?colorAccent"/>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:padding="7dp" android:id="@+id/linLayout_User"> android:layout_height="wrap_content"
android:padding="7dp"
android:id="@+id/linLayout_User">
<TextView <TextView
android:text="@string/sample_user" android:text="@string/sample_user"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_User" android:layout_height="wrap_content"
android:textSize="16sp" android:textStyle="bold" android:id="@+id/txtView_User"
android:textColor="@android:color/primary_text_light"/> android:textSize="16sp"
android:textStyle="bold"
/>
<TextView <TextView
android:text="@string/user" android:text="@string/user"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_UserDesc"/> android:layout_height="wrap_content"
android:id="@+id/txtView_UserDesc"/>
</LinearLayout> </LinearLayout>
<View <View
android:id="@+id/divider2" android:id="@+id/divider2"
@ -55,18 +71,21 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_margin="7dp" android:layout_height="wrap_content"
android:layout_margin="7dp"
android:id="@+id/linLayout_Course"> android:id="@+id/linLayout_Course">
<TextView <TextView
android:text="@string/sample_course" android:text="@string/sample_course"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_Course" android:layout_height="wrap_content"
android:textSize="16sp" android:textColor="@android:color/primary_text_light" android:id="@+id/txtView_Course"
android:textSize="16sp"
android:textStyle="bold"/> android:textStyle="bold"/>
<TextView <TextView
android:text="@string/course_desc" android:text="@string/course_desc"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_CourseDesc"/> android:layout_height="wrap_content"
android:id="@+id/txtView_CourseDesc"/>
</LinearLayout> </LinearLayout>
<View <View
android:id="@+id/divider" android:id="@+id/divider"
@ -77,43 +96,57 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_margin="7dp" android:layout_height="match_parent"
android:layout_margin="7dp"
android:id="@+id/linLayout_About"> android:id="@+id/linLayout_About">
<TextView <TextView
android:text="@string/about_txtView" android:text="@string/about_txtView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_About" android:layout_height="wrap_content"
android:textStyle="bold" android:textSize="16sp" android:id="@+id/txtView_About"
android:textColor="@android:color/primary_text_light"/> android:textStyle="bold"
android:textSize="16sp"
/>
<TextView <TextView
android:text="@string/about_version" android:text="@string/about_version"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_AboutDesc"/> android:layout_height="wrap_content"
android:id="@+id/txtView_AboutDesc"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/cardView_Settings" app:cardElevation="5dp" android:id="@+id/cardView_Settings"
app:cardUseCompatPadding="true"> app:cardElevation="5dp"
app:cardUseCompatPadding="true"
app:cardBackgroundColor="?themeSecondary">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/linLayout_Settings" android:padding="7dp"> android:layout_height="wrap_content"
android:id="@+id/linLayout_Settings"
android:padding="7dp">
<TextView <TextView
android:text="@string/settings" android:text="@string/settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_Settings" android:layout_height="wrap_content"
android:id="@+id/txtView_Settings"
android:typeface="sans" android:typeface="sans"
android:textSize="18sp" android:textColor="?colorAccent" android:textSize="18sp"
android:textStyle="bold" android:paddingTop="3dp"/> android:textColor="?colorAccent"
android:textStyle="bold"
android:paddingTop="3dp"/>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical|end" android:gravity="center_vertical|end"
android:clickable="true" android:id="@+id/linLayout_PrimaryColor" android:focusable="true"> android:clickable="true"
android:id="@+id/linLayout_PrimaryColor"
android:focusable="true">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -121,22 +154,27 @@
<TextView <TextView
android:text="@string/primary_color" android:text="@string/primary_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_PrimaryColor" android:layout_height="wrap_content"
android:textSize="16sp" android:textStyle="bold" android:id="@+id/txtView_PrimaryColor"
android:textColor="@android:color/primary_text_light"/> android:textSize="16sp"
android:textStyle="bold"
/>
<TextView <TextView
android:text="@string/primary_color_desc" android:text="@string/primary_color_desc"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_PrimaryColorDesc"/> android:layout_height="wrap_content"
android:id="@+id/txtView_PrimaryColorDesc"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_margin="7dp" android:layout_height="wrap_content"
android:layout_margin="7dp"
android:gravity="end"> android:gravity="end">
<View <View
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:id="@+id/view_PrimaryColor" android:layout_height="40dp"
android:id="@+id/view_PrimaryColor"
android:background="?colorPrimary"/> android:background="?colorPrimary"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -145,7 +183,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical|end" android:gravity="center_vertical|end"
android:clickable="true" android:id="@+id/linLayout_AccentColor" android:focusable="true"> android:clickable="true"
android:id="@+id/linLayout_AccentColor"
android:focusable="true">
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -153,31 +193,38 @@
<TextView <TextView
android:text="@string/accent_color" android:text="@string/accent_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_AccentColor" android:layout_height="wrap_content"
android:textSize="16sp" android:textStyle="bold" android:id="@+id/txtView_AccentColor"
android:textColor="@android:color/primary_text_light"/> android:textSize="16sp"
android:textStyle="bold"
/>
<TextView <TextView
android:text="@string/accent_color_desc" android:text="@string/accent_color_desc"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_AccentColorDesc"/> android:layout_height="wrap_content"
android:id="@+id/txtView_AccentColorDesc"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_margin="7dp" android:layout_height="wrap_content"
android:layout_margin="7dp"
android:gravity="end"> android:gravity="end">
<View <View
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:id="@+id/view_AccentColor" android:layout_height="40dp"
android:id="@+id/view_AccentColor"
android:background="?colorAccent"/> android:background="?colorAccent"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<Switch <Switch
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/switch_buffet" android:layout_height="wrap_content"
android:id="@+id/switch_buffet"
android:textSize="16sp" android:textSize="16sp"
android:textColor="@android:color/primary_text_light" android:textStyle="bold" android:textStyle="bold"
android:text="@string/show_buffet"/> android:text="@string/show_buffet"
/>
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".fragments.TimeTableFragment"> tools:context=".fragments.TimeTableFragment"
android:background="?themePrimary">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -18,7 +19,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="false" android:animateLayoutChanges="false"
android:background="@color/themePrimary"
android:id="@+id/linLayout_Timetable"/> android:id="@+id/linLayout_Timetable"/>
</ScrollView> </ScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -11,7 +11,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/txtView_lessonSubject" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/txtView_lessonSubject" android:layout_weight="1"
android:textSize="15sp" android:textColor="@color/textPrimary"/> android:textSize="15sp"/>
<TextView <TextView
android:text="@string/a_time" android:text="@string/a_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -21,15 +21,15 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_lessonTeacher" android:textSize="15sp" android:layout_height="wrap_content" android:id="@+id/txtView_lessonTeacher" android:textSize="15sp"
android:textColor="@color/textPrimary"/> />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_lessonRoom" android:layout_height="wrap_content" android:id="@+id/txtView_lessonRoom"
android:textColor="@color/textPrimary"/> />
<View <View
android:id="@+id/divider_lesson" android:id="@+id/divider_lesson"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?android:attr/listDivider" android:background="?dividerColor"
/> />
</LinearLayout> </LinearLayout>

View File

@ -8,16 +8,16 @@
android:text="@string/meal" android:text="@string/meal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_MealHeading" android:textSize="18sp" android:layout_height="wrap_content" android:id="@+id/txtView_MealHeading" android:textSize="18sp"
android:textColor="@color/textPrimary" android:textAlignment="center" android:paddingBottom="5dp" android:textAlignment="center" android:paddingBottom="5dp"
android:textStyle="bold"/> android:textStyle="bold"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/txtView_Meal" android:textSize="15sp" android:layout_height="wrap_content" android:id="@+id/txtView_Meal" android:textSize="15sp"
android:textColor="@color/textPrimary" android:textAlignment="center"/> android:textAlignment="center"/>
<View <View
android:id="@+id/divider_meal" android:id="@+id/divider_meal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?android:attr/listDivider" android:background="?dividerColor"
/> />
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr format="string" name="themeName"/>
<attr format="color" name="themePrimary"/>
<attr format="color" name="themeSecondary"/>
<attr format="color" name="textPrimary"/>
<attr format="color" name="textSecondary"/>
<attr format="color" name="dividerColor"/>
</resources>

View File

@ -2,28 +2,27 @@
<resources> <resources>
<color name="colorPrimary">#000000</color> <color name="colorPrimary">#000000</color>
<color name="colorPrimaryDark">#000000</color> <color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#3F51B5</color> <color name="colorAccent">#3f51b5</color>
<color name="ic_launcher_background">#FFFFFF</color> <color name="ic_launcher_background">#ffffff</color>
<color name="themePrimary">#FFFFFF</color>
<color name="themeSecondary">#FFFFFF</color>
<color name="themeTertiary">#FAFAFA</color> <!-- TODO find a better color -->
<color name="themePrimary">#ffffff</color>
<color name="themeSecondary">#ffffff</color>
<color name="textPrimary">#000000</color> <color name="textPrimary">#000000</color>
<color name="textSecondary">#818181</color> <color name="textSecondary">#818181</color>
<!--theme color section, not the working colors--> <!--theme color section, not the working colors-->
<color name="textPrimaryDark">#FFFFFF</color>
<color name="textSecondaryDark">#E0E0E0</color>
<color name="textPrimaryLight">#000000</color>
<color name="textSecondaryLight">#818181</color>
<color name="themePrimaryDark">#000000</color> <color name="themePrimaryDark">#000000</color>
<color name="themeSecondaryDark">#303030</color> <color name="themeSecondaryDark">#303030</color>
<color name="themeTertiaryDark">#424242</color> <color name="themeTertiaryDark">#424242</color>
<color name="textPrimaryDark">#ffffff</color>
<color name="textSecondaryDark">#e0e0e0</color>
<color name="dividerDark">#232323</color>
<color name="themePrimaryLight">#ffffff</color>
<color name="themeSecondaryLight">#ffffff</color>
<color name="textPrimaryLight">#000000</color>
<color name="textSecondaryLight">#818181</color>
<color name="dividerLight">#e0e0e0</color>
<color name="themePrimaryLight">#FFFFFF</color>
<color name="themeSecondaryLight">#FFFFFF</color>
<color name="themeTertiaryLight">#424242</color> <!-- TODO find a better color -->
</resources> </resources>

View File

@ -1,13 +1,30 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
</style> </style>
<style name="AppTheme.Light" parent="AppTheme">
<item name="themeName">light</item>
<item name="themePrimary">@color/themePrimaryLight</item>
<item name="themeSecondary">@color/themeSecondaryLight</item>
<item name="android:textColor">@color/textPrimaryLight</item>
<item name="textPrimary">@color/textPrimaryLight</item>
<item name="dividerColor">@color/dividerLight</item>
</style>
<style name="AppTheme.Dark" parent="AppTheme">
<item name="themeName">dark</item>
<item name="themePrimary">@color/themePrimaryDark</item>
<item name="themeSecondary">@color/themeSecondaryDark</item>
<item name="android:textColor">@color/textPrimaryDark</item>
<item name="textPrimary">@color/textPrimaryDark</item>
<item name="dividerColor">@color/dividerDark</item>
</style>
<style name="AppTheme.NoActionBar"> <style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>