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 java.text.DateFormat; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.Locale; | |
import java.util.TimeZone; | |
import java.util.concurrent.TimeUnit; | |
public class HelloWorld { |
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
100% — FF | |
95% — F2 | |
90% — E6 | |
85% — D9 | |
80% — CC | |
75% — BF | |
70% — B3 | |
65% — A6 | |
60% — 99 | |
55% — 8C |
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 void getKeyHash(Context context) { | |
try { | |
PackageInfo info = getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), PackageManager.GET_SIGNATURES); | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
Log.i("Base64", Base64.encodeToString(md.digest(),Base64.NO_WRAP)); | |
} | |
} catch (PackageManager.NameNotFoundException e) { | |
Log.d("Name not found", e.getMessage(), e); |
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
// ./gradlew clean build generateRelease | |
apply plugin: 'maven' | |
def groupId = project.PUBLISH_GROUP_ID | |
def artifactId = project.PUBLISH_ARTIFACT_ID | |
def version = project.PUBLISH_VERSION | |
def localReleaseDest = "${buildDir}/release/${version}" | |
task androidJavadocs(type: Javadoc) { |
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 org.apache.commons.io.filefilter.DirectoryFileFilter; | |
import org.apache.commons.io.filefilter.WildcardFileFilter; | |
import java.io.File; | |
import java.io.FileFilter; | |
import java.io.FilenameFilter; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; |
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
/** | |
@author ${USER} | |
@since ${DAY_NAME_SHORT}, ${MONTH_NAME_FULL} ${DAY}, ${YEAR} | |
@version 1.0 | |
**/ |
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 ScopingFunctions { | |
fun main() { | |
val firstPerson = Person("Prokash", 28, "Programmer") | |
val secondPerson = Person("Elizabeth", 34, "Singer") | |
//Calls the specified function block with this value as its receiver and returns its result. | |
run { | |
if (firstPerson.age > secondPerson.age) firstPerson else secondPerson | |
}.printPerson() |
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
fun <T> LiveData<T>.toFlowable(owner: LifecycleOwner): Flowable<T> = | |
Flowable.fromPublisher(LiveDataReactiveStreams.toPublisher(owner, this)) | |
fun <T> Flowable<T>.toLiveData(): LiveData<T> = LiveDataReactiveStreams.fromPublisher(this) |
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
abstract class BaseViewModel: ViewModel() | |
{ | |
protected val _viewState: MutableLiveData<ViewState> = MutableLiveData() | |
// don't expose the MutableLiveData outside of the class | |
val viewState: LiveData<ViewState> | |
get() = _viewState // only getter / no setter | |
fun setViewState(viewState: ViewState){ |
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 AuthenticationInterceptor @Inject constructor(baseUrl: String, jwtToken: String) : | |
Interceptor { | |
private var baseUrl: HttpUrl | |
private var jwtToken: String | |
companion object { | |
private const val LOG_TAG = "AuthenticationInterceptor:" | |
private const val AUTHORIZATION = "Authorization" | |
private const val BEARER = "Bearer" |
OlderNewer