Skip to content

Instantly share code, notes, and snippets.

public class ApplicationSingleton extends Application {
public static ApplicationSingleton ourInstance;
public ApplicationSingleton() {}
@Override
public void onCreate(){
super.onCreate();
ourInstance = this;
@antonkazakov
antonkazakov / Mover.kt
Last active July 2, 2017 20:40
Move all sizes of drawable from one module to another
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
import java.util.*
/**
* Created by antonkazakov on 26.06.17.
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.greencode.kotlinsimplemvp"
/**
*
* This module provides all network dependencies like OkHttpClient with interceptors,
* Retrofit, GSON and RetrofitConverters.
*
* Any network dependency should go there.
*
* @author Anton Kazakov
* @date 29.03.17.
*/
@Override
@SuppressWarnings("deprecation")
public Observable<SimpleLocation> getMyLocation() {
return Observable.fromEmitter(new Action1<Emitter<Location>>() {
@Override
public void call(Emitter<Location> tEmitter) {
LocationListener locationListener = tEmitter::onNext;
GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener = connectionResult -> tEmitter.onError(new LocationUnavailableException("ERROR"));
GoogleApiClient.ConnectionCallbacks connectionCallbacks = new GoogleApiClient.ConnectionCallbacks() {
/**
* Created by antonkazakov on 15.11.16.
*/
public class SeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener {
private int mProgress;
private int MAX = 20;
public SeekBarPreference(Context context) {
this(context, null, 0);
public abstract class BaseFragment extends Fragment {
private Unbinder unbinder;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
injectDependencies(AppDelegate.getAppComponent(AppDelegate.getContext()));
}