Use theme secondary color in Compose UI
This commit is contained in:
1 parent
36796fee37
commit
3033e471cd
18 files changed
+24
-30
No files matched your search
@@ -31,7 +31,6 @@ import com.v2ray.ang.util.Utils
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.jvm.Volatile
|
||||
import libv2ray.CoreCallbackHandler
|
||||
import libv2ray.CoreController
|
||||
import libv2ray.ProcessFinder
|
||||
|
||||
@@ -43,6 +43,7 @@ enum class Language(val code: String, val languageTag: String) {
|
||||
} else {
|
||||
CHINA
|
||||
}
|
||||
|
||||
"vi" -> VIETNAMESE
|
||||
"ru" -> RUSSIAN
|
||||
"fa" -> PERSIAN
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.v2ray.ang.contracts.ServiceControl
|
||||
import com.v2ray.ang.core.CoreServiceManager
|
||||
import com.v2ray.ang.handler.AppLocaleManager
|
||||
import com.v2ray.ang.handler.NotificationManager
|
||||
import com.v2ray.ang.handler.SettingsManager
|
||||
import com.v2ray.ang.util.LogUtil
|
||||
import java.lang.ref.SoftReference
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.v2ray.ang.contracts.ServiceControl
|
||||
import com.v2ray.ang.core.CoreServiceManager
|
||||
import com.v2ray.ang.handler.AppLocaleManager
|
||||
import com.v2ray.ang.handler.NotificationManager
|
||||
import com.v2ray.ang.handler.SettingsManager
|
||||
import com.v2ray.ang.root.RootProxyManager
|
||||
import com.v2ray.ang.util.LogUtil
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@@ -151,7 +151,7 @@ class CoreTestService : Service() {
|
||||
}
|
||||
|
||||
is RealPingEvent.Finish -> {
|
||||
if(message.subscriptionId.isNotEmpty()){
|
||||
if (message.subscriptionId.isNotEmpty()) {
|
||||
if (MmkvManager.decodeSettingsBool(AppConfig.PREF_AUTO_REMOVE_INVALID_AFTER_TEST, false)) {
|
||||
AngConfigManager.removeInvalidServer(message.subscriptionId)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.ScaffoldDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -32,8 +31,8 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.v2ray.ang.R
|
||||
import com.v2ray.ang.dto.AppInfo
|
||||
import com.v2ray.ang.ui.base.BaseComponentActivity
|
||||
import com.v2ray.ang.ui.compose.AppListItem
|
||||
import com.v2ray.ang.ui.compose.AppDropdownMenuItems
|
||||
import com.v2ray.ang.ui.compose.AppListItem
|
||||
import com.v2ray.ang.ui.compose.AppTopBar
|
||||
import com.v2ray.ang.ui.compose.ItemDivider
|
||||
import com.v2ray.ang.ui.compose.verticalScrollbar
|
||||
|
||||
@@ -116,7 +116,7 @@ class AppPickerViewModel(application: Application) : BaseViewModel(application)
|
||||
|
||||
return apps.filter {
|
||||
it.appName.contains(query, ignoreCase = true) ||
|
||||
it.packageName.contains(query, ignoreCase = true)
|
||||
it.packageName.contains(query, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.v2ray.ang.ui.compose
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
@@ -43,19 +41,19 @@ import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import coil.request.ImageRequest
|
||||
import com.v2ray.ang.util.AppIconFetcher
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.v2ray.ang.R
|
||||
import com.v2ray.ang.util.AppIconFetcher
|
||||
import sh.calvin.reorderable.ReorderableCollectionItemScope
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@@ -110,7 +108,7 @@ fun AppTopBar(
|
||||
enter = expandVertically(),
|
||||
exit = shrinkVertically()
|
||||
) {
|
||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth(), color = colorFabActive)
|
||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth(), color = MaterialTheme.colorScheme.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,7 +209,7 @@ fun AppListItem(
|
||||
Checkbox(
|
||||
checked = checked,
|
||||
onCheckedChange = onCheckedChange,
|
||||
colors = CheckboxDefaults.colors(checkedColor = colorFabActive)
|
||||
colors = CheckboxDefaults.colors(checkedColor = MaterialTheme.colorScheme.secondary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.v2ray.ang.ui.compose
|
||||
import android.graphics.Bitmap
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.selection.selectable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@@ -15,6 +14,7 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.selection.selectable
|
||||
import androidx.compose.foundation.text.selection.TextSelectionColors
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Icon
|
||||
|
||||
@@ -35,7 +35,7 @@ fun PreferenceGroupHeader(title: String, modifier: Modifier = Modifier) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = colorFabActive,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 8.dp)
|
||||
@@ -59,13 +59,13 @@ fun CollapsiblePreferenceGroupHeader(
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = colorFabActive,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_expand_more_24dp),
|
||||
contentDescription = null,
|
||||
tint = colorFabActive,
|
||||
tint = MaterialTheme.colorScheme.secondary,
|
||||
modifier = Modifier
|
||||
.size(24.dp)
|
||||
.rotate(if (expanded) 180f else 0f)
|
||||
|
||||
@@ -172,6 +172,7 @@ fun AppTheme(
|
||||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||
}
|
||||
|
||||
darkTheme -> DarkColor
|
||||
else -> LightColor
|
||||
}
|
||||
|
||||
@@ -73,7 +73,9 @@ fun MainDrawerContent(drawerState: DrawerState, onNavigate: (MainDestination) ->
|
||||
drawerContainerColor = MaterialTheme.colorScheme.surface
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.verticalScroll(drawerScrollState).verticalScrollbar(drawerScrollState)
|
||||
modifier = Modifier
|
||||
.verticalScroll(drawerScrollState)
|
||||
.verticalScrollbar(drawerScrollState)
|
||||
) {
|
||||
Surface(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -18,7 +18,6 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.v2ray.ang.dto.GroupMapItem
|
||||
import com.v2ray.ang.dto.entities.ServersCache
|
||||
import com.v2ray.ang.ui.compose.colorFabActive
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
@Composable
|
||||
@@ -45,7 +44,7 @@ fun GroupTabBar(
|
||||
)
|
||||
.clip(RoundedCornerShape(3.dp)),
|
||||
width = Dp.Unspecified,
|
||||
color = colorFabActive
|
||||
color = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
},
|
||||
divider = {}
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.v2ray.ang.ui.compose.AppDropdownMenuItems
|
||||
import com.v2ray.ang.ui.compose.AppListItem
|
||||
import com.v2ray.ang.ui.compose.AppTopBar
|
||||
import com.v2ray.ang.ui.compose.ItemDivider
|
||||
import com.v2ray.ang.ui.compose.colorFabActive
|
||||
import com.v2ray.ang.ui.compose.verticalScrollbar
|
||||
import com.v2ray.ang.util.Utils
|
||||
|
||||
@@ -224,7 +223,7 @@ fun PerAppProxyScreen(
|
||||
onCheckedChange = onPerAppProxyChanged,
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = MaterialTheme.colorScheme.onSecondary,
|
||||
checkedTrackColor = colorFabActive
|
||||
checkedTrackColor = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -245,7 +244,7 @@ fun PerAppProxyScreen(
|
||||
onCheckedChange = onBypassAppsChanged,
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = MaterialTheme.colorScheme.onSecondary,
|
||||
checkedTrackColor = colorFabActive
|
||||
checkedTrackColor = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ class PerAppProxyViewModel(application: Application) : BaseViewModel(application
|
||||
|
||||
return apps.filter {
|
||||
it.appName.contains(query, ignoreCase = true) ||
|
||||
it.packageName.contains(query, ignoreCase = true)
|
||||
it.packageName.contains(query, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ import com.v2ray.ang.ui.compose.ReorderableListItem
|
||||
import com.v2ray.ang.ui.compose.SelectListDialog
|
||||
import com.v2ray.ang.ui.compose.SettingsListItem
|
||||
import com.v2ray.ang.ui.compose.colorConfigType
|
||||
import com.v2ray.ang.ui.compose.colorFabActive
|
||||
import com.v2ray.ang.ui.compose.verticalScrollbar
|
||||
import com.v2ray.ang.util.JsonUtil
|
||||
import com.v2ray.ang.util.LogUtil
|
||||
@@ -386,7 +385,7 @@ private fun RoutingRulesetItem(
|
||||
modifier = Modifier.scale(0.7f),
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = MaterialTheme.colorScheme.onSecondary,
|
||||
checkedTrackColor = colorFabActive
|
||||
checkedTrackColor = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ import com.v2ray.ang.ui.compose.QRCodeDialog
|
||||
import com.v2ray.ang.ui.compose.ReorderableListItem
|
||||
import com.v2ray.ang.ui.compose.SelectListDialog
|
||||
import com.v2ray.ang.ui.compose.SettingsSwitchItem
|
||||
import com.v2ray.ang.ui.compose.colorFabActive
|
||||
import com.v2ray.ang.ui.compose.verticalScrollbar
|
||||
import com.v2ray.ang.util.QRCodeDecoder
|
||||
import com.v2ray.ang.util.Utils
|
||||
@@ -233,7 +232,7 @@ fun SubSettingScreen(
|
||||
modifier = Modifier.scale(0.7f),
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = MaterialTheme.colorScheme.onSecondary,
|
||||
checkedTrackColor = colorFabActive
|
||||
checkedTrackColor = MaterialTheme.colorScheme.secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class AppIconFetcher(
|
||||
class Factory(private val context: Context) : Fetcher.Factory<Any> {
|
||||
override fun create(data: Any, options: Options, imageLoader: ImageLoader): Fetcher? {
|
||||
val dataString = data.toString()
|
||||
|
||||
|
||||
if (dataString.startsWith("appicon:")) {
|
||||
val pkg = dataString.substringAfter("appicon:")
|
||||
return AppIconFetcher(pkg, context)
|
||||
|
||||
Reference in new issue
Block a user