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 ExpandableCard( | |
isOpenByDefault: Boolean = false, | |
title: String, | |
hasItem: Boolean = true, | |
padding: Dp = 15.dp, | |
onClick: () -> Unit, | |
content: @Composable () -> Unit | |
) { |
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
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) |
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
class Decryptor { | |
private var keyStore: KeyStore? = null | |
init { | |
initKeyStore() | |
} | |
@Throws( | |
KeyStoreException::class, |
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
class Encryptor { | |
lateinit var encryption: ByteArray | |
private set | |
lateinit var iv: ByteArray | |
private set | |
@Throws( | |
UnrecoverableEntryException::class, | |
NoSuchAlgorithmException::class, | |
KeyStoreException::class, |
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
init { | |
System.loadLibrary("native-lib") | |
} | |
external fun secureText(): String | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
MyApplicationTheme { |
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
# 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. |
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
// | |
// Created by Qamar Safadi on 16/06/2023. | |
// | |
#include <jni.h> | |
#include <string> | |
extern "C" | |
jstring | |
Java_com_qamar_myapplication_MainActivity_secureText( |
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
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 |
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
// 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 { |
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.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 |
NewerOlder