class SimpleSingleton {
private static SimpleSingleton sInstance;
private SimpleSingleton() {}
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
| Apache License | |
| Version 2.0, January 2004 | |
| http://www.apache.org/licenses/ | |
| TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
| 1. Definitions. | |
| "License" shall mean the terms and conditions for use, reproduction, | |
| and distribution as defined by Sections 1 through 9 of this document. |
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
| import android.annotation.SuppressLint | |
| import android.content.ContentUris | |
| import android.content.Context | |
| import android.content.CursorLoader | |
| import android.database.Cursor | |
| import android.net.Uri | |
| import android.os.Build | |
| import android.os.Environment | |
| import android.provider.DocumentsContract | |
| import android.provider.MediaStore |
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
| public class DecryptKey { | |
| //before you proceed, you need to ensure your public key is PKCS8 since that is what can be read natively in java. | |
| //If your key begins with-----BEGIN CERTIFICATE-----, | |
| // the it is ssleay and you need to convert it using the openssl command below | |
| //openssl pkcs8 -topk8 -inform pem -in public.key -outform pem -nocrypt -out pkcs8-public-key.pem | |
| //TODO You can you phpsecLib lib but it doesn't support some Library | |
| //opnssl work fine | |
| final private static String RSA_PRIVATE_KEY = | |
| -----BEGIN PUBLIC KEY----- | |
| MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzTrKt2Y7HqQpt8w379Sl |
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
| /** | |
| * An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has | |
| * already been handled. | |
| * | |
| * [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled. | |
| */ | |
| class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> { | |
| override fun onChanged(event: Event<T>?) { | |
| event?.getContentIfNotHandled()?.let { value -> | |
| onEventUnhandledContent(value) |
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
| import android.graphics.Canvas; | |
| import android.graphics.Paint; | |
| import android.support.annotation.NonNull; | |
| import android.text.Editable; | |
| import android.text.Spannable; | |
| import android.text.TextWatcher; | |
| import android.text.style.ReplacementSpan; | |
| public class ExpiryDateTextWatcher implements TextWatcher { | |
| private int maxLength = 5; |
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
| import android.app.Activity; | |
| import android.content.res.Configuration; | |
| import android.content.res.Resources; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.util.Log; | |
| import android.graphics.Point; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.ColorDrawable; | |
| import android.util.DisplayMetrics; |
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 | |
| # Download Postman | |
| cd /tmp || exit | |
| echo "Downloading Postman..." | |
| wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz | |
| # Extract and install Postman to /opt | |
| echo "Extracting and installing to /opt..." | |
| sudo tar -xzf postman.tar.gz -C /opt/ |
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
| public abstract class OnItemVisibleChangeListener extends RecyclerView.OnScrollListener { | |
| private static final String TAG = OnItemVisibleChangeListener.class.getSimpleName(); | |
| private int mFirstVisibleItemPosition = RecyclerView.NO_POSITION; | |
| private int mFirstCompletelyVisibleItemPosition = RecyclerView.NO_POSITION; | |
| private int mLastVisibleItemPosition = RecyclerView.NO_POSITION; | |
| private int mLastCompletelyVisibleItemPosition = RecyclerView.NO_POSITION; | |
| @Override | |
| public void onScrolled(RecyclerView recyclerView, int dx, int dy) { |
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
| # These rules refer: https://developer.android.com/studio/run/device.html | |
| # and include many suggestions from Arch Linux, GitHub and other Communities. | |
| # Latest version can be found at: https://github.com/M0Rf30/android-udev-rules | |
| # Skip this section below if this device is not connected by USB | |
| SUBSYSTEM!="usb", GOTO="android_usb_rules_end" | |
| LABEL="android_usb_rules_begin" | |
| # Devices listed here in android_usb_rules_{begin...end} are connected by USB | |
| # Acer |