Skip to content

Instantly share code, notes, and snippets.

@Devofure
Devofure / FirebaseItemLiveData.java
Last active June 11, 2017 21:32
A LiveData example when working with firebase database and LiveData, inspired by the examples of Android architecture guide lines
package com.devofure.tlog.repository.api;
import android.support.annotation.NonNull;
import com.devofure.tlog.model.Resource;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
@Devofure
Devofure / ClojarsDependencyGson.java
Last active September 13, 2015 17:05
example of gson using to convert from json to java object when fetching with OkHttp
public class ClojarsDependency {
@Expose
public long downloads;
@Expose @SerializedName("homepage")
public String url;
@Expose
public String description;
@Devofure
Devofure / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Devofure
Devofure / Dimension Material Desing
Last active August 29, 2015 14:06
Android Dimension Material Desing
<resources>
<dimen name="activity_vertical_padding">16dp</dimen>
<dimen name="popup_vertical_bottom_padding">16dp</dimen>
<dimen name="popup_vertical_content_padding">24dp</dimen>
<dimen name="popup_vertical_action_height_padding">36dp</dimen>
<dimen name="item_height">48dp</dimen>
<dimen name="default_padding_between_icon_text">32dp</dimen>
<dimen name="divider_vertical_width">1dp</dimen>
<dimen name="divider_horizontal_height">1dp</dimen>
<dimen name="divider_horizontal_padding_down">8dp</dimen>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Default colors -->
<color name="default_background">#fde0dc</color>
<color name="default_white">#ffffffff</color>
<color name="default_black">#ff000000</color>
<!-- http://central.sonatype.org/pages/ossrh-guide.html -->
<!-- Android Material Design Colors -->
package se.project.generic.androidbaseapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.Window;
import android.widget.TextView;