Skip to content

Instantly share code, notes, and snippets.

View Bhavdip's full-sized avatar
🎯
Focusing

bhavdip Bhavdip

🎯
Focusing
View GitHub Profile
@scruffyfox
scruffyfox / Card UI
Last active August 29, 2015 13:57
Card drawable
Basic card layout with drawables and styles.
Missing icons: ic_action_remove, ic_action_accept and ic_action_cancel (all can be found in the standard android icon pack)
Example screenshot: https://pbs.twimg.com/media/BmTdvKhIYAAkrPa.png
@matthew-carroll
matthew-carroll / HttpBoilerplate.java
Last active August 29, 2015 13:59
Intro to Retrofit by Square
// Compose a single request to send to the server:
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://www.myserver.com/apis/users/" + userId + "/profile");
List<NameValuePair> bodyParams = new ArrayList<NameValuePair>();
pairs.add(new NameValuePair("first_name", firstName));
pairs.add(new NameValuePair("last_name", firstName));
pairs.add(new NameValuePair("street1", firstName));
pairs.add(new NameValuePair("street2", firstName));
pairs.add(new NameValuePair("zip", firstName));
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator" >
<alpha
android:fromAlpha="0"
android:toAlpha="1"
android:duration="2000" >
</alpha>
@burntcookie90
burntcookie90 / card_bg.xml
Created June 6, 2014 18:08
Android Cards UI background
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp"/>
<solid android:color="#dbdbdb" />
</shape>
</item>
@lenamuit
lenamuit / google_now_card.xml
Created June 9, 2014 16:47
Google Now card background
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp"/>
<solid android:color="#ccc" />
=========
styles.xml
=========
<style name="TransparentProgressDialog" parent="@android:Theme.Holo.Light.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
@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.");
@vizZ
vizZ / gist:704b965e679324b3ba40
Last active August 29, 2015 14:09
Reactive Programming @ Aftonbladet
public interface AftonbladetAPI {
@GET("/item/{id}.json")
Observable<Item> item(@Path("id") long id);
@GET("/topstories.json")
Observable<List<Long>> topStories();
}
public void onRefresh() {
@nitindhar7
nitindhar7 / wait.xml
Created October 17, 2011 03:06
Animation frames in the res/drawable/ folder
<animation-list android:oneshot="false">
<item android:drawable="@drawable/wait_0" android:duration="50" />
<item android:drawable="@drawable/wait_1" android:duration="50" />
<item android:drawable="@drawable/wait_2" android:duration="50" />
<item android:drawable="@drawable/wait_3" android:duration="50" />
<item android:drawable="@drawable/wait_4" android:duration="50" />
<item android:drawable="@drawable/wait_5" android:duration="50" />
</animation-list>
@nitindhar7
nitindhar7 / gist:1708545
Created January 31, 2012 03:23
Tab layout for the tutorial
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/tabcontainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"