Add AMOLED mode (#279)

This commit is contained in:
Mikołaj Pich 2019-04-19 23:52:34 +02:00 committed by Rafał Borcz
parent 269af4b7ba
commit 2bf7755157
31 changed files with 139 additions and 91 deletions

View File

@ -94,7 +94,7 @@ dependencies {
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.google.android.material:material:1.0.0" implementation "com.google.android.material:material:1.1.0-alpha05"
implementation 'com.github.wulkanowy:MaterialChipsInput:b72fd0ee6f' implementation 'com.github.wulkanowy:MaterialChipsInput:b72fd0ee6f'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
@ -124,7 +124,7 @@ dependencies {
implementation "com.jakewharton.threetenabp:threetenabp:1.2.0" implementation "com.jakewharton.threetenabp:threetenabp:1.2.0"
implementation "com.jakewharton.timber:timber:4.7.1" implementation "com.jakewharton.timber:timber:4.7.1"
implementation "at.favre.lib:slf4j-timber:1.0.1" implementation "at.favre.lib:slf4j-timber:1.0.1"
implementation "com.squareup.okhttp3:logging-interceptor:3.14.1" implementation "com.squareup.okhttp3:logging-interceptor:3.12.1"
implementation "com.mikepenz:aboutlibraries:6.2.3" implementation "com.mikepenz:aboutlibraries:6.2.3"
implementation 'com.takisoft.preferencex:preferencex:1.0.0' implementation 'com.takisoft.preferencex:preferencex:1.0.0'

View File

@ -1,7 +1,6 @@
package io.github.wulkanowy package io.github.wulkanowy
import android.content.Context import android.content.Context
import androidx.appcompat.app.AppCompatDelegate
import androidx.multidex.MultiDex import androidx.multidex.MultiDex
import androidx.work.Configuration import androidx.work.Configuration
import androidx.work.WorkManager import androidx.work.WorkManager
@ -13,8 +12,8 @@ import dagger.android.support.DaggerApplication
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.utils.Log import eu.davidea.flexibleadapter.utils.Log
import io.fabric.sdk.android.Fabric import io.fabric.sdk.android.Fabric
import io.github.wulkanowy.BuildConfig.CRASHLYTICS_ENABLED
import io.github.wulkanowy.BuildConfig.DEBUG import io.github.wulkanowy.BuildConfig.DEBUG
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.di.DaggerAppComponent import io.github.wulkanowy.di.DaggerAppComponent
import io.github.wulkanowy.services.sync.SyncWorkerFactory import io.github.wulkanowy.services.sync.SyncWorkerFactory
import io.github.wulkanowy.utils.CrashlyticsTree import io.github.wulkanowy.utils.CrashlyticsTree
@ -27,9 +26,6 @@ import javax.inject.Inject
class WulkanowyApp : DaggerApplication() { class WulkanowyApp : DaggerApplication() {
@Inject
lateinit var prefRepository: PreferencesRepository
@Inject @Inject
lateinit var workerFactory: SyncWorkerFactory lateinit var workerFactory: SyncWorkerFactory
@ -41,29 +37,32 @@ class WulkanowyApp : DaggerApplication() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
AndroidThreeTen.init(this) AndroidThreeTen.init(this)
initializeFabric()
if (DEBUG) enableDebugLog()
AppCompatDelegate.setDefaultNightMode(prefRepository.currentTheme)
WorkManager.initialize(this, Configuration.Builder().setWorkerFactory(workerFactory).build()) WorkManager.initialize(this, Configuration.Builder().setWorkerFactory(workerFactory).build())
RxJavaPlugins.setErrorHandler(::onError) RxJavaPlugins.setErrorHandler(::onError)
initCrashlytics()
initLogging()
} }
private fun enableDebugLog() { private fun initLogging() {
if (DEBUG) {
Timber.plant(DebugLogTree()) Timber.plant(DebugLogTree())
FlexibleAdapter.enableLogs(Log.Level.DEBUG) FlexibleAdapter.enableLogs(Log.Level.DEBUG)
} } else {
private fun initializeFabric() {
Fabric.with(Fabric.Builder(this).kits(
Crashlytics.Builder().core(CrashlyticsCore.Builder().disabled(!BuildConfig.CRASHLYTICS_ENABLED).build()).build()
).debuggable(DEBUG).build())
Timber.plant(CrashlyticsTree()) Timber.plant(CrashlyticsTree())
} }
}
private fun onError(t: Throwable) { private fun initCrashlytics() {
if (t is UndeliverableException && t.cause is IOException || t.cause is InterruptedException) { Fabric.with(Fabric.Builder(this).kits(
Timber.e(t.cause, "An undeliverable error occurred") Crashlytics.Builder().core(CrashlyticsCore.Builder().disabled(!CRASHLYTICS_ENABLED).build()).build()
} else throw t ).debuggable(DEBUG).build())
}
private fun onError(error: Throwable) {
if (error is UndeliverableException && error.cause is IOException || error.cause is InterruptedException) {
Timber.e(error.cause, "An undeliverable error occurred")
} else throw error
} }
override fun applicationInjector(): AndroidInjector<out DaggerApplication> { override fun applicationInjector(): AndroidInjector<out DaggerApplication> {

View File

@ -23,9 +23,9 @@ class PreferencesRepository @Inject constructor(
val isGradeExpandable: Boolean val isGradeExpandable: Boolean
get() = !sharedPref.getBoolean(context.getString(R.string.pref_key_expand_grade), false) get() = !sharedPref.getBoolean(context.getString(R.string.pref_key_expand_grade), false)
val currentThemeKey: String = context.getString(R.string.pref_key_theme) val appThemeKey: String = context.getString(R.string.pref_key_app_theme)
val currentTheme: Int val appTheme: String
get() = sharedPref.getString(currentThemeKey, "1")?.toIntOrNull() ?: 1 get() = sharedPref.getString(appThemeKey, "light") ?: "light"
val gradeColorTheme: String val gradeColorTheme: String
get() = sharedPref.getString(context.getString(R.string.pref_key_grade_color_scheme), "vulcan") ?: "vulcan" get() = sharedPref.getString(context.getString(R.string.pref_key_grade_color_scheme), "vulcan") ?: "vulcan"

View File

@ -34,7 +34,7 @@ internal class AppModule {
@Singleton @Singleton
@Provides @Provides
fun provideAppWidgetManager(context: Context) = AppWidgetManager.getInstance(context) fun provideAppWidgetManager(context: Context): AppWidgetManager = AppWidgetManager.getInstance(context)
@Singleton @Singleton
@Named("isDebug") @Named("isDebug")

View File

@ -48,8 +48,7 @@ class LuckyNumberWork @Inject constructor(
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, PendingIntent.getActivity(context, 0,
MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT) MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT))
)
.build()) .build())
} }
} }

