Skip to content

Instantly share code, notes, and snippets.

Tobias Schürg tobiasschuerg

Block or report user

Report or block tobiasschuerg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tobiasschuerg
tobiasschuerg / GsonDelegatePref
Created Oct 20, 2018
Kotlin Delegate for persistant objects
View GsonDelegatePref
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,
@tobiasschuerg
tobiasschuerg / SupportDatePickerDialog.java
Last active Apr 17, 2019
SupportDatePickerDialog for working around IllegalFormatConversionException on Samsung 5.0 and Samsung 5.1. Inspired by http://stackoverflow.com/a/31855744/570168
View SupportDatePickerDialog.java
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 / EasyColorableActivity.java
Last active Aug 21, 2019
Activity which let's you easily color toolbar, its back button and overflow menu items
View EasyColorableActivity.java
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 / .gitignore
Last active Aug 29, 2015 — forked from kogakure/.gitignore
gitignore for latex projects
View .gitignore
*.acn
*.acr
*.alg
*.aux
*.bbl
*.blg
*.dvi
*.glg
*.glo
*.gls
View TimeZoneOffset
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 / FilteredArrayAdapter.java
Created Aug 31, 2012
Android Arrayadapter with text filtering for the use with a TextWatcher.
View FilteredArrayAdapter.java
/**
* 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> {
You can’t perform that action at this time.