Skip to content

Instantly share code, notes, and snippets.

interface CryptographyManager {
/**
* This method first gets or generates an instance of SecretKey and then initializes the Cipher
* with the key. The secret key uses [ENCRYPT_MODE][Cipher.ENCRYPT_MODE] is used.
*/
fun getInitializedCipherForEncryption(keyName: String): Cipher
/**
* This method first gets or generates an instance of SecretKey and then initializes the Cipher
Observable.just("Will")
.observeOn(Schedulers.io())
.flatMap({ name ->
updateUserName.execute(name) //returns another Observable<ApiResult> after calling the API
}, {
//this is executed after resolving the last observable emitted, so the result is ready.
name: String, apiResult: ApiResult -> Pair(name, apiResult)
})
.subscribe({ result ->
@Heroes84
Heroes84 / height.java
Created October 29, 2019 22:45 — forked from hamakn/height.java
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(