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.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; |
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 SizeHelper @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : ConstraintHelper(context, attrs, defStyleAttr) { | |
private val screenHeight: Int = resources.displayMetrics.heightPixels | |
private val screenWidth: Int = resources.displayMetrics.widthPixels | |
private var layoutConstraintScreenHeightPercent = UNSPECIFIED_CONSTRAINT_SCREEN_PERCENT |
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
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 |
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
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME} | |
import android.support.v7.widget.RecyclerView | |
import android.view.View | |
import android.view.ViewGroup | |
#end | |
#parse("File Header.java") | |
class ${NAME}(private var items: MutableList<${ITEM_TYPE}>): RecyclerView.Adapter<${VIEWHOLDER}>() { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ${VIEWHOLDER} { |
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.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; |
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
// from http://developer.gstsystem.co.in/apiportal/howToStart/download | |
package org.gst.poc.util; | |
import java.util.Scanner; | |
public class GSTINValidator { | |
public static final String GSTINFORMAT_REGEX = "[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}"; | |
public static final String GSTN_CODEPOINT_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
public static void main(String args[]) { |
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
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* 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 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 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; |
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
object PreferenceHelper { | |
fun defaultPrefs(context: Context): SharedPreferences | |
= PreferenceManager.getDefaultSharedPreferences(context) | |
fun customPrefs(context: Context, name: String): SharedPreferences | |
= context.getSharedPreferences(name, Context.MODE_PRIVATE) | |
inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) { | |
val editor = this.edit() |
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
public static String decrypt(@NotNull String input, @NotNull String key){ | |
byte[] bytes = Base64.decodeBase64(input); | |
if(bytes.length < 17) { | |
return null; | |
} | |
byte[] ivBytes = Arrays.copyOfRange(bytes, 0, 16); | |
byte[] contentBytes = Arrays.copyOfRange(bytes, 16, bytes.length); | |
NewerOlder