Skip to content

Instantly share code, notes, and snippets.

View loganj's full-sized avatar

Logan Johnson loganj

  • Square, Inc.
  • New York, NY
View GitHub Profile
protected void onBindView(View view) {
super.onBindView(view);
View checkboxView = view.findViewById(com.android.internal.R.id.checkbox);
if (checkboxView != null && checkboxView instanceof Checkable) {
((Checkable) checkboxView).setChecked(mChecked);
// ...
}
// from Tony Morris, http://blog.tmorris.net/further-understanding-scalaoption/
// Scala version 2.8.0.final
// http://scalacheck.googlecode.com/files/scalacheck_2.8.0-1.8-SNAPSHOT.jar
/*
Below are 15 exercises. The task is to emulate the scala.Option API
without using Some/None subtypes, but instead using a fold (called a
catamorphism).
commit 1f44e0b6df61729b4fdc7be6fc4ec145bb89a8b9
Author: Logan Johnson <ljohnson@mobilizationlabs.com>
Date: Thu Aug 19 16:11:30 2010 -0400
choose root based on host for each request
diff --git a/tim-session-common/src/main/java/com/terracotta/session/SessionFilter.java b/tim-session-common/src/main/java/com/terracotta/session/SessionFilter.java
index 6d4f3b4..523945a 100644
--- a/tim-session-common/src/main/java/com/terracotta/session/SessionFilter.java
+++ b/tim-session-common/src/main/java/com/terracotta/session/SessionFilter.java
//Wysie: Workaround for the entry.type bug, since entry.type always returns -1
final Integer type = entryValues.getAsInteger(Phone.TYPE);
//Wysie: Bug here, entry.type always returns -1.
if (/*entry.type*/type == CommonDataKinds.Phone.TYPE_MOBILE || mShowSmsLinksForAllPhones) {
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): FATAL EXCEPTION: main
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): java.lang.NullPointerException
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): at com.android.contacts.ViewContactActivity.buildEntries(ViewContactActivity.java:954)
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): at com.android.contacts.ViewContactActivity.bindData(ViewContactActivity.java:526)
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): at com.android.contacts.ViewContactActivity.considerBindData(ViewContactActivity.java:519)
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): at com.android.contacts.ViewContactActivity.access$400(ViewContactActivity.java:106)
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): at com.android.contacts.ViewContactActivity$2.onPostExecute(ViewContactActivity.java:380)
08-11 08:24:02.239: ERROR/AndroidRuntime(2409): at com.android.contacts.ViewContactActivity$2.onPostExecute(ViewContactActivity.java:349)
08-11 08:24:02.239: ERROR/AndroidRunt
//Wysie: Workaround for the entry.type bug, since entry.type always returns -1
final Integer type = entryValues.getAsInteger(Phone.TYPE);
//Wysie: Bug here, entry.type always returns -1.
if (/*entry.type*/type == CommonDataKinds.Phone.TYPE_MOBILE || mShowSmsLinksForAllPhones) {
/*
* Copyright (C) 2007 The Android Open Source Project
*
* 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
07-19 08:33:24.959: ERROR/AndroidRuntime(10952): FATAL EXCEPTION: main
java.lang.NullPointerException
at android.text.SpannableStringBuilder.<init>(SpannableStringBuilder.java:44)
at android.telephony.PhoneNumberUtils.formatNumber(PhoneNumberUtils.java:1068)
at com.android.contacts.ui.widget.ReadOnlyContactEditorView.setState(ReadOnlyContactEditorView.java:166)
at com.android.contacts.ui.EditContactActivity.bindEditors(EditContactActivity.java:431)
at com.android.contacts.ui.EditContactActivity$QueryEntitiesTask.onPostExecute(EditContactActivity.java:257)
at com.android.contacts.ui.EditContactActivity$QueryEntitiesTask.onPostExecute(EditContactActivity.java:194)
at com.android.contacts.util.WeakAsyncTask.onPostExecute(WeakAsyncTask.java:56)
at android.os.AsyncTask.finish(AsyncTask.java:417)
https://gist.github.com/b24f5990a675cb1e940a
protected boolean persistBoolean(boolean value) {
if (shouldPersist()) {
if (value == getPersistedBoolean(!value)) {
// It's already there, so the same as persisting
return true;
}
SharedPreferences.Editor editor = mPreferenceManager.getEditor();
editor.putBoolean(mKey, value);
tryCommit(editor);