Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Learning

Pranav Lathigara pranavlathigara

🤓
Learning
  • Rajkot
View GitHub Profile
@pranavlathigara
pranavlathigara / DeCryptor.java
Created Nov 6, 2019 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
View DeCryptor.java
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@pranavlathigara
pranavlathigara / Cryptography.java
Created Nov 6, 2019 — forked from Diederikjh/Cryptography.java
Single class that handles encryption and decryption with keys using the Android `Keystore` API. Mostly inspired by this [blog post](https://medium.com/@ericfu/securely-storing-secrets-in-an-android-application-501f030ae5a3). This was tested with API 18 and 25 level emulator (and a level 23 device).
View Cryptography.java
package com.example.yourapp;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.security.KeyPairGeneratorSpec;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.support.annotation.RequiresApi;
View Multiple Click Issue Kotlin Extension Function
class SafeClickListener(
private var defaultInterval: Int = 1000,
private val onSafeCLick: (View) -> Unit
) : View.OnClickListener {
private var lastTimeClicked: Long = 0
override fun onClick(v: View) {
if (SystemClock.elapsedRealtime() - lastTimeClicked < defaultInterval) {
return
View BindExt.kt
import android.app.Activity
import android.support.annotation.IdRes
import android.view.View
fun <T : View> Activity.bind(@IdRes idRes: Int): Lazy<T> {
@Suppress("UNCHECKED_CAST")
return unsafeLazy { findViewById(idRes) as T }
}
fun <T : View> View.bind(@IdRes idRes: Int): Lazy<T> {
@pranavlathigara
pranavlathigara / IntroVideoView.java
Created Feb 11, 2019 — forked from vishhmakasana/IntroVideoView.java
In Android Play mp4 video as a background intro video in your app like latest freelancer app plays it on their intro page of android app.
View IntroVideoView.java
package com.example.videointro;
import java.io.IOException;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.os.Build;
import android.util.AttributeSet;
@pranavlathigara
pranavlathigara / README.md
Created Jan 30, 2019 — forked from lopspower/README.md
Hexadecimal color code for transparency
View README.md

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@pranavlathigara
pranavlathigara / AesCipher.java
Created Jan 24, 2019 — forked from demisang/AesCipher.java
AES/CBC/PKCS5Padding encrypt/decrypt PHP and JAVA example classes
View AesCipher.java
import android.support.annotation.Nullable;
import android.util.Base64;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@pranavlathigara
pranavlathigara / BaseActivity.java
Created Jan 22, 2019 — forked from sandeeptengale/BaseActivity.java
Sample code to create BaseActivity for Android
View BaseActivity.java
package com.vtuforum.android.views
import android.app.ProgressDialog
import android.os.Bundle
import android.support.design.widget.CoordinatorLayout
import android.support.v7.app.AppCompatActivity
import android.widget.FrameLayout
import android.widget.ImageButton
import android.widget.TextView
import com.vtuforum.vtustudies.R
@pranavlathigara
pranavlathigara / introrx.md
Created Dec 14, 2018 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@pranavlathigara
pranavlathigara / ActivityA.java
Created Feb 3, 2017
Stackoverflow answer, "Singleton in Android"
View ActivityA.java
package com.example.testSingleton;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {