Update icon.
BIN
app/src/debug/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
15
app/src/debug/res/drawable/ic_launcher_foreground.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108"
|
||||
android:tint="#FFFFFF">
|
||||
<group android:scaleX="1.8009"
|
||||
android:scaleY="1.8009"
|
||||
android:translateX="32.3892"
|
||||
android:translateY="32.3892">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
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"/>
|
||||
</group>
|
||||
</vector>
|
||||
5
app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
app/src/debug/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/debug/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
app/src/debug/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1,010 B |
BIN
app/src/debug/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2 KiB |
BIN
app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
4
app/src/debug/res/values/ic_launcher_background.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#C92443</color>
|
||||
</resources>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
|
|
@ -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("") }
|
||||
|
|
@ -53,15 +56,20 @@ fun Search(
|
|||
.clickable(onClick = onSearch)
|
||||
.then(modifier),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
IconButton(
|
||||
modifier = Modifier.padding(start = horizontalPadding),
|
||||
onClick = if (state.content != ContentState.INITIAL) onClose else onSearch,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier
|
||||
.padding(start = horizontalPadding)
|
||||
.size(24.dp),
|
||||
imageVector = Icons.Default.Search,
|
||||
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,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
android:viewportWidth="108"
|
||||
android:viewportHeight="108"
|
||||
android:tint="#FFFFFF">
|
||||
<group android:scaleX="2.349"
|
||||
android:scaleY="2.349"
|
||||
android:translateX="25.812"
|
||||
android:translateY="25.812">
|
||||
<group android:scaleX="1.8009"
|
||||
android:scaleY="1.8009"
|
||||
android:translateX="32.3892"
|
||||
android:translateY="32.3892">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,11.55C9.64,9.35 6.48,8 3,8v11c3.48,0 6.64,1.35 9,3.55 2.36,-2.19 5.52,-3.55 9,-3.55V8c-3.48,0 -6.64,1.35 -9,3.55zM12,8c1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3 1.34,3 3,3z"/>
|
||||
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"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#4CAF50</color>
|
||||
<color name="ic_launcher_background">#269482</color>
|
||||
</resources>
|
||||