Skip to content

Instantly share code, notes, and snippets.

View iammert's full-sized avatar
🎧
Focusing

Mert Şimşek iammert

🎧
Focusing
View GitHub Profile
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created April 26, 2018 12:14
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@jeffdgr8
jeffdgr8 / TimePickerDialogFixedNougatSpinner.java
Last active February 14, 2023 13:15
TimePickerDialog with fixed android:timePickerMode spinner in Nougat
package my.packagename;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TimePicker;
import java.lang.reflect.Constructor;
@czyrux
czyrux / PresenterLoader.java
Last active July 26, 2021 05:43
PresenterLoader
import android.content.Context;
import android.support.v4.content.Loader;
public final class PresenterLoader<T extends Presenter> extends Loader<T>{
private final PresenterFactory<T> factory;
private T presenter;
public PresenterLoader(Context context, PresenterFactory<T> factory) {
super(context);
@iammert
iammert / gist:faa6cd996c752dcfb10a
Created September 16, 2015 16:57
update gitignore already commited
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
git push origin master
@gokhanbarisaker
gokhanbarisaker / PicassoDecoder.java
Last active September 1, 2016 15:17
Picasso decoder for subsampling-scale-image-view
/**
* Created by gokhanbarisaker on 8/30/15.
*/
public class PicassoDecoder implements ImageDecoder
{
private String tag;
private Picasso picasso;
public PicassoDecoder(String tag, Picasso picasso) {
this.tag = tag;
anonymous
anonymous / gist:3b25e358e87334292ce5
Created June 18, 2015 16:03
Swipe Dismiss
import android.animation.ObjectAnimator;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@iPaulPro
iPaulPro / include_list_viewpager.xml
Last active March 7, 2024 11:13
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 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
@sohamtriveous
sohamtriveous / build.gradle
Last active February 1, 2017 16:36
A sample RxJava-Android and retrolambda gradle configuration for Android Studio on Mac OS.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.databaseexample"
minSdkVersion 14
targetSdkVersion 22
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();