Skip to content

Instantly share code, notes, and snippets.

@f2prateek
f2prateek / HttpRequestAdapter.java
Created June 4, 2014 05:44
Signing Requests with Retrofit and SignPost
package com.f2prateek.five00px.data.api.auth;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import oauth.signpost.http.HttpRequest;
import retrofit.client.Header;
import retrofit.client.Request;
@f2prateek
f2prateek / ActivitySubscriptionManager.java
Last active October 23, 2017 14:30
Managing Subscriptions in Android with RxJava
/*
* Copyright 2014 Prateek Srivastava
*
* 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
package com.f2prateek.articuno.util;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.util.SparseArray;
import java.io.Serializable;
import java.util.ArrayList;
/**
@f2prateek
f2prateek / CustomView.java
Last active June 11, 2018 02:57
Event Bus in view
public class CustomView extends View {
private final Bus bus;
public CustomView(Bus bus, ....) {
super(....);
this.bus = bus;
}
@Override protected void onAttachedToWindow() {
@f2prateek
f2prateek / gist:6416614
Created September 2, 2013 19:43
GradientColorHelper
/*
* Copyright 2013 Prateek Srivastava (@f2prateek)
*
* 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
@f2prateek
f2prateek / FluentSpannableStringBuilder.java
Last active December 21, 2015 03:49
FluentSpannableStringBuilder
package com.f2prateek.couchpotato.util;
import android.text.Spannable;
import android.text.SpannableString;
import java.util.ArrayList;
import java.util.List;
public class FluentSpannableStringBuilder {
List<Bean> beanList;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity"
@f2prateek
f2prateek / README.md
Created May 19, 2013 01:43
Quickly deploy Volley to your maven repository.

Quickly deploy Volley to your maven repository. Volley is a library that makes networking for Android apps easier and most importantly, faster. For an example to use Volley in your app, check out Folly.

Steps

git clone https://android.googlesource.com/platform/frameworks/volley
cd volley
(download the pom.xml)
mvn clean install
@f2prateek
f2prateek / MainActivity.java
Created January 20, 2013 19:21
Custom inner class in R.java?
package com.f2prateek.test;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
TextView mTextView;
@f2prateek
f2prateek / CheckBoxActionProvider.java
Created October 30, 2012 18:26
Custom Action Provider in ActionBar - a checkbox with a textview descrption
package com.psrivastava.deviceframegenerator.widget;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;