1+ package com.olivia.lazyverticaltitlegrid
2+
3+ import android.os.Bundle
4+ import androidx.activity.ComponentActivity
5+ import androidx.activity.compose.setContent
6+ import androidx.compose.foundation.ExperimentalFoundationApi
7+ import androidx.compose.material.Text
8+ import androidx.compose.runtime.Composable
9+ import androidx.compose.ui.tooling.preview.Preview
10+ import com.olivia.lazyverticaltitlegrid.ui.theme.LazyVerticalTitleGridTheme
11+
12+ class MainActivity : ComponentActivity () {
13+ @OptIn(ExperimentalFoundationApi ::class )
14+ override fun onCreate (savedInstanceState : Bundle ? ) {
15+ super .onCreate(savedInstanceState)
16+ setContent {
17+ LazyVerticalTitleGridTheme {
18+ /*
19+ // A surface container using the 'background' color from the theme
20+ val data: List<Pair<String, List<String>>> = listOf(
21+ Pair(
22+ "TITLE1",
23+ listOf(
24+ "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg",
25+ "https://cdn.pixabay.com/photo/2013/04/03/21/25/flower-100263__340.jpg",
26+ "https://cdn.pixabay.com/photo/2013/08/20/15/47/poppies-174276__480.jpg",
27+ "https://cdn.pixabay.com/photo/2017/02/15/13/40/tulips-2068692__480.jpg",
28+ "https://cdn.pixabay.com/photo/2017/04/23/20/36/tulips-2254970__480.jpg",
29+ "https://cdn.pixabay.com/photo/2020/07/08/08/07/daisy-5383056__480.jpg",
30+ "https://cdn.pixabay.com/photo/2016/02/27/06/43/cherry-blossom-tree-1225186__480.jpg",
31+ "https://cdn.pixabay.com/photo/2021/08/07/19/49/cosmea-6529220__480.jpg",
32+ )
33+ ),
34+ Pair(
35+ "TITLE2",
36+ listOf(
37+ "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg",
38+ "https://cdn.pixabay.com/photo/2017/02/15/13/40/tulips-2068692__480.jpg",
39+ "https://cdn.pixabay.com/photo/2013/04/03/21/25/flower-100263__340.jpg",
40+ "https://cdn.pixabay.com/photo/2013/08/20/15/47/poppies-174276__480.jpg",
41+ "https://cdn.pixabay.com/photo/2016/02/27/06/43/cherry-blossom-tree-1225186__480.jpg",
42+ "https://cdn.pixabay.com/photo/2017/04/23/20/36/tulips-2254970__480.jpg",
43+ "https://cdn.pixabay.com/photo/2021/08/07/19/49/cosmea-6529220__480.jpg",
44+ "https://cdn.pixabay.com/photo/2020/07/08/08/07/daisy-5383056__480.jpg",
45+ )
46+ ),
47+ Pair(
48+ "TITLE3",
49+ listOf(
50+ "https://cdn.pixabay.com/photo/2016/02/27/06/43/cherry-blossom-tree-1225186__480.jpg",
51+ "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg",
52+ "https://cdn.pixabay.com/photo/2013/08/20/15/47/poppies-174276__480.jpg",
53+ "https://cdn.pixabay.com/photo/2017/02/15/13/40/tulips-2068692__480.jpg",
54+ "https://cdn.pixabay.com/photo/2013/04/03/21/25/flower-100263__340.jpg",
55+ "https://cdn.pixabay.com/photo/2020/07/08/08/07/daisy-5383056__480.jpg",
56+ "https://cdn.pixabay.com/photo/2017/04/23/20/36/tulips-2254970__480.jpg",
57+ "https://cdn.pixabay.com/photo/2021/08/07/19/49/cosmea-6529220__480.jpg",
58+ )
59+ ),
60+ Pair(
61+ "TITLE4",
62+ listOf(
63+ "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg",
64+ "https://cdn.pixabay.com/photo/2013/04/03/21/25/flower-100263__340.jpg",
65+ "https://cdn.pixabay.com/photo/2013/08/20/15/47/poppies-174276__480.jpg",
66+ "https://cdn.pixabay.com/photo/2017/02/15/13/40/tulips-2068692__480.jpg",
67+ "https://cdn.pixabay.com/photo/2017/04/23/20/36/tulips-2254970__480.jpg",
68+ "https://cdn.pixabay.com/photo/2020/07/08/08/07/daisy-5383056__480.jpg",
69+ "https://cdn.pixabay.com/photo/2016/02/27/06/43/cherry-blossom-tree-1225186__480.jpg",
70+ "https://cdn.pixabay.com/photo/2021/08/07/19/49/cosmea-6529220__480.jpg",
71+ )
72+ ),
73+ Pair(
74+ "TITLE5",
75+ listOf(
76+ "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg",
77+ "https://cdn.pixabay.com/photo/2017/02/15/13/40/tulips-2068692__480.jpg",
78+ "https://cdn.pixabay.com/photo/2013/04/03/21/25/flower-100263__340.jpg",
79+ "https://cdn.pixabay.com/photo/2013/08/20/15/47/poppies-174276__480.jpg",
80+ "https://cdn.pixabay.com/photo/2016/02/27/06/43/cherry-blossom-tree-1225186__480.jpg",
81+ "https://cdn.pixabay.com/photo/2017/04/23/20/36/tulips-2254970__480.jpg",
82+ "https://cdn.pixabay.com/photo/2021/08/07/19/49/cosmea-6529220__480.jpg",
83+ "https://cdn.pixabay.com/photo/2020/07/08/08/07/daisy-5383056__480.jpg",
84+ )
85+ ),
86+ Pair(
87+ "TITLE6",
88+ listOf(
89+ "https://cdn.pixabay.com/photo/2016/02/27/06/43/cherry-blossom-tree-1225186__480.jpg",
90+ "https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510__340.jpg",
91+ "https://cdn.pixabay.com/photo/2013/08/20/15/47/poppies-174276__480.jpg",
92+ "https://cdn.pixabay.com/photo/2017/02/15/13/40/tulips-2068692__480.jpg",
93+ "https://cdn.pixabay.com/photo/2013/04/03/21/25/flower-100263__340.jpg",
94+ "https://cdn.pixabay.com/photo/2020/07/08/08/07/daisy-5383056__480.jpg",
95+ "https://cdn.pixabay.com/photo/2017/04/23/20/36/tulips-2254970__480.jpg",
96+ "https://cdn.pixabay.com/photo/2021/08/07/19/49/cosmea-6529220__480.jpg",
97+ )
98+ )
99+
100+ )
101+ LazyVerticalTitleGrid(
102+ cells = GridCells.Adaptive(100.dp),
103+ title = { title ->
104+ Text(
105+ modifier = Modifier.fillMaxWidth()
106+ .padding(start = 16.dp, end = 16.dp, top = 4.dp, bottom = 8.dp),
107+ text = title,
108+ style = MaterialTheme.typography.body2,
109+ color = MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.medium)
110+ )
111+ },
112+ content = { content ->
113+ AsyncImage(
114+ contentScale = ContentScale.Crop,
115+ model = content,
116+ contentDescription = "content"
117+ )
118+ },
119+ data = data
120+ )
121+ */
122+
123+ }
124+ }
125+ }
126+ }
127+
128+ @Composable
129+ fun Greeting (name : String ) {
130+ Text (text = " Hello $name !" )
131+ }
132+
133+ @Preview(showBackground = true )
134+ @Composable
135+ fun DefaultPreview () {
136+ LazyVerticalTitleGridTheme {
137+ Greeting (" Android" )
138+ }
139+ }
0 commit comments