View File

@ -48,8 +48,8 @@ class MessageWork @Inject constructor(
.setPriority(PRIORITY_HIGH) .setPriority(PRIORITY_HIGH)
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, PendingIntent.getActivity(context, 0, MainActivity.getStartIntent(context)
MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT) .putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT)
) )
.setStyle(NotificationCompat.InboxStyle().run { .setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.message_number_item, messages.size, messages.size)) setSummaryText(context.resources.getQuantityString(R.plurals.message_number_item, messages.size, messages.size))

View File

@ -48,8 +48,7 @@ class NoteWork @Inject constructor(
.setColor(context.getCompatColor(R.color.colorPrimary)) .setColor(context.getCompatColor(R.color.colorPrimary))
.setContentIntent( .setContentIntent(
PendingIntent.getActivity(context, 0, PendingIntent.getActivity(context, 0,
MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT) MainActivity.getStartIntent(context).putExtra(EXTRA_START_MENU_INDEX, 4), FLAG_UPDATE_CURRENT))
)
.setStyle(NotificationCompat.InboxStyle().run { .setStyle(NotificationCompat.InboxStyle().run {
setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size)) setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size))
notes.forEach { addLine("${it.teacher}: ${it.category}") } notes.forEach { addLine("${it.teacher}: ${it.category}") }

View File

@ -2,17 +2,30 @@ package io.github.wulkanowy.ui.base
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.fragment.app.Fragment
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.android.material.snackbar.Snackbar.LENGTH_LONG import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
import dagger.android.support.DaggerAppCompatActivity import dagger.android.AndroidInjection
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import io.github.wulkanowy.R import io.github.wulkanowy.R
import javax.inject.Inject
abstract class BaseActivity : DaggerAppCompatActivity(), BaseView { abstract class BaseActivity : AppCompatActivity(), BaseView, HasSupportFragmentInjector {
@Inject
lateinit var supportFragmentInjector: DispatchingAndroidInjector<Fragment>
@Inject
lateinit var themeManager: ThemeManager
protected lateinit var messageContainer: View protected lateinit var messageContainer: View
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
themeManager.applyTheme(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
} }
@ -31,4 +44,6 @@ abstract class BaseActivity : DaggerAppCompatActivity(), BaseView {
super.onDestroy() super.onDestroy()
invalidateOptionsMenu() invalidateOptionsMenu()
} }
override fun supportFragmentInjector() = supportFragmentInjector
} }

