Browse Source

theme the dialogs and navView too, added a License dialog

pull/31/head
Jannik 2 years ago
parent
commit
2cc2ecf952
Signed by: Seil0 GPG Key ID: E8459F3723C52C24
  1. 4
      app/build.gradle
  2. 25
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt
  3. 3
      app/src/main/res/layout/activity_main.xml
  4. 17
      app/src/main/res/layout/fragment_settings.xml
  5. 2
      app/src/main/res/layout/fragment_timetable.xml
  6. 39
      app/src/main/res/raw/notices.xml
  7. 2
      app/src/main/res/values-de-rDE/strings.xml
  8. 45
      app/src/main/res/values/strings.xml
  9. 13
      app/src/main/res/values/styles.xml

4
app/build.gradle

@ -26,7 +26,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
@ -43,6 +46,7 @@ dependencies {
implementation 'com.afollestad:aesthetic:1.0.0-beta05'
implementation 'com.afollestad.material-dialogs:core:2.8.1'
implementation 'com.afollestad.material-dialogs:color:2.8.1'
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
testImplementation 'junit:junit:4.12'

25
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/SettingsFragment.kt

@ -24,6 +24,7 @@ package org.mosad.seil0.projectlaogai.fragments
import android.content.Context
import android.os.Bundle
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -35,23 +36,24 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.color.colorChooser
import com.afollestad.materialdialogs.customview.customView
import com.afollestad.materialdialogs.list.listItems
import com.afollestad.materialdialogs.list.listItemsSingleChoice
import de.psdev.licensesdialog.LicensesDialog
import kotlinx.android.synthetic.main.fragment_settings.*
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread
import org.mosad.seil0.projectlaogai.BuildConfig
import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.controller.CacheController
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.coursesList
import org.mosad.seil0.projectlaogai.controller.PreferencesController
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorAccent
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorPrimary
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cCourse
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cShowBuffet
import org.mosad.seil0.projectlaogai.R
import org.mosad.seil0.projectlaogai.controller.CacheController
import org.mosad.seil0.projectlaogai.controller.CacheController.Companion.coursesList
import org.mosad.seil0.projectlaogai.controller.TCoRAPIController
import org.mosad.seil0.projectlaogai.hsoparser.DataTypes
import java.util.*
import android.util.TypedValue
import com.afollestad.materialdialogs.list.listItemsSingleChoice
/**
* The settings controller class
@ -62,6 +64,7 @@ class SettingsFragment : Fragment() {
private lateinit var linLayoutUser: LinearLayout
private lateinit var linLayoutCourse: LinearLayout
private lateinit var linLayoutAbout: LinearLayout
private lateinit var linLayoutLicence: LinearLayout
private lateinit var linLayoutTheme: LinearLayout
private lateinit var linLayoutPrimaryColor: LinearLayout
private lateinit var linLayoutAccentColor: LinearLayout
@ -74,6 +77,7 @@ class SettingsFragment : Fragment() {
linLayoutUser = view.findViewById(R.id.linLayout_User)
linLayoutCourse = view.findViewById(R.id.linLayout_Course)
linLayoutAbout = view.findViewById(R.id.linLayout_About)
linLayoutLicence = view.findViewById(R.id.linLayout_Licence)
linLayoutTheme = view.findViewById(R.id.linLayout_Theme)
linLayoutPrimaryColor = view.findViewById(R.id.linLayout_PrimaryColor)
linLayoutAccentColor = view.findViewById(R.id.linLayout_AccentColor)
@ -133,6 +137,17 @@ class SettingsFragment : Fragment() {
.show()
}
linLayoutLicence.setOnClickListener {
// open a new license dialog
LicensesDialog.Builder(context!!)
.setNotices(R.raw.notices)
.setTitle(R.string.licenses)
.setIncludeOwnLicense(true)
.setThemeResourceId(R.style.AppTheme_Light)
.build()
.show()
}
linLayoutTheme.setOnClickListener {
val themes = listOf(
resources.getString(R.string.themeLight),

3
app/src/main/res/layout/activity_main.xml

@ -20,8 +20,9 @@
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="?themeSecondary"
app:headerLayout="@layout/nav_header_main"
app:itemTextColor="?colorAccent"
app:menu="@menu/activity_main_drawer"/>
</androidx.drawerlayout.widget.DrawerLayout>

17
app/src/main/res/layout/fragment_settings.xml

@ -113,6 +113,23 @@
android:layout_height="wrap_content"
android:id="@+id/txtView_AboutDesc"/>
</LinearLayout>
<View
android:id="@+id/divider6"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?dividerColor"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/linLayout_Licence"
android:layout_margin="7dp">
<TextView
android:text="@string/licenses"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/textView3"
android:textStyle="bold" android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

2
app/src/main/res/layout/fragment_timetable.xml

@ -27,6 +27,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true" android:id="@+id/faBtnAddLesson" android:elevation="7dp"
android:visibility="visible" android:layout_gravity="bottom|center|end" android:layout_marginEnd="7dp"
android:visibility="visible" android:layout_gravity="bottom|center|end" android:layout_marginEnd="11dp"
android:layout_marginBottom="11dp" android:focusable="true"/>
</FrameLayout>

39
app/src/main/res/raw/notices.xml

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<notices>
<notice>
<name>Material Dialogs</name>
<url>https://github.com/afollestad/material-dialogs</url>
<copyright>Copyright (C) Aidan Follestad</copyright>
<license>Apache Software License 2.0</license>
</notice>
<notice>
<name>Aesthetic</name>
<url>https://github.com/afollestad/aesthetic</url>
<copyright>Copyright Aidan Follestad</copyright>
<license>Apache Software License 2.0</license>
</notice>
<notice>
<name>gson</name>
<url>https://github.com/google/gson</url>
<copyright>Copyright 2008 Google Inc.</copyright>
<license>Apache Software License 2.0</license>
</notice>
<notice>
<name>anko</name>
<url>https://github.com/Kotlin/anko</url>
<copyright>Copyright JetBrains</copyright>
<license>Apache Software License 2.0</license>
</notice>
<notice>
<name>Android Sliding Up Panel</name>
<url>https://github.com/umano/AndroidSlidingUpPanel</url>
<copyright />
<license>Apache Software License 2.0</license>
</notice>
<notice>
<name>Android Support Libraries</name>
<url>http://developer.android.com/tools/support-library/index.html</url>
<copyright>Copyright (C) 2016 The Android Open Source Project</copyright>
<license>Apache Software License 2.0</license>
</notice>
</notices>

2
app/src/main/res/values-de-rDE/strings.xml

@ -21,6 +21,7 @@
<string name="accent_color">Akzentfarbe</string>
<string name="accent_color_desc">Die Akzentfarbe, Standard ist indigo</string>
<string name="select">auswählen</string>
<string name="close">schließen</string>
<string name="about_dialog_heading">Über</string>
<string name="loading_timetable">lade Stundenplan …</string>
<string name="navigation_drawer_close">Navigationsleiste schließen</string>
@ -31,4 +32,5 @@
<string name="themeLight">Hell</string>
<string name="themeDark">Dunkel</string>
<string name="themeBlack">Schwarz</string>
<string name="licenses">Lizenzen</string>
</resources>

45
app/src/main/res/values/strings.xml

@ -18,34 +18,37 @@
<string name="mensa_closed">the Mensa is closed</string>
<string name="no_more_food">No more Food this week</string>
<string name="no_lesson_today">"No lecture today!"</string>
<string name="error">Error</string>
<string name="timetable_error">Could not load timetable!"</string>
<string name="sample_user" translatable="false">SampleUser@stud.hs-offenburg.de</string>
<string name="sample_course" translatable="false">SampleCourse 3</string>
<string name="sample_date" translatable="false">Montag, 30.02</string>
<string name="a_time" translatable="false">0.00 – 23.59</string>
<string name="info">Info</string>
<string name="user">User</string>
<string name="course_desc">Tap to change course</string>
<string name="select_course">Select your course</string>
<string name="primary_color">primary color</string>
<string name="primary_color_desc">The primary color, default is black.</string>
<string name="accent_color">accent color</string>
<string name="accent_color_desc">The accent color, default is indigo.</string>
<string name="show_buffet">always show buffet</string>
<string name="select">select</string>
<string name="about_txtView" translatable="false">hso App by @Seil0</string>
<string name="about_version" translatable="false">version %1$s (%2$s)</string>
<string name="loading_timetable">loading timetable …</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="loading_timetable">loading timetable …</string>
<string name="about_txtView" translatable="false">hso App by @Seil0</string>
<string name="about_version" translatable="false">Version %1$s (%2$s)</string>
<string name="licenses">Licenses</string>
<string name="theme">Theme</string>
<string name="themeLight">light</string>
<string name="themeDark">dark</string>
<string name="themeBlack">black</string>
<string name="themeLight">Light</string>
<string name="themeDark">Dark</string>
<string name="themeBlack">Black</string>
<string name="primary_color">Primary color</string>
<string name="primary_color_desc">The primary color, default is black.</string>
<string name="accent_color">Accent color</string>
<string name="accent_color_desc">The accent color, default is indigo.</string>
<string name="show_buffet">Always show buffet</string>
<string name="select">select</string>
<string name="close">close</string>
<string name="sample_user" translatable="false">SampleUser@stud.hs-offenburg.de</string>
<string name="sample_course" translatable="false">SampleCourse 3</string>
<string name="sample_date" translatable="false">Montag, 30.02</string>
<string name="a_time" translatable="false">0.00 – 23.59</string>
<string name="no_lesson_today">"No lecture today!"</string>
<string name="error">Error</string>
<string name="timetable_error">Could not load timetable!"</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>

13
app/src/main/res/values/styles.xml

@ -5,6 +5,7 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="md_color_button_text">@color/colorAccent</item>
</style>
<style name="AppTheme.Light" parent="AppTheme">
@ -12,8 +13,12 @@
<item name="themePrimary">@color/themePrimaryLight</item>
<item name="themeSecondary">@color/themeSecondaryLight</item>
<item name="android:textColor">@color/textPrimaryLight</item>
<item name="android:textColorPrimary">@color/textPrimaryLight</item>
<item name="textPrimary">@color/textPrimaryLight</item>
<item name="dividerColor">@color/dividerLight</item>
<item name="md_background_color">@color/themeSecondaryLight</item>
<item name="md_color_title">@color/textPrimaryLight</item>
<item name="md_color_content">@color/textPrimaryLight</item>
</style>
<style name="AppTheme.Dark" parent="AppTheme">
@ -21,8 +26,12 @@
<item name="themePrimary">@color/themePrimaryDark</item>
<item name="themeSecondary">@color/themeSecondaryDark</item>
<item name="android:textColor">@color/textPrimaryDark</item>
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="textPrimary">@color/textPrimaryDark</item>
<item name="dividerColor">@color/dividerDark</item>
<item name="md_background_color">@color/themeSecondaryDark</item>
<item name="md_color_title">@color/textPrimaryDark</item>
<item name="md_color_content">@color/textPrimaryDark</item>
</style>
<style name="AppTheme.Black" parent="AppTheme">
@ -30,8 +39,12 @@
<item name="themePrimary">@color/themePrimaryDark</item>
<item name="themeSecondary">@color/themePrimaryDark</item>
<item name="android:textColor">@color/textPrimaryDark</item>
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="textPrimary">@color/textPrimaryDark</item>
<item name="dividerColor">@color/dividerDark</item>
<item name="md_background_color">@color/themeSecondaryDark</item>
<item name="md_color_title">@color/textPrimaryDark</item>
<item name="md_color_content">@color/textPrimaryDark</item>
</style>
<style name="AppTheme.NoActionBar">

Loading…
Cancel
Save