Skip to content

Commit 9b2de23

Browse files
committed
Convert project to use AndroidX
1 parent 5b03fed commit 9b2de23

40 files changed

+177
-173
lines changed

app/build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ android {
2929
applicationId "com.google.samples.apps.sunflower"
3030
minSdkVersion rootProject.minSdkVersion
3131
targetSdkVersion rootProject.targetSdkVersion
32-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
32+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3333
versionCode 1
3434
versionName "0.1.5"
3535
vectorDrawables.useSupportLibrary true
@@ -47,27 +47,27 @@ android {
4747
}
4848

4949
dependencies {
50-
kapt "android.arch.persistence.room:compiler:$rootProject.roomVersion"
50+
kapt "androidx.room:room-compiler:$rootProject.roomVersion"
5151
kapt "com.github.bumptech.glide:compiler:$rootProject.glideVersion"
52-
implementation "android.arch.lifecycle:extensions:$rootProject.lifecycleVersion"
5352
implementation "android.arch.navigation:navigation-fragment-ktx:$rootProject.navigationVersion"
5453
implementation "android.arch.navigation:navigation-ui-ktx:$rootProject.navigationVersion"
55-
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
5654
implementation "android.arch.work:work-runtime-ktx:$rootProject.workVersion"
55+
implementation "androidx.appcompat:appcompat:$rootProject.supportLibraryVersion"
56+
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"
5757
implementation "androidx.core:core-ktx:$rootProject.ktxVersion"
58-
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
59-
implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
60-
implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
61-
implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion"
62-
implementation "com.android.support:design:$rootProject.supportLibraryVersion"
58+
implementation "androidx.legacy:legacy-support-v4:$rootProject.supportLibraryVersion"
59+
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion"
60+
implementation "androidx.recyclerview:recyclerview:$rootProject.supportLibraryVersion"
61+
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
6362
implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
63+
implementation "com.google.android.material:material:$rootProject.supportLibraryVersion"
6464
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
6565
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.kotlinVersion"
6666

6767
// Testing dependencies
68-
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion"
69-
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$rootProject.espressoVersion"
70-
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
71-
androidTestImplementation "com.android.support.test.uiautomator:uiautomator-v18:$uiAutomatorVersion"
68+
androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.espressoVersion"
69+
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
70+
androidTestImplementation "androidx.test.espresso:espresso-intents:$rootProject.espressoVersion"
71+
androidTestImplementation "androidx.test.uiautomator:uiautomator:$rootProject.uiAutomatorVersion"
7272
testImplementation "junit:junit:$rootProject.junitVersion"
7373
}

app/src/androidTest/java/com/google/samples/apps/sunflower/GardenActivityTest.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616

1717
package com.google.samples.apps.sunflower
1818

19-
import android.support.test.InstrumentationRegistry
20-
import android.support.test.espresso.Espresso.onView
21-
import android.support.test.espresso.action.ViewActions
22-
import android.support.test.espresso.action.ViewActions.click
23-
import android.support.test.espresso.assertion.ViewAssertions.matches
24-
import android.support.test.espresso.contrib.DrawerMatchers.isClosed
25-
import android.support.test.espresso.contrib.DrawerMatchers.isOpen
26-
import android.support.test.espresso.contrib.NavigationViewActions.navigateTo
27-
import android.support.test.espresso.matcher.ViewMatchers.isDisplayed
28-
import android.support.test.espresso.matcher.ViewMatchers.isRoot
29-
import android.support.test.espresso.matcher.ViewMatchers.withContentDescription
30-
import android.support.test.espresso.matcher.ViewMatchers.withId
31-
import android.support.test.rule.ActivityTestRule
32-
import android.support.test.uiautomator.UiDevice
3319
import android.view.Gravity
20+
import androidx.test.InstrumentationRegistry
21+
import androidx.test.espresso.Espresso.onView
22+
import androidx.test.espresso.action.ViewActions
23+
import androidx.test.espresso.action.ViewActions.click
24+
import androidx.test.espresso.assertion.ViewAssertions.matches
25+
import androidx.test.espresso.contrib.DrawerMatchers.isClosed
26+
import androidx.test.espresso.contrib.DrawerMatchers.isOpen
27+
import androidx.test.espresso.contrib.NavigationViewActions.navigateTo
28+
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
29+
import androidx.test.espresso.matcher.ViewMatchers.isRoot
30+
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
31+
import androidx.test.espresso.matcher.ViewMatchers.withId
32+
import androidx.test.rule.ActivityTestRule
33+
import androidx.test.uiautomator.UiDevice
3434
import com.google.samples.apps.sunflower.utilities.getToolbarNavigationContentDescription
3535
import org.junit.Assert.assertEquals
3636
import org.junit.Rule

app/src/androidTest/java/com/google/samples/apps/sunflower/PlantDetailFragmentTest.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ package com.google.samples.apps.sunflower
1818

1919
import android.accessibilityservice.AccessibilityService
2020
import android.content.Intent
21-
import android.support.test.InstrumentationRegistry
22-
import android.support.test.espresso.Espresso.onView
23-
import android.support.test.espresso.action.ViewActions.click
24-
import android.support.test.espresso.intent.Intents
25-
import android.support.test.espresso.intent.Intents.intended
26-
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction
27-
import android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra
28-
import android.support.test.espresso.intent.matcher.IntentMatchers.hasType
29-
import android.support.test.espresso.matcher.ViewMatchers.withId
30-
import android.support.test.rule.ActivityTestRule
31-
import android.support.test.runner.AndroidJUnit4
3221
import androidx.navigation.findNavController
22+
import androidx.test.InstrumentationRegistry
23+
import androidx.test.espresso.Espresso.onView
24+
import androidx.test.espresso.action.ViewActions.click
25+
import androidx.test.espresso.intent.Intents
26+
import androidx.test.espresso.intent.Intents.intended
27+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction
28+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra
29+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasType
30+
import androidx.test.espresso.matcher.ViewMatchers.withId
31+
import androidx.test.rule.ActivityTestRule
32+
import androidx.test.runner.AndroidJUnit4
3333
import com.google.samples.apps.sunflower.utilities.chooser
3434
import com.google.samples.apps.sunflower.utilities.testPlant
3535
import org.hamcrest.CoreMatchers.allOf

app/src/androidTest/java/com/google/samples/apps/sunflower/data/GardenPlantingDaoTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package com.google.samples.apps.sunflower.data
1818

19-
import android.arch.persistence.room.Room
20-
import android.support.test.InstrumentationRegistry
21-
import android.support.test.espresso.matcher.ViewMatchers.assertThat
19+
import androidx.room.Room
20+
import androidx.test.InstrumentationRegistry
21+
import androidx.test.espresso.matcher.ViewMatchers.assertThat
2222
import com.google.samples.apps.sunflower.utilities.getValue
2323
import com.google.samples.apps.sunflower.utilities.testCalendar
2424
import com.google.samples.apps.sunflower.utilities.testGardenPlanting

app/src/androidTest/java/com/google/samples/apps/sunflower/data/PlantDaoTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package com.google.samples.apps.sunflower.data
1818

19-
import android.arch.persistence.room.Room
20-
import android.support.test.InstrumentationRegistry
21-
import android.support.test.runner.AndroidJUnit4
19+
import androidx.room.Room
20+
import androidx.test.InstrumentationRegistry
21+
import androidx.test.runner.AndroidJUnit4
2222
import com.google.samples.apps.sunflower.utilities.getValue
2323
import org.hamcrest.Matchers.equalTo
2424
import org.junit.After

app/src/androidTest/java/com/google/samples/apps/sunflower/utilities/LiveDataTestUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.google.samples.apps.sunflower.utilities
1818

19-
import android.arch.lifecycle.LiveData
19+
import androidx.lifecycle.LiveData
2020
import java.util.concurrent.CountDownLatch
2121
import java.util.concurrent.TimeUnit
2222

app/src/androidTest/java/com/google/samples/apps/sunflower/utilities/TestUtils.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ package com.google.samples.apps.sunflower.utilities
1818

1919
import android.app.Activity
2020
import android.content.Intent
21-
import android.support.design.widget.CollapsingToolbarLayout
22-
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction
23-
import android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra
24-
import android.support.test.espresso.matcher.BoundedMatcher
25-
import android.support.v7.widget.Toolbar
2621
import android.view.View
22+
import androidx.appcompat.widget.Toolbar
23+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction
24+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra
25+
import androidx.test.espresso.matcher.BoundedMatcher
26+
import com.google.android.material.appbar.CollapsingToolbarLayout
2727
import com.google.samples.apps.sunflower.data.GardenPlanting
2828
import com.google.samples.apps.sunflower.data.Plant
2929
import org.hamcrest.Description

app/src/androidTest/java/com/google/samples/apps/sunflower/viewmodels/PlantDetailViewModelTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package com.google.samples.apps.sunflower.viewmodels
1818

19-
import android.arch.persistence.room.Room
20-
import android.support.test.InstrumentationRegistry
19+
import androidx.room.Room
20+
import androidx.test.InstrumentationRegistry
2121
import com.google.samples.apps.sunflower.data.AppDatabase
2222
import com.google.samples.apps.sunflower.data.GardenPlantingRepository
2323
import com.google.samples.apps.sunflower.data.PlantRepository

app/src/main/java/com/google/samples/apps/sunflower/GardenActivity.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
package com.google.samples.apps.sunflower
1818

19-
import android.databinding.DataBindingUtil
2019
import android.os.Bundle
21-
import android.support.v4.view.GravityCompat
22-
import android.support.v4.widget.DrawerLayout
23-
import android.support.v7.app.AppCompatActivity
20+
import androidx.appcompat.app.AppCompatActivity
21+
import androidx.core.view.GravityCompat
22+
import androidx.databinding.DataBindingUtil
23+
import androidx.drawerlayout.widget.DrawerLayout
2424
import androidx.navigation.Navigation
2525
import androidx.navigation.ui.NavigationUI
2626
import androidx.navigation.ui.setupWithNavController

app/src/main/java/com/google/samples/apps/sunflower/GardenFragment.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
package com.google.samples.apps.sunflower
1818

19-
import android.arch.lifecycle.Observer
20-
import android.arch.lifecycle.ViewModelProviders
2119
import android.os.Bundle
22-
import android.support.v4.app.Fragment
2320
import android.view.LayoutInflater
2421
import android.view.View
2522
import android.view.ViewGroup
23+
import androidx.fragment.app.Fragment
24+
import androidx.lifecycle.Observer
25+
import androidx.lifecycle.ViewModelProviders
2626
import com.google.samples.apps.sunflower.adapters.GardenPlantingAdapter
2727
import com.google.samples.apps.sunflower.databinding.FragmentGardenBinding
2828
import com.google.samples.apps.sunflower.utilities.InjectorUtils

0 commit comments

Comments
 (0)