Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions V2rayNG/app/src/main/java/com/v2ray/ang/ui/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ package com.v2ray.ang.ui
import android.os.Bundle
import android.webkit.WebView
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -58,7 +61,7 @@ fun AboutScreen(onBackClick: () -> Unit) {
val appIdText = BuildConfig.APPLICATION_ID

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.title_about),
Expand Down Expand Up @@ -101,6 +104,7 @@ fun AboutScreen(onBackClick: () -> Unit) {
versionText = versionText,
appIdText = appIdText
)
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import android.os.Bundle
import androidx.activity.viewModels
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
Expand All @@ -16,7 +20,6 @@ import androidx.compose.material3.Icon
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
Expand Down Expand Up @@ -128,7 +131,7 @@ fun AppPickerScreen(
}

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = title,
Expand Down Expand Up @@ -185,7 +188,8 @@ fun AppPickerScreen(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding)
.verticalScrollbar(listState)
.verticalScrollbar(listState),
contentPadding = PaddingValues(bottom = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding())
) {
items(items = apps, key = { it.packageName }) { app ->
val checked = selectedPackages.contains(app.packageName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import androidx.activity.viewModels
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -198,7 +200,7 @@ fun BackupScreen(
val webDavSummary = currentWebDavConfig?.baseUrl

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.title_configuration_backup_restore),
Expand Down Expand Up @@ -235,6 +237,7 @@ fun BackupScreen(
subtitle = webDavSummary,
onClick = { showWebDavDialog = true }
)
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ package com.v2ray.ang.ui.checkupdate
import android.os.Bundle
import androidx.activity.viewModels
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -63,7 +66,7 @@ fun CheckUpdateScreen(
val versionText = "v${BuildConfig.VERSION_NAME} ($libVersion)"

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.update_check_for_update),
Expand All @@ -90,6 +93,7 @@ fun CheckUpdateScreen(
onClick = { viewModel.checkForUpdates() }
)
VersionInfoBlock(versionText = versionText)
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import androidx.activity.viewModels
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
Expand All @@ -21,7 +25,6 @@ import androidx.compose.material3.Icon
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.getValue
Expand Down Expand Up @@ -136,7 +139,7 @@ fun LogcatScreen(
val listState = rememberLazyListState()

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.title_logcat),
Expand Down Expand Up @@ -206,7 +209,8 @@ fun LogcatScreen(
state = listState,
modifier = Modifier
.fillMaxSize()
.verticalScrollbar(listState)
.verticalScrollbar(listState),
contentPadding = PaddingValues(bottom = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding())
) {
itemsIndexed(items = logs, key = { index, _ -> index }) { _, log ->
LogcatItem(log = log, onLongClick = { Utils.setClipboard(context, log) })
Expand Down
29 changes: 13 additions & 16 deletions V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainBottomBar.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.v2ray.ang.ui.main

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand All @@ -17,7 +18,6 @@ import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -40,26 +40,23 @@ fun MainBottomBar(
onAction: (MainAction) -> Unit
) {
Box(modifier = Modifier.fillMaxWidth()) {
Column(modifier = Modifier.fillMaxWidth()) {
Column(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.surface)
.clickable(onClick = { onAction(MainAction.TestCurrentServer) })
.windowInsetsPadding(WindowInsets.navigationBars)
) {
AppDivider()
Surface(
Row(
modifier = Modifier
.fillMaxWidth()
.windowInsetsPadding(WindowInsets.navigationBars)
.height(64.dp)
.clickable(onClick = { onAction(MainAction.TestCurrentServer) }),
color = MaterialTheme.colorScheme.surface,
tonalElevation = 0.dp
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(text = displayText, style = MaterialTheme.typography.bodyMedium)
}
Text(text = displayText, style = MaterialTheme.typography.bodyMedium)
}
}
FloatingActionButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -20,7 +24,6 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
Expand Down Expand Up @@ -137,7 +140,7 @@ fun PerAppProxyScreen(
}

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.per_app_proxy_settings),
Expand Down Expand Up @@ -264,7 +267,8 @@ fun PerAppProxyScreen(
state = listState,
modifier = Modifier
.fillMaxSize()
.verticalScrollbar(listState)
.verticalScrollbar(listState),
contentPadding = PaddingValues(bottom = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding())
) {
items(items = apps, key = { it.packageName }) { app ->
val checked = blacklist.contains(app.packageName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsBottomHeight
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -176,7 +178,7 @@ fun RoutingEditScreen(
}

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.routing_settings_rule_title),
Expand Down Expand Up @@ -294,6 +296,7 @@ fun RoutingEditScreen(
editable = true
)
Spacer(modifier = Modifier.height(36.dp))
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars))
}

if (showDeleteConfirm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ import androidx.activity.viewModels
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
Expand All @@ -22,7 +26,6 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
Expand Down Expand Up @@ -216,7 +219,7 @@ fun RoutingSettingScreen(
}

Scaffold(
contentWindowInsets = ScaffoldDefaults.contentWindowInsets,
contentWindowInsets = WindowInsets(0),
topBar = {
AppTopBar(
title = stringResource(R.string.routing_settings_title),
Expand Down Expand Up @@ -260,7 +263,8 @@ fun RoutingSettingScreen(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding)
.verticalScrollbar(lazyListState)
.verticalScrollbar(lazyListState),
contentPadding = PaddingValues(bottom = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding())
) {
item(key = "domain_strategy") {
SettingsListItem(
Expand Down
Loading