Compare commits
6 Commits
ca0734e977
...
b1fbb301b6
Author | SHA1 | Date |
---|---|---|
Stefan Schüller | b1fbb301b6 | |
Stefan Schüller | 604a813b84 | |
Stefan Schüller | 5518b96c46 | |
Stefan Schüller | 217efd2ba2 | |
Stefan Schüller | 4bde8d8957 | |
Stefan Schüller | 2ee169d7e1 |
8
TODO.md
8
TODO.md
|
@ -23,11 +23,17 @@ x discover view
|
|||
- Permissions for download
|
||||
- subscribe / unsubscribe
|
||||
x CI pipeline (gradle?)
|
||||
- add language filter support
|
||||
- add app language selection
|
||||
- add themes and selection
|
||||
- Add NSFW filter
|
||||
- Translate all strings
|
||||
- Swipe player down and up
|
||||
- implement preferences using data stores
|
||||
|
||||
Issues:
|
||||
- Server change doesn't work until restart (retrofit)
|
||||
- Login/logout needs to update UI
|
||||
- Memory issue on explore list
|
||||
- Word "Subscribe" too long in app bar
|
||||
- VideoList meta bar can't be dynamic height, causes scroll back issue.
|
||||
x Refreshing video list causes odd loading order of video items
|
||||
|
|
|
@ -3,8 +3,7 @@ package net.schueller.peertube.common
|
|||
object Constants {
|
||||
|
||||
const val PREF_LANG_APP_KEY = "pref_language_app"
|
||||
const val PREF_THEME_KEY = "pref_theme"
|
||||
const val PREF_DARK_MODE_KEY = "pref_dark_mode"
|
||||
|
||||
const val PREF_SHOW_NSFW_KEY = "pref_show_nsfw"
|
||||
const val PREF_VIDEO_LANG_KEY = "pref_show_nsfw"
|
||||
const val PREF_VIDEO_SPEED_KEY = "pref_video_speed"
|
||||
|
@ -43,4 +42,33 @@ object Constants {
|
|||
|
||||
const val APP_BACKGROUND_AUDIO_INTENT = "BACKGROUND_AUDIO"
|
||||
|
||||
const val PREF_THEME_KEY = "pref_theme"
|
||||
const val PREF_DARK_MODE_KEY = "pref_dark_mode_2"
|
||||
const val PREF_DARK_MODE_DARK = "dark"
|
||||
const val PREF_DARK_MODE_LIGHT = "light"
|
||||
const val PREF_DARK_MODE_AUTO = "auto"
|
||||
|
||||
// legacy color prefs
|
||||
const val COLOR_PREF_DEFAULT = "AppTheme.RED"
|
||||
const val COLOR_PREF_RED = "AppTheme.RED"
|
||||
const val COLOR_PREF_PINK = "AppTheme.PINK"
|
||||
const val COLOR_PREF_PURPLE = "AppTheme.PURPLE"
|
||||
const val COLOR_PREF_DEEPPURPLE = "AppTheme.DEEPPURPLE"
|
||||
const val COLOR_PREF_INDIGO = "AppTheme.INDIGO"
|
||||
const val COLOR_PREF_BLUE = "AppTheme.BLUE"
|
||||
const val COLOR_PREF_LIGHTBLUE = "AppTheme.LIGHTBLUE"
|
||||
const val COLOR_PREF_CYAN = "AppTheme.CYAN"
|
||||
const val COLOR_PREF_TEAL = "AppTheme.TEAL"
|
||||
const val COLOR_PREF_GREEN = "AppTheme.GREEN"
|
||||
const val COLOR_PREF_LIGHTGREEN = "AppTheme.LIGHTGREEN"
|
||||
const val COLOR_PREF_LIME = "AppTheme.LIME"
|
||||
const val COLOR_PREF_YELLOW = "AppTheme.YELLOW"
|
||||
const val COLOR_PREF_AMBER = "AppTheme.AMBER"
|
||||
const val COLOR_PREF_ORANGE = "AppTheme.ORANGE"
|
||||
const val COLOR_PREF_DEEPORANGE = "AppTheme.DEEPORANGE"
|
||||
const val COLOR_PREF_BROWN = "AppTheme.BROWN"
|
||||
const val COLOR_PREF_GRAY = "AppTheme.GRAY"
|
||||
const val COLOR_PREF_BLUEGRAY = "AppTheme.BLUEGRAY"
|
||||
|
||||
|
||||
}
|
|
@ -19,6 +19,8 @@ import net.schueller.peertube.feature_server_address.domain.repository.ServerAdd
|
|||
import net.schueller.peertube.feature_server_address.domain.repository.ServerRepository
|
||||
import net.schueller.peertube.feature_video.domain.repository.VideoRepository
|
||||
import net.schueller.peertube.feature_server_address.domain.use_case.*
|
||||
import net.schueller.peertube.feature_settings.settings.data.repository.SettingsRepositoryImpl
|
||||
import net.schueller.peertube.feature_settings.settings.domain.repository.SettingsRepository
|
||||
import net.schueller.peertube.feature_video.data.remote.auth.LoginService
|
||||
import net.schueller.peertube.feature_video.data.remote.auth.Session
|
||||
import net.schueller.peertube.feature_video.data.repository.RetrofitInstance
|
||||
|
@ -78,6 +80,12 @@ object AppModule {
|
|||
return VideoRepositoryImpl(api)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideSettingsRepository(@ApplicationContext context: Context): SettingsRepository {
|
||||
return SettingsRepositoryImpl(context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideServerInstanceApi(): ServerInstanceApi {
|
||||
|
|
|
@ -102,11 +102,11 @@ class AddEditAddressViewModel @Inject constructor(
|
|||
is AddEditAddressEvent.PrefillServerFromSearch -> {
|
||||
|
||||
onEvent(AddEditAddressEvent.EnteredServerName(event.server.name ?: ""))
|
||||
onEvent(AddEditAddressEvent.EnteredServerHost(event.server.host ?: ""))
|
||||
// onEvent(AddEditAddressEvent.EnteredServerHost(event.server.host ?: ""))
|
||||
|
||||
viewModelScope.launch {
|
||||
|
||||
Log.v("AEAVM", "Selected Server: " + event.server.host.toString())
|
||||
Log.v("AEAVM", "Selected Server: " + event.server.host)
|
||||
|
||||
// TODO: doesn't work, textfield is not updated
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package net.schueller.peertube.feature_settings.settings.data.repository
|
||||
|
||||
import android.content.Context
|
||||
import androidx.datastore.preferences.core.booleanPreferencesKey
|
||||
import androidx.datastore.preferences.core.intPreferencesKey
|
||||
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import net.schueller.peertube.feature_settings.settings.domain.repository.SettingsRepository
|
||||
import net.schueller.peertube.presentation.dataStore
|
||||
|
||||
class SettingsRepositoryImpl(private val context: Context) : SettingsRepository {
|
||||
|
||||
override suspend fun getBooleanSettings(key: String, default: Boolean): Flow<Boolean> {
|
||||
val dataStoreKey = booleanPreferencesKey(key)
|
||||
return context.dataStore.data.map { preferences ->
|
||||
preferences[dataStoreKey] ?: default
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getStringSettings(key: String, default: String): Flow<String> {
|
||||
val dataStoreKey = stringPreferencesKey(key)
|
||||
return context.dataStore.data.map { preferences ->
|
||||
preferences[dataStoreKey] ?: default
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getIntegerSettings(key: String, default: Int): Flow<Int> {
|
||||
val dataStoreKey = intPreferencesKey(key)
|
||||
return context.dataStore.data.map { preferences ->
|
||||
preferences[dataStoreKey] ?: default
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package net.schueller.peertube.feature_settings.settings.domain.repository
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface SettingsRepository {
|
||||
|
||||
suspend fun getBooleanSettings(key: String, default: Boolean): Flow<Boolean>
|
||||
suspend fun getStringSettings(key: String, default: String): Flow<String>
|
||||
suspend fun getIntegerSettings(key: String, default: Int): Flow<Int>
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package net.schueller.peertube.feature_settings.settings
|
||||
package net.schueller.peertube.feature_settings.settings.presentation
|
||||
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
||||
|
@ -7,11 +7,29 @@ import androidx.compose.ui.platform.LocalContext
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.jamal.composeprefs.ui.GroupHeader
|
||||
import com.jamal.composeprefs.ui.PrefsScreen
|
||||
import com.jamal.composeprefs.ui.prefs.*
|
||||
import net.schueller.peertube.presentation.dataStore
|
||||
import net.schueller.peertube.R
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_AMBER
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_BLUE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_BLUEGRAY
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_BROWN
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_CYAN
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_DEEPORANGE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_DEEPPURPLE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_GRAY
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_GREEN
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_INDIGO
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_LIGHTBLUE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_LIGHTGREEN
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_LIME
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_ORANGE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_PINK
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_PURPLE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_RED
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_TEAL
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_YELLOW
|
||||
import net.schueller.peertube.common.Constants.PREF_ACCEPT_INSECURE_KEY
|
||||
import net.schueller.peertube.common.Constants.PREF_BACKGROUND_AUDIO_KEY
|
||||
import net.schueller.peertube.common.Constants.PREF_BACKGROUND_BEHAVIOR_KEY
|
||||
|
@ -245,9 +263,25 @@ fun SettingsScreen() {
|
|||
title = stringResource(R.string.pref_title_app_theme),
|
||||
useSelectedAsSummary = true,
|
||||
entries = mapOf(
|
||||
"0" to "Entry 1",
|
||||
"1" to "Entry 2",
|
||||
"2" to "Entry 3"
|
||||
COLOR_PREF_RED to stringResource(R.string.red),
|
||||
COLOR_PREF_PINK to stringResource(R.string.pink),
|
||||
COLOR_PREF_PURPLE to stringResource(R.string.purple),
|
||||
COLOR_PREF_DEEPPURPLE to stringResource(R.string.deeppurple),
|
||||
COLOR_PREF_INDIGO to stringResource(R.string.indigo),
|
||||
COLOR_PREF_BLUE to stringResource(R.string.blue),
|
||||
COLOR_PREF_LIGHTBLUE to stringResource(R.string.lightblue),
|
||||
COLOR_PREF_CYAN to stringResource(R.string.cyan),
|
||||
COLOR_PREF_TEAL to stringResource(R.string.teal),
|
||||
COLOR_PREF_GREEN to stringResource(R.string.green),
|
||||
COLOR_PREF_LIGHTGREEN to stringResource(R.string.lightgreen),
|
||||
COLOR_PREF_LIME to stringResource(R.string.lime),
|
||||
COLOR_PREF_YELLOW to stringResource(R.string.yellow),
|
||||
COLOR_PREF_AMBER to stringResource(R.string.amber),
|
||||
COLOR_PREF_ORANGE to stringResource(R.string.orange),
|
||||
COLOR_PREF_DEEPORANGE to stringResource(R.string.deeporange),
|
||||
COLOR_PREF_BROWN to stringResource(R.string.brown),
|
||||
COLOR_PREF_GRAY to stringResource(R.string.gray),
|
||||
COLOR_PREF_BLUEGRAY to stringResource(R.string.bluegray)
|
||||
)
|
||||
)
|
||||
}
|
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.Scaffold
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
|
@ -15,6 +16,7 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
|||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
|
@ -35,7 +37,7 @@ import net.schueller.peertube.feature_video.presentation.video.components.appBar
|
|||
import net.schueller.peertube.feature_video.presentation.video.components.videoPlay.VideoPlayScreen
|
||||
import net.schueller.peertube.feature_video.presentation.video.events.VideoPlayEvent
|
||||
import net.schueller.peertube.feature_video.presentation.video.player.ExoPlayerHolder
|
||||
import net.schueller.peertube.presentation.Screen
|
||||
import net.schueller.peertube.presentation.ui.theme.PeertubeTheme
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
|
@ -59,24 +61,6 @@ fun VideoListScreen(
|
|||
val context = LocalContext.current
|
||||
|
||||
|
||||
// Events
|
||||
LaunchedEffect(key1 = true) {
|
||||
viewModel.eventFlow.collectLatest { event ->
|
||||
when(event) {
|
||||
is VideoListViewModel.UiEvent.ScrollToTop -> {
|
||||
listState.scrollToItem(index = 0)
|
||||
}
|
||||
is VideoListViewModel.UiEvent.ShowToast -> {
|
||||
Toast.makeText(
|
||||
context,
|
||||
event.message,
|
||||
event.length
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auto hide top appbar
|
||||
val toolBarHeight = 56.dp
|
||||
val toolBarHeightPx = with(LocalDensity.current) { toolBarHeight.roundToPx().toFloat()}
|
||||
|
@ -92,6 +76,27 @@ fun VideoListScreen(
|
|||
}
|
||||
}
|
||||
|
||||
// Events
|
||||
LaunchedEffect(key1 = true) {
|
||||
viewModel.eventFlow.collectLatest { event ->
|
||||
when(event) {
|
||||
is VideoListViewModel.UiEvent.ScrollToTop -> {
|
||||
listState.scrollToItem(index = 0)
|
||||
// reset toolbar to visible
|
||||
toolBarOffsetHeightPx.value = 0f
|
||||
}
|
||||
is VideoListViewModel.UiEvent.ShowToast -> {
|
||||
Toast.makeText(
|
||||
context,
|
||||
event.message,
|
||||
event.length
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Box(
|
||||
Modifier
|
||||
.fillMaxSize()
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package net.schueller.peertube.feature_video.presentation.video.components.videoPlay
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.animation.core.LinearEasing
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
|
@ -375,10 +377,9 @@ fun VideoPlayScreen(
|
|||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||
}
|
||||
}
|
||||
// BackHandler(enabled = true) {
|
||||
// Log.v("back", "back pressed")
|
||||
//
|
||||
// enterPIPMode(activity)
|
||||
// }
|
||||
BackHandler(enabled = true) {
|
||||
Log.v("back", "back pressed")
|
||||
videoPlayViewModel.playerVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,8 @@ import android.os.Bundle
|
|||
import android.util.Log
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Surface
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.datastore.core.DataStore
|
||||
import androidx.datastore.preferences.core.Preferences
|
||||
import androidx.datastore.preferences.preferencesDataStore
|
||||
|
@ -27,7 +25,6 @@ import androidx.navigation.compose.NavHost
|
|||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.navigation.navArgument
|
||||
import coil.annotation.ExperimentalCoilApi
|
||||
import com.google.accompanist.permissions.ExperimentalPermissionsApi
|
||||
import com.google.accompanist.permissions.rememberMultiplePermissionsState
|
||||
import com.google.android.exoplayer2.ui.PlayerNotificationManager
|
||||
|
@ -40,7 +37,7 @@ import net.schueller.peertube.common.Constants.PREF_BACKGROUND_STOP_KEY
|
|||
import net.schueller.peertube.common.Constants.PREF_BACK_PAUSE_KEY
|
||||
import net.schueller.peertube.common.VideoHelper
|
||||
import net.schueller.peertube.feature_server_address.presentation.address_add_edit.AddEditAddressScreen
|
||||
import net.schueller.peertube.feature_settings.settings.SettingsScreen
|
||||
import net.schueller.peertube.feature_settings.settings.presentation.SettingsScreen
|
||||
import net.schueller.peertube.presentation.ui.theme.PeertubeTheme
|
||||
import net.schueller.peertube.feature_video.presentation.video.VideoListScreen
|
||||
import net.schueller.peertube.feature_server_address.presentation.ServerAddressScreen
|
||||
|
@ -64,7 +61,8 @@ class MainActivity : ComponentActivity() {
|
|||
|
||||
@OptIn(ExperimentalPermissionsApi::class,
|
||||
androidx.compose.material.ExperimentalMaterialApi::class,
|
||||
androidx.compose.ui.ExperimentalComposeUiApi::class
|
||||
androidx.compose.ui.ExperimentalComposeUiApi::class,
|
||||
coil.annotation.ExperimentalCoilApi::class
|
||||
)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -95,7 +93,9 @@ class MainActivity : ComponentActivity() {
|
|||
// }
|
||||
// )
|
||||
|
||||
Surface(color = MaterialTheme.colors.background) {
|
||||
Surface(
|
||||
color = MaterialTheme.colors.background
|
||||
) {
|
||||
val navController = rememberNavController()
|
||||
NavHost(
|
||||
navController = navController,
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package net.schueller.peertube.presentation.ui.theme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val md_theme_light_primary = Color(0xFF1760a5)
|
||||
val md_theme_light_onPrimary = Color(0xFFffffff)
|
||||
val md_theme_light_primaryContainer = Color(0xFFd3e4ff)
|
||||
val md_theme_light_onPrimaryContainer = Color(0xFF001c3a)
|
||||
val md_theme_light_secondary = Color(0xFF545f70)
|
||||
val md_theme_light_onSecondary = Color(0xFFffffff)
|
||||
val md_theme_light_secondaryContainer = Color(0xFFd7e3f8)
|
||||
val md_theme_light_onSecondaryContainer = Color(0xFF111c2b)
|
||||
val md_theme_light_tertiary = Color(0xFF6d5677)
|
||||
val md_theme_light_onTertiary = Color(0xFFffffff)
|
||||
val md_theme_light_tertiaryContainer = Color(0xFFf5d9ff)
|
||||
val md_theme_light_onTertiaryContainer = Color(0xFF261430)
|
||||
val md_theme_light_error = Color(0xFFba1b1b)
|
||||
val md_theme_light_errorContainer = Color(0xFFffdad4)
|
||||
val md_theme_light_onError = Color(0xFFffffff)
|
||||
val md_theme_light_onErrorContainer = Color(0xFF410001)
|
||||
val md_theme_light_background = Color(0xFFfdfcff)
|
||||
val md_theme_light_onBackground = Color(0xFF1b1b1d)
|
||||
val md_theme_light_surface = Color(0xFFfdfcff)
|
||||
val md_theme_light_onSurface = Color(0xFF1b1b1d)
|
||||
val md_theme_light_surfaceVariant = Color(0xFFdfe2eb)
|
||||
val md_theme_light_onSurfaceVariant = Color(0xFF43474e)
|
||||
val md_theme_light_outline = Color(0xFF73777f)
|
||||
val md_theme_light_inverseOnSurface = Color(0xFFf1f0f4)
|
||||
val md_theme_light_inverseSurface = Color(0xFF2f3033)
|
||||
|
||||
val md_theme_dark_primary = Color(0xFFa1c9ff)
|
||||
val md_theme_dark_onPrimary = Color(0xFF00315e)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF004884)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFFd3e4ff)
|
||||
val md_theme_dark_secondary = Color(0xFFbcc7db)
|
||||
val md_theme_dark_onSecondary = Color(0xFF263141)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF3c4758)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFd7e3f8)
|
||||
val md_theme_dark_tertiary = Color(0xFFd9bde3)
|
||||
val md_theme_dark_onTertiary = Color(0xFF3c2946)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF543f5e)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFFf5d9ff)
|
||||
val md_theme_dark_error = Color(0xFFffb4a9)
|
||||
val md_theme_dark_errorContainer = Color(0xFF930006)
|
||||
val md_theme_dark_onError = Color(0xFF680003)
|
||||
val md_theme_dark_onErrorContainer = Color(0xFFffdad4)
|
||||
val md_theme_dark_background = Color(0xFF1b1b1d)
|
||||
val md_theme_dark_onBackground = Color(0xFFe3e2e6)
|
||||
val md_theme_dark_surface = Color(0xFF1b1b1d)
|
||||
val md_theme_dark_onSurface = Color(0xFFe3e2e6)
|
||||
val md_theme_dark_surfaceVariant = Color(0xFF43474e)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFc3c6cf)
|
||||
val md_theme_dark_outline = Color(0xFF8d9199)
|
||||
val md_theme_dark_inverseOnSurface = Color(0xFF1b1b1d)
|
||||
val md_theme_dark_inverseSurface = Color(0xFFe3e2e6)
|
||||
|
||||
val seed = Color(0xFF5175a4)
|
||||
val error = Color(0xFFba1b1b)
|
|
@ -1,78 +1,78 @@
|
|||
package net.schueller.peertube.presentation.ui.theme
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_BLUE
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_GREEN
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_RED
|
||||
import net.schueller.peertube.common.Constants.PREF_DARK_MODE_AUTO
|
||||
import net.schueller.peertube.common.Constants.PREF_DARK_MODE_DARK
|
||||
|
||||
private val LightThemeColors = lightColorScheme(
|
||||
|
||||
primary = md_theme_light_primary,
|
||||
onPrimary = md_theme_light_onPrimary,
|
||||
primaryContainer = md_theme_light_primaryContainer,
|
||||
onPrimaryContainer = md_theme_light_onPrimaryContainer,
|
||||
secondary = md_theme_light_secondary,
|
||||
onSecondary = md_theme_light_onSecondary,
|
||||
secondaryContainer = md_theme_light_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_light_onSecondaryContainer,
|
||||
tertiary = md_theme_light_tertiary,
|
||||
onTertiary = md_theme_light_onTertiary,
|
||||
tertiaryContainer = md_theme_light_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_light_onTertiaryContainer,
|
||||
error = md_theme_light_error,
|
||||
errorContainer = md_theme_light_errorContainer,
|
||||
onError = md_theme_light_onError,
|
||||
onErrorContainer = md_theme_light_onErrorContainer,
|
||||
background = md_theme_light_background,
|
||||
onBackground = md_theme_light_onBackground,
|
||||
surface = md_theme_light_surface,
|
||||
onSurface = md_theme_light_onSurface,
|
||||
surfaceVariant = md_theme_light_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_light_onSurfaceVariant,
|
||||
outline = md_theme_light_outline,
|
||||
inverseOnSurface = md_theme_light_inverseOnSurface,
|
||||
inverseSurface = md_theme_light_inverseSurface,
|
||||
)
|
||||
private val DarkThemeColors = darkColorScheme(
|
||||
|
||||
primary = md_theme_dark_primary,
|
||||
onPrimary = md_theme_dark_onPrimary,
|
||||
primaryContainer = md_theme_dark_primaryContainer,
|
||||
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
|
||||
secondary = md_theme_dark_secondary,
|
||||
onSecondary = md_theme_dark_onSecondary,
|
||||
secondaryContainer = md_theme_dark_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
|
||||
tertiary = md_theme_dark_tertiary,
|
||||
onTertiary = md_theme_dark_onTertiary,
|
||||
tertiaryContainer = md_theme_dark_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
|
||||
error = md_theme_dark_error,
|
||||
errorContainer = md_theme_dark_errorContainer,
|
||||
onError = md_theme_dark_onError,
|
||||
onErrorContainer = md_theme_dark_onErrorContainer,
|
||||
background = md_theme_dark_background,
|
||||
onBackground = md_theme_dark_onBackground,
|
||||
surface = md_theme_dark_surface,
|
||||
onSurface = md_theme_dark_onSurface,
|
||||
surfaceVariant = md_theme_dark_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
|
||||
outline = md_theme_dark_outline,
|
||||
inverseOnSurface = md_theme_dark_inverseOnSurface,
|
||||
inverseSurface = md_theme_dark_inverseSurface,
|
||||
)
|
||||
@Composable
|
||||
fun PeertubeTheme(
|
||||
useDarkTheme: Boolean = isSystemInDarkTheme(),
|
||||
viewModel: ThemeViewModel = hiltViewModel(),
|
||||
content: @Composable() () -> Unit
|
||||
) {
|
||||
val colors = if (!useDarkTheme) {
|
||||
LightThemeColors
|
||||
|
||||
val useDarkMode = if (viewModel.themeState.value.darkMode == PREF_DARK_MODE_AUTO) {
|
||||
useDarkTheme
|
||||
} else viewModel.themeState.value.darkMode == PREF_DARK_MODE_DARK
|
||||
|
||||
Log.v("TH", "useDarkMode : "+useDarkMode)
|
||||
Log.v("TH", "viewModel : "+viewModel.themeState.value.currentTheme)
|
||||
|
||||
// Support existing saved preferences in older version
|
||||
// https://material-foundation.github.io/material-theme-builder/
|
||||
val colors = if (!useDarkMode) {
|
||||
when (viewModel.themeState.value.currentTheme) {
|
||||
COLOR_PREF_BLUE -> {
|
||||
Log.v("TH", "use COLOR_PREF_BLUE : "+COLOR_PREF_BLUE)
|
||||
|
||||
net.schueller.peertube.presentation.ui.theme.colors.blue.LightThemeColors
|
||||
}
|
||||
COLOR_PREF_RED -> {
|
||||
Log.v("TH", "use COLOR_PREF_RED : "+COLOR_PREF_RED)
|
||||
|
||||
net.schueller.peertube.presentation.ui.theme.colors.red.LightThemeColors
|
||||
}
|
||||
COLOR_PREF_GREEN -> {
|
||||
Log.v("TH", "use COLOR_PREF_GREEN : "+COLOR_PREF_GREEN)
|
||||
|
||||
net.schueller.peertube.presentation.ui.theme.colors.green.LightThemeColors
|
||||
}
|
||||
else -> {
|
||||
Log.v("TH", "else : ")
|
||||
|
||||
net.schueller.peertube.presentation.ui.theme.colors.def.LightThemeColors
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DarkThemeColors
|
||||
when (viewModel.themeState.value.currentTheme) {
|
||||
COLOR_PREF_BLUE -> {
|
||||
Log.v("TH", "use COLOR_PREF_BLUE : "+COLOR_PREF_BLUE)
|
||||
net.schueller.peertube.presentation.ui.theme.colors.blue.DarkThemeColors
|
||||
}
|
||||
COLOR_PREF_RED -> {
|
||||
Log.v("TH", "use COLOR_PREF_RED : "+COLOR_PREF_RED)
|
||||
net.schueller.peertube.presentation.ui.theme.colors.red.DarkThemeColors
|
||||
}
|
||||
COLOR_PREF_GREEN -> {
|
||||
Log.v("TH", "use COLOR_PREF_GREEN : "+COLOR_PREF_GREEN)
|
||||
net.schueller.peertube.presentation.ui.theme.colors.green.DarkThemeColors
|
||||
}
|
||||
else -> {
|
||||
Log.v("TH", "else : ")
|
||||
net.schueller.peertube.presentation.ui.theme.colors.def.DarkThemeColors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log.v("TH", "colors : " + colors.primary)
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colors,
|
||||
typography = AppTypography,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package net.schueller.peertube.presentation.ui.theme
|
||||
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_DEFAULT
|
||||
import net.schueller.peertube.common.Constants.PREF_DARK_MODE_AUTO
|
||||
|
||||
data class ThemeState(
|
||||
val darkMode: String = PREF_DARK_MODE_AUTO,
|
||||
val currentTheme: String = COLOR_PREF_DEFAULT
|
||||
)
|
|
@ -0,0 +1,39 @@
|
|||
package net.schueller.peertube.presentation.ui.theme
|
||||
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.launch
|
||||
import net.schueller.peertube.common.Constants.COLOR_PREF_DEFAULT
|
||||
import net.schueller.peertube.common.Constants.PREF_DARK_MODE_AUTO
|
||||
import net.schueller.peertube.common.Constants.PREF_DARK_MODE_KEY
|
||||
import net.schueller.peertube.common.Constants.PREF_THEME_KEY
|
||||
import net.schueller.peertube.feature_settings.settings.domain.repository.SettingsRepository
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class ThemeViewModel @Inject constructor(private val settingsRepository: SettingsRepository): ViewModel() {
|
||||
|
||||
private val _themeState = mutableStateOf(ThemeState())
|
||||
val themeState: State<ThemeState> = _themeState
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
settingsRepository
|
||||
.getStringSettings(PREF_THEME_KEY, COLOR_PREF_DEFAULT).collect {
|
||||
_themeState.value = _themeState.value.copy(
|
||||
currentTheme = it
|
||||
)
|
||||
}
|
||||
settingsRepository
|
||||
.getStringSettings(PREF_DARK_MODE_KEY, PREF_DARK_MODE_AUTO).collect {
|
||||
_themeState.value = _themeState.value.copy(
|
||||
darkMode = it
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package net.schueller.peertube.presentation.ui.theme.colors.blue
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
|
||||
val md_theme_light_primary = Color(0xFF175db2)
|
||||
val md_theme_light_onPrimary = Color(0xFFffffff)
|
||||
val md_theme_light_primaryContainer = Color(0xFFd6e3ff)
|
||||
val md_theme_light_onPrimaryContainer = Color(0xFF001b3f)
|
||||
val md_theme_light_secondary = Color(0xFF565f71)
|
||||
val md_theme_light_onSecondary = Color(0xFFffffff)
|
||||
val md_theme_light_secondaryContainer = Color(0xFFdae3f9)
|
||||
val md_theme_light_onSecondaryContainer = Color(0xFF131c2b)
|
||||
val md_theme_light_tertiary = Color(0xFF6f5574)
|
||||
val md_theme_light_onTertiary = Color(0xFFffffff)
|
||||
val md_theme_light_tertiaryContainer = Color(0xFFf9d8fd)
|
||||
val md_theme_light_onTertiaryContainer = Color(0xFF28132e)
|
||||
val md_theme_light_error = Color(0xFFba1b1b)
|
||||
val md_theme_light_errorContainer = Color(0xFFffdad4)
|
||||
val md_theme_light_onError = Color(0xFFffffff)
|
||||
val md_theme_light_onErrorContainer = Color(0xFF410001)
|
||||
val md_theme_light_background = Color(0xFFfdfbff)
|
||||
val md_theme_light_onBackground = Color(0xFF1a1b1f)
|
||||
val md_theme_light_surface = Color(0xFFfdfbff)
|
||||
val md_theme_light_onSurface = Color(0xFF1a1b1f)
|
||||
val md_theme_light_surfaceVariant = Color(0xFFe0e2ec)
|
||||
val md_theme_light_onSurfaceVariant = Color(0xFF44474f)
|
||||
val md_theme_light_outline = Color(0xFF74777f)
|
||||
val md_theme_light_inverseOnSurface = Color(0xFFf2f0f4)
|
||||
val md_theme_light_inverseSurface = Color(0xFF2f3033)
|
||||
|
||||
val md_theme_dark_primary = Color(0xFFa8c7ff)
|
||||
val md_theme_dark_onPrimary = Color(0xFF002f66)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF004590)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFFd6e3ff)
|
||||
val md_theme_dark_secondary = Color(0xFFbec7dd)
|
||||
val md_theme_dark_onSecondary = Color(0xFF283141)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF3e4759)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFdae3f9)
|
||||
val md_theme_dark_tertiary = Color(0xFFdcbce0)
|
||||
val md_theme_dark_onTertiary = Color(0xFF3f2845)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF573e5c)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFFf9d8fd)
|
||||
val md_theme_dark_error = Color(0xFFffb4a9)
|
||||
val md_theme_dark_errorContainer = Color(0xFF930006)
|
||||
val md_theme_dark_onError = Color(0xFF680003)
|
||||
val md_theme_dark_onErrorContainer = Color(0xFFffdad4)
|
||||
val md_theme_dark_background = Color(0xFF1a1b1f)
|
||||
val md_theme_dark_onBackground = Color(0xFFe3e2e6)
|
||||
val md_theme_dark_surface = Color(0xFF1a1b1f)
|
||||
val md_theme_dark_onSurface = Color(0xFFe3e2e6)
|
||||
val md_theme_dark_surfaceVariant = Color(0xFF44474f)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFc4c6cf)
|
||||
val md_theme_dark_outline = Color(0xFF8d9099)
|
||||
val md_theme_dark_inverseOnSurface = Color(0xFF1a1b1f)
|
||||
val md_theme_dark_inverseSurface = Color(0xFFe3e2e6)
|
||||
|
||||
val seed = Color(0xFF1a5fb4)
|
||||
val error = Color(0xFFba1b1b)
|
||||
|
||||
|
||||
val LightThemeColors = lightColorScheme(
|
||||
primary = md_theme_light_primary,
|
||||
onPrimary = md_theme_light_onPrimary,
|
||||
primaryContainer = md_theme_light_primaryContainer,
|
||||
onPrimaryContainer = md_theme_light_onPrimaryContainer,
|
||||
secondary = md_theme_light_secondary,
|
||||
onSecondary = md_theme_light_onSecondary,
|
||||
secondaryContainer = md_theme_light_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_light_onSecondaryContainer,
|
||||
tertiary = md_theme_light_tertiary,
|
||||
onTertiary = md_theme_light_onTertiary,
|
||||
tertiaryContainer = md_theme_light_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_light_onTertiaryContainer,
|
||||
error = md_theme_light_error,
|
||||
errorContainer = md_theme_light_errorContainer,
|
||||
onError = md_theme_light_onError,
|
||||
onErrorContainer = md_theme_light_onErrorContainer,
|
||||
background = md_theme_light_background,
|
||||
onBackground = md_theme_light_onBackground,
|
||||
surface = md_theme_light_surface,
|
||||
onSurface = md_theme_light_onSurface,
|
||||
surfaceVariant = md_theme_light_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_light_onSurfaceVariant,
|
||||
outline = md_theme_light_outline,
|
||||
inverseOnSurface = md_theme_light_inverseOnSurface,
|
||||
inverseSurface = md_theme_light_inverseSurface,
|
||||
)
|
||||
|
||||
val DarkThemeColors = lightColorScheme(
|
||||
primary = md_theme_dark_primary,
|
||||
onPrimary = md_theme_dark_onPrimary,
|
||||
primaryContainer = md_theme_dark_primaryContainer,
|
||||
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
|
||||
secondary = md_theme_dark_secondary,
|
||||
onSecondary = md_theme_dark_onSecondary,
|
||||
secondaryContainer = md_theme_dark_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
|
||||
tertiary = md_theme_dark_tertiary,
|
||||
onTertiary = md_theme_dark_onTertiary,
|
||||
tertiaryContainer = md_theme_dark_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
|
||||
error = md_theme_dark_error,
|
||||
errorContainer = md_theme_dark_errorContainer,
|
||||
onError = md_theme_dark_onError,
|
||||
onErrorContainer = md_theme_dark_onErrorContainer,
|
||||
background = md_theme_dark_background,
|
||||
onBackground = md_theme_dark_onBackground,
|
||||
surface = md_theme_dark_surface,
|
||||
onSurface = md_theme_dark_onSurface,
|
||||
surfaceVariant = md_theme_dark_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
|
||||
outline = md_theme_dark_outline,
|
||||
inverseOnSurface = md_theme_dark_inverseOnSurface,
|
||||
inverseSurface = md_theme_dark_inverseSurface,
|
||||
)
|
|
@ -0,0 +1,118 @@
|
|||
package net.schueller.peertube.presentation.ui.theme.colors.def
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val md_theme_light_primary = Color(0xFF1760a5)
|
||||
val md_theme_light_onPrimary = Color(0xFFffffff)
|
||||
val md_theme_light_primaryContainer = Color(0xFFd3e4ff)
|
||||
val md_theme_light_onPrimaryContainer = Color(0xFF001c3a)
|
||||
val md_theme_light_secondary = Color(0xFF545f70)
|
||||
val md_theme_light_onSecondary = Color(0xFFffffff)
|
||||
val md_theme_light_secondaryContainer = Color(0xFFd7e3f8)
|
||||
val md_theme_light_onSecondaryContainer = Color(0xFF111c2b)
|
||||
val md_theme_light_tertiary = Color(0xFF6d5677)
|
||||
val md_theme_light_onTertiary = Color(0xFFffffff)
|
||||
val md_theme_light_tertiaryContainer = Color(0xFFf5d9ff)
|
||||
val md_theme_light_onTertiaryContainer = Color(0xFF261430)
|
||||
val md_theme_light_error = Color(0xFFba1b1b)
|
||||
val md_theme_light_errorContainer = Color(0xFFffdad4)
|
||||
val md_theme_light_onError = Color(0xFFffffff)
|
||||
val md_theme_light_onErrorContainer = Color(0xFF410001)
|
||||
val md_theme_light_background = Color(0xFFfdfcff)
|
||||
val md_theme_light_onBackground = Color(0xFF1b1b1d)
|
||||
val md_theme_light_surface = Color(0xFFfdfcff)
|
||||
val md_theme_light_onSurface = Color(0xFF1b1b1d)
|
||||
val md_theme_light_surfaceVariant = Color(0xFFdfe2eb)
|
||||
val md_theme_light_onSurfaceVariant = Color(0xFF43474e)
|
||||
val md_theme_light_outline = Color(0xFF73777f)
|
||||
val md_theme_light_inverseOnSurface = Color(0xFFf1f0f4)
|
||||
val md_theme_light_inverseSurface = Color(0xFF2f3033)
|
||||
|
||||
val md_theme_dark_primary = Color(0xFFa1c9ff)
|
||||
val md_theme_dark_onPrimary = Color(0xFF00315e)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF004884)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFFd3e4ff)
|
||||
val md_theme_dark_secondary = Color(0xFFbcc7db)
|
||||
val md_theme_dark_onSecondary = Color(0xFF263141)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF3c4758)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFd7e3f8)
|
||||
val md_theme_dark_tertiary = Color(0xFFd9bde3)
|
||||
val md_theme_dark_onTertiary = Color(0xFF3c2946)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF543f5e)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFFf5d9ff)
|
||||
val md_theme_dark_error = Color(0xFFffb4a9)
|
||||
val md_theme_dark_errorContainer = Color(0xFF930006)
|
||||
val md_theme_dark_onError = Color(0xFF680003)
|
||||
val md_theme_dark_onErrorContainer = Color(0xFFffdad4)
|
||||
val md_theme_dark_background = Color(0xFF1b1b1d)
|
||||
val md_theme_dark_onBackground = Color(0xFFe3e2e6)
|
||||
val md_theme_dark_surface = Color(0xFF1b1b1d)
|
||||
val md_theme_dark_onSurface = Color(0xFFe3e2e6)
|
||||
val md_theme_dark_surfaceVariant = Color(0xFF43474e)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFc3c6cf)
|
||||
val md_theme_dark_outline = Color(0xFF8d9199)
|
||||
val md_theme_dark_inverseOnSurface = Color(0xFF1b1b1d)
|
||||
val md_theme_dark_inverseSurface = Color(0xFFe3e2e6)
|
||||
|
||||
val seed = Color(0xFF5175a4)
|
||||
val error = Color(0xFFba1b1b)
|
||||
|
||||
|
||||
// default
|
||||
val LightThemeColors = lightColorScheme(
|
||||
|
||||
primary = md_theme_light_primary,
|
||||
onPrimary = md_theme_light_onPrimary,
|
||||
primaryContainer = md_theme_light_primaryContainer,
|
||||
onPrimaryContainer = md_theme_light_onPrimaryContainer,
|
||||
secondary = md_theme_light_secondary,
|
||||
onSecondary = md_theme_light_onSecondary,
|
||||
secondaryContainer = md_theme_light_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_light_onSecondaryContainer,
|
||||
tertiary = md_theme_light_tertiary,
|
||||
onTertiary = md_theme_light_onTertiary,
|
||||
tertiaryContainer = md_theme_light_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_light_onTertiaryContainer,
|
||||
error = md_theme_light_error,
|
||||
errorContainer = md_theme_light_errorContainer,
|
||||
onError = md_theme_light_onError,
|
||||
onErrorContainer = md_theme_light_onErrorContainer,
|
||||
background = md_theme_light_background,
|
||||
onBackground = md_theme_light_onBackground,
|
||||
surface = md_theme_light_surface,
|
||||
onSurface = md_theme_light_onSurface,
|
||||
surfaceVariant = md_theme_light_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_light_onSurfaceVariant,
|
||||
outline = md_theme_light_outline,
|
||||
inverseOnSurface = md_theme_light_inverseOnSurface,
|
||||
inverseSurface = md_theme_light_inverseSurface,
|
||||
)
|
||||
val DarkThemeColors = darkColorScheme(
|
||||
|
||||
primary = md_theme_dark_primary,
|
||||
onPrimary = md_theme_dark_onPrimary,
|
||||
primaryContainer = md_theme_dark_primaryContainer,
|
||||
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
|
||||
secondary = md_theme_dark_secondary,
|
||||
onSecondary = md_theme_dark_onSecondary,
|
||||
secondaryContainer = md_theme_dark_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
|
||||
tertiary = md_theme_dark_tertiary,
|
||||
onTertiary = md_theme_dark_onTertiary,
|
||||
tertiaryContainer = md_theme_dark_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
|
||||
error = md_theme_dark_error,
|
||||
errorContainer = md_theme_dark_errorContainer,
|
||||
onError = md_theme_dark_onError,
|
||||
onErrorContainer = md_theme_dark_onErrorContainer,
|
||||
background = md_theme_dark_background,
|
||||
onBackground = md_theme_dark_onBackground,
|
||||
surface = md_theme_dark_surface,
|
||||
onSurface = md_theme_dark_onSurface,
|
||||
surfaceVariant = md_theme_dark_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
|
||||
outline = md_theme_dark_outline,
|
||||
inverseOnSurface = md_theme_dark_inverseOnSurface,
|
||||
inverseSurface = md_theme_dark_inverseSurface,
|
||||
)
|
|
@ -0,0 +1,116 @@
|
|||
package net.schueller.peertube.presentation.ui.theme.colors.green
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
|
||||
val md_theme_light_primary = Color(0xFF006d41)
|
||||
val md_theme_light_onPrimary = Color(0xFFffffff)
|
||||
val md_theme_light_primaryContainer = Color(0xFF87f9b8)
|
||||
val md_theme_light_onPrimaryContainer = Color(0xFF002110)
|
||||
val md_theme_light_secondary = Color(0xFF4e6355)
|
||||
val md_theme_light_onSecondary = Color(0xFFffffff)
|
||||
val md_theme_light_secondaryContainer = Color(0xFFd1e8d6)
|
||||
val md_theme_light_onSecondaryContainer = Color(0xFF0c1f14)
|
||||
val md_theme_light_tertiary = Color(0xFF3b6471)
|
||||
val md_theme_light_onTertiary = Color(0xFFffffff)
|
||||
val md_theme_light_tertiaryContainer = Color(0xFFbfe9f8)
|
||||
val md_theme_light_onTertiaryContainer = Color(0xFF001f28)
|
||||
val md_theme_light_error = Color(0xFFba1b1b)
|
||||
val md_theme_light_errorContainer = Color(0xFFffdad4)
|
||||
val md_theme_light_onError = Color(0xFFffffff)
|
||||
val md_theme_light_onErrorContainer = Color(0xFF410001)
|
||||
val md_theme_light_background = Color(0xFFfbfdf8)
|
||||
val md_theme_light_onBackground = Color(0xFF191c1a)
|
||||
val md_theme_light_surface = Color(0xFFfbfdf8)
|
||||
val md_theme_light_onSurface = Color(0xFF191c1a)
|
||||
val md_theme_light_surfaceVariant = Color(0xFFdce5dc)
|
||||
val md_theme_light_onSurfaceVariant = Color(0xFF404942)
|
||||
val md_theme_light_outline = Color(0xFF717972)
|
||||
val md_theme_light_inverseOnSurface = Color(0xFFeff1ec)
|
||||
val md_theme_light_inverseSurface = Color(0xFF2e312e)
|
||||
|
||||
val md_theme_dark_primary = Color(0xFF69dc9d)
|
||||
val md_theme_dark_onPrimary = Color(0xFF00391f)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF00522f)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFF87f9b8)
|
||||
val md_theme_dark_secondary = Color(0xFFb5ccbb)
|
||||
val md_theme_dark_onSecondary = Color(0xFF213528)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF374b3e)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFd1e8d6)
|
||||
val md_theme_dark_tertiary = Color(0xFFa3cddc)
|
||||
val md_theme_dark_onTertiary = Color(0xFF033541)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF214c58)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFFbfe9f8)
|
||||
val md_theme_dark_error = Color(0xFFffb4a9)
|
||||
val md_theme_dark_errorContainer = Color(0xFF930006)
|
||||
val md_theme_dark_onError = Color(0xFF680003)
|
||||
val md_theme_dark_onErrorContainer = Color(0xFFffdad4)
|
||||
val md_theme_dark_background = Color(0xFF191c1a)
|
||||
val md_theme_dark_onBackground = Color(0xFFe2e3df)
|
||||
val md_theme_dark_surface = Color(0xFF191c1a)
|
||||
val md_theme_dark_onSurface = Color(0xFFe2e3df)
|
||||
val md_theme_dark_surfaceVariant = Color(0xFF404942)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFc0c9c0)
|
||||
val md_theme_dark_outline = Color(0xFF8a938b)
|
||||
val md_theme_dark_inverseOnSurface = Color(0xFF191c1a)
|
||||
val md_theme_dark_inverseSurface = Color(0xFFe2e3df)
|
||||
|
||||
val seed = Color(0xFF26a269)
|
||||
val error = Color(0xFFba1b1b)
|
||||
|
||||
|
||||
val LightThemeColors = lightColorScheme(
|
||||
primary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_primary,
|
||||
onPrimary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onPrimary,
|
||||
primaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_primaryContainer,
|
||||
onPrimaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onPrimaryContainer,
|
||||
secondary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_secondary,
|
||||
onSecondary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onSecondary,
|
||||
secondaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_secondaryContainer,
|
||||
onSecondaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onSecondaryContainer,
|
||||
tertiary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_tertiary,
|
||||
onTertiary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onTertiary,
|
||||
tertiaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_tertiaryContainer,
|
||||
onTertiaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onTertiaryContainer,
|
||||
error = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_error,
|
||||
errorContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_errorContainer,
|
||||
onError = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onError,
|
||||
onErrorContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onErrorContainer,
|
||||
background = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_background,
|
||||
onBackground = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onBackground,
|
||||
surface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_surface,
|
||||
onSurface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onSurface,
|
||||
surfaceVariant = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_surfaceVariant,
|
||||
onSurfaceVariant = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_onSurfaceVariant,
|
||||
outline = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_outline,
|
||||
inverseOnSurface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_inverseOnSurface,
|
||||
inverseSurface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_light_inverseSurface,
|
||||
)
|
||||
|
||||
val DarkThemeColors = lightColorScheme(
|
||||
primary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_primary,
|
||||
onPrimary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onPrimary,
|
||||
primaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_primaryContainer,
|
||||
onPrimaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onPrimaryContainer,
|
||||
secondary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_secondary,
|
||||
onSecondary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onSecondary,
|
||||
secondaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_secondaryContainer,
|
||||
onSecondaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onSecondaryContainer,
|
||||
tertiary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_tertiary,
|
||||
onTertiary = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onTertiary,
|
||||
tertiaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_tertiaryContainer,
|
||||
onTertiaryContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onTertiaryContainer,
|
||||
error = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_error,
|
||||
errorContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_errorContainer,
|
||||
onError = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onError,
|
||||
onErrorContainer = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onErrorContainer,
|
||||
background = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_background,
|
||||
onBackground = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onBackground,
|
||||
surface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_surface,
|
||||
onSurface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onSurface,
|
||||
surfaceVariant = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_surfaceVariant,
|
||||
onSurfaceVariant = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_onSurfaceVariant,
|
||||
outline = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_outline,
|
||||
inverseOnSurface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_inverseOnSurface,
|
||||
inverseSurface = net.schueller.peertube.presentation.ui.theme.colors.blue.md_theme_dark_inverseSurface,
|
||||
)
|
|
@ -0,0 +1,117 @@
|
|||
package net.schueller.peertube.presentation.ui.theme.colors.red
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
|
||||
val md_theme_light_primary = Color(0xFFb22735)
|
||||
val md_theme_light_onPrimary = Color(0xFFffffff)
|
||||
val md_theme_light_primaryContainer = Color(0xFFffd9d9)
|
||||
val md_theme_light_onPrimaryContainer = Color(0xFF410007)
|
||||
val md_theme_light_secondary = Color(0xFF765655)
|
||||
val md_theme_light_onSecondary = Color(0xFFffffff)
|
||||
val md_theme_light_secondaryContainer = Color(0xFFffdad9)
|
||||
val md_theme_light_onSecondaryContainer = Color(0xFF2c1515)
|
||||
val md_theme_light_tertiary = Color(0xFF745a2f)
|
||||
val md_theme_light_onTertiary = Color(0xFFffffff)
|
||||
val md_theme_light_tertiaryContainer = Color(0xFFffddaa)
|
||||
val md_theme_light_onTertiaryContainer = Color(0xFF281800)
|
||||
val md_theme_light_error = Color(0xFFba1b1b)
|
||||
val md_theme_light_errorContainer = Color(0xFFffdad4)
|
||||
val md_theme_light_onError = Color(0xFFffffff)
|
||||
val md_theme_light_onErrorContainer = Color(0xFF410001)
|
||||
val md_theme_light_background = Color(0xFFfcfcfc)
|
||||
val md_theme_light_onBackground = Color(0xFF201a1a)
|
||||
val md_theme_light_surface = Color(0xFFfcfcfc)
|
||||
val md_theme_light_onSurface = Color(0xFF201a1a)
|
||||
val md_theme_light_surfaceVariant = Color(0xFFf4dddc)
|
||||
val md_theme_light_onSurfaceVariant = Color(0xFF524343)
|
||||
val md_theme_light_outline = Color(0xFF857372)
|
||||
val md_theme_light_inverseOnSurface = Color(0xFFfbeeed)
|
||||
val md_theme_light_inverseSurface = Color(0xFF362f2f)
|
||||
|
||||
val md_theme_dark_primary = Color(0xFFffb3b4)
|
||||
val md_theme_dark_onPrimary = Color(0xFF680011)
|
||||
val md_theme_dark_primaryContainer = Color(0xFF900921)
|
||||
val md_theme_dark_onPrimaryContainer = Color(0xFFffd9d9)
|
||||
val md_theme_dark_secondary = Color(0xFFe6bdbc)
|
||||
val md_theme_dark_onSecondary = Color(0xFF442929)
|
||||
val md_theme_dark_secondaryContainer = Color(0xFF5d3f3f)
|
||||
val md_theme_dark_onSecondaryContainer = Color(0xFFffdad9)
|
||||
val md_theme_dark_tertiary = Color(0xFFe4c18d)
|
||||
val md_theme_dark_onTertiary = Color(0xFF412d05)
|
||||
val md_theme_dark_tertiaryContainer = Color(0xFF5b431a)
|
||||
val md_theme_dark_onTertiaryContainer = Color(0xFFffddaa)
|
||||
val md_theme_dark_error = Color(0xFFffb4a9)
|
||||
val md_theme_dark_errorContainer = Color(0xFF930006)
|
||||
val md_theme_dark_onError = Color(0xFF680003)
|
||||
val md_theme_dark_onErrorContainer = Color(0xFFffdad4)
|
||||
val md_theme_dark_background = Color(0xFF201a1a)
|
||||
val md_theme_dark_onBackground = Color(0xFFede0df)
|
||||
val md_theme_dark_surface = Color(0xFF201a1a)
|
||||
val md_theme_dark_onSurface = Color(0xFFede0df)
|
||||
val md_theme_dark_surfaceVariant = Color(0xFF524343)
|
||||
val md_theme_dark_onSurfaceVariant = Color(0xFFd8c2c1)
|
||||
val md_theme_dark_outline = Color(0xFFa08c8b)
|
||||
val md_theme_dark_inverseOnSurface = Color(0xFF201a1a)
|
||||
val md_theme_dark_inverseSurface = Color(0xFFede0df)
|
||||
|
||||
val seed = Color(0xFFa51d2d)
|
||||
val error = Color(0xFFba1b1b)
|
||||
|
||||
|
||||
// RED Theme
|
||||
val LightThemeColors = lightColorScheme(
|
||||
primary = md_theme_light_primary,
|
||||
onPrimary = md_theme_light_onPrimary,
|
||||
primaryContainer = md_theme_light_primaryContainer,
|
||||
onPrimaryContainer = md_theme_light_onPrimaryContainer,
|
||||
secondary = md_theme_light_secondary,
|
||||
onSecondary = md_theme_light_onSecondary,
|
||||
secondaryContainer = md_theme_light_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_light_onSecondaryContainer,
|
||||
tertiary = md_theme_light_tertiary,
|
||||
onTertiary = md_theme_light_onTertiary,
|
||||
tertiaryContainer = md_theme_light_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_light_onTertiaryContainer,
|
||||
error = md_theme_light_error,
|
||||
errorContainer = md_theme_light_errorContainer,
|
||||
onError = md_theme_light_onError,
|
||||
onErrorContainer = md_theme_light_onErrorContainer,
|
||||
background = md_theme_light_background,
|
||||
onBackground = md_theme_light_onBackground,
|
||||
surface = md_theme_light_surface,
|
||||
onSurface = md_theme_light_onSurface,
|
||||
surfaceVariant = md_theme_light_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_light_onSurfaceVariant,
|
||||
outline = md_theme_light_outline,
|
||||
inverseOnSurface = md_theme_light_inverseOnSurface,
|
||||
inverseSurface = md_theme_light_inverseSurface,
|
||||
)
|
||||
|
||||
val DarkThemeColors = lightColorScheme(
|
||||
primary = md_theme_dark_primary,
|
||||
onPrimary = md_theme_dark_onPrimary,
|
||||
primaryContainer = md_theme_dark_primaryContainer,
|
||||
onPrimaryContainer = md_theme_dark_onPrimaryContainer,
|
||||
secondary = md_theme_dark_secondary,
|
||||
onSecondary = md_theme_dark_onSecondary,
|
||||
secondaryContainer = md_theme_dark_secondaryContainer,
|
||||
onSecondaryContainer = md_theme_dark_onSecondaryContainer,
|
||||
tertiary = md_theme_dark_tertiary,
|
||||
onTertiary = md_theme_dark_onTertiary,
|
||||
tertiaryContainer = md_theme_dark_tertiaryContainer,
|
||||
onTertiaryContainer = md_theme_dark_onTertiaryContainer,
|
||||
error = md_theme_dark_error,
|
||||
errorContainer = md_theme_dark_errorContainer,
|
||||
onError = md_theme_dark_onError,
|
||||
onErrorContainer = md_theme_dark_onErrorContainer,
|
||||
background = md_theme_dark_background,
|
||||
onBackground = md_theme_dark_onBackground,
|
||||
surface = md_theme_dark_surface,
|
||||
onSurface = md_theme_dark_onSurface,
|
||||
surfaceVariant = md_theme_dark_surfaceVariant,
|
||||
onSurfaceVariant = md_theme_dark_onSurfaceVariant,
|
||||
outline = md_theme_dark_outline,
|
||||
inverseOnSurface = md_theme_dark_inverseOnSurface,
|
||||
inverseSurface = md_theme_dark_inverseSurface,
|
||||
)
|
|
@ -1,16 +0,0 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Peertube" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
|
@ -1,10 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
|
@ -1,17 +1,6 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Peertube" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<style name="Theme.Peertube" parent="android:Theme.Material.Light.NoActionBar">
|
||||
<item name="android:statusBarColor">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Peertube.NoActionBar">
|
||||
|
@ -19,7 +8,4 @@
|
|||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Peertube.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="Theme.Peertube.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
</resources>
|
|
@ -10,7 +10,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.1.0'
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$koltin_version"
|
||||
classpath "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
|
||||
|
||||
|
|
Loading…
Reference in New Issue