Skip to content

Commit

Permalink
Update Gradle versions, Update Stack Layout (Deprecated) -> Box Layou…
Browse files Browse the repository at this point in the history
…t & Add Bulb Icon

Signed-off-by: Sanju S <[email protected]>
  • Loading branch information
Spikeysanju committed Oct 2, 2020
1 parent 033b083 commit 1e3965a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ android {
dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha07'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-beta01'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ import www.spikeysanju.jetquotes.utils.shareToOthers
@Composable
fun CTAButtons(quote: String, author: String) {
val context = ContextAmbient.current
Stack(modifier = Modifier.fillMaxSize()) {
Row(modifier = Modifier.background(MaterialTheme.colors.primaryVariant)
.align(Alignment.BottomEnd)
.padding(30.dp, 30.dp, 0.dp, 30.dp)) {
Box(modifier = Modifier.fillMaxSize()) {
Row(
modifier = Modifier.background(MaterialTheme.colors.primaryVariant)
.align(Alignment.BottomEnd)
.padding(30.dp, 30.dp, 0.dp, 30.dp)
) {

Button(
icon = vectorResource(id = R.drawable.ic_copy),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ import www.spikeysanju.jetquotes.utils.copyToClipboard
fun DetailCard(quote: String, author: String) {
val context = ContextAmbient.current

Stack(modifier = Modifier.fillMaxSize()) {
Box(modifier = Modifier.fillMaxSize()) {

Column(
modifier = Modifier.clickable(onClick = {
context.copyToClipboard(quote.plus("").plus("- $author"))
Toast.makeText(context, "Quote copied!", Toast.LENGTH_SHORT).show()
}).background(MaterialTheme.colors.primaryVariant).padding(40.dp).align(Alignment.Center).padding(12.dp),
}).background(MaterialTheme.colors.primaryVariant).padding(40.dp)
.align(Alignment.Center).padding(12.dp),

) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fun QuotesCard(quote: Quote) {

Spacer(Modifier.preferredHeight(12.dp))

Stack(modifier = Modifier.fillMaxSize()) {
Box(modifier = Modifier.fillMaxSize()) {
Text(
modifier = Modifier.align(Alignment.CenterEnd).padding(12.dp),
text = quote.author.toString().ifBlank { " - Unknown" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ import www.spikeysanju.jetquotes.R

@Composable
fun QuotesThemeSwitch(onToggle: () -> Unit) {
val icon = vectorResource(R.drawable.ic_share)
val icon = vectorResource(R.drawable.ic_day)
Icon(icon, Modifier.padding(end = 8.dp).clickable(onClick = onToggle))
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ package www.spikeysanju.jetquotes.view
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.RowScope.align
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.setContent
import androidx.compose.ui.text.style.TextAlign
Expand Down Expand Up @@ -76,7 +74,6 @@ fun DetailQuoteApp(quote: String, author: String) {
title = { Text(text = "JetQuotes", textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth()) },
backgroundColor = MaterialTheme.colors.primary,
contentColor = MaterialTheme.colors.onPrimary,
modifier = Modifier.align(Alignment.CenterVertically),
elevation = 0.dp
)
}, bodyContent = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.foundation.Text
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.RowScope.align
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
Expand All @@ -44,7 +43,6 @@ import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ContextAmbient
import androidx.compose.ui.platform.setContent
Expand Down Expand Up @@ -161,7 +159,6 @@ fun App(toggleTheme: () -> Unit) {
},
backgroundColor = MaterialTheme.colors.primary,
contentColor = MaterialTheme.colors.onPrimary,
modifier = Modifier.align(Alignment.CenterVertically),
elevation = 0.dp,
actions = {
QuotesThemeSwitch(toggleTheme)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.0.0-alpha03'
compose_version = '1.0.0-alpha04'
}
ext.kotlin_version = "1.4.10"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-alpha12'
classpath 'com.android.tools.build:gradle:4.2.0-alpha13'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down

0 comments on commit 1e3965a

Please sign in to comment.