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
/* | |
* Copyright (C) 2010 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 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 static android.graphics.BitmapFactory.decodeResource; | |
import static com.google.common.base.Optional.fromNullable; | |
public static final Double MAX_MEMORY_ALLOCATION = 6E6; | |
/** | |
* This method loads a bitmap from the resources respecting the max memory an image should take in memory | |
* @param imageResource | |
* @param context | |
* @return |
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 android.support.v7.widget.AppCompatEditText; | |
import android.text.Editable; | |
import android.text.InputFilter; | |
import android.text.InputType; | |
import android.text.Spanned; | |
import android.text.TextWatcher; | |
import android.text.method.DigitsKeyListener; | |
import android.util.AttributeSet; |
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.util.concurrent.TimeUnit; | |
import io.reactivex.Observable; | |
import io.reactivex.ObservableSource; | |
import io.reactivex.ObservableTransformer; | |
import io.reactivex.Observer; | |
import io.reactivex.functions.Consumer; | |
public static class CacheObservable<T> implements ObservableTransformer<T, T> { | |
private final long timeout; |
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 joaocsousa.github.com.myapplication; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.annotation.StringRes; | |
import android.support.v4.view.LayoutInflaterCompat; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.AttributeSet; | |
import android.view.LayoutInflater; |
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 class Main { | |
public static final long START_TIME = System.currentTimeMillis(); | |
public static void main(String[] args) throws InterruptedException { | |
SingletonTask singletonTask = singletonTask(); | |
singletonTask.getObservable() | |
.subscribeOn(Schedulers.newThread()) |
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
// how to use | |
SafeZip.zip(single1, single2, ::merge).subscribe(...) |
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 datetime | |
import time | |
ano = datetime.date.today().year | |
proxinoAno = ano + 1 | |
while (True): | |
agora = datetime.datetime.now() | |
primeiroDiaProximoAno = datetime.datetime(proxinoAno, 1, 1, 0, 0, 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
//region initializing the logger using the application object or any other way | |
class CoreApplication : Application() { | |
private val initializer by inject<LogInitializer>() | |
override fun onCreate() { | |
super.onCreate() | |
initializer.initialize() | |
} | |
} | |
interface LogInitializer { |