├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── android
│ │ └── compose01
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── android
│ │ │ └── compose01
│ │ │ ├── timeline
│ │ │ ├── Header.kt
│ │ │ ├── PostSection.kt
│ │ │ ├── Posts.kt
│ │ │ ├── Stories.kt
│ │ │ ├── TimelineActivity.kt
│ │ │ ├── TimelineViewModel.kt
│ │ │ └── ui
│ │ │ │ └── theme
│ │ │ │ ├── Color.kt
│ │ │ │ ├── Shape.kt
│ │ │ │ ├── Theme.kt
│ │ │ │ └── Type.kt
│ │ │ └── ui
│ │ │ └── theme
│ │ │ ├── Color.kt
│ │ │ ├── Shape.kt
│ │ │ ├── Theme.kt
│ │ │ └── Type.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── elon_musk.jpg
│ │ ├── elzero.jpg
│ │ ├── facebook_header.xml
│ │ ├── ic_android_black_24dp.xml
│ │ ├── ic_baseline_image_24.xml
│ │ ├── ic_baseline_language_24.xml
│ │ ├── ic_comment.xml
│ │ ├── ic_iconfinder_sed_22_2236328.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_like.xml
│ │ ├── ic_messenger.xml
│ │ ├── ic_notification.xml
│ │ ├── ic_room.xml
│ │ ├── ic_round_add_24.xml
│ │ ├── ic_round_groups_24.xml
│ │ ├── ic_round_home_24.xml
│ │ ├── ic_round_menu_24.xml
│ │ ├── ic_round_notifications_24.xml
│ │ ├── ic_round_search_24.xml
│ │ ├── ic_round_storefront_24.xml
│ │ ├── ic_round_supervised_user_circle_24.xml
│ │ ├── ic_round_video_call_24.xml
│ │ ├── ic_share.xml
│ │ ├── me.jpg
│ │ └── wallpaper.jpg
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── values-night
│ │ └── themes.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── com
│ └── android
│ └── compose01
│ └── ExampleUnitTest.kt
├── build.gradle
├── demo1.png
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 | .idea/
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### Facebook Timeline Compose
2 |
3 | - This project is facebook timeline UI with pure kotlin Jetpack Compose (No XML files included).
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'kotlin-android'
4 | }
5 |
6 | android {
7 | compileSdkVersion 30
8 |
9 | defaultConfig {
10 | applicationId "com.android.compose01"
11 | minSdkVersion 21
12 | targetSdkVersion 30
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | kotlinOptions {
30 | jvmTarget = '1.8'
31 | useIR = true
32 | }
33 | buildFeatures {
34 | compose true
35 | }
36 | composeOptions {
37 | kotlinCompilerExtensionVersion compose_version
38 | kotlinCompilerVersion '1.4.31'
39 | }
40 | }
41 |
42 | dependencies {
43 |
44 | implementation 'androidx.core:core-ktx:1.3.2'
45 | implementation 'androidx.appcompat:appcompat:1.2.0'
46 | implementation 'com.google.android.material:material:1.3.0'
47 | implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha04"
48 | implementation "androidx.compose.ui:ui:$compose_version"
49 | implementation "androidx.compose.material:material:$compose_version"
50 | implementation "androidx.compose.ui:ui-tooling:$compose_version"
51 | implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
52 | implementation 'androidx.activity:activity-compose:1.3.0-alpha04'
53 | testImplementation 'junit:junit:4.13.2'
54 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
56 |
57 | implementation "androidx.activity:activity-ktx:1.3.0-alpha04"
58 |
59 | implementation "dev.chrisbanes.accompanist:accompanist-coil:0.6.1"
60 |
61 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/android/compose01/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.android.compose01", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/Header.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline
2 |
3 | import androidx.compose.foundation.background
4 | import androidx.compose.foundation.layout.Spacer
5 | import androidx.compose.foundation.layout.padding
6 | import androidx.compose.foundation.layout.size
7 | import androidx.compose.foundation.shape.CircleShape
8 | import androidx.compose.material.*
9 | import androidx.compose.material.TabRowDefaults.tabIndicatorOffset
10 | import androidx.compose.runtime.Composable
11 | import androidx.compose.runtime.mutableStateOf
12 | import androidx.compose.runtime.remember
13 | import androidx.compose.ui.Modifier
14 | import androidx.compose.ui.draw.clip
15 | import androidx.compose.ui.graphics.Color
16 | import androidx.compose.ui.res.colorResource
17 | import androidx.compose.ui.res.painterResource
18 | import androidx.compose.ui.unit.dp
19 | import com.android.compose01.R
20 | import com.android.compose01.ui.theme.iconsBackground
21 | import com.android.compose01.ui.theme.purple500
22 |
23 |
24 | @Composable
25 | fun Header() {
26 |
27 | TopAppBar(
28 | backgroundColor = Color.White,
29 | title = {
30 |
31 | Icon(
32 | painter = painterResource(id = R.drawable.facebook_header),
33 | contentDescription = null,
34 | tint = purple500,
35 | )
36 |
37 | },
38 |
39 | actions = {
40 |
41 | IconButton(
42 | onClick = {},
43 | modifier = Modifier
44 | .size(36.dp)
45 | .clip(CircleShape)
46 | .background(iconsBackground)
47 |
48 | ) {
49 | Icon(
50 | painter = painterResource(R.drawable.ic_round_search_24),
51 | contentDescription = "",
52 | tint = Color.Black,
53 | )
54 | }
55 |
56 | Spacer(modifier = Modifier.padding(start = 8.dp))
57 |
58 | IconButton(
59 | onClick = {},
60 | modifier = Modifier
61 | .size(36.dp)
62 | .clip(CircleShape)
63 | .background(iconsBackground)
64 |
65 | ) {
66 | Icon(
67 | painter = painterResource(R.drawable.ic_messenger),
68 | contentDescription = "",
69 | tint = Color.Black,
70 | )
71 | }
72 |
73 | Spacer(modifier = Modifier.padding(start = 8.dp))
74 |
75 | },
76 | )
77 |
78 |
79 | TabsLayout()
80 |
81 | }
82 |
83 |
84 | @Composable
85 | fun TabsLayout() {
86 |
87 | val selectedTabIndex = remember { mutableStateOf(0) }
88 |
89 |
90 |
91 | val indicator = @Composable { tabPositions: List ->
92 | TabRowDefaults.Indicator(
93 | color = colorResource(R.color.purple_500),
94 | modifier = Modifier.tabIndicatorOffset(tabPositions[selectedTabIndex.value])
95 | )
96 | }
97 |
98 | TabRow(
99 | selectedTabIndex = selectedTabIndex.value,
100 | indicator = indicator,
101 | backgroundColor = Color.White
102 | ) {
103 |
104 |
105 |
106 | Tab(
107 | selected = false,
108 | onClick = { selectedTabIndex.value = 0 },
109 | ) {
110 | Icon(
111 | painter = painterResource(R.drawable.ic_round_home_24),
112 | contentDescription = "",
113 | modifier = Modifier.padding(16.dp),
114 | tint = if (selectedTabIndex.value == 0) purple500 else Color.Gray,
115 | )
116 | }
117 |
118 |
119 | Tab(selected = false, onClick = { selectedTabIndex.value = 1 }) {
120 | Icon(
121 | painter = painterResource(R.drawable.ic_round_storefront_24),
122 | contentDescription = "",
123 | modifier = Modifier.padding(16.dp),
124 | tint = if (selectedTabIndex.value == 1) purple500 else Color.Gray,
125 | )
126 | }
127 |
128 | Tab(selected = false, onClick = { selectedTabIndex.value = 2 }) {
129 | Icon(
130 | painter = painterResource(R.drawable.ic_round_notifications_24),
131 | contentDescription = "",
132 | modifier = Modifier.padding(16.dp),
133 | tint = if (selectedTabIndex.value == 2) purple500 else Color.Gray,
134 | )
135 | }
136 |
137 | Tab(selected = false, onClick = { selectedTabIndex.value = 3 }) {
138 | Icon(
139 | painter = painterResource(R.drawable.ic_round_menu_24), contentDescription = "",
140 | modifier = Modifier.padding(16.dp),
141 | tint = if (selectedTabIndex.value == 3) purple500 else Color.Gray,
142 | )
143 | }
144 |
145 | }
146 |
147 | }
148 |
149 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
150 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/PostSection.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline
2 |
3 | import androidx.compose.foundation.Image
4 | import androidx.compose.foundation.background
5 | import androidx.compose.foundation.border
6 | import androidx.compose.foundation.clickable
7 | import androidx.compose.foundation.layout.*
8 | import androidx.compose.foundation.shape.CircleShape
9 | import androidx.compose.foundation.shape.RoundedCornerShape
10 | import androidx.compose.material.*
11 | import androidx.compose.runtime.Composable
12 | import androidx.compose.ui.Alignment
13 | import androidx.compose.ui.Modifier
14 | import androidx.compose.ui.draw.clip
15 | import androidx.compose.ui.graphics.Color
16 | import androidx.compose.ui.res.colorResource
17 | import androidx.compose.ui.res.painterResource
18 | import androidx.compose.ui.res.stringResource
19 | import androidx.compose.ui.unit.dp
20 | import androidx.compose.ui.unit.sp
21 | import androidx.constraintlayout.compose.ConstraintLayout
22 | import androidx.constraintlayout.compose.Dimension
23 | import com.android.compose01.R
24 | import com.android.compose01.ui.theme.softGray
25 |
26 |
27 | @Composable
28 | fun PostSection() {
29 |
30 | Column(modifier = Modifier.background(Color.White)) {
31 |
32 |
33 | ConstraintLayout(
34 | modifier = Modifier
35 | .fillMaxWidth()
36 | ) {
37 |
38 | val (image, text) = createRefs()
39 |
40 |
41 |
42 | Image(
43 | painter = painterResource(R.drawable.me),
44 | contentDescription = "",
45 | modifier = Modifier
46 | .constrainAs(image) {
47 | linkTo(parent.top, parent.bottom, 16.dp, 16.dp)
48 | start.linkTo(parent.start, margin = 16.dp)
49 | }
50 | .width(38.dp)
51 | .clip(CircleShape)
52 |
53 | )
54 |
55 |
56 | Text(
57 | text = stringResource(R.string.whats_on_your_mind),
58 | color = Color.Gray,
59 | modifier = Modifier
60 | .constrainAs(text) {
61 | start.linkTo(image.end, margin = 16.dp)
62 | end.linkTo(parent.end, margin = 16.dp)
63 | top.linkTo(image.top)
64 | bottom.linkTo(image.bottom)
65 | width = Dimension.fillToConstraints
66 | }
67 | .border(width = 1.dp, color = softGray, shape = CircleShape)
68 | .padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 8.dp),
69 | fontSize = 16.sp
70 | )
71 |
72 |
73 | }
74 |
75 |
76 | Divider(color = softGray, thickness = 1.dp)
77 |
78 |
79 | ConstraintLayout(modifier = Modifier.fillMaxWidth()) {
80 |
81 | val (live, photo, room) = createRefs()
82 |
83 | Surface(modifier = Modifier.constrainAs(live) {
84 | linkTo(parent.start, photo.start)
85 | }) {
86 | PostAction(
87 | icon = R.drawable.ic_round_video_call_24,
88 | tint = colorResource(R.color.color_FFE91E63),
89 | action = R.string.live
90 | )
91 | }
92 |
93 |
94 | Surface(modifier = Modifier.constrainAs(photo) {
95 | linkTo(live.end, room.start)
96 | }) {
97 | PostAction(
98 | icon = R.drawable.ic_baseline_image_24,
99 | tint = colorResource(R.color.teal_700),
100 | action = R.string.photo
101 | )
102 | }
103 |
104 |
105 | Surface(modifier = Modifier.constrainAs(room) {
106 | linkTo(photo.end, parent.end)
107 | }) {
108 | PostAction(
109 | icon = R.drawable.ic_room,
110 | tint = colorResource(R.color.purple_500),
111 | action = R.string.room
112 | )
113 | }
114 |
115 |
116 | }
117 |
118 |
119 | }
120 |
121 | }
122 |
123 |
124 | @Composable
125 | fun PostAction(
126 | icon: Int,
127 | tint: Color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current),
128 | action: Int,
129 | onClick: () -> Unit = {}
130 | ) {
131 |
132 | Row(
133 | modifier = Modifier
134 | .clip(RoundedCornerShape(5.dp))
135 | .clickable { onClick.invoke() }
136 | .padding(8.dp),
137 | verticalAlignment = Alignment.CenterVertically
138 | ) {
139 |
140 | Icon(
141 | painter = painterResource(id = icon),
142 | contentDescription = null,
143 | tint = tint,
144 | modifier = Modifier.size(20.dp)
145 | )
146 |
147 | Text(
148 | text = stringResource(id = action),
149 | modifier = Modifier.padding(start = 4.dp),
150 | fontSize = 12.sp
151 | )
152 |
153 | }
154 |
155 | }
156 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/Posts.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline
2 |
3 | import androidx.compose.foundation.Image
4 | import androidx.compose.foundation.background
5 | import androidx.compose.foundation.layout.*
6 | import androidx.compose.foundation.lazy.LazyColumn
7 | import androidx.compose.foundation.lazy.items
8 | import androidx.compose.foundation.shape.CircleShape
9 | import androidx.compose.material.*
10 | import androidx.compose.runtime.Composable
11 | import androidx.compose.ui.Alignment
12 | import androidx.compose.ui.Modifier
13 | import androidx.compose.ui.graphics.Color
14 | import androidx.compose.ui.res.painterResource
15 | import androidx.compose.ui.text.font.FontWeight
16 | import androidx.compose.ui.unit.dp
17 | import androidx.compose.ui.unit.sp
18 | import com.android.compose01.R
19 | import com.android.compose01.ui.theme.softGray
20 |
21 |
22 | @Composable
23 | fun Posts(postsList: List) {
24 |
25 | LazyColumn {
26 |
27 |
28 | item {
29 |
30 | Text(text = "fgfgfggfgf")
31 |
32 | }
33 |
34 | items(postsList) { item: SinglePost ->
35 | Post(singlePost = item)
36 | }
37 |
38 |
39 | }
40 |
41 | }
42 |
43 | @Composable
44 | fun Post(singlePost: SinglePost) {
45 |
46 | Column(
47 | modifier = Modifier
48 | .fillMaxWidth()
49 | .padding(bottom = 8.dp)
50 | .background(Color.White)
51 | ) {
52 |
53 | Row(modifier = Modifier.padding(8.dp)) {
54 |
55 |
56 | Card(
57 | shape = CircleShape,
58 | modifier = Modifier
59 | .width(45.dp),
60 | backgroundColor = Color.Gray
61 | ) {
62 | Image(
63 | painter = painterResource(id = singlePost.authorPhoto),
64 | contentDescription = null
65 | )
66 | }
67 |
68 | Column(modifier = Modifier.padding(start = 16.dp), verticalArrangement = Arrangement.Center) {
69 |
70 | Text(text = singlePost.authorName, fontWeight = FontWeight.Bold)
71 |
72 |
73 | Row (verticalAlignment = Alignment.CenterVertically){
74 |
75 | Text(text = "20m • ", color = Color.Gray, fontSize = 12.sp)
76 | Icon(
77 | painter = painterResource(R.drawable.ic_baseline_language_24),
78 | contentDescription = null,
79 | modifier = Modifier.width(14.dp),
80 | tint = Color.Gray
81 | )
82 | }
83 |
84 | }
85 |
86 | }
87 |
88 | if (!singlePost.text.isNullOrBlank()) {
89 | Text(text = singlePost.text, modifier = Modifier.padding(8.dp))
90 | }
91 |
92 | if (singlePost.photo != null) {
93 | Spacer(modifier = Modifier.padding(8.dp))
94 | Image(
95 | painter = painterResource(id = singlePost.photo),
96 | contentDescription = null,
97 | modifier = Modifier.fillMaxWidth()
98 | )
99 | }
100 |
101 |
102 | Divider(
103 | color = softGray,
104 | thickness = 0.5.dp,
105 | modifier = Modifier.padding(start = 8.dp, end = 8.dp)
106 | )
107 |
108 | PostActionsSection()
109 |
110 |
111 | }
112 |
113 | }
114 |
115 |
116 | @Composable
117 | fun PostActionsSection() {
118 |
119 | Row(
120 | modifier = Modifier
121 | .fillMaxWidth()
122 | .height(40.dp)
123 | ) {
124 |
125 | Button(
126 | onClick = { /*TODO*/ },
127 | modifier = Modifier.weight(0.33f),
128 | colors = ButtonDefaults.buttonColors(backgroundColor = Color.White),
129 | elevation = ButtonDefaults.elevation(0.dp)
130 | ) {
131 | Icon(
132 | painter = painterResource(R.drawable.ic_like),
133 | contentDescription = null,
134 | modifier = Modifier.width(33.dp)
135 | )
136 | Text(text = "Like", color = Color.Gray)
137 | }
138 |
139 |
140 | Button(
141 | onClick = { /*TODO*/ },
142 | modifier = Modifier.weight(0.33f),
143 | colors = ButtonDefaults.buttonColors(backgroundColor = Color.White),
144 | elevation = ButtonDefaults.elevation(0.dp)
145 | ) {
146 | Icon(
147 | painter = painterResource(R.drawable.ic_comment),
148 | contentDescription = null,
149 | modifier = Modifier.width(33.dp)
150 | )
151 | Text(text = "Comment", color = Color.Gray)
152 | }
153 |
154 |
155 | Button(
156 | onClick = { /*TODO*/ },
157 | modifier = Modifier.weight(0.33f),
158 | colors = ButtonDefaults.buttonColors(backgroundColor = Color.White),
159 | elevation = ButtonDefaults.elevation(0.dp)
160 | ) {
161 | Icon(
162 | painter = painterResource(R.drawable.ic_share),
163 | contentDescription = null,
164 | modifier = Modifier.width(35.dp)
165 | )
166 | Text(text = "Share", color = Color.Gray)
167 | }
168 |
169 | }
170 |
171 | }
172 |
173 |
174 | data class SinglePost(
175 | val id: Long = System.currentTimeMillis(),
176 | val authorName: String,
177 | val authorPhoto: Int,
178 | val text: String? = null,
179 | val photo: Int? = null,
180 | val timestamp: Long = System.currentTimeMillis(),
181 | )
182 |
183 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/Stories.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline
2 |
3 | import androidx.compose.foundation.Image
4 | import androidx.compose.foundation.border
5 | import androidx.compose.foundation.clickable
6 | import androidx.compose.foundation.layout.*
7 | import androidx.compose.foundation.lazy.LazyRow
8 | import androidx.compose.foundation.lazy.items
9 | import androidx.compose.foundation.shape.CircleShape
10 | import androidx.compose.foundation.shape.RoundedCornerShape
11 | import androidx.compose.material.Card
12 | import androidx.compose.material.Surface
13 | import androidx.compose.material.Text
14 | import androidx.compose.runtime.Composable
15 | import androidx.compose.ui.Modifier
16 | import androidx.compose.ui.graphics.Color
17 | import androidx.compose.ui.graphics.Shadow
18 | import androidx.compose.ui.layout.ContentScale
19 | import androidx.compose.ui.res.colorResource
20 | import androidx.compose.ui.res.painterResource
21 | import androidx.compose.ui.text.TextStyle
22 | import androidx.compose.ui.unit.dp
23 | import androidx.compose.ui.unit.sp
24 | import androidx.constraintlayout.compose.ConstraintLayout
25 | import com.android.compose01.R
26 | import dev.chrisbanes.accompanist.coil.CoilImage
27 |
28 |
29 | @Composable
30 | fun Stories(stories: ArrayList) {
31 |
32 |
33 | Surface(color = Color.White, modifier = Modifier.padding(top = 8.dp)) {
34 |
35 | LazyRow(modifier = Modifier.padding(top = 8.dp, bottom = 8.dp)) {
36 |
37 | items(stories, itemContent = { story ->
38 |
39 | StoryCard(
40 | story = Story(
41 | userName = story.userName,
42 | userProfile = story.userProfile,
43 | imgUrl = story.imgUrl
44 | )
45 | )
46 |
47 | })
48 |
49 | }
50 |
51 | }
52 |
53 |
54 |
55 | }
56 |
57 |
58 | @Composable
59 | fun StoryCard(story: Story) {
60 |
61 | Card(
62 | shape = RoundedCornerShape(12.dp),
63 | modifier = Modifier
64 | .width(130.dp)
65 | .height(190.dp)
66 | .padding(4.dp),
67 | backgroundColor = Color.Gray
68 | ) {
69 |
70 |
71 | ConstraintLayout(
72 | modifier = Modifier
73 | .fillMaxWidth()
74 | .fillMaxHeight()
75 | .clickable { /* todo */ }
76 | ) {
77 |
78 | val (profileImg, storyImg, name) = createRefs()
79 |
80 | CoilImage(
81 | data = story.imgUrl,
82 | contentDescription = null,
83 | modifier = Modifier.constrainAs(storyImg) {
84 | linkTo(parent.start, parent.end)
85 | linkTo(parent.top, parent.bottom)
86 | },
87 | contentScale = ContentScale.Crop
88 | )
89 |
90 | Text(
91 | text = story.userName,
92 | fontSize = 13.sp,
93 | color = Color.White,
94 | modifier = Modifier
95 | .constrainAs(name) {
96 | start.linkTo(parent.start)
97 | bottom.linkTo(parent.bottom)
98 | }
99 | .padding(8.dp),
100 | style = TextStyle(
101 | shadow = Shadow(
102 | color = Color.Red,
103 | ),
104 |
105 | )
106 | )
107 |
108 |
109 |
110 | Card(
111 | shape = CircleShape,
112 | modifier = Modifier
113 | .constrainAs(profileImg) {
114 | top.linkTo(parent.top)
115 | start.linkTo(parent.start)
116 | }
117 | .padding(8.dp)
118 | .width(40.dp)
119 | .height(40.dp)
120 | .border(
121 | width = 2.dp,
122 | color = colorResource(R.color.purple_500),
123 | shape = CircleShape
124 | )
125 | .padding(4.dp)
126 | ) {
127 |
128 |
129 | Image(
130 | painter = painterResource(story.userProfile),
131 | contentDescription = "",
132 | contentScale = ContentScale.Crop,
133 | )
134 |
135 | }
136 |
137 | }
138 |
139 |
140 | }
141 |
142 | }
143 |
144 |
145 | data class Story(
146 | val userName: String,
147 | val userProfile: Int,
148 | val imgUrl: String,
149 | )
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/TimelineActivity.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline
2 |
3 | import android.os.Bundle
4 | import androidx.activity.ComponentActivity
5 | import androidx.activity.compose.setContent
6 | import androidx.compose.foundation.layout.*
7 | import androidx.compose.foundation.lazy.LazyColumn
8 | import androidx.compose.foundation.lazy.items
9 | import androidx.compose.material.Surface
10 | import androidx.compose.runtime.Composable
11 | import androidx.compose.ui.Modifier
12 | import androidx.compose.ui.tooling.preview.Preview
13 | import androidx.compose.ui.unit.dp
14 | import androidx.lifecycle.ViewModelProvider
15 | import com.android.compose01.timeline.ui.theme.Compose01Theme
16 | import com.android.compose01.ui.theme.softGray
17 |
18 | class TimelineActivity : ComponentActivity() {
19 |
20 | private lateinit var viewModel: TimelineViewModel
21 |
22 | override fun onCreate(savedInstanceState: Bundle?) {
23 | super.onCreate(savedInstanceState)
24 |
25 | viewModel = ViewModelProvider(this).get(TimelineViewModel::class.java)
26 |
27 | setContent {
28 | Compose01Theme(darkTheme = false) {
29 | TimelineScreen(viewModel)
30 | }
31 | }
32 | }
33 |
34 | }//TimelineActivity
35 |
36 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 |
38 | @Preview(showBackground = true)
39 | @Composable
40 | fun DefaultPreview2() {
41 | Compose01Theme {
42 | TimelineScreen(TimelineViewModel())
43 | }
44 | }
45 |
46 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47 |
48 | @Composable
49 | fun TimelineScreen(viewModel: TimelineViewModel) {
50 |
51 |
52 | Surface(
53 | color = softGray, modifier = Modifier
54 | .fillMaxWidth()
55 | .fillMaxHeight()
56 | ) {
57 |
58 | Column {
59 |
60 | Header()
61 |
62 | LazyColumn {
63 |
64 |
65 | item {
66 | Column {
67 | PostSection()
68 | Stories(viewModel.getStories())
69 | Spacer(modifier = Modifier.padding(4.dp))
70 | }
71 | }
72 |
73 | items(viewModel.getPosts()) { item: SinglePost -> Post(singlePost = item) }
74 |
75 | }
76 |
77 |
78 | }
79 |
80 |
81 | }
82 |
83 | }
84 |
85 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/TimelineViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline
2 |
3 | import androidx.lifecycle.ViewModel
4 | import com.android.compose01.R
5 |
6 | class TimelineViewModel : ViewModel() {
7 |
8 |
9 | fun getStories() = arrayListOf().apply {
10 |
11 | add(
12 | Story(
13 | userName = "Ahmed M Abdalla",
14 | userProfile = R.drawable.me,
15 | imgUrl = "https://upload.wikimedia.org/wikipedia/commons/8/8c/Cristiano_Ronaldo_2018.jpg"
16 | )
17 | )
18 |
19 | add(
20 | Story(
21 | userName = "Messi",
22 | userProfile = R.drawable.me,
23 | imgUrl = "https://upload.wikimedia.org/wikipedia/commons/d/d9/Lionel_Messi_20180626_%28cropped%29.jpg"
24 | )
25 | )
26 |
27 | add(
28 | Story(
29 | userName = "Elon Musk",
30 | userProfile = R.drawable.elon_musk,
31 | imgUrl = "https://cdn.vox-cdn.com/thumbor/nDW7YqKV8soKsZSfRorGXJLSH50=/1400x1400/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/22147179/1229892934.jpg"
32 | )
33 | )
34 |
35 | add(
36 | Story(
37 | userName = "Cristiano Ronaldo",
38 | userProfile = R.drawable.me,
39 | imgUrl = "https://upload.wikimedia.org/wikipedia/commons/8/8c/Cristiano_Ronaldo_2018.jpg"
40 | )
41 | )
42 |
43 | add(
44 | Story(
45 | userName = "Yasser Ali",
46 | userProfile = R.drawable.me,
47 | imgUrl = "https://pbs.twimg.com/profile_images/1251163079301386240/FgDdw5tG.jpg"
48 | )
49 | )
50 |
51 | add(
52 | Story(
53 | userName = "Elon Musk",
54 | userProfile = R.drawable.elon_musk,
55 | imgUrl = "https://pbs.twimg.com/profile_images/1251163079301386240/FgDdw5tG.jpg"
56 | )
57 | )
58 |
59 | }
60 |
61 |
62 | fun getPosts(): List {
63 |
64 | return arrayListOf().apply {
65 |
66 | add(
67 | SinglePost(
68 | authorName = "Ahmed M. Abdalla",
69 | authorPhoto = R.drawable.me,
70 | text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, ",/*photo = R.drawable.wallpaper,*/
71 | )
72 | )
73 |
74 | add(
75 | SinglePost(
76 | authorName = "Ossama Elzero",
77 | authorPhoto = R.drawable.elzero,
78 | text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry",
79 | photo = R.drawable.elon_musk,
80 | )
81 | )
82 |
83 | add(
84 | SinglePost(
85 | authorName = "Ahmed M. Abdalla",
86 | authorPhoto = R.drawable.me,
87 | text = "Hello World, This is first jetpack compose project",/*photo = R.drawable.wallpaper,*/
88 | )
89 | )
90 |
91 | add(
92 | SinglePost(
93 | authorName = "Ahmed M. Abdalla",
94 | authorPhoto = R.drawable.me,
95 | text = "Hello World, This is first jetpack compose project",
96 | photo = R.drawable.wallpaper,
97 | )
98 | )
99 |
100 | }
101 |
102 | }
103 |
104 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/ui/theme/Color.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline.ui.theme
2 |
3 | import androidx.compose.ui.graphics.Color
4 |
5 | val purple200 = Color(0xFFBB86FC)
6 | val purple500 = Color(0xFF6200EE)
7 | val purple700 = Color(0xFF3700B3)
8 | val teal200 = Color(0xFF03DAC5)
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/ui/theme/Shape.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline.ui.theme
2 |
3 | import androidx.compose.foundation.shape.RoundedCornerShape
4 | import androidx.compose.material.Shapes
5 | import androidx.compose.ui.unit.dp
6 |
7 | val shapes = Shapes(
8 | small = RoundedCornerShape(4.dp),
9 | medium = RoundedCornerShape(4.dp),
10 | large = RoundedCornerShape(0.dp)
11 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/ui/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline.ui.theme
2 |
3 | import androidx.compose.foundation.isSystemInDarkTheme
4 | import androidx.compose.material.MaterialTheme
5 | import androidx.compose.material.darkColors
6 | import androidx.compose.material.lightColors
7 | import androidx.compose.runtime.Composable
8 |
9 | private val DarkColorPalette = darkColors(
10 | primary = purple200,
11 | primaryVariant = purple700,
12 | secondary = teal200
13 | )
14 |
15 | private val LightColorPalette = lightColors(
16 | primary = purple500,
17 | primaryVariant = purple700,
18 | secondary = teal200
19 |
20 | /* Other default colors to override
21 | background = Color.White,
22 | surface = Color.White,
23 | onPrimary = Color.White,
24 | onSecondary = Color.Black,
25 | onBackground = Color.Black,
26 | onSurface = Color.Black,
27 | */
28 | )
29 |
30 | @Composable
31 | fun Compose01Theme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) {
32 | val colors = if (darkTheme) {
33 | DarkColorPalette
34 | } else {
35 | LightColorPalette
36 | }
37 |
38 | MaterialTheme(
39 | colors = colors,
40 | typography = typography,
41 | shapes = shapes,
42 | content = content
43 | )
44 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/timeline/ui/theme/Type.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.timeline.ui.theme
2 |
3 | import androidx.compose.material.Typography
4 | import androidx.compose.ui.text.TextStyle
5 | import androidx.compose.ui.text.font.FontFamily
6 | import androidx.compose.ui.text.font.FontWeight
7 | import androidx.compose.ui.unit.sp
8 |
9 | // Set of Material typography styles to start with
10 | val typography = Typography(
11 | body1 = TextStyle(
12 | fontFamily = FontFamily.Default,
13 | fontWeight = FontWeight.Normal,
14 | fontSize = 16.sp
15 | )
16 | /* Other default text styles to override
17 | button = TextStyle(
18 | fontFamily = FontFamily.Default,
19 | fontWeight = FontWeight.W500,
20 | fontSize = 14.sp
21 | ),
22 | caption = TextStyle(
23 | fontFamily = FontFamily.Default,
24 | fontWeight = FontWeight.Normal,
25 | fontSize = 12.sp
26 | )
27 | */
28 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/ui/theme/Color.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.ui.theme
2 |
3 | import androidx.compose.ui.graphics.Color
4 |
5 | val purple200 = Color(0xFFBB86FC)
6 | val purple500 = Color(0xFF1877F2)
7 | val purple700 = Color(0xFF1877F2)
8 | val teal200 = Color(0xFF03DAC5)
9 | val softGray = Color(0xFFDFDFDF)
10 | val iconsBackground = Color(0xFFF0F0F0)
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/ui/theme/Shape.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.ui.theme
2 |
3 | import androidx.compose.foundation.shape.RoundedCornerShape
4 | import androidx.compose.material.Shapes
5 | import androidx.compose.ui.unit.dp
6 |
7 | val shapes = Shapes(
8 | small = RoundedCornerShape(4.dp),
9 | medium = RoundedCornerShape(4.dp),
10 | large = RoundedCornerShape(0.dp)
11 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/ui/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.ui.theme
2 |
3 | import androidx.compose.foundation.isSystemInDarkTheme
4 | import androidx.compose.material.MaterialTheme
5 | import androidx.compose.material.darkColors
6 | import androidx.compose.material.lightColors
7 | import androidx.compose.runtime.Composable
8 |
9 | private val DarkColorPalette = darkColors(
10 | primary = purple500,
11 | primaryVariant = purple500,
12 | secondary = purple500
13 | )
14 |
15 | private val LightColorPalette = lightColors(
16 | primary = purple500,
17 | primaryVariant = purple500,
18 | secondary = purple500
19 |
20 | /* Other default colors to override
21 | background = Color.White,
22 | surface = Color.White,
23 | onPrimary = Color.White,
24 | onSecondary = Color.Black,
25 | onBackground = Color.Black,
26 | onSurface = Color.Black,
27 | */
28 | )
29 |
30 | @Composable
31 | fun Compose01Theme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) {
32 | val colors = if (darkTheme) {
33 | DarkColorPalette
34 | } else {
35 | LightColorPalette
36 | }
37 |
38 | MaterialTheme(
39 | colors = colors,
40 | typography = typography,
41 | shapes = shapes,
42 | content = content
43 | )
44 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/android/compose01/ui/theme/Type.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01.ui.theme
2 |
3 | import androidx.compose.material.Typography
4 | import androidx.compose.ui.text.TextStyle
5 | import androidx.compose.ui.text.font.FontFamily
6 | import androidx.compose.ui.text.font.FontWeight
7 | import androidx.compose.ui.unit.sp
8 |
9 | // Set of Material typography styles to start with
10 | val typography = Typography(
11 | body1 = TextStyle(
12 | fontFamily = FontFamily.Default,
13 | fontWeight = FontWeight.Normal,
14 | fontSize = 16.sp
15 | )
16 | /* Other default text styles to override
17 | button = TextStyle(
18 | fontFamily = FontFamily.Default,
19 | fontWeight = FontWeight.W500,
20 | fontSize = 14.sp
21 | ),
22 | caption = TextStyle(
23 | fontFamily = FontFamily.Default,
24 | fontWeight = FontWeight.Normal,
25 | fontSize = 12.sp
26 | )
27 | */
28 | )
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/elon_musk.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/drawable/elon_musk.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/elzero.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/drawable/elzero.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/facebook_header.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_android_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_image_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_language_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_comment.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_iconfinder_sed_22_2236328.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_like.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_messenger.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notification.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_room.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_add_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_groups_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_home_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_menu_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_notifications_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_search_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_storefront_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_supervised_user_circle_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_round_video_call_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/me.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/drawable/me.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wallpaper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/drawable/wallpaper.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #1877f2
5 | #1877f2
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #E91E63
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Facebook Timeline Compose
3 | What\'s your name
4 | My Compose App
5 | facebook
6 | What\'s on your mind?
7 | Live
8 | Photo
9 | Room
10 | TestActivity
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/test/java/com/android/compose01/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.android.compose01
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext {
4 | compose_version = '1.0.0-beta01'
5 | }
6 | repositories {
7 | google()
8 | mavenCentral()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:7.0.0-alpha09'
12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | google()
22 | jcenter()
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
--------------------------------------------------------------------------------
/demo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/demo1.png
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ahmed7official/Facebook-Timeline-Compose-Android/255f3c8c982f78548bb2622513ef3ac2af5c488b/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Feb 24 21:25:05 EET 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = "Compose 01"
2 | include ':app'
3 |
--------------------------------------------------------------------------------