Skip to content

Instantly share code, notes, and snippets.

View Kisty's full-sized avatar

Timothy Kist Kisty

View GitHub Profile
@Kisty
Kisty / android-28-sources.md
Created September 4, 2019 15:04 — forked from cketti/android-28-sources.md
Build your own android-28 sources

Build "Sources for Android 28" so you can comfortably browse the Android API source in Android Studio.

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@Kisty
Kisty / config.ini
Created October 30, 2018 10:32
Emulator issue on CI server
cat less ~/.android/avd/Nexus_5X_API_24.avd/config.ini
cat: less: No such file or directory
AvdId=Nexus_5X_API_24
PlayStore.enabled=false
abi.type=armeabi-v7a
avd.ini.displayname=Nexus 5X API 24
avd.ini.encoding=UTF-8
disk.dataPartition.size=800M
fastboot.chosenSnapshotFile=
fastboot.forceChosenSnapshotBoot=no
Observable<DownloadState> observable =
Observable.interval(PROGRESS_INTERVAL_MILLIS, TimeUnit.MILLISECONDS)
.flatMap(new Function<Long, ObservableSource<DownloadState>>() {
@Override
public ObservableSource<DownloadState> apply(Long aLong) throws Exception {
DownloadManager.Query query = new DownloadManager.Query();
query.setFilterById(downloadId);
Cursor cursor = getDownloadManager().query(query);
if (!cursor.moveToFirst()) {
cursor.close();
@Kisty
Kisty / ShadowEMVideoView.java
Last active April 29, 2016 16:37
Robolectric shadow for EMVideoView
@Implements(com.devbrackets.android.exomedia.EMVideoView.class)
public class ShadowEMVideoView extends ShadowRelativeLayout {
public static final int STOP = 0;
public static final int START = 1;
public static final int SUSPEND = 2;
public static final int PAUSE = 3;
private int currentState = -1;
private int prevState;
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
@Kisty
Kisty / ListScrollingUtils
Last active August 29, 2015 14:19
Programatically scroll to a position in a ListView
public void scrollToPosition(ListView lv, int position, boolean clipToPadding) {
scrollToPositionFromTop(lv, position, 0, clipToPadding);
}
public void scrollToPositionFromTop(ListView lv, int item, int y, boolean clipToPadding) {
//Had to apply this offset if clipToPadding="false"
if (!clipToPadding) {
item -= lv.getPaddingTop();
}
this.setSelectionFromTop(position, y);