Skip to content

Commit

Permalink
Merge pull request #308 from android/dev_alpha08
Browse files Browse the repository at this point in the history
[All] Update to Compose 1.0.0-alpha08
  • Loading branch information
yrezgui authored Dec 3, 2020
2 parents e1ab50d + 03965b2 commit 2cff653
Show file tree
Hide file tree
Showing 165 changed files with 1,635 additions and 1,499 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/Crane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/JetNews.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Jetcaster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/Jetchat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Jetsnack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Jetsurvey.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
51 changes: 49 additions & 2 deletions .github/workflows/Owl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down Expand Up @@ -57,3 +57,50 @@ jobs:
with:
name: build-reports
path: ${{ env.SAMPLE_PATH }}/app/build/reports

test:
needs: build
runs-on: macOS-latest # enables hardware acceleration in the virtual machine
timeout-minutes: 30
strategy:
matrix:
api-level: [23, 26, 29]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt

- uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum.txt') }}

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
disable-animations: true
script: ./gradlew connectedCheck --stacktrace
working-directory: ${{ env.SAMPLE_PATH }}

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v2
with:
name: test-reports
path: ${{ env.SAMPLE_PATH }}/app/build/reports
4 changes: 2 additions & 2 deletions .github/workflows/Rally.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Generate cache key
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Build all projects
run: ./scripts/gradlew_recursive.sh assembleDebug
Expand Down
7 changes: 4 additions & 3 deletions Crane/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ android {
}

release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Expand Down Expand Up @@ -106,15 +106,16 @@ android {
dependencies {
implementation Libs.Kotlin.stdlib
implementation Libs.Kotlin.Coroutines.android
implementation Libs.googleMaps
implementation Libs.GoogleMaps.maps
implementation Libs.GoogleMaps.mapsKtx

implementation Libs.AndroidX.Compose.runtime
implementation Libs.AndroidX.Compose.runtimeLivedata
implementation Libs.AndroidX.Compose.foundation
implementation Libs.AndroidX.Compose.material
implementation Libs.AndroidX.Compose.layout
implementation Libs.AndroidX.Compose.animation
implementation Libs.AndroidX.UI.tooling
implementation Libs.AndroidX.Compose.tooling
implementation Libs.Accompanist.coil

implementation Libs.AndroidX.Lifecycle.viewModelKtx
Expand Down
7 changes: 5 additions & 2 deletions Crane/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-renamesourcefileattribute SourceFile

# Repackage classes into the top-level.
-repackageclasses
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,21 @@ class DetailsActivityTest {

@get:Rule(order = 1)
val composeTestRule = AndroidComposeTestRule(
ActivityScenarioRule<DetailsActivity>(
activityRule = ActivityScenarioRule<DetailsActivity>(
createDetailsActivityIntent(
InstrumentationRegistry.getInstrumentation().targetContext,
testExploreModel
)
)
),
// Needed for now, discussed in https://issuetracker.google.com/issues/174472899
activityProvider = { rule ->
var activity: DetailsActivity? = null
rule.scenario.onActivity { activity = it }
if (activity == null) {
throw IllegalStateException("Activity was not set in the ActivityScenarioRule!")
}
activity!!
}
)

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ package androidx.compose.samples.crane.di
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ApplicationComponent
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi

@OptIn(ExperimentalCoroutinesApi::class)
@Module
@InstallIn(ApplicationComponent::class)
@InstallIn(SingletonComponent::class)
class TestDispatchersModule {

@Provides
Expand Down
12 changes: 11 additions & 1 deletion Crane/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@

<uses-permission android:name="android.permission.INTERNET" />

<!--
Android 11 package visibility changes require that apps specify which
set of other packages on the device that they can access. Since this
sample uses Google Maps, specifying the Google Maps package name is
required so that the buttons on the Map toolbar launch the Google Maps app.
-->
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>

<application
android:name=".CraneApplication"
android:allowBackup="true"
Expand All @@ -42,4 +52,4 @@
<activity android:name=".calendar.CalendarActivity" />
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.ui.tooling.preview.Preview

@Composable
fun SimpleUserInput(
Expand Down Expand Up @@ -124,7 +124,7 @@ private fun CraneBaseUserInput(
if (vectorImageId != null) {
Icon(
modifier = Modifier.preferredSize(24.dp, 24.dp),
asset = vectorResource(id = vectorImageId),
imageVector = vectorResource(id = vectorImageId),
tint = if (tintIcon()) tint else Color(0x80FFFFFF)
)
Spacer(Modifier.preferredWidth(8.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ import androidx.compose.samples.crane.R
import androidx.compose.samples.crane.ui.CraneTheme
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.ui.tooling.preview.Preview

private val screens = listOf("Find Trips", "My Trips", "Saved Trips", "Price Alerts", "My Account")

@Composable
fun CraneDrawer(modifier: Modifier = Modifier) {
Column(modifier.fillMaxSize().padding(start = 24.dp, top = 48.dp)) {
Image(asset = vectorResource(id = R.drawable.ic_crane_drawer))
Image(imageVector = vectorResource(id = R.drawable.ic_crane_drawer))
for (screen in screens) {
Spacer(Modifier.preferredHeight(24.dp))
Text(text = screen, style = MaterialTheme.typography.h4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import androidx.compose.samples.crane.home.CraneScreen
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ConfigurationAmbient
import androidx.compose.ui.platform.AmbientConfiguration
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import androidx.core.os.ConfigurationCompat
Expand All @@ -52,10 +52,10 @@ fun CraneTabBar(
Row(Modifier.padding(top = 8.dp)) {
Image(
modifier = Modifier.padding(top = 8.dp).clickable(onClick = onMenuClicked),
asset = vectorResource(id = R.drawable.ic_menu)
imageVector = vectorResource(id = R.drawable.ic_menu)
)
Spacer(Modifier.preferredWidth(8.dp))
Image(asset = vectorResource(id = R.drawable.ic_crane_logo))
Image(imageVector = vectorResource(id = R.drawable.ic_crane_logo))
}
children(Modifier.weight(1f).align(Alignment.CenterVertically))
}
Expand Down Expand Up @@ -93,7 +93,7 @@ fun CraneTabs(
Text(
modifier = textModifier,
text = title.toUpperCase(
ConfigurationCompat.getLocales(ConfigurationAmbient.current)[0]
ConfigurationCompat.getLocales(AmbientConfiguration.current)[0]
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private fun ExploreItem(
Box(Modifier.fillMaxSize()) {
Image(
modifier = Modifier.preferredSize(36.dp).align(Alignment.Center),
asset = vectorResource(id = R.drawable.ic_crane_logo)
imageVector = vectorResource(id = R.drawable.ic_crane_logo)
)
}
}
Expand Down
Loading

0 comments on commit 2cff653

Please sign in to comment.