Skip to content

Instantly share code, notes, and snippets.

Alex Zhukovich AlexZhukovich

Block or report user

Report or block AlexZhukovich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AlexZhukovich
AlexZhukovich / Analytics.kt
Last active Aug 19, 2019
Android ProcessLifecycleOwner 
by example - source code for article https://alexzh.com/2019/08/19/android-processlifecycleowner-by-example/
View Analytics.kt
class Analytics {
private var startSessionTimestamp: Long = -1
private val reporters = mutableListOf<AnalyticsReporter>()
fun addReporter(reporter: AnalyticsReporter) {
reporters.add(reporter)
}
fun startSession() {
startSessionTimestamp = Date().time
@AlexZhukovich
AlexZhukovich / Dependencies
Created Feb 1, 2019
Sharing test cases between local and instrumentation tests - dependencies
View Dependencies
dependencies {
...
// Robolectric
testImplementation "org.robolectric:robolectric:$robolectric_version" // 4.1
// Android test runner and rules
androidTestImplementation "androidx.test:runner:$test_runner_version" // 1.1.0
androidTestImplementation "androidx.test:core:$test_core_version" // 1.1.0
androidTestImplementation "androidx.test.ext:junit:$test_junit_version" // 1.1.0
androidTestImplementation "androidx.test:rules:$test_rules_version" // 1.1.0
View TestDataFactory
object TestDataFactory {
fun randomString(): String {
return UUID.randomUUID().toString()
}
fun randomDouble(): Double {
return Math.random()
}
View EmptyRecyclerView.java
package com.alexzh.recyclerviewsetemptyview;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
public class EmptyRecyclerView extends RecyclerView {
private View mEmptyView;
View app-module-build.gradle
//ExternalModulesInProject/Application/app
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.alexzh.application"
minSdkVersion 14
targetSdkVersion 25
@AlexZhukovich
AlexZhukovich / module-build.gradle
Last active Oct 23, 2017
Versions managing of dependencies in Gradle
View module-build.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.alexzh.temperatureconverter"
minSdkVersion 14
You can’t perform that action at this time.