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 androidx.compose.runtime.Composable | |
import androidx.compose.ui.platform.LocalInspectionMode | |
import com.google.accompanist.permissions.ExperimentalPermissionsApi | |
import com.google.accompanist.permissions.PermissionState | |
import com.google.accompanist.permissions.PermissionStatus | |
/** | |
* Wrapper for [com.google.accompanist.permissions.rememberPermissionState] to grant permissions when in Inspection mode |
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
@Composable | |
fun CameraPreview( | |
modifier: Modifier = Modifier, | |
scaleType: PreviewView.ScaleType = PreviewView.ScaleType.FILL_CENTER, | |
cameraSelector: CameraSelector = CameraSelector.DEFAULT_FRONT_CAMERA | |
) { | |
val lifecycleOwner = LocalLifecycleOwner.current | |
AndroidView( | |
modifier = modifier, | |
factory = { context -> |
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
#!/usr/bin/python | |
import http.client | |
import httplib2 | |
import os | |
import random | |
import sys | |
import time | |
from apiclient.discovery import build |
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 android.content.Context | |
import android.nfc.tech.MifareClassic | |
object NfcUtils { | |
fun Context.isMifareClassicCompatible(): Boolean = | |
packageManager.systemAvailableFeatures.any { it.name == "com.nxp.mifare" } |
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 android.app.Activity | |
import android.nfc.NfcAdapter | |
import android.nfc.Tag | |
import androidx.lifecycle.DefaultLifecycleObserver | |
import androidx.lifecycle.LifecycleOwner | |
class NfcTagLifecycleObserver( | |
private val activity: Activity, |
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 io.reactivex.rxjava3.disposables.Disposable | |
import io.reactivex.rxjava3.exceptions.CompositeException | |
import io.reactivex.rxjava3.exceptions.Exceptions | |
import io.reactivex.rxjava3.internal.util.ExceptionHelper | |
/** | |
* A disposable that can hold onto multiple other Disposables | |
* and only keeps the last Disposable added with the same key. |
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 android.content.Context | |
import android.graphics.Canvas | |
import android.graphics.Paint | |
import android.graphics.Rect | |
import android.graphics.Typeface | |
import android.text.TextPaint | |
import android.util.AttributeSet | |
import com.google.android.material.textfield.TextInputEditText |
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.graphics.ImageFormat | |
import android.graphics.Rect | |
import android.graphics.YuvImage | |
import android.media.Image | |
import com.bumptech.glide.Priority | |
import com.bumptech.glide.load.DataSource | |
import com.bumptech.glide.load.data.DataFetcher | |
import java.io.ByteArrayOutputStream | |
import java.nio.ByteBuffer |
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 android.view.View | |
import android.view.ViewGroup | |
import androidx.annotation.Px | |
import androidx.core.view.ViewCompat | |
import androidx.core.view.updateLayoutParams | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.viewpager2.widget.ViewPager2 |
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.utils | |
import androidx.viewpager2.widget.ViewPager2 | |
object ViewPagerUtils { | |
fun ViewPager2.scrollToLastPosition() { | |
val lastPosition = adapter?.itemCount?.minus(1) ?: 0 | |
if (currentItem != lastPosition) { | |
currentItem = lastPosition |
NewerOlder