Skip to content

Instantly share code, notes, and snippets.

View mseroczynski's full-sized avatar

Michał Seroczyński mseroczynski

View GitHub Profile
@mseroczynski
mseroczynski / AspectRatioImageView.java
Last active August 29, 2015 14:26 — forked from JakeWharton/AspectRatioImageView.java
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {
@mseroczynski
mseroczynski / OrderActivity.java
Created January 21, 2016 08:47 — forked from donnfelker/OrderActivity.java
RxJava Bound Service AIDL Abstraction
package com.donnfelker.rxexample;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
@mseroczynski
mseroczynski / EachDirectoryPath.md
Created April 15, 2016 10:47 — forked from granoeste/EachDirectoryPath.md
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

@mseroczynski
mseroczynski / HomeActivity.kt
Created August 31, 2016 08:59 — forked from antoniolg/HomeActivity.kt
Snackbar extensions on Kotlin, to create a useful small DSL.
class HomeActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_home)
setSupportActionBar(toolbar)
fab.setOnClickListener {
it.snack("Snack message") {
action("Action") { toast("Action clicked") }
@mseroczynski
mseroczynski / Channel.java
Created September 12, 2016 23:12 — forked from macsystems/Channel.java
If you want to parse an RSS Feed using SimpleXML you can use this as an Start. I used this to parse RSS using RetroFit from Square
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Namespace;
import org.simpleframework.xml.NamespaceList;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Text;
import java.util.List;
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
@mseroczynski
mseroczynski / Firebase Database API Cheatsheet
Created January 12, 2017 14:09 — forked from odigity/Firebase Database API Cheatsheet
Firebase Database API Cheatsheet
There is no way to store an empty object/array/null value.
There are also no actual arrays. Array values get stored as objects with integer keys.
(If all keys are integers, it will be returned as an array.)
Basically, it's one giant tree of hashes with string keys.
Simply write a value to any location, and the intermediary locations will automatically come into existance.
── Classes ──
DataSnapshot : Container for a subtree of data at a particular location.
@mseroczynski
mseroczynski / OnItemSelectedListener.java
Created February 17, 2017 15:34 — forked from andreynovikov/OnItemSelectedListener.java
Complete working solution for Android action bar tabs with fragments having separate back stack for each tab.
// Custom interface that enables communication between Fragment and its Activity
public interface OnItemSelectedListener
{
public void onItemSelected(String item);
}
@mseroczynski
mseroczynski / parse.ino
Created March 16, 2017 22:55 — forked from krhoyt/parse.ino
Arduino Yun to Parse.com (Process, curl).
// Original:
// http://hypernephelist.com/2014/08/19/https_on_arduino_yun.html
// Libraries
#include <Process.h>
// Literals
// #define DEBUG
// Constants