Skip to content

Instantly share code, notes, and snippets.

View gturedi's full-sized avatar

Gökhan Türedi gturedi

View GitHub Profile
@gturedi
gturedi / CustomAnimationListener.java
Last active February 10, 2016 09:34
abstract classes to avoid to implement unnecessary methods and boilerplate code for android development
package gturedi.gist;
import android.view.animation.Animation;
public abstract class CustomAnimationListener
implements Animation.AnimationListener {
@Override
public void onAnimationStart(Animation animation) {
}
@gturedi
gturedi / ActivityUtil.java
Last active February 10, 2016 09:55
utility classes for android development
package gturedi.gist;
import android.app.Activity;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@gturedi
gturedi / ObservableWebView.java
Last active February 10, 2016 10:04
small useful custom view classes
// click and scrol listener supported webview
package gturedi.gist;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.webkit.WebView;
public class ObservableWebView
@gturedi
gturedi / PeriodicTask.java
Last active January 28, 2016 17:18
simple util class to run periodic tasks on android
package gturedi.sample;
import android.content.Context;
import android.content.SharedPreferences;
public class PeriodicTask {
private static final int ONE_DAY_IN_MILLIS = 1000 * 60 * 60 * 24;
public static void run(final Context context, Runnable runnable) {
@gturedi
gturedi / ReadCallback.java
Last active August 29, 2015 14:22
simple manager class to write/read (a)synchronously data object to file
import java.io.Serializable;
public interface ReadCallback<T extends Serializable> {
void done(Exception e, T result);
}
@gturedi
gturedi / TouchUtil.java
Last active August 29, 2015 14:15
simple util class to attach double tap event handler to a view
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
public class TouchUtil {
public static void addDoubleTapListenerToView(final View target, final Runnable action){
final GestureDetector gestureDetector = new GestureDetector(target.getContext(), new GestureDetector.SimpleOnGestureListener() {
@gturedi
gturedi / MainActivity.java
Last active August 29, 2015 14:03
"Android DatePickerDialog'daki DayPicker'i Gizleme" adlı blog postu icin kod ornegi: http://gturedi.blogspot.com.tr/2014/07/android-datepickerdialogdaki-daypickeri.html
package com.example.hide_day_picker;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.DatePicker;
import java.lang.reflect.Field;