Skip to content

Instantly share code, notes, and snippets.

View qamarelsafadi's full-sized avatar

Qamar A. Safadi qamarelsafadi

View GitHub Profile
enum class ValidationType {
Text, Phone, Email, Password
}
data class InputWrapper(
var inputValue: MutableState<String> = mutableStateOf(""),
var borderColor: String = Gray,
val validationType: ValidationType? = ValidationType.Text
) {
var validationMessageResourceId: Int = R.string.empty_lbl
//
// Created by Qamar Safadi on 16/06/2023.
//
#include <jni.h>
#include <string>
extern "C"
jstring
Java_com_qamar_myapplication_MainActivity_secureText(
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.
# Gradle automatically packages shared libraries with your APK.
init {
System.loadLibrary("native-lib")
}
external fun secureText(): String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
class Encryptor {
lateinit var encryption: ByteArray
private set
lateinit var iv: ByteArray
private set
@Throws(
UnrecoverableEntryException::class,
NoSuchAlgorithmException::class,
KeyStoreException::class,
class Decryptor {
private var keyStore: KeyStore? = null
init {
initKeyStore()
}
@Throws(
KeyStoreException::class,
class MainActivity : AppCompatActivity() {
lateinit var encryptor: Encryptor
private val SAMPLE_ALIAS = BuildConfig.MY_ALIAS // save your ALIAS key in local.properties for more security
init {
encryptText()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@Composable
fun ExpandableCard(
isOpenByDefault: Boolean = false,
title: String,
hasItem: Boolean = true,
padding: Dp = 15.dp,
onClick: () -> Unit,
content: @Composable () -> Unit
) {