Skip to content

Instantly share code, notes, and snippets.

View qamarelsafadi's full-sized avatar

Qamar A. Safadi qamarelsafadi

View GitHub Profile
@Composable
fun ExpandableCard(
isOpenByDefault: Boolean = false,
title: String,
hasItem: Boolean = true,
padding: Dp = 15.dp,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
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)
class Decryptor {
private var keyStore: KeyStore? = null
init {
initKeyStore()
}
@Throws(
KeyStoreException::class,
class Encryptor {
lateinit var encryption: ByteArray
private set
lateinit var iv: ByteArray
private set
@Throws(
UnrecoverableEntryException::class,
NoSuchAlgorithmException::class,
KeyStoreException::class,
init {
System.loadLibrary("native-lib")
}
external fun secureText(): String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyApplicationTheme {
# 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.
//
// Created by Qamar Safadi on 16/06/2023.
//
#include <jni.h>
#include <string>
extern "C"
jstring
Java_com_qamar_myapplication_MainActivity_secureText(
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
// update your activity version
implementation 'androidx.activity:activity-ktx:1.7.1'
val pickMedia = registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri ->
// Callback is invoked after the user selects a media item or closes the
// photo picker.
if (uri != null) {
// do what you want with pic
} else {
import android.app.LocaleManager
import android.content.Context
import android.os.Build
import android.os.LocaleList
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat
import java.util.Locale
/// Change Langauage Extenstion