-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated some libs, some minor ui changes and refactors
- Loading branch information
Showing
7 changed files
with
292 additions
and
181 deletions.
There are no files selected for viewing
This file contains 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
54 changes: 54 additions & 0 deletions
54
.../main/java/io/github/yamin8000/owl/feature_home/ui/components/BottomAppBarDuringSearch.kt
This file contains 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,54 @@ | ||
/* | ||
* freeDictionaryApp/freeDictionaryApp.feature_home.main | ||
* BottomAppBarDuringSearch.kt Copyrighted by Yamin Siahmargooei at 2024/12/5 | ||
* BottomAppBarDuringSearch.kt Last modified at 2024/12/5 | ||
* This file is part of freeDictionaryApp/freeDictionaryApp.feature_home.main. | ||
* Copyright (C) 2024 Yamin Siahmargooei | ||
* | ||
* freeDictionaryApp/freeDictionaryApp.feature_home.main 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. | ||
* | ||
* freeDictionaryApp/freeDictionaryApp.feature_home.main 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 freeDictionaryApp. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.github.yamin8000.owl.feature_home.ui.components | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.twotone.Stop | ||
import androidx.compose.material3.BottomAppBar | ||
import androidx.compose.material3.FloatingActionButton | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import io.github.yamin8000.owl.strings.R | ||
|
||
@Composable | ||
internal fun BottomAppBarDuringSearch( | ||
modifier: Modifier = Modifier, | ||
onCancel: () -> Unit | ||
) { | ||
BottomAppBar( | ||
modifier = modifier, | ||
actions = {}, | ||
floatingActionButton = { | ||
FloatingActionButton( | ||
onClick = onCancel, | ||
content = { | ||
Icon( | ||
imageVector = Icons.TwoTone.Stop, | ||
contentDescription = stringResource(R.string.cancel) | ||
) | ||
} | ||
) | ||
} | ||
) | ||
} |
This file contains 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
108 changes: 108 additions & 0 deletions
108
...me/src/main/java/io/github/yamin8000/owl/feature_home/ui/components/NormalBottomAppBar.kt
This file contains 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,108 @@ | ||
/* | ||
* freeDictionaryApp/freeDictionaryApp.feature_home.main | ||
* NormalBottomAppBar.kt Copyrighted by Yamin Siahmargooei at 2024/12/5 | ||
* NormalBottomAppBar.kt Last modified at 2024/12/5 | ||
* This file is part of freeDictionaryApp/freeDictionaryApp.feature_home.main. | ||
* Copyright (C) 2024 Yamin Siahmargooei | ||
* | ||
* freeDictionaryApp/freeDictionaryApp.feature_home.main 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. | ||
* | ||
* freeDictionaryApp/freeDictionaryApp.feature_home.main 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 freeDictionaryApp. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.github.yamin8000.owl.feature_home.ui.components | ||
|
||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.CutCornerShape | ||
import androidx.compose.foundation.text.KeyboardActions | ||
import androidx.compose.foundation.text.KeyboardOptions | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.twotone.Clear | ||
import androidx.compose.material.icons.twotone.Search | ||
import androidx.compose.material3.BottomAppBar | ||
import androidx.compose.material3.TextField | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.input.ImeAction | ||
import androidx.compose.ui.text.input.KeyboardCapitalization | ||
import androidx.compose.ui.text.input.KeyboardType | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import io.github.yamin8000.owl.common.ui.components.ClickableIcon | ||
import io.github.yamin8000.owl.common.ui.components.PersianText | ||
import io.github.yamin8000.owl.strings.R | ||
|
||
@Composable | ||
internal fun NormalBottomAppBar( | ||
modifier: Modifier = Modifier, | ||
onSearch: () -> Unit, | ||
onSearchTermChange: (String) -> Unit, | ||
searchTerm: String | ||
) { | ||
BottomAppBar( | ||
modifier = modifier, | ||
content = { | ||
val onSearchClick = remember { onSearch } | ||
val onTermChanged: (String) -> Unit = remember { | ||
onSearchTermChange | ||
} | ||
TextField( | ||
singleLine = true, | ||
shape = CutCornerShape(topEnd = 8.dp, topStart = 8.dp), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
label = { | ||
PersianText( | ||
text = stringResource(R.string.search), | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
}, | ||
placeholder = { | ||
PersianText( | ||
text = stringResource(R.string.search_hint), | ||
modifier = Modifier.fillMaxWidth(), | ||
fontSize = 12.sp | ||
) | ||
}, | ||
leadingIcon = { | ||
val onClearClick = remember { { onSearchTermChange("") } } | ||
ClickableIcon( | ||
enabled = searchTerm.isNotBlank(), | ||
imageVector = Icons.TwoTone.Clear, | ||
contentDescription = stringResource(R.string.clear), | ||
onClick = onClearClick | ||
) | ||
}, | ||
trailingIcon = { | ||
ClickableIcon( | ||
enabled = searchTerm.isNotBlank(), | ||
imageVector = Icons.TwoTone.Search, | ||
contentDescription = stringResource(R.string.search), | ||
onClick = onSearchClick | ||
) | ||
}, | ||
value = searchTerm, | ||
onValueChange = onTermChanged, | ||
keyboardActions = KeyboardActions(onSearch = { onSearchClick() }), | ||
keyboardOptions = KeyboardOptions( | ||
imeAction = ImeAction.Search, | ||
keyboardType = KeyboardType.Text, | ||
capitalization = KeyboardCapitalization.Words | ||
) | ||
) | ||
} | ||
) | ||
} |
Oops, something went wrong.