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 eu.micer.sample.util; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.support.annotation.NonNull; | |
import java.util.concurrent.Executor; | |
import java.util.concurrent.Executors; | |
public class AppExecutors { |
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 getErrorCodeName(int errorCode) { | |
Field[] fields = ErrorCodes.class.getDeclaredFields(); | |
for (Field f : fields) { | |
if (Modifier.isStatic(f.getModifiers()) | |
&& Modifier.isFinal(f.getModifiers())) { | |
try { | |
int value = f.getInt(new Object()); | |
if (value == errorCode) { | |
return f.getName(); | |
} |
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
private inline fun <T> TextView.updateOrHide(content: T?, action: TextView.(content: T) -> Unit) { | |
if (content != null) { | |
visibility = View.VISIBLE | |
action(content) | |
} else { | |
visibility = View.GONE | |
} | |
} |
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
int delay = 25; | |
observableRemainingTime.setValue(TIME_FOR_ANSWER); | |
timerDisposable = Observable.timer(delay, TimeUnit.MILLISECONDS, Schedulers.computation()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.repeatUntil(() -> time <= 0) | |
.subscribe(tick -> { | |
time = time - delay; | |
observableRemainingTime.setValue(time); | |
}, | |
Throwable::printStackTrace, |
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.content.Context | |
import timber.log.Timber.d | |
import java.security.KeyManagementException | |
import java.security.KeyStore | |
import java.security.NoSuchAlgorithmException | |
import java.security.SecureRandom | |
import java.security.cert.Certificate | |
import java.security.cert.CertificateException | |
import java.security.cert.CertificateFactory | |
import java.security.cert.X509Certificate |
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.content.ContentUris | |
import android.content.Context | |
import android.database.Cursor | |
import android.net.Uri | |
import android.os.Build | |
import android.os.Environment | |
import android.provider.DocumentsContract | |
import android.provider.MediaStore | |
import android.support.v4.content.CursorLoader | |
import android.text.TextUtils |
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.betvictor.casino.presentation.views | |
/* | |
* Copyright 2019 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 |