From ca186a411cf12da3b995f3233b633195dc622a93 Mon Sep 17 00:00:00 2001 From: AskNilesh Date: Thu, 5 Oct 2023 12:51:40 +0530 Subject: [PATCH 1/2] - Fixed Placeholder issue in TUISearchBar --- .../tarkalabs/ui/UIComponentListActivity.kt | 3 +- .../uicomponents/components/TUISearchBar.kt | 6 ++-- .../uicomponents/components/TUITopBar.kt | 34 ++++++++++--------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/example/src/main/java/com/tarkalabs/ui/UIComponentListActivity.kt b/example/src/main/java/com/tarkalabs/ui/UIComponentListActivity.kt index c5d4c244..69274597 100644 --- a/example/src/main/java/com/tarkalabs/ui/UIComponentListActivity.kt +++ b/example/src/main/java/com/tarkalabs/ui/UIComponentListActivity.kt @@ -39,7 +39,8 @@ class UIComponentListActivity : ComponentActivity() { title = "Lorem Ipsum", navigationIcon = Regular.ChevronRight20, searchIcon = Regular.ChevronRight20, - searchQuery = query + searchQuery = query, + searchQueryHint = "search Query Hint" ) }) { paddingValues -> Column( diff --git a/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUISearchBar.kt b/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUISearchBar.kt index c250c3cd..89e56f27 100644 --- a/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUISearchBar.kt +++ b/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUISearchBar.kt @@ -10,7 +10,6 @@ import androidx.compose.material3.SearchBarDefaults.inputFieldColors import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.testTag @@ -83,7 +82,10 @@ import com.tarkalabs.uicomponents.theme.TUITheme containerColor = TUITheme.colors.inputBackground, dividerColor = Color.Transparent, inputFieldColors = inputFieldColors( - cursorColor = TUITheme.colors.inputText, focusedTextColor = TUITheme.colors.inputText + cursorColor = TUITheme.colors.inputText, + focusedTextColor = TUITheme.colors.inputText, + unfocusedPlaceholderColor = TUITheme.colors.inputText, + focusedPlaceholderColor = TUITheme.colors.inputText, ), ), ) {} diff --git a/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUITopBar.kt b/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUITopBar.kt index 1a5a86f1..e100395d 100644 --- a/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUITopBar.kt +++ b/tarkaui/src/main/java/com/tarkalabs/uicomponents/components/TUITopBar.kt @@ -47,25 +47,26 @@ import com.tarkalabs.uicomponents.theme.TUITheme * @param onSecondMenuItemClicked The callback function to be called when the second menu item icon is clicked. * @param onThirdMenuItemClicked The callback function to be called when the third menu item icon is clicked. * @param onSearchQuery The callback function to be called when a search query is entered. + * @param searchQueryHint the default search query hint that we need to show in searchbar * @param colors The colors to be applied to the top app bar. * @param searchQuery the default search text that we need to show in searchbar * @param scrollBehavior The scroll behavior to be applied to the top app bar. * How to use TopBar() -TopBar( -title = "My App", -navigationIcon = TarkaIcon.Back, // Optional: Pass the navigation icon -searchIcon = TarkaIcon.Search, // Optional: Pass the search icon -menuItemIconOne = TarkaIcon.Menu, // Optional: Pass the first menu item icon -menuItemIconTwo = TarkaIcon.Settings, // Optional: Pass the second menu item icon -menuItemIconThree = TarkaIcon.Notifications, // Optional: Pass the third menu item icon -onNavigationIconClick = { /* Handle navigation icon click */ }, -onFirstMenuItemClicked = { /* Handle first menu item click */ }, -onSecondMenuItemClicked = { /* Handle second menu item click */ }, -onThirdMenuItemClicked = { /* Handle third menu item click */ }, -onSearchQuery = { query -> /* Handle search query */ }, -colors = TopAppBarColors(/* Specify custom colors if needed */), -scrollBehavior = TopAppBarScrollBehavior.ScrollOnAppBarScroll, // Optional: Specify scroll behavior -) + TopBar( + title = "My App", + navigationIcon = TarkaIcon.Back, // Optional: Pass the navigation icon + searchIcon = TarkaIcon.Search, // Optional: Pass the search icon + menuItemIconOne = TarkaIcon.Menu, // Optional: Pass the first menu item icon + menuItemIconTwo = TarkaIcon.Settings, // Optional: Pass the second menu item icon + menuItemIconThree = TarkaIcon.Notifications, // Optional: Pass the third menu item icon + onNavigationIconClick = { /* Handle navigation icon click */ }, + onFirstMenuItemClicked = { /* Handle first menu item click */ }, + onSecondMenuItemClicked = { /* Handle second menu item click */ }, + onThirdMenuItemClicked = { /* Handle third menu item click */ }, + onSearchQuery = { query -> /* Handle search query */ }, + colors = TopAppBarColors(/* Specify custom colors if needed */), + scrollBehavior = TopAppBarScrollBehavior.ScrollOnAppBarScroll, // Optional: Specify scroll behavior + ) */ @OptIn(ExperimentalMaterial3Api::class) @Composable fun TUITopBar( modifier: Modifier = Modifier, @@ -81,6 +82,7 @@ scrollBehavior = TopAppBarScrollBehavior.ScrollOnAppBarScroll, // Optional: Spec onThirdMenuItemClicked: () -> Unit = {}, onSearchQuery: (String) -> Unit = {}, searchQuery : String = "", + searchQueryHint : String = "", disableSearchIcon: Boolean = false, clearQueryAndHideSearchBar: Boolean = false, colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors( @@ -117,7 +119,7 @@ scrollBehavior = TopAppBarScrollBehavior.ScrollOnAppBarScroll, // Optional: Spec .padding(horizontal = 16.dp) , query = query, - placeholder = "", + placeholder = searchQueryHint, leadingIcon = TarkaIcons.Regular.ChevronLeft24, onLeadingIconClick = { query = "" From ace5ae05fe92d369b4fcba0848b05e638222003f Mon Sep 17 00:00:00 2001 From: AskNilesh Date: Thu, 5 Oct 2023 12:53:17 +0530 Subject: [PATCH 2/2] - Version update --- tarkaui/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tarkaui/build.gradle.kts b/tarkaui/build.gradle.kts index 799f2df0..2b0ca4b7 100644 --- a/tarkaui/build.gradle.kts +++ b/tarkaui/build.gradle.kts @@ -66,7 +66,7 @@ publishing { run { groupId = "com.tarkalabs" artifactId = getLibraryArtifactId() - version = "0.48-alpha" + version = "0.49-alpha" artifact("$buildDir/outputs/aar/${getLibraryArtifactId()}-release.aar") } }