Skip to content

Commit

Permalink
First beta version
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingermainbusiness committed Jun 4, 2022
1 parent 4ec6fc0 commit f946599
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repositories {

```groovy
dependencies {
implementation 'com.github.germainkevinbusiness:CollapsingTopBarCompose:1.0.0-alpha08'
implementation 'com.github.germainkevinbusiness:CollapsingTopBarCompose:1.0.0-beta01'
}
```

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0.0-alpha08"
versionName "1.0.0-beta01"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringArrayResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -58,12 +59,7 @@ class MainActivity : ComponentActivity() {
}
}

// icons to mimic drawer destinations
val items =
listOf(Icons.Default.Favorite, Icons.Default.Face, Icons.Default.Email)

val context = LocalContext.current
val contactNames = context.resources.getStringArray(R.array.contactNames)
val contactNames = stringArrayResource(id = R.array.contactNames)

/**
* A scrollBehavior determines the behavior of the CollapsingTopBar when it is
Expand All @@ -78,16 +74,11 @@ class MainActivity : ComponentActivity() {
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
scaffoldState = scaffoldState,
drawerContent = {
LeftDrawer(
closeLeftDrawer = closeLeftDrawer,
drawerItems = items
)
},
drawerContent = { LeftDrawer(closeLeftDrawer = closeLeftDrawer) },
topBar = {
CollapsingTopBar(
scrollBehavior = scrollBehavior,
centeredTitleAndSubtitle = true,
centeredTitleAndSubtitle = false,
title = {
Text(
stringResource(id = R.string.all_contacts),
Expand Down Expand Up @@ -132,7 +123,10 @@ class MainActivity : ComponentActivity() {
Spacer(modifier = Modifier.height(6.dp))
}
items(count = contactNames.size) {
ContactListNames(context, contactNames[it])
ContactListNames(
context = LocalContext.current,
contactName = contactNames[it]
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.*
import androidx.compose.material.icons.outlined.MoreVert
import androidx.compose.material.icons.outlined.Search
import androidx.compose.material3.*
Expand Down Expand Up @@ -62,9 +63,10 @@ fun MoreMenuIcons() {
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LeftDrawer(
drawerItems: List<ImageVector>,
closeLeftDrawer: () -> Unit
) {
// icons to mimic drawer destinations
val drawerItems = listOf(Icons.Default.Contacts, Icons.Default.Settings, Icons.Default.Email)
val selectedItem = remember { mutableStateOf(drawerItems[0]) }
Column(
modifier = Modifier
Expand Down
2 changes: 1 addition & 1 deletion collapsingtopbar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ afterEvaluate {
// You can then customize attributes of the publication as shown below.
groupId = 'com.germainkevin.collapsingtopbarcompose'
artifactId = 'collapsingtopbarcompose'
version = '1.0.0-alpha08'
version = '1.0.0-beta01'
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions collapsingtopbar/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.germainkevin.collapsingtopbar">

</manifest>
<manifest package="com.germainkevin.collapsingtopbar" />

0 comments on commit f946599

Please sign in to comment.