Original solution sacrifices new api lint check.
Here my solution:
int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
/* | |
* Hex Opacity Values | |
*/ | |
100% — FF | |
95% — F2 | |
90% — E6 | |
85% — D9 | |
80% — CC | |
75% — BF |
public Observable<FilesWrapper> download(List<Thing> things) { | |
return Observable.from(things) | |
.flatMap(thing -> { | |
File file = new File(getExternalCacheDir() + File.separator + thing.getName()); | |
if (file.exists()) { | |
return Observable.just(file); | |
} | |
Request request = new Request.Builder().url(thing.getUrl()).build(); |
package com.example; | |
import android.content.Intent; | |
import android.widget.Button; | |
import com.example.MockSupport; | |
import org.junit.Before; | |
import org.junit.Rule; | |
import org.junit.Test; |
Original solution sacrifices new api lint check.
Here my solution:
int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
// retries up to 3 times while exponentially backing off with each retry | |
.retryWhen(errors -> | |
errors | |
.zipWith( | |
Observable.range(1, MAX_RETRIES), (n, i) -> i | |
) | |
.flatMap( | |
retryCount -> Observable.timer((long) Math.pow(4, retryCount), TimeUnit.SECONDS) | |
) | |
) |
This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).
The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.
Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se
#!/bin/bash | |
if [ -z "$1" ]; then | |
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4 | |
else | |
shot_path="$*" | |
fi | |
# Enable show taps on screen | |
adb shell content insert --uri content://settings/system --bind name:s:show_touches --bind value:i:1 |
class PostFragment : Fragment() { | |
private lateinit var bin: CompositeDisposable | |
private lateinit var vm: PostViewModel | |
private lateinit var id: String | |
private lateinit var title: TextView | |
private lateinit var body: TextView | |
private lateinit var refreshButton: Button |
import kotlinx.coroutines.experimental.* | |
import kotlinx.coroutines.experimental.channels.* | |
import kotlinx.coroutines.experimental.selects.* | |
import java.util.concurrent.* | |
// operator | |
fun <T> ReceiveChannel<T>.distinctInTimeWindow(time: Long, unit: TimeUnit): ReceiveChannel<T> = produce { | |
require(time > 0) | |
consume { | |
val source = this@distinctInTimeWindow |