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
PublishSubject<Long> animationTimer; | |
Subscription animationSubscription; | |
animationSubscription = Observable.interval(1, TimeUnit.SECONDS) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribeOn(Schedulers.newThread()) | |
.subscribe(animationTimer = PublishSubject.create()); |
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 org.firezenk.utils; | |
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.util.Log; | |
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
onTrimMemory(int level) |
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
case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW: | |
case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL: |
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 static final int DEFAULT_THRESHOLD_PERCENTAGE = 10; |
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 totalMemorySize(): Long { | |
val path: File = Environment.getDataDirectory() | |
val stat: StatFs = StatFs(path.getPath()) | |
return stat.getBlockCountLong() * stat.getBlockSizeLong() | |
} |
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 isLowMemory(): Boolean { | |
val memoryLimit: Long = (getTotalInternalMemorySize() * DEFAULT_THRESHOLD_PERCENTAGE) / 100; | |
return availableMemorySize() <= tenPercentLimit; | |
} |
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 availableMemorySize(): Long { | |
val path: File = Environment.getDataDirectory() | |
val stat: StatFs = StatFs(path.getPath()) | |
return stat.getAvailableBlocksLong() * stat.getBlockSizeLong() | |
} |
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
plop.addHelper('lowerCase', (text) => text.toLowerCase()); |