sprint-1 #1
109
libary/src/main/java/com/example/libary/Tabbar.kt
Normal file
109
libary/src/main/java/com/example/libary/Tabbar.kt
Normal file
@ -0,0 +1,109 @@
|
||||
package com.example.libary
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
import androidx.compose.material3.NavigationBarItemDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.example.libary.theme.AccentColor
|
||||
import com.example.libary.theme.InputIconColor
|
||||
|
||||
data class TabBarData(
|
||||
val icon: Int,
|
||||
val name: String
|
||||
)
|
||||
|
||||
val defaultTabBarData = listOf(
|
||||
TabBarData(
|
||||
icon = R.drawable.bot_1,
|
||||
name = "Главная"
|
||||
),
|
||||
TabBarData(
|
||||
icon = R.drawable.bot_2,
|
||||
name = "Каталог"
|
||||
),
|
||||
TabBarData(
|
||||
icon = R.drawable.bot_3,
|
||||
name = "Проекты"
|
||||
),
|
||||
TabBarData(
|
||||
icon = R.drawable.bot_4,
|
||||
name = "Профиль"
|
||||
)
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun TabBar(
|
||||
modifier: Modifier = Modifier,
|
||||
value: MutableState<TabBarData>,
|
||||
data: List<TabBarData> = defaultTabBarData
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.shadow(10.dp, spotColor = Color(0x4DA0A0A0), ambientColor = Color(0x4DA0A0A0))
|
||||
) {
|
||||
HorizontalDivider(thickness = 1.dp, color = Color(0x4DA0A0A0))
|
||||
|
||||
NavigationBar(
|
||||
containerColor = Color.White
|
||||
) {
|
||||
data.forEach {
|
||||
NavigationBarItem(
|
||||
selected = value.value == it,
|
||||
colors = NavigationBarItemDefaults.colors(
|
||||
indicatorColor = Color.Transparent
|
||||
),
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(it.icon),
|
||||
contentDescription = null,
|
||||
tint = if (value.value == it) AccentColor else Color(0xFFB8C1CC)
|
||||
)
|
||||
},
|
||||
label = {
|
||||
Text(
|
||||
text = it.name,
|
||||
color = if (value.value == it) AccentColor else Color(0xFFB8C1CC),
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
value.value = it
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun TabBarPrev() {
|
||||
val value = remember { mutableStateOf(defaultTabBarData[0]) }
|
||||
Column {
|
||||
Spacer(Modifier.height(100.dp))
|
||||
TabBar(
|
||||
value = value
|
||||
)
|
||||
}
|
||||
}
|
9
libary/src/main/res/drawable/bot_1.xml
Normal file
9
libary/src/main/res/drawable/bot_1.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:pathData="M27.481,15.773L23.809,12.624V8.373C23.809,8.112 23.598,7.901 23.337,7.901H20.878C20.617,7.901 20.405,8.112 20.405,8.373V9.702L16.315,6.195C16.136,6.034 15.865,6.034 15.685,6.195L4.52,15.773C4.368,15.903 4.314,16.113 4.385,16.3C4.455,16.486 4.635,16.608 4.835,16.605H8.191V25.446C8.191,25.707 8.403,25.919 8.663,25.919H10.307C10.568,25.919 10.78,25.707 10.78,25.446C10.78,25.186 10.568,24.974 10.307,24.974H9.136V16.132C9.136,15.872 8.924,15.66 8.663,15.66H6.104L16,7.184L25.897,15.66H23.337C23.076,15.66 22.865,15.872 22.865,16.132V24.974H21.69C21.43,24.974 21.218,25.186 21.218,25.446C21.218,25.707 21.43,25.919 21.69,25.919H23.337C23.598,25.919 23.809,25.707 23.809,25.446V16.605H27.176C27.375,16.608 27.555,16.486 27.625,16.3C27.696,16.113 27.642,15.903 27.491,15.773L27.481,15.773ZM21.353,8.846H22.865V11.815L21.353,10.518V8.846ZM20.408,17.732H11.592C11.331,17.732 11.119,17.943 11.119,18.204V26.391C11.119,26.652 11.331,26.864 11.592,26.864H20.408C20.669,26.864 20.881,26.652 20.881,26.391V18.204C20.881,17.943 20.669,17.732 20.408,17.732ZM16.671,18.677V20.859L16.561,20.792L16.56,20.793C16.374,20.68 16.135,20.71 15.981,20.865L15.553,21.296L15.333,21.044V18.677L16.671,18.677ZM19.939,25.919H12.068V18.677H14.391V21.221C14.39,21.337 14.432,21.449 14.508,21.536L15.178,22.298C15.265,22.396 15.388,22.454 15.519,22.458C15.645,22.459 15.766,22.409 15.855,22.32L16.378,21.791L16.885,22.106C17.031,22.193 17.212,22.195 17.36,22.112C17.507,22.028 17.599,21.872 17.6,21.703V18.677H19.936L19.939,25.919Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
</vector>
|
35
libary/src/main/res/drawable/bot_2.xml
Normal file
35
libary/src/main/res/drawable/bot_2.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:pathData="M7,23.479V8.521C7,7.129 8.129,6 9.521,6H22.479C23.871,6 25,7.129 25,8.521V23.479C25,24.871 23.871,26 22.479,26H9.521C8.129,26 7,24.871 7,23.479Z"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M11,16V11H16V16H11Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M20,11H21"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M20,16H21"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M11,21L21,21"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
27
libary/src/main/res/drawable/bot_3.xml
Normal file
27
libary/src/main/res/drawable/bot_3.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M7.369,1.837H2.683C2.456,1.837 2.305,1.987 2.305,2.212V6.825C2.305,7.05 2.456,7.2 2.683,7.2H7.331C7.558,7.2 7.709,7.049 7.709,6.825V2.212C7.746,1.987 7.557,1.837 7.369,1.837ZM6.991,6.45H3.061V2.587H6.953V6.45H6.991Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M7.369,9.3H2.683C2.456,9.3 2.305,9.45 2.305,9.675V14.287C2.305,14.512 2.456,14.662 2.683,14.662H7.331C7.558,14.662 7.709,14.512 7.709,14.287V9.675C7.746,9.487 7.557,9.3 7.369,9.3ZM6.991,13.95H3.061V10.05H6.953V13.95H6.991Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M7.369,16.8H2.683C2.456,16.8 2.305,16.95 2.305,17.175V21.787C2.305,22.012 2.456,22.162 2.683,22.162H7.331C7.558,22.162 7.709,22.012 7.709,21.787V17.175C7.746,16.987 7.557,16.8 7.369,16.8ZM6.991,21.412H3.061V17.55H6.953V21.412H6.991Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M4.194,5.662C4.269,5.737 4.383,5.774 4.458,5.774C4.572,5.774 4.647,5.737 4.723,5.662L6.537,3.862C6.688,3.712 6.688,3.487 6.537,3.337C6.386,3.187 6.159,3.187 6.008,3.337L4.458,4.874L4.043,4.462C3.891,4.312 3.665,4.312 3.514,4.462C3.362,4.612 3.362,4.837 3.514,4.987L4.194,5.662Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M4.194,13.162C4.269,13.237 4.345,13.274 4.458,13.274C4.572,13.274 4.647,13.237 4.723,13.162L6.537,11.362C6.688,11.212 6.688,10.987 6.537,10.837C6.386,10.687 6.159,10.687 6.008,10.837L4.458,12.374L4.043,11.962C3.891,11.812 3.665,11.812 3.514,11.962C3.362,12.112 3.362,12.337 3.514,12.487L4.194,13.162Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M4.194,20.662C4.269,20.737 4.383,20.774 4.458,20.774C4.572,20.774 4.647,20.737 4.723,20.662L6.537,18.862C6.688,18.712 6.688,18.487 6.537,18.337C6.386,18.187 6.159,18.187 6.008,18.337L4.458,19.874L4.043,19.462C3.891,19.312 3.665,19.312 3.514,19.462C3.362,19.612 3.362,19.837 3.514,19.987L4.194,20.662Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M23.655,13.462H19.423C19.196,13.462 19.045,13.612 19.045,13.837C18.289,13.575 18.553,13.725 18.175,13.537L18.176,5.887C18.176,5.775 18.138,5.7 18.062,5.625L12.508,0.112C12.432,0.038 12.319,0 12.243,0H0.378C0.151,0 0,0.15 0,0.375V23.625C0,23.85 0.151,24 0.378,24H17.76C17.987,24 18.138,23.85 18.138,23.625V21.45H19.007C19.045,21.638 19.196,21.75 19.385,21.75H23.617C23.844,21.75 23.995,21.6 23.995,21.375V13.838C24.033,13.613 23.844,13.463 23.655,13.463L23.655,13.462ZM19.045,14.587V20.7H11.752C11.223,20.7 11.185,20.287 11.185,20.175C11.185,20.024 11.223,19.912 11.299,19.8C11.374,19.687 11.525,19.65 11.676,19.65C11.903,19.65 12.054,19.5 12.054,19.275C12.054,19.049 11.903,18.9 11.676,18.9H11.147C10.618,18.9 10.58,18.487 10.58,18.375C10.58,18.187 10.694,17.85 11.11,17.85C11.299,17.85 11.45,17.699 11.487,17.512C11.487,17.324 11.374,17.137 11.185,17.099H10.921C10.316,17.137 10.089,17.024 10.014,16.725C9.976,16.574 10.014,16.387 10.089,16.274C10.203,16.162 10.354,16.087 10.505,16.087C10.732,16.087 10.883,15.937 10.883,15.712C10.883,15.487 10.732,15.337 10.505,15.337H9.938C9.523,15.337 9.409,15 9.409,14.812C9.409,14.737 9.447,14.287 9.976,14.287H12.621C13.226,14.287 13.717,14.024 13.944,13.612C14.133,13.199 14.208,12.487 13.339,11.362C13.037,10.987 12.923,10.499 13.075,10.124C13.264,9.599 13.793,9.374 14.133,9.337C14.095,12.074 16.816,13.687 18.025,14.249C18.062,14.325 19.045,14.587 19.045,14.587L19.045,14.587ZM12.621,1.274L16.891,5.512H12.621V1.274ZM17.42,23.249H0.793V0.749H11.865V5.887C11.865,6.112 12.016,6.262 12.243,6.262H17.42V13.087C16.286,12.374 14.888,11.099 14.926,9.337C14.926,9.149 14.85,8.924 14.699,8.812C14.548,8.662 14.321,8.624 14.132,8.624C13.263,8.737 12.658,9.224 12.394,9.899C12.167,10.537 12.318,11.249 12.772,11.849C13.263,12.449 13.452,13.012 13.301,13.274C13.188,13.499 12.81,13.537 12.658,13.537H10.013C9.144,13.537 8.691,14.174 8.691,14.812C8.691,15.262 8.955,15.749 9.409,15.974C9.258,16.274 9.22,16.574 9.295,16.912C9.409,17.362 9.711,17.624 10.013,17.737C9.9,17.924 9.862,18.149 9.862,18.374C9.862,18.824 10.127,19.312 10.58,19.537C10.467,19.724 10.429,19.949 10.429,20.174C10.429,20.812 10.882,21.449 11.752,21.449H17.42L17.42,23.249ZM23.277,21.037H19.8V14.212H23.277V21.037Z"
|
||||
android:fillColor="#B8C1CC"/>
|
||||
</vector>
|
16
libary/src/main/res/drawable/bot_4.xml
Normal file
16
libary/src/main/res/drawable/bot_4.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,6m-4,0a4,4 0,1 1,8 0a4,4 0,1 1,-8 0"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"/>
|
||||
<path
|
||||
android:pathData="M12,13C16.502,13 20,16.326 20,20.25V20.251C20,20.251 20,20.253 19.999,20.256C19.997,20.262 19.99,20.277 19.974,20.304C19.937,20.361 19.858,20.454 19.7,20.57C19.376,20.809 18.841,21.061 18.081,21.285C16.573,21.731 14.425,22 12,22C9.575,22 7.427,21.731 5.919,21.285C5.159,21.061 4.624,20.809 4.3,20.57C4.142,20.454 4.063,20.361 4.026,20.304C4.01,20.277 4.003,20.262 4.001,20.256C4,20.253 4,20.251 4,20.251V20.25C4,16.326 7.498,13 12,13Z"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#B8C1CC"/>
|
||||
</vector>
|
Loading…
x
Reference in New Issue
Block a user