Skip to content

Commit

Permalink
Merge "[JetNews] Merge 'github/develop' and bump to dev17, 1.4, gradl…
Browse files Browse the repository at this point in the history
…e 6.6"
  • Loading branch information
JoseAlcerreca authored and Gerrit Code Review committed Aug 21, 2020
2 parents 28a0960 + 5168201 commit 3993789
Show file tree
Hide file tree
Showing 32 changed files with 452 additions and 566 deletions.
22 changes: 19 additions & 3 deletions JetNews/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ dependencies {

implementation "androidx.compose.runtime:runtime-livedata:$compose_version"

implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0-alpha05"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0-alpha06"

androidTestImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation "androidx.ui:ui-test:$compose_version"

ktlint 'com.pinterest:ktlint:0.37.0'
ktlint 'com.pinterest:ktlint:0.38.0-alpha01'
}

task ktlint(type: JavaExec, group: 'verification') {
Expand All @@ -104,7 +104,23 @@ task ktlintFormat(type: JavaExec, group: 'formatting') {

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
// Enable experimental coroutines APIs, including Flow
freeCompilerArgs += '-Xopt-in=kotlin.Experimental'
// Set JVM target to 1.8
jvmTarget = "1.8"
freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
}
}

// TODO: Figure out which dependencies need this and force them individually
configurations.configureEach() {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion kotlin_version
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ import androidx.ui.test.onAllNodes
import androidx.ui.test.onNodeWithText
import androidx.ui.test.performClick
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@MediumTest
@RunWith(JUnit4::class)
class JetnewsUiTest {

@get:Rule
Expand All @@ -43,15 +41,16 @@ class JetnewsUiTest {
composeTestRule.launchJetNewsApp(InstrumentationRegistry.getInstrumentation().targetContext)
}

@Ignore // TODO Investigate why this passes locally but fail on CI
@Test
fun app_launches() {
onNodeWithText("Jetnews").assertIsDisplayed()
}

@Ignore // TODO Investigate why this passes locally but fail on CI
@Test
fun app_opensArticle() {
// Using unmerged tree because of https://issuetracker.google.com/issues/161979921
onAllNodes(hasSubstring("Manuel Vivo"), useUnmergedTree = true)[0].performClick()
onAllNodes(hasSubstring("3 min read"), useUnmergedTree = true)[0].assertIsDisplayed()
onAllNodes(hasSubstring("Manuel Vivo"))[0].performClick()
onAllNodes(hasSubstring("3 min read"))[0].assertIsDisplayed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.example.jetnews

import android.content.Context
import androidx.compose.remember
import androidx.compose.runtime.remember
import androidx.lifecycle.SavedStateHandle
import androidx.ui.test.ComposeTestRule
import com.example.jetnews.ui.JetnewsApp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.example.jetnews.data.posts.impl

import android.content.Context
import androidx.ui.graphics.imageFromResource
import androidx.compose.ui.graphics.imageFromResource
import com.example.jetnews.data.Result
import com.example.jetnews.data.posts.PostsRepository
import com.example.jetnews.model.Post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.example.jetnews.data.posts.impl

import android.content.res.Resources
import android.os.Handler
import androidx.ui.graphics.imageFromResource
import androidx.compose.ui.graphics.imageFromResource
import com.example.jetnews.data.Result
import com.example.jetnews.data.posts.PostsRepository
import com.example.jetnews.model.Post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.example.jetnews.data.posts.impl

import android.content.res.Resources
import androidx.ui.graphics.imageFromResource
import androidx.compose.ui.graphics.imageFromResource
import com.example.jetnews.R
import com.example.jetnews.model.Markup
import com.example.jetnews.model.MarkupType
Expand Down Expand Up @@ -171,7 +171,8 @@ val paragraphsPost1 = listOf(
)
),
Paragraph(
ParagraphType.Bullet, "Patchwork Plaid — A modularization story",
ParagraphType.Bullet,
"Patchwork Plaid — A modularization story",
listOf(
Markup(
MarkupType.Link,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.example.jetnews.data.posts.impl

import android.content.Context
import androidx.ui.graphics.imageFromResource
import androidx.compose.ui.graphics.imageFromResource
import com.example.jetnews.data.Result
import com.example.jetnews.data.posts.PostsRepository
import com.example.jetnews.model.Post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.example.jetnews.model

import androidx.ui.graphics.ImageAsset
import androidx.compose.ui.graphics.ImageAsset

data class Post(
val id: String,
Expand Down
54 changes: 27 additions & 27 deletions JetNews/app/src/main/java/com/example/jetnews/ui/JetnewsApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,34 @@

package com.example.jetnews.ui

import androidx.compose.Composable
import androidx.ui.animation.Crossfade
import androidx.ui.core.Alignment
import androidx.ui.core.Modifier
import androidx.ui.foundation.Image
import androidx.ui.foundation.Text
import androidx.ui.graphics.Color
import androidx.ui.graphics.ColorFilter
import androidx.ui.graphics.vector.VectorAsset
import androidx.ui.layout.Arrangement
import androidx.ui.layout.Column
import androidx.ui.layout.Row
import androidx.ui.layout.Spacer
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.fillMaxWidth
import androidx.ui.layout.padding
import androidx.ui.layout.preferredHeight
import androidx.ui.layout.preferredWidth
import androidx.ui.material.Divider
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Surface
import androidx.ui.material.TextButton
import androidx.ui.material.icons.Icons
import androidx.ui.material.icons.filled.Home
import androidx.ui.material.icons.filled.ListAlt
import androidx.ui.res.vectorResource
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.Image
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.TextButton
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.ListAlt
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.vector.VectorAsset
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import androidx.ui.tooling.preview.Preview
import androidx.ui.unit.dp
import com.example.jetnews.R
import com.example.jetnews.data.AppContainer
import com.example.jetnews.data.interests.InterestsRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.example.jetnews.ui

import androidx.compose.mutableStateListOf
import androidx.compose.runtime.mutableStateListOf

object JetnewsStatus {
val favorites = mutableStateListOf<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.example.jetnews.ui
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.ui.core.setContent
import androidx.compose.ui.platform.setContent
import com.example.jetnews.JetnewsApplication

class MainActivity : AppCompatActivity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package com.example.jetnews.ui

import android.os.Bundle
import androidx.annotation.MainThread
import androidx.compose.getValue
import androidx.compose.setValue
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.core.os.bundleOf
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

package com.example.jetnews.ui

import androidx.compose.Composable
import androidx.ui.material.Surface
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
import com.example.jetnews.ui.theme.JetnewsTheme

@Composable
internal fun ThemedPreview(
darkTheme: Boolean = false,
children: @Composable() () -> Unit
children: @Composable () -> Unit
) {
JetnewsTheme(darkTheme = darkTheme) {
Surface {
Expand Down
Loading

0 comments on commit 3993789

Please sign in to comment.