View File

@ -0,0 +1,24 @@
package io.github.wulkanowy.ui.base
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import io.github.wulkanowy.R
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import javax.inject.Inject
class ThemeManager @Inject constructor(private val preferencesRepository: PreferencesRepository) {
fun applyTheme(activity: AppCompatActivity) {
activity.delegate.apply {
when (preferencesRepository.appTheme) {
"light" -> setLocalNightMode(MODE_NIGHT_NO)
"dark" -> setLocalNightMode(MODE_NIGHT_YES)
"black" -> {
setLocalNightMode(MODE_NIGHT_YES)
activity.setTheme(R.style.WulkanowyTheme_Black)
}
}
}
}
}

View File

@ -77,12 +77,12 @@ class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainC
attendanceNextButton.setOnClickListener { presenter.onNextDay() } attendanceNextButton.setOnClickListener { presenter.onNextDay() }
} }
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater?.inflate(R.menu.action_menu_attendance, menu) inflater.inflate(R.menu.action_menu_attendance, menu)
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
return if (item?.itemId == R.id.attendanceMenuSummary) presenter.onSummarySwitchSelected() return if (item.itemId == R.id.attendanceMenuSummary) presenter.onSummarySwitchSelected()
else false else false
} }

View File

@ -57,9 +57,9 @@ class GradeFragment : BaseSessionFragment(), GradeView, MainView.MainChildView,
presenter.onAttachView(this, savedInstanceState?.getInt(SAVED_SEMESTER_KEY)) presenter.onAttachView(this, savedInstanceState?.getInt(SAVED_SEMESTER_KEY))
} }
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater?.inflate(R.menu.action_menu_grade, menu) inflater.inflate(R.menu.action_menu_grade, menu)
semesterSwitchMenu = menu?.findItem(R.id.gradeMenuSemester) semesterSwitchMenu = menu.findItem(R.id.gradeMenuSemester)
presenter.onCreateMenu() presenter.onCreateMenu()
} }
@ -82,8 +82,8 @@ class GradeFragment : BaseSessionFragment(), GradeView, MainView.MainChildView,
gradeSwipe.setOnRefreshListener { presenter.onSwipeRefresh() } gradeSwipe.setOnRefreshListener { presenter.onSwipeRefresh() }
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
return if (item?.itemId == R.id.gradeMenuSemester) presenter.onSemesterSwitch() return if (item.itemId == R.id.gradeMenuSemester) presenter.onSemesterSwitch()
else false else false
} }

View File

@ -67,8 +67,8 @@ class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.
presenter.onAttachView(this) presenter.onAttachView(this)
} }
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater?.inflate(R.menu.action_menu_grade_details, menu) inflater.inflate(R.menu.action_menu_grade_details, menu)
} }
override fun initView() { override fun initView() {
@ -88,8 +88,8 @@ class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.
gradeDetailsSwipe.setOnRefreshListener { presenter.onSwipeRefresh() } gradeDetailsSwipe.setOnRefreshListener { presenter.onSwipeRefresh() }
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
return if (item?.itemId == R.id.gradeDetailsMenuRead) presenter.onMarkAsReadSelected() return if (item.itemId == R.id.gradeDetailsMenuRead) presenter.onMarkAsReadSelected()
else false else false
} }

View File

@ -168,7 +168,7 @@ class MainActivity : BaseActivity(), MainView {
.apply { addFlags(FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK) }) .apply { addFlags(FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK) })
} }
override fun onSaveInstanceState(outState: Bundle?) { override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
navController.onSaveInstanceState(outState) navController.onSaveInstanceState(outState)
} }

View File

