Skip to content

Instantly share code, notes, and snippets.

View intrications's full-sized avatar

Michael Basil intrications

View GitHub Profile
@dtmilano
dtmilano / android-select-device
Last active November 29, 2023 09:29
Script to select one connected device or emulator when running adb
#! /bin/bash
#=====================================================================
# Selects an android device
# Copyright (C) 2012-2022 Diego Torres Milano. All rights reserved.
#
# The simplest way to invoke this script is creating a function like
# this one in your shell startup file:
#
# ```
# adb ()
@amlcurran
amlcurran / MultiContentAdapter.java
Last active December 11, 2015 03:38
Simple Adapter which can handle multiple input cursors asynchronously (ideal for usage with CursorLoaders)
/* Copyright 2013 Alex Curran
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
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@jdamcd
jdamcd / AndroidManifest.xml
Created February 16, 2013 11:43
Android snippet for hiding debug screens behind SECRET_CODE broadcasts sent via the dialler.
<receiver android:name=".SecretCodeReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data
android:scheme="android_secret_code"
android:host="1111" />
</intent-filter>
</receiver>
@frankiesardo
frankiesardo / QuickReturn.java
Last active December 14, 2015 22:49
A refactored version of LarsWerkman's QuickReturnListView. It should provide an easier to use API and an easier to understand library.
public class QuickReturn {
private final static int ANIMATION_DURATION_MILLIS = 250;
private final ListView listView;
private final View quickReturnView;
private final View headerPlaceholder;
private int itemCount;
private int itemOffsetY[];
@imminent
imminent / DoneDiscardCallbacks.java
Last active December 15, 2015 10:49
Snippet for binding Done/Discard Bar pattern via ActivityLifecycleCallbacks.
/*
* Copyright 2012 Dandre Allison
* 2012 Roman Nurik
*
* 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
*
@KidA78
KidA78 / gist:5279210
Created March 31, 2013 02:19
Some code to help engineers mock Twitter4J using EasyMock
import java.util.ArrayList;
import java.util.List;
import org.easymock.EasyMock;
import org.easymock.IExpectationSetters;
import org.json.JSONArray;
import org.json.JSONObject;
import twitter4j.Paging;
import twitter4j.RateLimitStatus;
@cyrilmottier
cyrilmottier / gist:5292270
Created April 2, 2013 13:39
Passing additional information into a Cursor
package com.cyrilmottier.android.avelov.database;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.os.Bundle;
/**
* A Cursor that completely re-writes the actual Cursor capabilities related to extras. It allows clients to use the setExtras(Bundle) (this
* method is actually hidden in the Android framework).
*
@ManuelPeinado
ManuelPeinado / SimpleBindingAdapter.java
Last active December 16, 2015 11:09
A variation on Jake Wharton's BindingAdapter (https://gist.github.com/JakeWharton/5423616) which is slightly more convenient for adapters that only have one view type
package com.manuelpeinado;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
* A variation on Jake Wharton's BindingAdapter (https://gist.github.com/JakeWharton/5423616) which is slightly more convenient
* for adapters that only have one view type
*/
@johnkil
johnkil / DbUtils.java
Last active December 16, 2015 13:48
Utilities to work with SQLite database (based on http://udinic.wordpress.com/2012/05/09/sqlite-drop-column-support).
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;
/**
@emil10001
emil10001 / BusProvider.java
Last active December 16, 2015 14:29
Playing around with Square's Open Source lib, Otto. Here's the full github project: https://github.com/emil10001/OttoExampleAndroid
// Provided by Square under the Apache License
public final class BusProvider {
private static final Bus BUS = new Bus();
public static Bus getInstance() {
return BUS;
}
private BusProvider() {
// No instances.