diff --git a/app/src/debug/ic_launcher-playstore.png b/app/src/debug/ic_launcher-playstore.png
new file mode 100644
index 0000000..14af100
Binary files /dev/null and b/app/src/debug/ic_launcher-playstore.png differ
diff --git a/app/src/debug/res/drawable/ic_launcher_foreground.xml b/app/src/debug/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..450bd0b
--- /dev/null
+++ b/app/src/debug/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..7353dbd
--- /dev/null
+++ b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..7353dbd
--- /dev/null
+++ b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/app/src/debug/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..877b271
Binary files /dev/null and b/app/src/debug/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e1fac56
Binary files /dev/null and b/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/app/src/debug/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f1aef4f
Binary files /dev/null and b/app/src/debug/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..2efadb8
Binary files /dev/null and b/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..229a9b0
Binary files /dev/null and b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..f6505e7
Binary files /dev/null and b/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..68aac08
Binary files /dev/null and b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e53902f
Binary files /dev/null and b/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..3f48018
Binary files /dev/null and b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..200541b
Binary files /dev/null and b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/debug/res/values/ic_launcher_background.xml b/app/src/debug/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..a5de281
--- /dev/null
+++ b/app/src/debug/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #C92443
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png
index 620278f..8cba87a 100644
Binary files a/app/src/main/ic_launcher-playstore.png and b/app/src/main/ic_launcher-playstore.png differ
diff --git a/app/src/main/java/com/pixelized/biblib/ui/composable/Search.kt b/app/src/main/java/com/pixelized/biblib/ui/composable/Search.kt
index b01ccd4..866bd4d 100644
--- a/app/src/main/java/com/pixelized/biblib/ui/composable/Search.kt
+++ b/app/src/main/java/com/pixelized/biblib/ui/composable/Search.kt
@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.filled.Search
import androidx.compose.runtime.*
@@ -24,6 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.pixelized.biblib.R
import com.pixelized.biblib.ui.scaffold.SearchScaffoldState
+import com.pixelized.biblib.ui.scaffold.SearchScaffoldState.ContentState
import com.pixelized.biblib.ui.scaffold.rememberSearchScaffoldState
import com.pixelized.biblib.ui.theme.BibLibTheme
import com.pixelized.biblib.utils.extention.bibLib
@@ -37,13 +39,14 @@ fun Search(
state: SearchScaffoldState = rememberSearchScaffoldState(),
focusRequester: FocusRequester = remember { FocusRequester() },
avatar: String?,
+ onClose: () -> Unit = default(),
onAvatar: () -> Unit = default(),
onSearch: () -> Unit = default(),
) {
val horizontalPadding by animateDpAsState(
targetValue = when (state.isCollapsed()) {
- true -> MaterialTheme.bibLib.dimen.dp8
- else -> MaterialTheme.bibLib.dimen.dp16
+ true -> MaterialTheme.bibLib.dimen.default
+ else -> MaterialTheme.bibLib.dimen.dp4
}
)
var search by remember { mutableStateOf("") }
@@ -54,14 +57,19 @@ fun Search(
.then(modifier),
verticalAlignment = Alignment.CenterVertically
) {
- Icon(
- modifier = Modifier
- .padding(start = horizontalPadding)
- .size(24.dp),
- imageVector = Icons.Default.Search,
- tint = MaterialTheme.colors.onSurface,
- contentDescription = null
- )
+ IconButton(
+ modifier = Modifier.padding(start = horizontalPadding),
+ onClick = if (state.content != ContentState.INITIAL) onClose else onSearch,
+ ) {
+ Icon(
+ imageVector = when (state.content) {
+ ContentState.INITIAL -> Icons.Default.Search
+ else -> Icons.Default.Close
+ },
+ tint = MaterialTheme.colors.onSurface,
+ contentDescription = null
+ )
+ }
TextField(
modifier = Modifier
.focusRequester(focusRequester = focusRequester)
@@ -69,13 +77,17 @@ fun Search(
label = {
Text(
color = MaterialTheme.colors.onSurface,
- text = "Rechercher sur BibLib"
+ text = if (state.content != ContentState.PROFILE) {
+ "Rechercher sur BibLib"
+ } else {
+ "Profile"
+ }
)
},
- value = if (state.content == SearchScaffoldState.ContentState.SEARCH) search else "",
+ value = if (state.content == ContentState.SEARCH) search else "",
singleLine = true,
- enabled = state.content == SearchScaffoldState.ContentState.SEARCH,
- readOnly = state.content != SearchScaffoldState.ContentState.SEARCH,
+ enabled = state.content == ContentState.SEARCH,
+ readOnly = state.content != ContentState.SEARCH,
colors = TextFieldDefaults.outlinedTextFieldColors(
focusedBorderColor = Color.Transparent,
unfocusedBorderColor = Color.Transparent,
@@ -88,20 +100,19 @@ fun Search(
modifier = Modifier.padding(end = horizontalPadding),
onClick = onAvatar,
) {
+ val imageModifier = Modifier
+ .clip(CircleShape)
+ .size(MaterialTheme.bibLib.dimen.dp32)
if (avatar != null) {
GlideImage(
- modifier = Modifier
- .clip(CircleShape)
- .size(32.dp),
+ modifier = imageModifier,
previewPlaceholder = R.drawable.ic_google,
contentScale = ContentScale.Fit,
imageModel = avatar,
)
} else {
Icon(
- modifier = Modifier
- .clip(CircleShape)
- .size(32.dp),
+ modifier = imageModifier,
tint = MaterialTheme.colors.onSurface,
imageVector = Icons.Default.Person,
contentDescription = null,
@@ -120,11 +131,18 @@ private fun SearchContentEmptyPreview() {
}
}
+
@Composable
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_NO)
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES)
-private fun SearchContentPreview() {
+private fun SearchContentEmptyDeployPreview() {
BibLibTheme {
- Search(avatar = "")
+ Search(
+ avatar = "",
+ state = rememberSearchScaffoldState(
+ expended = true,
+ content = ContentState.SEARCH,
+ ),
+ )
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/pixelized/biblib/ui/scaffold/SearchScaffold.kt b/app/src/main/java/com/pixelized/biblib/ui/scaffold/SearchScaffold.kt
index 488634a..a681da4 100644
--- a/app/src/main/java/com/pixelized/biblib/ui/scaffold/SearchScaffold.kt
+++ b/app/src/main/java/com/pixelized/biblib/ui/scaffold/SearchScaffold.kt
@@ -86,10 +86,14 @@ fun SearchScaffold(
@Composable
fun rememberSearchScaffoldState(
- expended: Boolean = false
+ expended: Boolean = false,
+ content: SearchScaffoldState.ContentState = SearchScaffoldState.ContentState.INITIAL,
): SearchScaffoldState {
return rememberSaveable(saver = SearchScaffoldState.Saver) {
- SearchScaffoldState(expended = expended)
+ SearchScaffoldState(
+ expended = expended,
+ state = content,
+ )
}
}
diff --git a/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt b/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt
index f30aae3..9a2cc2d 100644
--- a/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt
+++ b/app/src/main/java/com/pixelized/biblib/ui/screen/home/HomeScreen.kt
@@ -62,11 +62,16 @@ fun HomeScreen(
state = state,
avatar = accountViewModel.avatar,
focusRequester = focusRequester,
+ onClose = {
+ focusManager.clearFocus(force = true)
+ keyboard?.hide()
+ state.collapse()
+ },
onSearch = {
if (state.content != ContentState.SEARCH || state.isCollapsed()) {
state.expand(ContentState.SEARCH)
scope.launch {
- delay(100)
+ delay(100) // let the animation play before requesting the focus
focusRequester.requestFocus()
}
} else {
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
index ab39c4b..450bd0b 100644
--- a/app/src/main/res/drawable/ic_launcher_foreground.xml
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -4,12 +4,12 @@
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#FFFFFF">
-
+
+ android:pathData="M19,1l-5,5v11l5,-4.5L19,1zM1,6v14.65c0,0.25 0.25,0.5 0.5,0.5 0.1,0 0.15,-0.05 0.25,-0.05C3.1,20.45 5.05,20 6.5,20c1.95,0 4.05,0.4 5.5,1.5L12,6c-1.45,-1.1 -3.55,-1.5 -5.5,-1.5S2.45,4.9 1,6zM23,19.5L23,6c-0.6,-0.45 -1.25,-0.75 -2,-1v13.5c-1.1,-0.35 -2.3,-0.5 -3.5,-0.5 -1.7,0 -4.15,0.65 -5.5,1.5v2c1.35,-0.85 3.8,-1.5 5.5,-1.5 1.65,0 3.35,0.3 4.75,1.05 0.1,0.05 0.15,0.05 0.25,0.05 0.25,0 0.5,-0.25 0.5,-0.5v-1.1z"/>
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
index 35d9c3b..1bd688f 100644
--- a/app/src/main/res/values/ic_launcher_background.xml
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -1,4 +1,4 @@
- #4CAF50
+ #269482
\ No newline at end of file