Skip to content

Instantly share code, notes, and snippets.

View koalahamlet's full-sized avatar
㊙️
shhhh

Michael Alan Huff koalahamlet

㊙️
shhhh
View GitHub Profile
@koalahamlet
koalahamlet / gist:9632bd2927f7d6395f27
Created May 23, 2014 22:26
my current gradle settings
//inner build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
@koalahamlet
koalahamlet / gist:11239337
Created April 24, 2014 02:22
insert photo method
private void insertPhoto(LetCursor c) {
String assetUUID = getUuid(URI_ASSETS, c.getString(DB.KEY_ASSET_ID));
String inspectionUUID = getUuid(URI_INSPECTIONS, c.getString(DB.KEY_INSPECTION_ID));
String spaceUUID = getUuid(URI_SPACES, c.getString(DB.KEY_SPACE_ID));
String itemUUID = getUuid(URI_ITEMS, c.getString(DB.KEY_ITEM_ID));
String certificateUUID = getUuid(URI_CERTIFICATES, c.getString(DB.KEY_CERTIFICATE_ID));
String meterUUID = getUuid(URI_METERS, c.getString(DB.KEY_METER_ID));
String keyUUID = getUuid(URI_KEYS, c.getString(DB.KEY_KEY_ID));
ContentValues ccv = new ContentValues();
#<Packet:0xb32426e8> {
:id => 12469676,
:command_type => "UPLOAD",
:client_command_id => "f88f81b1-3b04-47be-8b55-5e9e71b0c2b2",
:device_id => "a13c973d60314bdb",
:email => "andrew+3@grio.com",
:asset_id => "0c860170-a5dd-46fd-b630-3a19314495dd",
:inspection_id => "fddd31b2-7818-40fd-a3fc-674f1e18897f",
:space_id => nil,
:item_id => nil,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/tvName"
android:layout_width="match_parent"
@koalahamlet
koalahamlet / gist:11157861
Created April 21, 2014 21:54
createOfflineTemplate
private TemplateResponse.Template createOfflineTemplate(String inspectionId) {
TemplateResponse.Template template = new TemplateResponse.Template();
template.name = "offline reinspect";
template.status = "300";
ArrayList<TemplateResponse.Space> tempSpaces = new ArrayList<TemplateResponse.Space>();
// Populate Spaces
Cursor spaceCursor = getContentResolver().query(
protected boolean addInputToCV(ContentValues cv, String key, TextView inputView,
ContentValues baselineCv) {
String input = inputView.getText().toString();
if (TextUtils.isEmpty(input) && inputView.getHint() != null)
input = inputView.getHint().toString();
// TODO: All this logic is pretty tricky for correctly handling changes in all cases
// NB: need to check Button first as Button are also TextViews
if (inputView instanceof Button) { // It's a date picker
try {
@koalahamlet
koalahamlet / gist:10953148
Created April 17, 2014 04:38
first attempt
@POST("/books")
void createBookz(@Body String author,
String categories,
String title,
String publisher,
Callback<Book> cb);
04-16 20:47:53.227 8340-8367/mike.libraryplus.app W/dalvikvm﹕ threadid=11: thread exiting with uncaught exception (group=0x41a5e700)
04-16 20:47:53.266 8340-8367/mike.libraryplus.app E/AndroidRuntime﹕ FATAL EXCEPTION: Retrofit-Idle
@koalahamlet
koalahamlet / gist:10953081
Created April 17, 2014 04:36
second attempt
@POST("/books")
void createBook(@Body Book book,
Callback<Book> cb);
04-16 20:59:24.782 8697-8697/mike.libraryplus.app E/DEBUG﹕ retrofit.RetrofitError: java.io.EOFException
04-16 20:59:33.219 8697-8697/mike.libraryplus.app E/DEBUG﹕ retrofit.RetrofitError: retrofit.converter.ConversionException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2
@koalahamlet
koalahamlet / gist:10953002
Last active August 29, 2015 13:59
book detail menu
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="mike.libraryplus.app.BookDetailActivty">
<item
android:id="@+id/menu_share"
android:actionProviderClass="android.widget.ShareActionProvider"
android:icon="@drawable/ic_share"
android:orderInCategory="100"
@koalahamlet
koalahamlet / gist:10952233
Created April 17, 2014 04:09
shareActionProvider
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_book_detail, menu);
// Get the ActionProvider for later usage
provider = (ShareActionProvider) menu.findItem(R.id.menu_share).getActionProvider();
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {