Skip to content

Instantly share code, notes, and snippets.

Avatar

John Carlson Jawnnypoo

View GitHub Profile
View gist:5852c6285930eeeca6deaf82c4d92677
long days = ChronoUnit.DAYS.between(LocalDate.now(), otherDate);
@Jawnnypoo
Jawnnypoo / styles.xml
Created Apr 7, 2016
AppCompatDialog theme
View styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="alertDialogTheme">@style/AppAlertDialogStyle</item>
</style>
@Jawnnypoo
Jawnnypoo / CrashlyticsTree.java
Created Mar 8, 2016
Timber tree which prints error messages and stack traces to Crashlytics
View CrashlyticsTree.java
package com.example;
import android.util.Log;
import com.crashlytics.android.Crashlytics;
import timber.log.Timber;
/**
* {@link timber.log.Timber.Tree} which prints important messages to Crashlytics
View colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white">#ffffffff</color>
<color name="white_90">#E6ffffff</color>
<color name="white_80">#CCffffff</color>
<color name="white_70">#B3ffffff</color>
<color name="white_60">#99ffffff</color>
<color name="white_50">#80ffffff</color>
<color name="white_40">#66FFFFFF</color>
@Jawnnypoo
Jawnnypoo / BuildScript.cs
Last active Oct 19, 2021
Typical Buildscript for Unity on Jenkins. Run with command line args "-quit -batchmode -projectPath ${WORKSPACE} -executeMethod BuildScript.PerformAndroidBuild -logfile /dev/stdout"
View BuildScript.cs
using UnityEditor;
using System;
using System.Collections.Generic;
class BuildScript {
static string[] SCENES = FindEnabledEditorScenes();
static string APP_NAME = "AngryBots";
static string TARGET_DIR = "target";
View gist:136f5049534484906acb
### Keybase proof
I hereby claim:
* I am Jawnnypoo on github.
* I am jawnnypoo (https://keybase.io/jawnnypoo) on keybase.
* I have a public key whose fingerprint is 6685 FBCB 3BF0 3236 DDB8 0B53 816A 9180 2393 C178
To claim this, I am signing this object:
@Jawnnypoo
Jawnnypoo / CommonIntents.java
Last active Aug 8, 2017
Common Android Intents, as builders
View CommonIntents.java
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.app.SearchManager;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Events;
import android.provider.AlarmClock;
@Jawnnypoo
Jawnnypoo / ObjectAnimator Change Icon Color
Last active May 13, 2020
Use ObjectAnimator to change color of an icon dynamically
We couldn’t find that file to show.
@Jawnnypoo
Jawnnypoo / onPreDrawExample
Created Dec 10, 2014
Example of setting an onPreDrawListener on a view
View onPreDrawExample
final View view = findViewById(R.id.view_id);
view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
view.getViewTreeObserver().removeOnPreDrawListener(this);
//Do the things you want to do. Return true if you want to draw that frame, otherwise return false
return false;
}
});
@Jawnnypoo
Jawnnypoo / AccelerometerActivity.java
Last active Dec 7, 2019
Accelerometer example that shows moving a circle based on accelerometer input.
View AccelerometerActivity.java
package com.jawnnypoo.example;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.hardware.Sensor;
import android.hardware.SensorEvent;