@ -64,16 +64,16 @@ class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainVi
presenter.onAttachView(this, (savedInstanceState ?: arguments)?.getInt(MESSAGE_ID_KEY) ?: 0) presenter.onAttachView(this, (savedInstanceState ?: arguments)?.getInt(MESSAGE_ID_KEY) ?: 0)
} }
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater?.inflate(R.menu.action_menu_message_preview, menu) inflater.inflate(R.menu.action_menu_message_preview, menu)
menuReplyButton = menu?.findItem(R.id.messagePreviewMenuReply) menuReplyButton = menu.findItem(R.id.messagePreviewMenuReply)
menuForwardButton = menu?.findItem(R.id.messagePreviewMenuForward) menuForwardButton = menu.findItem(R.id.messagePreviewMenuForward)
menuDeleteButton = menu?.findItem(R.id.messagePreviewMenuDelete) menuDeleteButton = menu.findItem(R.id.messagePreviewMenuDelete)
presenter.onCreateOptionsMenu() presenter.onCreateOptionsMenu()
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item?.itemId) { return when (item.itemId) {
R.id.messagePreviewMenuReply -> presenter.onReply() R.id.messagePreviewMenuReply -> presenter.onReply()
R.id.messagePreviewMenuForward -> presenter.onForward() R.id.messagePreviewMenuForward -> presenter.onForward()
R.id.messagePreviewMenuDelete -> presenter.onMessageDelete() R.id.messagePreviewMenuDelete -> presenter.onMessageDelete()

View File

@ -3,7 +3,6 @@ package io.github.wulkanowy.ui.modules.settings
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import com.takisoft.preferencex.PreferenceFragmentCompat import com.takisoft.preferencex.PreferenceFragmentCompat
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
import io.github.wulkanowy.BuildConfig.DEBUG import io.github.wulkanowy.BuildConfig.DEBUG
@ -44,8 +43,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
presenter.onSharedPreferenceChanged(key) presenter.onSharedPreferenceChanged(key)
} }
override fun setTheme(theme: Int) { override fun recreateView() {
AppCompatDelegate.setDefaultNightMode(theme)
activity?.recreate() activity?.recreate()
} }

View File

@ -31,8 +31,8 @@ class SettingsPresenter @Inject constructor(
when (key) { when (key) {
serviceEnableKey -> syncManager.run { if (isServiceEnabled) startSyncWorker() else stopSyncWorker() } serviceEnableKey -> syncManager.run { if (isServiceEnabled) startSyncWorker() else stopSyncWorker() }
servicesIntervalKey, servicesOnlyWifiKey -> syncManager.startSyncWorker(true) servicesIntervalKey, servicesOnlyWifiKey -> syncManager.startSyncWorker(true)
currentThemeKey -> view?.setTheme(currentTheme)
isDebugNotificationEnableKey -> chuckCollector.showNotification(isDebugNotificationEnable) isDebugNotificationEnableKey -> chuckCollector.showNotification(isDebugNotificationEnable)
appThemeKey -> view?.recreateView()
} }
} }
analytics.logEvent("setting_changed", "name" to key) analytics.logEvent("setting_changed", "name" to key)

View File

@ -4,7 +4,7 @@ import io.github.wulkanowy.ui.base.BaseView
interface SettingsView : BaseView { interface SettingsView : BaseView {
fun setTheme(theme: Int) fun recreateView()
fun setServicesSuspended(serviceEnablesKey: String, isHolidays: Boolean) fun setServicesSuspended(serviceEnablesKey: String, isHolidays: Boolean)
} }

View File

@ -3,12 +3,12 @@ package io.github.wulkanowy.ui.modules.splash
import android.os.Bundle import android.os.Bundle
import android.widget.Toast import android.widget.Toast
import android.widget.Toast.LENGTH_LONG import android.widget.Toast.LENGTH_LONG
import io.github.wulkanowy.ui.base.BaseActivity import dagger.android.support.DaggerAppCompatActivity
import io.github.wulkanowy.ui.modules.login.LoginActivity import io.github.wulkanowy.ui.modules.login.LoginActivity
import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainActivity
import javax.inject.Inject import javax.inject.Inject
class SplashActivity : BaseActivity(), SplashView { class SplashActivity : DaggerAppCompatActivity(), SplashView {
@Inject @Inject
lateinit var presenter: SplashPresenter lateinit var presenter: SplashPresenter
@ -29,6 +29,10 @@ class SplashActivity : BaseActivity(), SplashView {
} }
override fun showError(text: String, error: Throwable) { override fun showError(text: String, error: Throwable) {
showMessage(text)
}
override fun showMessage(text: String) {
Toast.makeText(this, text, LENGTH_LONG).show() Toast.makeText(this, text, LENGTH_LONG).show()
} }

View File

@ -80,12 +80,12 @@ class TimetableFragment : BaseSessionFragment(), TimetableView, MainView.MainChi
timetableNextButton.setOnClickListener { presenter.onNextDay() } timetableNextButton.setOnClickListener { presenter.onNextDay() }
} }
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater?.inflate(R.menu.action_menu_timetable, menu) inflater.inflate(R.menu.action_menu_timetable, menu)
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
return if (item?.itemId == R.id.timetableMenuCompletedLessons) presenter.onCompletedLessonsSwitchSelected() return if (item.itemId == R.id.timetableMenuCompletedLessons) presenter.onCompletedLessonsSwitchSelected()
else false else false
} }

