Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Complete kotlinization #48

Merged
merged 10 commits into from Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ build/
*.apk
*.aar
*.zip
.vscode
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -19,4 +19,6 @@ android:
# https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943
- tools
- tools
script: ./gradlew clean build
script:
- python scripts/checksnippets.py
- ./gradlew clean build
2 changes: 1 addition & 1 deletion admob/app/src/main/AndroidManifest.xml
Expand Up @@ -15,7 +15,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.firebase.example.admob.KotlinMainActivity" />
<activity android:name="com.google.firebase.example.admob.kotlin.MainActivity" />
</application>

</manifest>
@@ -1,10 +1,10 @@
package com.google.firebase.example.admob
package com.google.firebase.example.admob.kotlin

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.google.android.gms.ads.MobileAds

class KotlinMainActivity : AppCompatActivity() {
class MainActivity : AppCompatActivity() {

// [START ads_on_create]
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -15,4 +15,4 @@ class KotlinMainActivity : AppCompatActivity() {
}
// [END ads_on_create]

}
}
2 changes: 1 addition & 1 deletion admob/gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
8 changes: 4 additions & 4 deletions appindexing/app/src/main/AndroidManifest.xml
Expand Up @@ -24,11 +24,11 @@
</intent-filter>
</activity>

<activity android:name=".KotlinMainActivity" />
<activity android:name=".KotlinMeasureActivity" />
<activity android:name=".kotlin.MainActivity" />
<activity android:name=".kotlin.MeasureActivity" />

<receiver
android:name=".KotlinAppIndexingUpdateReceiver"
android:name=".kotlin.AppIndexingUpdateReceiver"
android:exported="true"
android:permission="com.google.android.gms.permission.APPINDEXING">
<intent-filter>
Expand Down Expand Up @@ -56,7 +56,7 @@
<!-- [END appindexing_service_manifest] -->

<service
android:name=".KotlinAppIndexingUpdateService"
android:name=".kotlin.AppIndexingUpdateService"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>

Expand Down
@@ -1,13 +1,14 @@
package com.google.firebase.example.appindexing
package com.google.firebase.example.appindexing.kotlin

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.google.firebase.appindexing.FirebaseAppIndex
import com.google.firebase.example.appindexing.AppIndexingUpdateService

// [START appindexing_update_receiver]
/** Receives broadcast for App Indexing Update. */
class KotlinAppIndexingUpdateReceiver : BroadcastReceiver() {
class AppIndexingUpdateReceiver : BroadcastReceiver() {

override fun onReceive(context: Context, intent: Intent?) {
if (intent != null && FirebaseAppIndex.ACTION_UPDATE_INDEX == intent.action) {
Expand All @@ -17,4 +18,4 @@ class KotlinAppIndexingUpdateReceiver : BroadcastReceiver() {
}

}
// [END appindexing_update_receiver]
// [END appindexing_update_receiver]
@@ -1,16 +1,17 @@
package com.google.firebase.example.appindexing
package com.google.firebase.example.appindexing.kotlin

import android.content.Context
import android.content.Intent
import android.support.v4.app.JobIntentService
import com.google.firebase.appindexing.FirebaseAppIndex
import com.google.firebase.appindexing.Indexable
import com.google.firebase.appindexing.builders.Indexables
import com.google.firebase.example.appindexing.AppIndexingUpdateService
import com.google.firebase.example.appindexing.model.Recipe
import java.util.*

// [START appindexing_update_service]
class KotlinAppIndexingUpdateService : JobIntentService() {
class AppIndexingUpdateService : JobIntentService() {
// Job-ID must be unique across your whole app.
private val UNIQUE_JOB_ID = 42

Expand Down Expand Up @@ -50,4 +51,4 @@ class KotlinAppIndexingUpdateService : JobIntentService() {
}
// [END_EXCLUDE]
}
// [END appindexing_update_service]
// [END appindexing_update_service]
@@ -1,4 +1,4 @@
package com.google.firebase.example.appindexing
package com.google.firebase.example.appindexing.kotlin

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
Expand All @@ -10,7 +10,7 @@ import com.google.firebase.example.appindexing.interfaces.MainActivityInterface
import com.google.firebase.example.appindexing.model.Note
import com.google.firebase.example.appindexing.model.Recipe

class KotlinMainActivity : AppCompatActivity(), MainActivityInterface {
class MainActivity : AppCompatActivity(), MainActivityInterface {
lateinit var mNote: Note

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -79,4 +79,4 @@ class KotlinMainActivity : AppCompatActivity(), MainActivityInterface {
return null
}

}
}
@@ -1,4 +1,4 @@
package com.google.firebase.example.appindexing
package com.google.firebase.example.appindexing.kotlin

import android.net.ParseException
import android.net.Uri
Expand All @@ -9,7 +9,7 @@ import com.google.firebase.appindexing.AndroidAppUri
import com.google.firebase.example.appindexing.interfaces.MeasureActivityInterface

// [START appindexing_measure_activity]
class KotlinMeasureActivity : AppCompatActivity(), MeasureActivityInterface {
class MeasureActivity : AppCompatActivity(), MeasureActivityInterface {

override fun getReferrer() : Uri? {

Expand Down Expand Up @@ -74,4 +74,4 @@ class KotlinMeasureActivity : AppCompatActivity(), MeasureActivityInterface {
}

}
// [END appindexing_measure_activity]
// [END appindexing_measure_activity]
2 changes: 1 addition & 1 deletion appindexing/gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
2 changes: 1 addition & 1 deletion auth/app/src/main/AndroidManifest.xml
Expand Up @@ -15,7 +15,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".KotlinMainActivity" />
<activity android:name=".kotlin.MainActivity" />
<activity android:name=".FirebaseUIActivity"></activity>
</application>

Expand Down
Expand Up @@ -11,13 +11,13 @@
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.quickstart.auth.interfaces.FirebaseUIActivityInterface;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

// TODO: kotlin
public class FirebaseUIActivity extends AppCompatActivity {
public class FirebaseUIActivity extends AppCompatActivity implements FirebaseUIActivityInterface {

private static final int RC_SIGN_IN = 123;

Expand All @@ -27,6 +27,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_firebase_ui);
}

@Override
public void createSignInIntent() {
// [START auth_fui_create_intent]
// Choose authentication providers
Expand Down Expand Up @@ -69,6 +70,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
// [END auth_fui_result]

@Override
public void signOut() {
// [START auth_fui_signout]
AuthUI.getInstance()
Expand All @@ -81,6 +83,7 @@ public void onComplete(@NonNull Task<Void> task) {
// [END auth_fui_signout]
}

@Override
public void delete() {
// [START auth_fui_delete]
AuthUI.getInstance()
Expand All @@ -94,6 +97,7 @@ public void onComplete(@NonNull Task<Void> task) {
// [END auth_fui_delete]
}

@Override
public void themeAndLogo() {
List<AuthUI.IdpConfig> providers = Collections.emptyList();

Expand All @@ -109,6 +113,7 @@ public void themeAndLogo() {
// [END auth_fui_theme_logo]
}

@Override
public void privacyAndTerms() {
List<AuthUI.IdpConfig> providers = Collections.emptyList();
// [START auth_fui_pp_tos]
Expand Down