Skip to content

Commit

Permalink
Convert Quickstart to AndroidX (firebase#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern authored Jun 13, 2019
1 parent ffa4157 commit de662b7
Show file tree
Hide file tree
Showing 240 changed files with 988 additions and 934 deletions.
18 changes: 9 additions & 9 deletions admob/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand All @@ -34,20 +34,20 @@ configurations.all {

dependencies {
implementation project(":internal:lintchecks")
implementation project(":internal:chooser")
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation project(":internal:chooserx")
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.browser:browser:1.0.0'

// [START gradle_play_config]
implementation 'com.google.firebase:firebase-ads:17.2.1'
// [END gradle_play_config]
implementation 'com.google.firebase:firebase-core:16.0.9'

androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31"
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.google.samples.quickstart.admobexample;

import android.support.test.espresso.IdlingResource;
import androidx.test.espresso.IdlingResource;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdView;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.google.samples.quickstart.admobexample;


import android.support.test.espresso.Espresso;
import android.support.test.espresso.ViewInteraction;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.LargeTest;
import androidx.test.espresso.Espresso;
import androidx.test.espresso.ViewInteraction;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.filters.LargeTest;

import com.google.samples.quickstart.admobexample.java.MainActivity;

Expand All @@ -15,13 +15,13 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;

@LargeTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.google.samples.quickstart.admobexample.java;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;

import com.google.samples.quickstart.admobexample.R;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.google.samples.quickstart.admobexample.kotlin

// [SNIPPET load_banner_ad]
// Load an ad into the AdView.
// [START load_banner_ad]
// [START_EXCLUDE]
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.google.android.gms.ads.AdListener

// [SNIPPET load_banner_ad]
// Load an ad into the AdView.
// [START load_banner_ad]
import com.google.android.gms.ads.AdRequest
// [START_EXCLUDE]
import com.google.android.gms.ads.InterstitialAd
import com.google.samples.quickstart.admobexample.R
import kotlinx.android.synthetic.main.activity_main.adView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.google.samples.quickstart.admobexample.kotlin

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import androidx.appcompat.app.AppCompatActivity
import com.google.samples.quickstart.admobexample.R

class SecondActivity : AppCompatActivity() {
Expand Down
2 changes: 2 additions & 0 deletions admob/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
4 changes: 2 additions & 2 deletions admob/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ include ':internal:lintchecks'
project(':internal:lintchecks').projectDir = file('../internal/lintchecks')
include ':internal:lint'
project(':internal:lint').projectDir = file('../internal/lint')
include ':internal:chooser'
project(':internal:chooser').projectDir = file('../internal/chooser')
include ':internal:chooserx'
project(':internal:chooserx').projectDir = file('../internal/chooserx')
14 changes: 7 additions & 7 deletions analytics/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

buildTypes {
Expand All @@ -29,18 +29,18 @@ configurations.all {

dependencies {
implementation project(":internal:lintchecks")
implementation project(":internal:chooser")
implementation project(":internal:chooserx")
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31"

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-analytics:16.5.0'

androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.0'
}

apply plugin: 'com.google.gms.google-services'
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package com.google.firebase.quickstart.analytics;


import android.support.annotation.StringRes;
import android.support.test.espresso.NoMatchingViewException;
import android.support.test.espresso.ViewInteraction;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.filters.LargeTest;
import androidx.annotation.StringRes;
import androidx.test.espresso.NoMatchingViewException;
import androidx.test.espresso.ViewInteraction;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.filters.LargeTest;

import com.google.firebase.quickstart.analytics.java.MainActivity;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeLeft;
import static android.support.test.espresso.action.ViewActions.swipeRight;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.swipeLeft;
import static androidx.test.espresso.action.ViewActions.swipeRight;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;

@LargeTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.fragment.app.Fragment;

import com.google.firebase.quickstart.analytics.R;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;

import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.quickstart.analytics.R;

Expand All @@ -57,7 +58,7 @@ public class MainActivity extends AppCompatActivity {
};

/**
* The {@link android.support.v4.view.PagerAdapter} that will provide fragments for each image.
* The {@link androidx.core.view.PagerAdapter} that will provide fragments for each image.
* This uses a {@link FragmentPagerAdapter}, which keeps every loaded fragment in memory.
*/
private ImagePagerAdapter mImagePagerAdapter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.google.firebase.quickstart.analytics.kotlin

import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.fragment.app.Fragment
import com.google.firebase.quickstart.analytics.R

/**
Expand Down Expand Up @@ -51,4 +51,4 @@ class ImageFragment : Fragment() {
return fragment
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package com.google.firebase.quickstart.analytics.kotlin
import android.content.Intent
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.view.ViewPager
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.ViewPager
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.quickstart.analytics.R
import kotlinx.android.synthetic.main.activity_main.pagerTabStrip
Expand All @@ -36,7 +36,7 @@ class MainActivity : AppCompatActivity() {
}

/**
* The [android.support.v4.view.PagerAdapter] that will provide fragments for each image.
* The [androidx.viewpager.widget.PagerAdapter] that will provide fragments for each image.
* This uses a [FragmentPagerAdapter], which keeps every loaded fragment in memory.
*/
private lateinit var imagePagerAdapter: ImagePagerAdapter
Expand Down
6 changes: 3 additions & 3 deletions analytics/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.google.firebase.quickstart.analytics.java.MainActivity">

<android.support.v4.view.PagerTabStrip
<androidx.viewpager.widget.PagerTabStrip
android:id="@+id/pagerTabStrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top" />

</android.support.v4.view.ViewPager>
</androidx.viewpager.widget.ViewPager>
2 changes: 2 additions & 0 deletions analytics/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true
4 changes: 2 additions & 2 deletions analytics/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ include ':internal:lintchecks'
project(':internal:lintchecks').projectDir = file('../internal/lintchecks')
include ':internal:lint'
project(':internal:lint').projectDir = file('../internal/lint')
include ':internal:chooser'
project(':internal:chooser').projectDir = file('../internal/chooser')
include ':internal:chooserx'
project(':internal:chooserx').projectDir = file('../internal/chooserx')
Loading

0 comments on commit de662b7

Please sign in to comment.