-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - add meditation demo ui * update readme.md for addition of meditation gif ui
- Loading branch information
1 parent
ef61187
commit 0a81741
Showing
65 changed files
with
9,710 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,7 +358,8 @@ object DemoDataProvider { | |
"MoviesApp+MVVM", | ||
"DatingApp", | ||
"TikTok", | ||
"Paint" | ||
"Paint", | ||
"Meditation" | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import com.guru.composecookbook.build.dependencies.addComposeOfficialDependencies | ||
import com.guru.composecookbook.build.dependencies.addCoreAndroidUiDependencies | ||
|
||
plugins { | ||
/** | ||
* See [common-compose-module-configs-script-plugin.gradle.kts] file | ||
*/ | ||
id("common-compose-module-configs-script-plugin") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":theme")) | ||
implementation(project(":components:verticalgrid")) | ||
|
||
addComposeOfficialDependencies() | ||
addCoreAndroidUiDependencies() | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
...ation/src/androidTest/java/com/guru/composecookbook/meditation/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.guru.composecookbook.meditation | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.guru.composecookbook.meditation.test", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.guru.composecookbook.meditation"> | ||
|
||
<application> | ||
<activity | ||
android:name=".MeditationActivity" | ||
android:label="@string/title_activity_meditation" | ||
android:theme="@style/Theme.ComposeCookBook.NoActionBar" /> | ||
</application> | ||
</manifest> |
26 changes: 26 additions & 0 deletions
26
demos/meditation/src/main/java/com/guru/composecookbook/meditation/MeditaionActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.guru.composecookbook.meditation | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.ExperimentalFoundationApi | ||
import com.guru.composecookbook.meditation.ui.screen.MeditationHome | ||
import com.guru.composecookbook.meditation.ui.theme.MeditationAppTheme | ||
|
||
class MeditationActivity : ComponentActivity() { | ||
@OptIn(ExperimentalFoundationApi::class) | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
MeditationAppTheme { | ||
MeditationHome() | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
fun newIntent(context: Context) = Intent(context, MeditationActivity::class.java) | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...ditation/src/main/java/com/guru/composecookbook/meditation/ui/component/BottomMenuItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.guru.composecookbook.meditation.ui.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.guru.composecookbook.meditation.ui.model.BottomMenuContent | ||
import com.guru.composecookbook.meditation.ui.spacerHeight5 | ||
import com.guru.composecookbook.meditation.ui.theme.AquaBlue | ||
import com.guru.composecookbook.meditation.ui.theme.ButtonBlue | ||
import com.guru.composecookbook.meditation.ui.theme.Gray | ||
|
||
@Composable | ||
fun BottomMenuItem( | ||
item: BottomMenuContent, | ||
isSelected: Boolean = false, | ||
activeHighlightColor: Color = ButtonBlue, | ||
activeTextColor: Color = Color.White, | ||
inactiveTextColor: Color = AquaBlue, | ||
onItemClick: () -> Unit | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center, | ||
) { | ||
Box( | ||
contentAlignment = Alignment.Center, | ||
modifier = Modifier | ||
.clip(RoundedCornerShape(15.dp)) | ||
.background(if (isSelected) activeHighlightColor else Color.Transparent) | ||
.clickable { | ||
onItemClick() | ||
} | ||
.padding(15.dp) | ||
) { | ||
Icon( | ||
painter = painterResource(id = item.iconId), | ||
contentDescription = item.title, | ||
tint = if (isSelected) Color.White else Gray, | ||
modifier = Modifier.size(20.dp) | ||
) | ||
} | ||
spacerHeight5() | ||
Text( | ||
text = item.title, | ||
style = MaterialTheme.typography.h2, | ||
color = if(isSelected) activeTextColor else inactiveTextColor, | ||
fontSize = 14.sp | ||
) | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...meditation/src/main/java/com/guru/composecookbook/meditation/ui/component/CategoryItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.guru.composecookbook.meditation.ui.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.guru.composecookbook.meditation.ui.model.Categories | ||
import com.guru.composecookbook.meditation.ui.spacerHeight5 | ||
import com.guru.composecookbook.meditation.ui.theme.Blue | ||
import com.guru.composecookbook.meditation.ui.theme.DeepBlue | ||
import com.guru.composecookbook.meditation.ui.theme.Gray | ||
import com.guru.composecookbook.meditation.ui.theme.TextWhite | ||
import org.w3c.dom.Text | ||
|
||
@Composable | ||
fun CategoryItem( | ||
category: Categories, | ||
selectedItem : Boolean, | ||
onItemClick: () -> Unit | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
modifier = Modifier | ||
.padding(end = 15.dp) | ||
|
||
) { | ||
Box( | ||
modifier = Modifier | ||
.clip(RoundedCornerShape(18.dp)) | ||
.background(color = if (selectedItem) Blue else Gray) | ||
.clickable { | ||
onItemClick() | ||
} | ||
) { | ||
Icon( | ||
painter = painterResource(id = category.icon), | ||
contentDescription = "Category Icon", | ||
tint = TextWhite, | ||
modifier = Modifier.padding(18.dp).size(20.dp) | ||
) | ||
} | ||
spacerHeight5() | ||
Text( | ||
text = category.title, | ||
style = MaterialTheme.typography.body1, | ||
fontSize = 12.sp, | ||
color = if (selectedItem) DeepBlue else Gray, | ||
fontWeight = FontWeight.Bold | ||
) | ||
} | ||
} |
Oops, something went wrong.