View File

@ -2,7 +2,7 @@
<solid android:color="@null" /> <solid android:color="@null" />
<stroke <stroke
android:width="1dip" android:width="1dip"
android:color="#61000000" /> android:color="@color/spinner_stroke" />
<corners android:radius="4dip" /> <corners android:radius="4dip" />
<padding <padding
android:bottom="0dip" android:bottom="0dip"

View File

@ -130,7 +130,7 @@
android:layout_marginStart="7dp" android:layout_marginStart="7dp"
android:layout_marginLeft="7dp" android:layout_marginLeft="7dp"
android:layout_marginBottom="48dp" android:layout_marginBottom="48dp"
android:background="?android:colorBackground" android:background="?android:windowBackground"
android:paddingLeft="4dp" android:paddingLeft="4dp"
android:paddingRight="4dp" android:paddingRight="4dp"
android:text="@string/login_host_hint" android:text="@string/login_host_hint"

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="spinner_stroke">#61FFFFFF</color>
</resources>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<style name="WulkanowyTheme" parent="@style/Theme.AppCompat.DayNight"> <style name="WulkanowyTheme" parent="@style/Theme.MaterialComponents.Bridge">
<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/colorPrimary</item> <item name="colorAccent">@color/colorPrimary</item>
@ -9,6 +9,7 @@
<item name="android:navigationBarColor" tools:targetApi="21">@color/bottom_nav_background</item> <item name="android:navigationBarColor" tools:targetApi="21">@color/bottom_nav_background</item>
<item name="dividerColor">@color/divider_inverse</item> <item name="dividerColor">@color/divider_inverse</item>
<item name="chip_backgroundColor">@color/chip_backgroundColor_inverse</item> <item name="chip_backgroundColor">@color/chip_backgroundColor_inverse</item>
<item name="android:textColorTertiary">?android:textColorPrimary</item>
<item name="chip_labelColor">@color/chip_labelColor_inverse</item> <item name="chip_labelColor">@color/chip_labelColor_inverse</item>
<item name="chip_detailed_backgroundColor">@color/chip_backgroundColor_inverse</item> <item name="chip_detailed_backgroundColor">@color/chip_backgroundColor_inverse</item>
<item name="filterable_list_backgroundColor">@color/filterable_list_backgroundColor_inverse</item> <item name="filterable_list_backgroundColor">@color/filterable_list_backgroundColor_inverse</item>
@ -24,4 +25,10 @@
<item name="about_libraries_dividerDark_openSource">@color/about_libraries_dividerDark_openSource_dark</item> <item name="about_libraries_dividerDark_openSource">@color/about_libraries_dividerDark_openSource_dark</item>
<item name="about_libraries_dividerLight_openSource">@color/about_libraries_dividerLight_openSource_dark</item> <item name="about_libraries_dividerLight_openSource">@color/about_libraries_dividerLight_openSource_dark</item>
</style> </style>
<style name="WulkanowyTheme.Black" parent="WulkanowyTheme.NoActionBar">
<item name="android:windowBackground">@android:color/black</item>
<item name="android:navigationBarColor" tools:targetApi="21">@android:color/black</item>
<item name="bottomNavBackground">@android:color/black</item>
</style>
</resources> </resources>

View File

@ -242,7 +242,7 @@
<string name="pref_view_list">Domyślny widok</string> <string name="pref_view_list">Domyślny widok</string>
<string name="pref_view_grade_average_mode">Obliczanie średniej końcoworocznej</string> <string name="pref_view_grade_average_mode">Obliczanie średniej końcoworocznej</string>
<string name="pref_view_present">Pokazuj obecność we frekwencji</string> <string name="pref_view_present">Pokazuj obecność we frekwencji</string>
<string name="pref_view_theme_dark">Ciemny motyw (Beta)</string> <string name="pref_view_app_theme">Motyw apliakcji</string>
<string name="pref_view_expand_grade">Rozwiń oceny</string> <string name="pref_view_expand_grade">Rozwiń oceny</string>
<string name="pref_view_grade_color_scheme">Schemat kolorów ocen</string> <string name="pref_view_grade_color_scheme">Schemat kolorów ocen</string>

