update to kotlin 1.3.40, added theme choose option
* added missing dividers in settings * added a black theme * closes #15
This commit is contained in:
parent
a055f59cc8
commit
98b3adbf3b
|
@ -13,7 +13,7 @@ android {
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 14
|
versionCode 14
|
||||||
versionName "0.4.91"
|
versionName "0.4.92"
|
||||||
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")
|
||||||
|
@ -25,7 +25,6 @@ android {
|
||||||
shrinkResources false
|
shrinkResources false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_laogai_icon"
|
android:roundIcon="@mipmap/ic_laogai_icon"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme.Light">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".SplashActivity"
|
android:name=".SplashActivity"
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.Light"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="portrait">
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -205,7 +205,6 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||||
SettingsFragment().selectCourse(this)
|
SettingsFragment().selectCourse(this)
|
||||||
} else {
|
} else {
|
||||||
Aesthetic.config {
|
Aesthetic.config {
|
||||||
// activityTheme(R.style.AppTheme_Light)
|
|
||||||
colorPrimary(cColorPrimary)
|
colorPrimary(cColorPrimary)
|
||||||
colorPrimaryDark(cColorPrimary)
|
colorPrimaryDark(cColorPrimary)
|
||||||
colorAccent(cColorAccent)
|
colorAccent(cColorAccent)
|
||||||
|
|
|
@ -51,6 +51,7 @@ 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
|
import android.util.TypedValue
|
||||||
|
import com.afollestad.materialdialogs.list.listItemsSingleChoice
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The settings controller class
|
* The settings controller class
|
||||||
|
@ -61,6 +62,7 @@ class SettingsFragment : Fragment() {
|
||||||
private lateinit var linLayoutUser: LinearLayout
|
private lateinit var linLayoutUser: LinearLayout
|
||||||
private lateinit var linLayoutCourse: LinearLayout
|
private lateinit var linLayoutCourse: LinearLayout
|
||||||
private lateinit var linLayoutAbout: LinearLayout
|
private lateinit var linLayoutAbout: LinearLayout
|
||||||
|
private lateinit var linLayoutTheme: LinearLayout
|
||||||
private lateinit var linLayoutPrimaryColor: LinearLayout
|
private lateinit var linLayoutPrimaryColor: LinearLayout
|
||||||
private lateinit var linLayoutAccentColor: LinearLayout
|
private lateinit var linLayoutAccentColor: LinearLayout
|
||||||
private lateinit var switchBuffet: Switch
|
private lateinit var switchBuffet: Switch
|
||||||
|
@ -72,6 +74,7 @@ class SettingsFragment : Fragment() {
|
||||||
linLayoutUser = view.findViewById(R.id.linLayout_User)
|
linLayoutUser = view.findViewById(R.id.linLayout_User)
|
||||||
linLayoutCourse = view.findViewById(R.id.linLayout_Course)
|
linLayoutCourse = view.findViewById(R.id.linLayout_Course)
|
||||||
linLayoutAbout = view.findViewById(R.id.linLayout_About)
|
linLayoutAbout = view.findViewById(R.id.linLayout_About)
|
||||||
|
linLayoutTheme = view.findViewById(R.id.linLayout_Theme)
|
||||||
linLayoutPrimaryColor = view.findViewById(R.id.linLayout_PrimaryColor)
|
linLayoutPrimaryColor = view.findViewById(R.id.linLayout_PrimaryColor)
|
||||||
linLayoutAccentColor = view.findViewById(R.id.linLayout_AccentColor)
|
linLayoutAccentColor = view.findViewById(R.id.linLayout_AccentColor)
|
||||||
switchBuffet = view.findViewById(R.id.switch_buffet)
|
switchBuffet = view.findViewById(R.id.switch_buffet)
|
||||||
|
@ -85,17 +88,28 @@ class SettingsFragment : Fragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
// initialize the settings gui
|
||||||
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()
|
val outValue = TypedValue()
|
||||||
activity!!.theme.resolveAttribute(R.attr.themeName, outValue, true)
|
activity!!.theme.resolveAttribute(R.attr.themeName, outValue, true)
|
||||||
if (outValue.string == "dark") {
|
when(outValue.string) {
|
||||||
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryDark, activity!!.theme))
|
"light" -> {
|
||||||
} else {
|
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryLight, activity!!.theme))
|
||||||
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryLight, activity!!.theme))
|
txtView_SelectedTheme.text = resources.getString(R.string.themeLight)
|
||||||
|
}
|
||||||
|
"dark" -> {
|
||||||
|
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryDark, activity!!.theme))
|
||||||
|
txtView_SelectedTheme.text = resources.getString(R.string.themeDark)
|
||||||
|
}
|
||||||
|
"black" -> {
|
||||||
|
switch_buffet.setTextColor(activity!!.resources.getColor(R.color.textPrimaryDark, activity!!.theme))
|
||||||
|
txtView_SelectedTheme.text = resources.getString(R.string.themeBlack)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,19 +118,6 @@ 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 {
|
||||||
|
@ -132,6 +133,26 @@ class SettingsFragment : Fragment() {
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
linLayoutTheme.setOnClickListener {
|
||||||
|
val themes = listOf(
|
||||||
|
resources.getString(R.string.themeLight),
|
||||||
|
resources.getString(R.string.themeDark),
|
||||||
|
resources.getString(R.string.themeBlack)
|
||||||
|
)
|
||||||
|
MaterialDialog(context!!).show {
|
||||||
|
listItemsSingleChoice(items = themes) { _, index, _ ->
|
||||||
|
Aesthetic.config {
|
||||||
|
when (index) {
|
||||||
|
0 -> activityTheme(R.style.AppTheme_Light)
|
||||||
|
1 -> activityTheme(R.style.AppTheme_Dark)
|
||||||
|
2 -> activityTheme(R.style.AppTheme_Black)
|
||||||
|
else -> activityTheme(R.style.AppTheme_Light)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
linLayoutPrimaryColor.setOnClickListener {
|
linLayoutPrimaryColor.setOnClickListener {
|
||||||
// open a new color chooser dialog
|
// open a new color chooser dialog
|
||||||
MaterialDialog(context!!)
|
MaterialDialog(context!!)
|
||||||
|
|
|
@ -94,7 +94,7 @@ class TimeTableFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide the btnCardValue if the user is scrolling down
|
// hide the btnCardValue if the user is scrolling down
|
||||||
scrollViewTimetable.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
|
scrollViewTimetable.setOnScrollChangeListener { _, _, scrollY, _, oldScrollY ->
|
||||||
if (scrollY > oldScrollY) {
|
if (scrollY > oldScrollY) {
|
||||||
faBtnAddLesson.hide()
|
faBtnAddLesson.hide()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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:cardElevation="5dp" app:cardBackgroundColor="?themeSecondary"
|
app:cardUseCompatPadding="true"
|
||||||
|
app:cardElevation="5dp"
|
||||||
|
app:cardBackgroundColor="?themeSecondary"
|
||||||
>
|
>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
android:id="@+id/divider2"
|
android:id="@+id/divider2"
|
||||||
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
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
android:id="@+id/divider"
|
android:id="@+id/divider"
|
||||||
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
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/linLayout_Settings"
|
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"
|
||||||
|
@ -138,7 +138,28 @@
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="?colorAccent"
|
android:textColor="?colorAccent"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:paddingTop="3dp"/>
|
android:paddingTop="3dp" android:layout_margin="7dp"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" android:id="@+id/linLayout_Theme"
|
||||||
|
android:layout_margin="7dp">
|
||||||
|
<TextView
|
||||||
|
android:text="@string/theme"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" android:id="@+id/txtView_Theme"
|
||||||
|
android:textSize="16sp" android:textStyle="bold"/>
|
||||||
|
<TextView
|
||||||
|
android:text="@string/themeLight"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" android:id="@+id/txtView_SelectedTheme"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?dividerColor"
|
||||||
|
/>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -146,7 +167,7 @@
|
||||||
android:gravity="center_vertical|end"
|
android:gravity="center_vertical|end"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:id="@+id/linLayout_PrimaryColor"
|
android:id="@+id/linLayout_PrimaryColor"
|
||||||
android:focusable="true">
|
android:focusable="true" android:layout_margin="7dp">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -178,6 +199,12 @@
|
||||||
android:background="?colorPrimary"/>
|
android:background="?colorPrimary"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider4"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?dividerColor"
|
||||||
|
/>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -185,7 +212,7 @@
|
||||||
android:gravity="center_vertical|end"
|
android:gravity="center_vertical|end"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:id="@+id/linLayout_AccentColor"
|
android:id="@+id/linLayout_AccentColor"
|
||||||
android:focusable="true">
|
android:focusable="true" android:layout_margin="7dp">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -217,6 +244,12 @@
|
||||||
android:background="?colorAccent"/>
|
android:background="?colorAccent"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider5"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?android:attr/listDivider"
|
||||||
|
/>
|
||||||
<Switch
|
<Switch
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -224,7 +257,7 @@
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:text="@string/show_buffet"
|
android:text="@string/show_buffet"
|
||||||
/>
|
android:layout_margin="7dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -30,6 +30,6 @@
|
||||||
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="?dividerColor"
|
android:background="?dividerColor"/>
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -27,4 +27,8 @@
|
||||||
<string name="navigation_drawer_open">Navigationsleiste öffnen</string>
|
<string name="navigation_drawer_open">Navigationsleiste öffnen</string>
|
||||||
<string name="show_buffet">Buffet immer anzeigen</string>
|
<string name="show_buffet">Buffet immer anzeigen</string>
|
||||||
<string name="select_course">Wähle deinen Studiengang aus</string>
|
<string name="select_course">Wähle deinen Studiengang aus</string>
|
||||||
|
<string name="theme">Design</string>
|
||||||
|
<string name="themeLight">Hell</string>
|
||||||
|
<string name="themeDark">Dunkel</string>
|
||||||
|
<string name="themeBlack">Schwarz</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -42,6 +42,10 @@
|
||||||
<string name="about_dialog_heading">About</string>
|
<string name="about_dialog_heading">About</string>
|
||||||
<string name="about_dialog_text" translatable="false">"This software is made by @Seil0 and is published under the terms and conditions of GPL 3. For further information visit \ngit.mosad.xyz/Seil0/ProjectLaogai \n\n© 2018-2019 seil0@mosad.xyz "</string>
|
<string name="about_dialog_text" translatable="false">"This software is made by @Seil0 and is published under the terms and conditions of GPL 3. For further information visit \ngit.mosad.xyz/Seil0/ProjectLaogai \n\n© 2018-2019 seil0@mosad.xyz "</string>
|
||||||
<string name="loading_timetable">loading timetable …</string>
|
<string name="loading_timetable">loading timetable …</string>
|
||||||
|
<string name="theme">Theme</string>
|
||||||
|
<string name="themeLight">light</string>
|
||||||
|
<string name="themeDark">dark</string>
|
||||||
|
<string name="themeBlack">black</string>
|
||||||
|
|
||||||
<string name="save_key_course" translatable="false">org.mosad.seil0.projectlaogai.course</string>
|
<string name="save_key_course" translatable="false">org.mosad.seil0.projectlaogai.course</string>
|
||||||
<string name="save_key_courseTTLink" translatable="false">org.mosad.seil0.projectlaogai.courseTTLink</string>
|
<string name="save_key_courseTTLink" translatable="false">org.mosad.seil0.projectlaogai.courseTTLink</string>
|
||||||
|
|
|
@ -25,6 +25,15 @@
|
||||||
<item name="dividerColor">@color/dividerDark</item>
|
<item name="dividerColor">@color/dividerDark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.Black" parent="AppTheme">
|
||||||
|
<item name="themeName">black</item>
|
||||||
|
<item name="themePrimary">@color/themePrimaryDark</item>
|
||||||
|
<item name="themeSecondary">@color/themePrimaryDark</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>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.31'
|
ext.kotlin_version = '1.3.40'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
Loading…
Reference in New Issue