Skip to content

Instantly share code, notes, and snippets.

@JBirdVegas
JBirdVegas / gist:3874450
Created October 11, 2012 18:19
ContentObserver quick example
// references internal ContentObserver class
SettingsObserver observer = new SettingsObserver(new Handler());
// start watching for changes
observer.observe();
// where we do our work
updateSettings();
// Anonymous inner class to handle watching Uris
class SettingsObserver extends ContentObserver {
SettingsObserver(Handler handler) {
@JBirdVegas
JBirdVegas / VoltageControlTable.java
Created December 4, 2012 20:32
Refactoring of VoltageControlTables com.aokp.romcontrol.performance.VoltageControlTable I just narrowed the scope of some Objects, and moved finding the location to the Class initialization. This way we don't overly expose variables used by the class in
package com.jbirdvegas.example;
import android.util.Log;
import java.io.File;
public class VoltageControlTable {
private final String TAG = getClass().getSimpleName();
private String mTable = null;
@JBirdVegas
JBirdVegas / TestSeakyListFragment.java
Created January 9, 2013 18:37
Sneaky PreferenceFragment that is aware of Overscroll
package com.example.sneakylist;
import android.preference.PreferenceFragment;
import android.widget.AbsListView;
/**
* Created with IntelliJ IDEA.
* User: jbird
* Date: 1/9/13
* Time: 1:16 PM
@JBirdVegas
JBirdVegas / ThreadedIO.java
Created January 15, 2013 22:42
Threaded IO
package com.example.untitled1;
import android.provider.SyncStateContract;
/**
* Since we have no need to interact with the UI thread we can do all these
* operations in the worker thread. We generally use the AsyncTask class
* if we need to do something on the UI thread (ie update view) after
* our long running task but since here we are only performing IO tasks
* we don't need the UI thread to be involved
@JBirdVegas
JBirdVegas / stats.txt
Created January 28, 2013 20:49
the current state of aokp stats via CLOC
http://cloc.sourceforge.net v 1.56 T=2268.0 s (56.8 files/s, 16755.4 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
XML 12569 73656 430838 6163653
C++ 18084 958136 961917 5082931
C 13862 817664 1114762 4933013
Java 31622 833545 1904876 4234798
C/C++ Header 26955 697243 1390929 2702941
HTML 6494 101219 53494 1116927
@JBirdVegas
JBirdVegas / proguard-project.txt
Created February 7, 2013 06:00
progaurd-project.txt
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
@JBirdVegas
JBirdVegas / test.java
Created March 5, 2013 21:59
CMDProcessor returns
package com.aokp.romcontrol.fragments.team;
import android.util.Log;
import com.aokp.romcontrol.util.CMDProcessor;
import com.aokp.romcontrol.util.CommandResult;
import com.aokp.romcontrol.util.Executable;
import com.aokp.romcontrol.util.Helpers;
/**
* Created with IntelliJ IDEA.
@JBirdVegas
JBirdVegas / TeamShowcase.java
Created March 6, 2013 15:43
AOKP About refactor
package com.aokp.romcontrol.fragments.team;
import android.content.Context;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.view.View;
import com.aokp.romcontrol.AOKPPreferenceFragment;
import com.aokp.romcontrol.R;
@JBirdVegas
JBirdVegas / PasswordFinder.java
Created March 8, 2013 20:42
Grab all webview stored passwords
package com.jbirdvegas.webview;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.jbirdvegas.webview.aokp.CMDProcessor;
import com.jbirdvegas.webview.aokp.Executable;
import java.util.ArrayList;
public class PasswordFinder extends Activity {
@Override
@JBirdVegas
JBirdVegas / security.sh
Created September 1, 2013 01:08
***Because I'm paranoid*** This logs the users location, ip address and takes a photo. All this information is the committed to a git repository This script needs to be added as a "Startup Application" to be fully utilized.
#!/bin/sh
# wait till we are connected to the internet to run the script
while ! wget http://google.com -O- 2>/dev/null | grep -q Lucky; do
sleep 3
done
exec $1
cd $HOME/sec/