Add help to menu

This commit is contained in:
MM20 2022-10-28 13:29:04 +02:00
parent d0d7d13cd0
commit 5e2235cef7
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 27 additions and 0 deletions

View File

@ -38,6 +38,8 @@
<string name="app_info_version">Version %1$s</string>
<!-- Menu entry for launcher settings -->
<string name="settings">Settings</string>
<!-- Menu entry for launcher help -->
<string name="help">Help</string>
<!-- Set the device's wallpaper -->
<string name="wallpaper">Wallpaper</string>
<!-- Wind direction, used in weather widget -->

View File

@ -1,6 +1,9 @@
package de.mm20.launcher2.ui.launcher.search
import android.content.Intent
import android.net.Uri
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.animateDp
@ -24,6 +27,7 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.HelpOutline
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.material.icons.rounded.Wallpaper
@ -51,6 +55,7 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.stringResource
@ -146,6 +151,26 @@ fun SearchBar(
Icon(imageVector = Icons.Rounded.Settings, contentDescription = null)
}
)
val colorScheme = MaterialTheme.colorScheme
DropdownMenuItem(
onClick = {
CustomTabsIntent.Builder()
.setDefaultColorSchemeParams(
CustomTabColorSchemeParams.Builder()
.setToolbarColor(colorScheme.primaryContainer.toArgb())
.setSecondaryToolbarColor(colorScheme.secondaryContainer.toArgb())
.build()
)
.build().launchUrl(context, Uri.parse("https://kvaesitso.mm20.de/docs/user-guide"))
onDismissRequest()
},
text = {
Text(stringResource(R.string.help))
},
leadingIcon = {
Icon(imageVector = Icons.Rounded.HelpOutline, contentDescription = null)
}
)
}
},
focusRequester = focusRequester,