Skip to content

Instantly share code, notes, and snippets.

View tobiasschuerg's full-sized avatar

Tobias Schürg tobiasschuerg

View GitHub Profile
@tobiasschuerg
tobiasschuerg / FilteredArrayAdapter.java
Created August 31, 2012 15:08
Android Arrayadapter with text filtering for the use with a TextWatcher.
/**
* Arrayadapter (for Android) with text filtering for the use with a TextWatcher.
* Note: the objects in the List need a valid toString() method.
* @author Tobias Schürg
*
*/
public class FilteredArrayAdapter extends ArrayAdapter<ImageObject> {
import java.text.SimpleDateFormat;
import java.util.Date;
public class Timezone {
public static void main(String[] args) {
String tzOffset = new SimpleDateFormat("Z").format(new Date());
System.out.println("Your timezone offset: " + tzOffset);
}
}
@tobiasschuerg
tobiasschuerg / .gitignore
Last active August 18, 2020 19:34 — forked from kogakure/.gitignore
gitignore for latex projects
*.acn
*.acr
*.alg
*.aux
*.bbl
*.blg
*.dvi
*.glg
*.glo
*.gls
@tobiasschuerg
tobiasschuerg / EasyColorableActivity.java
Last active August 21, 2019 12:03
Activity which let's you easily color toolbar, its back button and overflow menu items
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
@tobiasschuerg
tobiasschuerg / SupportDatePickerDialog.java
Last active April 17, 2019 06:47
SupportDatePickerDialog for working around IllegalFormatConversionException on Samsung 5.0 and Samsung 5.1. Inspired by http://stackoverflow.com/a/31855744/570168
import android.app.DatePickerDialog;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.StyleRes;
import android.support.v7.view.ContextThemeWrapper;
@tobiasschuerg
tobiasschuerg / GsonDelegatePref
Created October 20, 2018 13:47
Kotlin Delegate for persistant objects
package com.tobiasschuerg
import android.content.SharedPreferences
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
class GsonDelegatePref<T>(
private val prefs: SharedPreferences,