View File

@ -10,11 +10,10 @@
<item>24 godzin</item> <item>24 godzin</item>
</string-array> </string-array>
<string-array name="theme_entries"> <string-array name="app_theme_entries">
<item>Wyłączony</item> <item>Jasny</item>
<item>Włączony</item> <item>Ciemny</item>
<item>Automatyczny</item> <item>Czarny (AMOLED)</item>
<item>Używaj ustawień systemowych</item>
</string-array> </string-array>
<string-array name="grade_modifier_entries"> <string-array name="grade_modifier_entries">

View File

@ -40,4 +40,6 @@
<color name="divider">#cccccc</color> <color name="divider">#cccccc</color>
<color name="divider_inverse">#777777</color> <color name="divider_inverse">#777777</color>
<color name="spinner_stroke">#61000000</color>
</resources> </resources>

View File

@ -2,7 +2,7 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation"> <resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="pref_key_start_menu">start_menu</string> <string name="pref_key_start_menu">start_menu</string>
<string name="pref_key_attendance_present">attendance_present</string> <string name="pref_key_attendance_present">attendance_present</string>
<string name="pref_key_theme">theme</string> <string name="pref_key_app_theme">app_theme</string>
<string name="pref_key_grade_color_scheme">grade_color_scheme</string> <string name="pref_key_grade_color_scheme">grade_color_scheme</string>
<string name="pref_key_expand_grade">expand_grade</string> <string name="pref_key_expand_grade">expand_grade</string>
<string name="pref_key_grade_average_mode">grade_average_mode</string> <string name="pref_key_grade_average_mode">grade_average_mode</string>

View File

@ -227,7 +227,7 @@
<string name="pref_view_list">Default view</string> <string name="pref_view_list">Default view</string>
<string name="pref_view_grade_average_mode">Calculation of the end-of-year average</string> <string name="pref_view_grade_average_mode">Calculation of the end-of-year average</string>
<string name="pref_view_present">Show presence in attendance</string> <string name="pref_view_present">Show presence in attendance</string>
<string name="pref_view_theme_dark">Dark theme (Beta)</string> <string name="pref_view_app_theme">Application theme</string>
<string name="pref_view_expand_grade">Expand grades</string> <string name="pref_view_expand_grade">Expand grades</string>
<string name="pref_view_grade_color_scheme">Grades color scheme</string> <string name="pref_view_grade_color_scheme">Grades color scheme</string>

View File

@ -1,6 +1,6 @@
<resources> <resources>
<style name="WulkanowyTheme" parent="@style/Theme.AppCompat.DayNight"> <style name="WulkanowyTheme" parent="@style/Theme.MaterialComponents.Light.Bridge">
<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/colorPrimary</item> <item name="colorAccent">@color/colorPrimary</item>

View File

@ -13,17 +13,15 @@
<item>3</item> <item>3</item>
</string-array> </string-array>
<string-array name="theme_entries"> <string-array name="app_theme_entries">
<item>Off</item> <item>Light</item>
<item>On</item> <item>Dark</item>
<item>Auto</item> <item>Black (AMOLED)</item>
<item>Follow system settings</item>
</string-array> </string-array>
<string-array name="theme_values" translatable="false"> <string-array name="app_theme_values" translatable="false">
<item>1</item> <item>light</item>
<item>2</item> <item>dark</item>
<item>0</item> <item>black</item>
<item>-1</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">

View File

@ -13,12 +13,12 @@
android:title="@string/pref_view_list" android:title="@string/pref_view_list"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<ListPreference <ListPreference
android:defaultValue="1" android:defaultValue="light"
android:entries="@array/theme_entries" android:entries="@array/app_theme_entries"
android:entryValues="@array/theme_values" android:entryValues="@array/app_theme_values"
android:key="theme" android:key="@string/pref_key_app_theme"
android:summary="%s" android:summary="%s"
android:title="@string/pref_view_theme_dark" android:title="@string/pref_view_app_theme"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"