Skip to content

Instantly share code, notes, and snippets.

View geftimov's full-sized avatar
🇧🇬
This feature is great!!!

Georgi Eftimov geftimov

🇧🇬
This feature is great!!!
View GitHub Profile
@geftimov
geftimov / gist:f0df80f2a969f31723dd
Created November 4, 2015 11:24
Different drawer layout
mDrawerLayout.setDrawerListener(new DrawerListener()
{
@Override
public void onDrawerStateChanged(int newState)
{
}
@Override
public void onDrawerSlide(View drawerView, float slideOffset)
{
@geftimov
geftimov / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@geftimov
geftimov / android-butterknife-config
Created November 13, 2014 12:31
Butterknife config
// in build gradle
compile 'com.jakewharton:butterknife:6.0.0'
@geftimov
geftimov / android-shared-prefs
Created November 13, 2014 12:29
SharedPrefs config
import android.content.Context;
import android.content.SharedPreferences;
import java.util.HashSet;
import java.util.Set;
public class SharedPrefs {
private static SharedPrefs singelton;
private final SharedPreferences sharedPreferences;
@geftimov
geftimov / android-basefragment-otto-dagger
Created November 5, 2014 13:00
BaseFragment Otto and Dagger
import android.app.Activity;
import android.support.v4.app.Fragment;
import com.eftimoff.jokes.JokesApplication;
import com.eftimoff.jokes.utils.SharedPrefs;
import com.squareup.otto.Bus;
import javax.inject.Inject;
import butterknife.ButterKnife;
@geftimov
geftimov / android-baseactivity-otto-dagger
Created November 5, 2014 12:59
BaseActivity Otto and Dagger
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import com.eftimoff.jokes.JokesApplication;
import com.eftimoff.jokes.utils.SharedPrefs;
import com.squareup.otto.Bus;
import javax.inject.Inject;
@geftimov
geftimov / android-otto-config
Created November 5, 2014 12:58
Otto config.
// in build gradle
compile 'com.squareup:otto:1.3.5'
//in dagger module
@Provides
@Singleton
Bus provideBus() {
return new Bus();
}
@geftimov
geftimov / andriod-dagger-config
Created November 5, 2014 11:32
Android dagger config.
//in Application class
private static ObjectGraph graph;
@Override
public void onCreate() {
super.onCreate();
graph = ObjectGraph.create(getModules().toArray());
}
protected List<Object> getModules() {
@geftimov
geftimov / android-timber-log
Last active August 29, 2015 14:05
Timber configuration.
//in Application onCreate()
Timber.plant(new Timber.DebugTree());
// in build gradle
compile 'com.jakewharton.timber:timber:2.5.0'
//usage
Timber.e("Request for questions failed.");
@geftimov
geftimov / android-google-analytics
Last active August 29, 2015 14:05
Configuration for google analytics
***************************************************
* Application class *
***************************************************
HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();
/**
* Enum used to identify the tracker that needs to be used for tracking.
* <p/>
* A single tracker is usually enough for most purposes. In case you do need multiple trackers,