Kotlin Tools for Android ViewModel, LiveData, Data Binding, Dependency injection, Async operations, Repository pattern, Retrofit, Form Validation, Cloud Firestore, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NotificationUtils extends ContextWrapper { | |
public static final String ANDROID_CHANNEL_ID = "com.androidstuff.tutsplustalerts.ANDROID"; | |
public static final String IOS_CHANNEL_ID = "com.androidstuff.tutsplustalerts.IOS"; | |
public static final String ANDROID_CHANNEL_NAME = "ANDROID CHANNEL"; | |
public static final String IOS_CHANNEL_NAME = "IOS CHANNEL"; | |
private NotificationManager notificationManager; | |
//.. | |
public NotificationUtils(Context base) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.Manifest; | |
import android.annotation.TargetApi; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.content.IntentSender; | |
import android.content.pm.PackageManager; | |
import android.location.Location; | |
import android.net.Uri; | |
import android.os.Build; | |
import android.os.Bundle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2014 Antonio Leiva Gordillo. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//{ Locate follows into your class | |
public static class ApplicationInfo { | |
public String label; | |
public String name; | |
public String packageName; | |
public Drawable icon; | |
@Override | |
public String toString() { | |
return "label:" + label + " name:" + name + " packageName:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.arekolek.diffutil | |
import android.arch.lifecycle.* | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.support.v7.util.DiffUtil | |
import android.support.v7.widget.RecyclerView | |
import android.util.Log | |
import android.view.LayoutInflater | |
import android.view.View |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.android.build.gradle.AppPlugin | |
task consolidateJunitXml { | |
description 'Copies JUnit XML reports into a single directory so SonarQube can import them all' | |
doLast { | |
def dest = file("${buildDir}/allJunit") | |
delete dest | |
copy { | |
from "${buildDir}/test-results/debug" | |
into dest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import okhttp3.ResponseBody; | |
import retrofit2.Response; | |
import retrofit2.Retrofit; | |
import retrofit2.RxJavaCallAdapterFactory; | |
import retrofit2.http.GET; | |
import retrofit2.http.Path; | |
import retrofit2.http.Url; | |
import rx.Observable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom implementation of AdapterDataObserver to show empty layouts | |
* for RecyclerView when there's no data | |
* | |
* Usage: | |
* | |
* adapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerView, emptyView)); | |
*/ | |
public class RVEmptyObserver extends RecyclerView.AdapterDataObserver { | |
private View emptyView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tinmegali.daggerwithkotlin.room | |
import android.arch.lifecycle.LiveData | |
import android.arch.lifecycle.Observer | |
import java.util.concurrent.CountDownLatch | |
import java.util.concurrent.TimeUnit | |
// Extension to allow unit tests on LiveData | |
// discussion on: https://stackoverflow.com/questions/44270688/unit-testing-room-and-livedata |
OlderNewer