Skip to content

Instantly share code, notes, and snippets.

View kibotu's full-sized avatar
🎯
Focusing

Jan Rabe kibotu

🎯
Focusing
View GitHub Profile
@kibotu
kibotu / HockeyAppHelper.java
Created May 7, 2016 06:08
HockeyAppHelper
public enum HockeyAppHelper {
instance;
private static final String HOCKEY_UPLOAD_URL = "https://rink.hockeyapp.net/api/2/apps/{0}/crashes/";
private static final String TAG = HockeyAppHelper.class.getSimpleName();
private CrashManagerListener listener;
public static void checkForCrashes(@NotNull final Activity context) {
instance.listener = createCrashManagerListener(context);
@kibotu
kibotu / RandomColor.java
Last active May 29, 2016 08:58
random pleasing color for android
public static ColorDrawable generateRandomColor() {
return generateRandomColor(255, 255, 255, 255);
}
public static ColorDrawable generateRandomColor(int alpha, int red, int green, int blue) {
final Random random = new Random();
int r = random.nextInt(256);
@kibotu
kibotu / NexusPlayerRemoteDelegate.cs
Last active May 29, 2016 08:59
Nexus Player Controls C#
namespace Platform.Android.NexusPlayer
{
public class NexusPlayerRemoteDelegate : MonoBehaviour
{
/**
* Nexus Player KeyCodes
*
* |-------------------------------------------------------------|
* |------------------------ F2 ---------------------------------|
@kibotu
kibotu / languages.txt
Created July 20, 2016 20:10
support android languages
@see https://github.com/android/platform_frameworks_base/tree/master/core/res/res
Language / Locale Supported since version
English, US (en_US) 1.1
German, Germany (de_DE) 1.1
Chinese, PRC (zh_CN) 1.5
Chinese, Taiwan (zh_TW) 1.5
Czech, Czech Republic (cs_CZ) 1.5
Dutch, Belgium (nl_BE) 1.5
@kibotu
kibotu / transparency.txt
Created July 20, 2016 20:29
transparency to hex
<!--
Transparency
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
@kibotu
kibotu / timer.java
Created August 12, 2016 15:27
java rx run once after 10 seconds
Observable.
timer(10, TimeUnit.SECONDS)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(r -> {
Logger.v(tag(), "on complete " + r);
}, Throwable::printStackTrace);
@kibotu
kibotu / android_update.sh
Created August 18, 2016 18:28
Bitrise android update.
#!/bin/bash
set -ex
echo y | android update sdk --no-ui --all --filter extra-android-support | grep 'package installed'
echo y | android update sdk --no-ui --all --filter platform-tools | grep 'package installed'
echo y | android update sdk --no-ui --all --filter tools | grep 'package installed'
echo y | android update sdk --no-ui --all --filter build-tools-24.0.1 | grep 'package installed'
echo y | android update sdk --no-ui --all --filter android-24 | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-android-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-m2repository | grep 'package installed'
@kibotu
kibotu / build.gradle
Created August 22, 2016 11:46
Forcing specific Support Library Version.
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:24.2.0'
}
@kibotu
kibotu / utils.java
Last active August 24, 2016 13:00
Android: Figure out if app is in foreground. (mainly for asyn / services)
public static boolean isInForeground() {
Activity activity = getActivity();
return activity != null && !activity.isFinishing() && activity.getWindow() != null;
}
@kibotu
kibotu / android_udpate.sh
Created August 26, 2016 11:31
android update bitrise
#!/bin/bash
set -ex
echo y | android update sdk --no-ui --all --filter extra-android-support | grep 'package installed'
echo y | android update sdk --no-ui --all --filter build-tools-24.0.1 | grep 'package installed'
echo y | android update sdk --no-ui --all --filter android-24 | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-android-m2repository | grep 'package installed'