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 2025 Ed Holloway-George • spght.dev | |
| 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
| package dev.spght.example.text | |
| import android.content.Context | |
| import android.graphics.Canvas | |
| import android.text.Spanned | |
| import android.text.TextPaint | |
| import android.util.AttributeSet | |
| import android.view.View | |
| import androidx.text.vertical.VerticalTextLayout |
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
| #!/bin/zsh | |
| # This script will verify your gradle-wrapper.jar | |
| # file's integrity for your project's Gradle version | |
| # For more info, see: | |
| # https://docs.gradle.org/current/userguide/gradle_wrapper.html#manually_verifying_the_gradle_wrapper_jar | |
| # | |
| # Usage: ./gradle-wrapper-verify.sh | |
| # Use within $PROJ_ROOT/gradle/wrapper folder |
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
| #! /bin/bash | |
| # To use: | |
| # Copy this file to the root of your Android Project | |
| # chmod +x trackSynthetics.sh | |
| # ./trackSynthetics.sh | tee results.csv | |
| # Open CSV file in your choice of spreadsheet software | |
| start=2022-02-23 # Date to start tracking | |
| end=2022-08-19 # Date to end tracking |
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
| val Context.dataStore by preferencesDataStore(name = "insecure-data-store") | |
| val pref1 = stringPreferencesKey("example_pref") | |
| val pref2 = stringPreferencesKey("example_pref_2") | |
| dataStore.edit { settings -> | |
| settings[pref1] = "My 1st Pref" | |
| settings[pref2] = "My 2nd Pref" | |
| } |
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
| // Use a user-entered passphrase to encrypt/decrypt | |
| val passPhrase: ByteArray = "password".encodeToByteArray() | |
| val sqlCipherSupportFactory: SupportSQLiteOpenHelper.Factory = SupportFactory(passPhrase) | |
| val database = Room.databaseBuilder( | |
| applicationContext, | |
| YourRoomDatabase::class.java, | |
| "secure-database") | |
| .openHelperFactory(sqlCipherSupportFactory) | |
| .build() |
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
| <map> | |
| <string name="ARTYCGdkOdwAqjLCjWdsepYfbO+lJzJFFrHIta8JSE0=">ASTonpk6n1buL/VN6mB/S95HNcyHzvFp5qbcpkJMjSQbqRkzO3HWe5KKcP6eTwtzIFamU3Ag</string> | |
| <string name="__androidx_security_crypto_encrypted_prefs_key_keyset__">12a90155259183605a12481ccf406838afc98126862109cc5e083185fe7259a052ccb4d1f859ac62ee1ab624f4b35df36c53a23c24547ee322aacc4526a654fd99e9997c0e6bf389b3bf2706a2e29b63d99a1e74535d68457fda16f04e706f127ca09c01622e26db72339720e814af1d6533efc8705eb8a073fa4e5afb2dbfb9446eaa27801942e0c8a8462ff6aed86738f500cdb77655294549810c2cfbe011b4c3900e3504eb3947502c7c1a4408e790e0a601123c0a30747970652e676f6f676c65617069732e636f6d2f676f6f676c652e63727970746f2e74696e6b2e4165735369764b6579100118e790e0a6012001</string> | |
| <string name="__androidx_security_crypto_encrypted_prefs_value_keyset__">128801700a3e737db7b3f8385be4aea6f74fbb844b86532055fa99032c67df4c5a5543e799dd9a621013ba716749b3decef994896914cea1d8dbf25fc13e6a7c6f19a0488dbd4a339642f4bfc4ad82fe1b27b4d4ca0a79c55e57354389f7c2e115af8c0d6f8fff0093299c2481a6cf25b5 |
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
| val masterKey = MasterKey.Builder(this) | |
| .setKeyScheme(MasterKey.KeyScheme.AES256_GCM) | |
| .build() | |
| EncryptedSharedPreferences.create(this, "myEncryptedPrefsFile", masterKey, PrefKeyEncryptionScheme.AES256_SIV, PrefValueEncryptionScheme.AES256_GCM).edit { | |
| putString("mySecretKey", "mySecretValue") | |
| } |
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
| val prefs = context?.getSharedPreferences("mySharedPrefFile", Context.MODE_PRIVATE) ?: return | |
| // Store some credentials we might not want others to read | |
| prefs.edit().putString("mySecretKey", "mySecretValue").apply() |
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
| <!-- In the main application --> | |
| <permission android:name="dev.spght.permission.example.MY_PERMISSION" | |
| android:protectionLevel="signature" | |
| android:label="A custom permission" /> | |
| <!-- In the secondary application --> | |
| <uses-permission android:name="dev.spght.permission.example.MY_PERMISSION"/> |
NewerOlder