Skip to content

Instantly share code, notes, and snippets.

Kurt Mbanje ckurtm

Block or report user

Report or block ckurtm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View avd_endless_pin_jump.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@ckurtm
ckurtm / ThreeTenABP
Created Feb 16, 2016
ThreeTenABP quick start
View ThreeTenABP
LocalDateTime ldt = LocalDateTime.now();
int ld = ldt.getDayOfMonth();
int lm = ldt.getMonthValue();
int ly = ldt.getYear();
Log.d(TAG,"3ten : "+ldt.toString());
Log.d(TAG,"3ten : [day: "+ld+"] [month: "+lm+"] [year: "+ly+"]");
Log.d(TAG,"3ten : [day: "+ldt.getDayOfWeek().name()+"] [month: "+ldt.getMonth().name()+"] [year: "+ldt.getYear()+"]");
ldt.withYear(2000);
@ckurtm
ckurtm / Jodatime.java
Last active Feb 16, 2016
Jodatime quick start
View Jodatime.java
DateTime dt = DateTime.now();
int jd = dt.getDayOfMonth();
int jm = dt.getMonthOfYear();
int jy = dt.getYear();
Log.d(TAG,"Joda : "+ dt.toString());
Log.d(TAG,"Joda : [day: "+jd+"] [month: "+jm+"] [year: "+jy+"]");
Log.d(TAG,"Joda : [day: "+dt.dayOfWeek().getAsText()+"] [month: "+dt.monthOfYear().getAsText()+"] [year: "+dt.year().getAsText()+"]");
dt.withYear(2000);
dt.plusHours(2);
@ckurtm
ckurtm / HeadlessFragment.java
Created Nov 26, 2015 — forked from keyboardr/HeadlessFragment.java
A file template for creating a headless Fragment. The attach() methods add the fragment to the parent if it doesn't already exist and returns the attached fragment. The methods ensure that the parent implements the parent interface. If needed, parameters may be added to the attach() methods to supply fragment arguments.
View HeadlessFragment.java
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
#parse("File Header.java")
public class ${NAME} extends Fragment {
private static final String FRAG_TAG = ${NAME}.class.getCanonicalName();
@ckurtm
ckurtm / AndroidManifest.xml
Created Nov 2, 2015
Example on how to use adb to start an Activity,BroadcastReceiver or Service from adb and include intent extras too. for Activity: adb shell am start -n "com.peirr.test/com.peirr.test.MyActivity" --es name "John" --ei age 30 for BroadcastReceiver adb shell am broadcast -n "com.peirr.test/com.peirr.test.MyReceiver" --es name "John" --ei age 30 for…
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.peirr.test">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
@ckurtm
ckurtm / TintActivity.java
Created Oct 29, 2015
Dynamically change color of a drawable using TintDrawables
View TintActivity.java
package com.peirra.tint;
import android.graphics.Color;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import java.util.Random;
@ckurtm
ckurtm / DrawableDrawableResoureDecoder.java
Last active Aug 29, 2015 — forked from TWiStErRob/DrawableDrawableResoureDecoder.java
Glide 3.6.0 proof of concept for loading a Drawable as Drawable through Glide
View DrawableDrawableResoureDecoder.java
class DrawableResoureDecoder implements ResourceDecoder<Drawable, Drawable> {
@Override public Resource<Drawable> decode(Drawable source, int width, int height) throws IOException {
return new DrawableResource<Drawable>(source) {
@Override public int getSize() { return 1; }
@Override public void recycle() { }
};
}
@Override public String getId() { return "DrawableDrawableResourceDecoder"; }
}
View GsonRequest.java
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
You can’t perform that action at this time.