Skip to content

Instantly share code, notes, and snippets.

View polbins's full-sized avatar
🏔️

polbins polbins

🏔️
View GitHub Profile
@polbins
polbins / README.md
Last active May 17, 2016 05:13
Add ADB Screen Capture to the Command Line

This alias adds ADB Screen Capture on the command-line

HOW-TO

Add the alias to your ~/.bash_profile

alias screencap="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > "

NOTE: to add adb to the command-line

@polbins
polbins / README.md
Last active June 20, 2022 02:50
Android Studio as default Git Diff Tool

Create Android Studio Command-line Launcher

  1. Open Android Studio
  2. Go to: Tools > Create Command-line Launcher
  3. Leave as default, Press OK

Configure Git to use Android Studio as default Diff Tool

  1. Add the following lines to your .gitconfig
@polbins
polbins / EndlessListActivity.java
Last active January 9, 2019 10:02
Android Endless Scroll using RecyclerView
public class EndlessListActivity<D> extends Activity {
private EndlessRecyclerOnScrollListener mEndlessScrollListener;
private EndlessListAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RecyclerView listView = (RecyclerView) findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
@polbins
polbins / .gitignore
Last active September 14, 2016 02:03
My Android Studio Project .gitignore
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@polbins
polbins / gist:437297ed7587c100e57d
Created March 10, 2015 14:27
Sample use of OkHttp + Retrofit Application Interceptor for Resending Requests w/ Refreshed Tokens
OkHttpClient okHttpClient = new OkHttpClient();
okHttpClient.interceptors().add(mRefreshAndRetryInterceptor);
mRestAdapter = new RestAdapter.Builder()
...
.setClient(new OkClient(okHttpClient))
.build();
private final Interceptor mRefreshAndRetryInterceptor = new Interceptor() {
@polbins
polbins / README.md
Last active September 6, 2019 11:08
Android Response Caching using Retrofit 1.9 + OkHttp 2.2

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

@polbins
polbins / README.md
Last active February 29, 2024 09:58
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter