This file contains hidden or 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.io.File; | |
import io.reactivex.Single; | |
import io.reactivex.schedulers.Schedulers; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
import okio.BufferedSink; | |
import okio.BufferedSource; | |
import okio.Okio; |
This file contains hidden or 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
/** | |
* Rx based timer that implements a simple timer functionality. Should be | |
* disposed when it goes out of scope since RxJava leaks otherwise. | |
* | |
* @author Pär Amsen 05/2017 | |
*/ | |
public class Timer { | |
private Observable<Void> timer; | |
private long time; | |
private boolean started; |
This file contains hidden or 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 com.paramsen.testground; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; |
This file contains hidden or 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.io.File; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Stack; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
// MIT License | |
// | |
// Copyright(c) 2017 Pär Amsen | |
// |
This file contains hidden or 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.app.Activity; | |
import android.content.Context; | |
import android.content.ContextWrapper; | |
import android.support.annotation.LayoutRes; | |
import android.util.AttributeSet; | |
import android.view.LayoutInflater; | |
import android.view.ViewGroup; | |
import android.widget.FrameLayout; | |
import android.widget.ScrollView; | |
import android.widget.TextView; |
This file contains hidden or 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
android { | |
//... | |
} | |
dependencies { | |
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') { | |
transitive = true | |
} | |
} |
This file contains hidden or 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
/** | |
* Wraps the inflated TextView, adds an ImageView programatically that matches_parent by force. | |
* By default the FrameLayout would adjust it's bounds to the added ImageView, even if we add a | |
* LayoutParams with MATCH_PARENT. I omitted it here since it doesn't matter. | |
* | |
* @author Pär Amsen 07/2017 | |
*/ | |
public class CustomFrameLayout extends FrameLayout { | |
public CustomFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) { | |
super(context, attrs); |
This file contains hidden or 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
// This is free and unencumbered software released into the public domain. | |
// | |
// Anyone is free to copy, modify, publish, use, compile, sell, or | |
// distribute this software, either in source code form or as a compiled | |
// binary, for any purpose, commercial or non-commercial, and by any | |
// means. | |
// | |
// In jurisdictions that recognize copyright laws, the author or authors | |
// of this software dedicate any and all copyright interest in the | |
// software to the public domain. We make this dedication for the benefit |
This file contains hidden or 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
/** | |
* Run convertVectorsToPngs() test, get the pngs from the device by "adb pull <the path>" and paste the res folders | |
* into your android project. | |
* | |
* @author Pär Amsen 01/2018 | |
*/ | |
@RunWith(AndroidJUnit4::class) | |
class Vector2Png { | |
lateinit var context: Context | |
lateinit var baseDir: File |
This file contains hidden or 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
/** | |
* Batch conversion from one dpi to the others using imagemagick | |
* (got some Windows and personal machine hardcoded stuff, change that) | |
* | |
* Usage: kotlinc -script batch-convert-dpi.kts <output dir> <paths to input files (pngs)> | |
*/ | |
import java.io.File | |
import jdk.nashorn.internal.runtime.ScriptingFunctions.readLine | |
import java.io.BufferedReader |
OlderNewer