-
Notifications
You must be signed in to change notification settings - Fork 173
feat: shortcuts customization #1385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
10ab2f1
fix: don't add dash prefix to shared address
Syn-McJ 9386bb1
feat: shortcuts UI and customization
Syn-McJ e1578c2
feat: handle SECURE_NOW removal properly
Syn-McJ eedef76
chore: cleanup
Syn-McJ 969e672
chore: coderabbit ai suggestions
Syn-McJ b6e2221
feat: shortcuts info panel (#1392)
Syn-McJ 1fa4910
Merge branch 'master' into feat/shortcuts-customization
HashEngineering e109709
fix: fonts
HashEngineering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
common/src/main/java/org/dash/wallet/common/ui/components/InfoPanel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| /* | ||
| * Copyright 2024 Dash Core Group. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package org.dash.wallet.common.ui.components | ||
|
|
||
| import androidx.annotation.DrawableRes | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.material3.Icon | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.shadow | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import org.dash.wallet.common.R | ||
|
|
||
| @Composable | ||
| fun InfoPanel( | ||
| title: String, | ||
| description: String, | ||
| modifier: Modifier = Modifier, | ||
| @DrawableRes leftIconRes: Int? = null, | ||
| @DrawableRes actionIconRes: Int? = null, | ||
| onAction: (() -> Unit)? = null | ||
| ) { | ||
| Box( | ||
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .background(MyTheme.Colors.backgroundSecondary, RoundedCornerShape(16.dp)) | ||
| .shadow(elevation = 20.dp, spotColor = Color(0x1AB8C1CC), ambientColor = Color(0x1AB8C1CC)), | ||
| ) { | ||
| Row( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .padding(14.dp, 15.dp), | ||
| verticalAlignment = Alignment.CenterVertically, | ||
| horizontalArrangement = Arrangement.spacedBy(10.dp) | ||
| ) { | ||
| leftIconRes?.let { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(34.dp), | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(id = leftIconRes), | ||
| contentDescription = null, | ||
| tint = Color.Unspecified | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| Column( | ||
| modifier = Modifier.weight(1f), | ||
| verticalArrangement = Arrangement.spacedBy(2.dp) | ||
| ) { | ||
| Text( | ||
| text = title, | ||
| style = MyTheme.CaptionMedium | ||
| ) | ||
|
|
||
| Text( | ||
| text = description, | ||
| style = MyTheme.Caption, | ||
| color = MyTheme.Colors.textSecondary | ||
| ) | ||
| } | ||
|
|
||
| if (actionIconRes != null && onAction != null) { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(28.dp) | ||
| .clickable { onAction() }, | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
| Icon( | ||
| painter = painterResource(id = actionIconRes), | ||
| contentDescription = "Close", | ||
| tint = MyTheme.Colors.gray | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| fun InfoPanelPreview() { | ||
| InfoPanel( | ||
| title = "Customize shortcut bar", | ||
| description = "Hold any button above to replace it with the function you need", | ||
| leftIconRes = R.drawable.ic_dash_blue_filled, | ||
| actionIconRes = R.drawable.ic_popup_close, | ||
| onAction = {} | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.