This file contains hidden or 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
# your package name | |
import android.Manifest | |
import android.content.Context | |
import android.content.Intent | |
import android.content.pm.PackageManager | |
import android.net.Uri | |
import android.os.Build | |
import android.provider.Settings | |
import android.util.Log |
This file contains hidden or 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.util.Log | |
import com.google.firebase.firestore.CollectionReference | |
import com.google.firebase.firestore.Query | |
import com.google.firebase.firestore.ktx.firestore | |
import com.google.firebase.ktx.Firebase | |
import com.midsizemango.scribblergame.Constants.Companion.FIRESTORE | |
class FirestoreAPI(collectionName: String) { | |
private val db = Firebase.firestore | |
private var collectionRef: CollectionReference |
This file contains hidden or 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
fun Fragment.isGranted(permission: AppPermission) = run { | |
context?.let { | |
(PermissionChecker.checkSelfPermission(it, permission.permissionName | |
) == PermissionChecker.PERMISSION_GRANTED) | |
} ?: false | |
} | |
fun Fragment.shouldShowRationale(permission: AppPermission) = run { | |
shouldShowRequestPermissionRationale(permission.permissionName) | |
} |
This file contains hidden or 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
importScripts('https://www.gstatic.com/firebasejs/6.0.2/firebase-app.js'); | |
importScripts('https://www.gstatic.com/firebasejs/6.0.2/firebase-messaging.js') | |
// Initialize the Firebase app in the service worker by passing in the | |
// messagingSenderId. | |
firebase.initializeApp({ | |
'messagingSenderId': '324534114351' | |
}); | |
// Retrieve an instance of Firebase Messaging so that it can handle background |
This file contains hidden or 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
class GlideImageHelper(context: Context) : IImageProcess { | |
private val mGlideInstance = Glide.with(context) | |
override fun loadUrl(url: String, targetView: ImageView) { | |
mGlideInstance.load(url).into(targetView) | |
} | |
override fun loadUri(uri: Uri, targetView: ImageView) { | |
mGlideInstance.load(uri).into(targetView) |
This file contains hidden or 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
/** | |
* Kotlin Extensions for simpler, easier and funw way | |
* of launching of Activities | |
*/ | |
inline fun <reified T : Any> Activity.launchActivity ( | |
requestCode: Int = -1, | |
options: Bundle? = null, | |
noinline init: Intent.() -> Unit = {}) | |
{ |
This file contains hidden or 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
class JsoupOgTagParser(var urlToParse: String) : AsyncTask<Void, Void, Void?>() { | |
private var title: String? = null | |
private var desc: String? = null | |
private var image: String? = null | |
private var url: String? = null | |
private var listener: Listener? = null | |
override fun doInBackground(vararg voids: Void): Void? { | |
val con = Jsoup.connect(urlToParse) |
This file contains hidden or 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 android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import com.example.Foo; | |
import com.example.RecycledPagerAdapter; | |
public class FooAdapter extends RecycledPagerAdapter<FooViewHolder> { |
NewerOlder