Skip to content

Instantly share code, notes, and snippets.

Avatar
🎧
Focusing

Mert Şimşek iammert

🎧
Focusing
View GitHub Profile
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created Apr 26, 2018
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
View EventObserver.kt
/**
* 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)
View LICENSE
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 Jan 21, 2021
TimePickerDialog with fixed android:timePickerMode spinner in Nougat
View TimePickerDialogFixedNougatSpinner.java
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;
View PresenterLoader.java
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 Sep 16, 2015
update gitignore already commited
View gist:faa6cd996c752dcfb10a
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
git push origin master
@gokhanbarisaker
gokhanbarisaker / PicassoDecoder.java
Last active Sep 1, 2016
Picasso decoder for subsampling-scale-image-view
View PicassoDecoder.java
/**
* 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 Jun 18, 2015
Swipe Dismiss
View gist:3b25e358e87334292ce5
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 Aug 12, 2022
CollapsingToolbarLayout with TabLayout
View include_list_viewpager.xml
<?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 Feb 1, 2017
A sample RxJava-Android and retrolambda gradle configuration for Android Studio on Mac OS.
View build.gradle
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 Mar 22, 2015
Hello World Enterprise Edition
View HelloWorld.java
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();