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.app.Presentation | |
| import android.content.Context | |
| import android.graphics.Bitmap | |
| import android.graphics.Picture | |
| import android.graphics.SurfaceTexture | |
| import android.hardware.display.DisplayManager | |
| import android.view.Display | |
| import android.view.Surface | |
| import android.view.ViewGroup | |
| import androidx.compose.foundation.layout.Box |
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.Manifest | |
| import android.content.pm.PackageManager | |
| import android.util.Log | |
| import android.view.ViewGroup | |
| import androidx.activity.compose.rememberLauncherForActivityResult | |
| import androidx.activity.result.contract.ActivityResultContracts | |
| import androidx.camera.core.CameraSelector | |
| import androidx.camera.core.ImageAnalysis | |
| import androidx.camera.core.Preview | |
| import androidx.camera.lifecycle.ProcessCameraProvider |
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
| private const val NumDots = 5 | |
| private const val AnimationDuration = 2000 | |
| private const val AnimationSegment = AnimationDuration / 10 | |
| private val MainDotSize = 24.dp | |
| private val Float.alphaFromRadians: Float | |
| get() { | |
| val normalized = (this / (2f * PI)).toFloat() | |
| return .5f + (normalized - .5f).absoluteValue | |
| } |
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
| enum class TickOrientation { | |
| TOP, START, END, BOTTOM | |
| } | |
| class TooltipShape( | |
| private val cornerRadiusDp: Dp, | |
| private val tickHeight: Dp, | |
| private val tickOrientation: TickOrientation | |
| ) : Shape { |
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
| /* | |
| * Copyright 2020 The Android Open Source Project | |
| * | |
| * 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 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
| @Composable | |
| fun ClockText() { | |
| val currentTimeMillis = remember { | |
| mutableStateOf(System.currentTimeMillis()) | |
| } | |
| LaunchedEffect(key1 = currentTimeMillis) { | |
| while (true) { | |
| delay(250) | |
| currentTimeMillis.value = System.currentTimeMillis() |
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
| /** | |
| * Set this on a textview and then you can potentially open links locally if applicable | |
| */ | |
| public class DefaultLinkMovementMethod extends LinkMovementMethod { | |
| private OnLinkClickedListener mOnLinkClickedListener; | |
| public DefaultLinkMovementMethod(OnLinkClickedListener onLinkClickedListener) { | |
| mOnLinkClickedListener = onLinkClickedListener; | |
| } |
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 androidx.compose.animation.animateColorAsState | |
| import androidx.compose.animation.core.animateFloatAsState | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.layout.Box | |
| import androidx.compose.foundation.layout.RowScope | |
| import androidx.compose.foundation.layout.fillMaxSize | |
| import androidx.compose.foundation.layout.padding | |
| import androidx.compose.material.* | |
| import androidx.compose.material.icons.Icons | |
| import androidx.compose.material.icons.filled.Delete |
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 androidx.compose.foundation.layout.BoxWithConstraints | |
| import androidx.compose.foundation.layout.BoxWithConstraintsScope | |
| import androidx.compose.foundation.text.InlineTextContent | |
| import androidx.compose.foundation.text.InternalFoundationTextApi | |
| import androidx.compose.foundation.text.TextDelegate | |
| import androidx.compose.material.LocalTextStyle | |
| import androidx.compose.material.Text | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Alignment | |
| import androidx.compose.ui.Modifier |
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
| // ref: https://www.baeldung.com/java-aes-encryption-decryption | |
| import java.util.* | |
| import javax.crypto.Cipher | |
| import javax.crypto.spec.IvParameterSpec | |
| import javax.crypto.spec.SecretKeySpec | |
| fun decrypt(algorithm: String, cipherText: String, key: SecretKeySpec, iv: IvParameterSpec): String { | |
| val cipher = Cipher.getInstance(algorithm) |
NewerOlder