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.foundation.shape.CircleShape
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
import androidx.compose.material.icons.Icons
|
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.Person
|
||||||
import androidx.compose.material.icons.filled.Search
|
import androidx.compose.material.icons.filled.Search
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
|
|
@ -24,6 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.pixelized.biblib.R
|
import com.pixelized.biblib.R
|
||||||
import com.pixelized.biblib.ui.scaffold.SearchScaffoldState
|
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.scaffold.rememberSearchScaffoldState
|
||||||
import com.pixelized.biblib.ui.theme.BibLibTheme
|
import com.pixelized.biblib.ui.theme.BibLibTheme
|
||||||
import com.pixelized.biblib.utils.extention.bibLib
|
import com.pixelized.biblib.utils.extention.bibLib
|
||||||
|
|
@ -37,13 +39,14 @@ fun Search(
|
||||||
state: SearchScaffoldState = rememberSearchScaffoldState(),
|
state: SearchScaffoldState = rememberSearchScaffoldState(),
|
||||||
focusRequester: FocusRequester = remember { FocusRequester() },
|
focusRequester: FocusRequester = remember { FocusRequester() },
|
||||||
avatar: String?,
|
avatar: String?,
|
||||||
|
onClose: () -> Unit = default(),
|
||||||
onAvatar: () -> Unit = default(),
|
onAvatar: () -> Unit = default(),
|
||||||
onSearch: () -> Unit = default(),
|
onSearch: () -> Unit = default(),
|
||||||
) {
|
) {
|
||||||
val horizontalPadding by animateDpAsState(
|
val horizontalPadding by animateDpAsState(
|
||||||
targetValue = when (state.isCollapsed()) {
|
targetValue = when (state.isCollapsed()) {
|
||||||
true -> MaterialTheme.bibLib.dimen.dp8
|
true -> MaterialTheme.bibLib.dimen.default
|
||||||
else -> MaterialTheme.bibLib.dimen.dp16
|
else -> MaterialTheme.bibLib.dimen.dp4
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
var search by remember { mutableStateOf("") }
|
var search by remember { mutableStateOf("") }
|
||||||
|
|
@ -54,14 +57,19 @@ fun Search(
|
||||||
.then(modifier),
|
.then(modifier),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Icon(
|
IconButton(
|
||||||
modifier = Modifier
|
modifier = Modifier.padding(start = horizontalPadding),
|
||||||
.padding(start = horizontalPadding)
|
onClick = if (state.content != ContentState.INITIAL) onClose else onSearch,
|
||||||
.size(24.dp),
|
) {
|
||||||
imageVector = Icons.Default.Search,
|
Icon(
|
||||||
tint = MaterialTheme.colors.onSurface,
|
imageVector = when (state.content) {
|
||||||
contentDescription = null
|
ContentState.INITIAL -> Icons.Default.Search
|
||||||
)
|
else -> Icons.Default.Close
|
||||||
|
},
|
||||||
|
tint = MaterialTheme.colors.onSurface,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
}
|
||||||
TextField(
|
TextField(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.focusRequester(focusRequester = focusRequester)
|
.focusRequester(focusRequester = focusRequester)
|
||||||
|
|
@ -69,13 +77,17 @@ fun Search(
|
||||||
label = {
|
label = {
|
||||||
Text(
|
Text(
|
||||||
color = MaterialTheme.colors.onSurface,
|
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,
|
singleLine = true,
|
||||||
enabled = state.content == SearchScaffoldState.ContentState.SEARCH,
|
enabled = state.content == ContentState.SEARCH,
|
||||||
readOnly = state.content != SearchScaffoldState.ContentState.SEARCH,
|
readOnly = state.content != ContentState.SEARCH,
|
||||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
focusedBorderColor = Color.Transparent,
|
focusedBorderColor = Color.Transparent,
|
||||||
unfocusedBorderColor = Color.Transparent,
|
unfocusedBorderColor = Color.Transparent,
|
||||||
|
|
@ -88,20 +100,19 @@ fun Search(
|
||||||
modifier = Modifier.padding(end = horizontalPadding),
|
modifier = Modifier.padding(end = horizontalPadding),
|
||||||
onClick = onAvatar,
|
onClick = onAvatar,
|
||||||
) {
|
) {
|
||||||
|
val imageModifier = Modifier
|
||||||
|
.clip(CircleShape)
|
||||||
|
.size(MaterialTheme.bibLib.dimen.dp32)
|
||||||
if (avatar != null) {
|
if (avatar != null) {
|
||||||
GlideImage(
|
GlideImage(
|
||||||
modifier = Modifier
|
modifier = imageModifier,
|
||||||
.clip(CircleShape)
|
|
||||||
.size(32.dp),
|
|
||||||
previewPlaceholder = R.drawable.ic_google,
|
previewPlaceholder = R.drawable.ic_google,
|
||||||
contentScale = ContentScale.Fit,
|
contentScale = ContentScale.Fit,
|
||||||
imageModel = avatar,
|
imageModel = avatar,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier
|
modifier = imageModifier,
|
||||||
.clip(CircleShape)
|
|
||||||
.size(32.dp),
|
|
||||||
tint = MaterialTheme.colors.onSurface,
|
tint = MaterialTheme.colors.onSurface,
|
||||||
imageVector = Icons.Default.Person,
|
imageVector = Icons.Default.Person,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
|
|
@ -120,11 +131,18 @@ private fun SearchContentEmptyPreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_NO)
|
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_NO)
|
||||||
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES)
|
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES)
|
||||||
private fun SearchContentPreview() {
|
private fun SearchContentEmptyDeployPreview() {
|
||||||
BibLibTheme {
|
BibLibTheme {
|
||||||
Search(avatar = "")
|
Search(
|
||||||
|
avatar = "",
|
||||||
|
state = rememberSearchScaffoldState(
|
||||||
|
expended = true,
|
||||||
|
content = ContentState.SEARCH,
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -86,10 +86,14 @@ fun SearchScaffold(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun rememberSearchScaffoldState(
|
fun rememberSearchScaffoldState(
|
||||||
expended: Boolean = false
|
expended: Boolean = false,
|
||||||
|
content: SearchScaffoldState.ContentState = SearchScaffoldState.ContentState.INITIAL,
|
||||||
): SearchScaffoldState {
|
): SearchScaffoldState {
|
||||||
return rememberSaveable(saver = SearchScaffoldState.Saver) {
|
return rememberSaveable(saver = SearchScaffoldState.Saver) {
|
||||||
SearchScaffoldState(expended = expended)
|
SearchScaffoldState(
|
||||||
|
expended = expended,
|
||||||
|
state = content,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,16 @@ fun HomeScreen(
|
||||||
state = state,
|
state = state,
|
||||||
avatar = accountViewModel.avatar,
|
avatar = accountViewModel.avatar,
|
||||||
focusRequester = focusRequester,
|
focusRequester = focusRequester,
|
||||||
|
onClose = {
|
||||||
|
focusManager.clearFocus(force = true)
|
||||||
|
keyboard?.hide()
|
||||||
|
state.collapse()
|
||||||
|
},
|
||||||
onSearch = {
|
onSearch = {
|
||||||
if (state.content != ContentState.SEARCH || state.isCollapsed()) {
|
if (state.content != ContentState.SEARCH || state.isCollapsed()) {
|
||||||
state.expand(ContentState.SEARCH)
|
state.expand(ContentState.SEARCH)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
delay(100)
|
delay(100) // let the animation play before requesting the focus
|
||||||
focusRequester.requestFocus()
|
focusRequester.requestFocus()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="108"
|
android:viewportHeight="108"
|
||||||
android:tint="#FFFFFF">
|
android:tint="#FFFFFF">
|
||||||
<group android:scaleX="2.349"
|
<group android:scaleX="1.8009"
|
||||||
android:scaleY="2.349"
|
android:scaleY="1.8009"
|
||||||
android:translateX="25.812"
|
android:translateX="32.3892"
|
||||||
android:translateY="25.812">
|
android:translateY="32.3892">
|
||||||
<path
|
<path
|
||||||
android:fillColor="@android:color/white"
|
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>
|
</group>
|
||||||
</vector>
|
</vector>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="ic_launcher_background">#4CAF50</color>
|
<color name="ic_launcher_background">#269482</color>
|
||||||
</resources>
|
</resources>
|
||||||