This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.InvocationHandler; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
public class ProxySample { | |
public static void main(String[] args) { | |
final Bar a = mapTo("It's a String!", Bar.class, true); | |
a.doSomething(); // prints [InvocationHandler] doSomething() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="android:Theme.Holo.Light"> | |
<item name="android:actionBarStyle">@style/ActionBar</item> | |
<item name="android:actionOverflowButtonStyle">@style/ActionBarOverflowButton</item> | |
</style> | |
<!-- ActionBar theme --> | |
<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@drawable/background_card_selected" android:state_selected="true" /> | |
<item android:drawable="@drawable/background_card_selected" android:state_pressed="true" /> | |
<item android:drawable="@drawable/background_card_default" /> | |
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the dex VM | |
*.dex | |
# Java class files | |
*.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.os.Build; | |
import android.view.View; | |
public class ViewUtil { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.subinkrishna.android.ui.widget; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.AbsListView; | |
import android.widget.ListView; | |
import android.widget.RelativeLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uri.Builder builder = new Uri.Builder(); | |
builder.scheme("https") | |
.authority("www.myawesomesite.com") | |
.appendPath("turtles") | |
.appendPath("types") | |
.appendQueryParameter("type", "1") | |
.appendQueryParameter("sort", "relevance") | |
.fragment("section-name"); | |
String myUrl = builder.build().toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just learned that when you accidentally merge on the wrong branch and push, there is a way to change it. | |
git reset --hard [sha-commit-before-merge] | |
git push [origin] [branch] --force | |
This will undo the merge and any commits after the merge, so this is useful if you catch your mistake before any more commits happens. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void copy(final InputStream in, | |
final OutputStream out, | |
final boolean closeStreams) throws IOException { | |
final int kilobyte = 1024; | |
byte[] buffer = null; | |
int count = -1; | |
if ((null != in) && (null != out)) { | |
try { | |
buffer = new byte[kilobyte]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item> | |
<shape android:shape="rectangle"> | |
<solid android:color="#FFF" /> | |
</shape> | |
</item> | |
<item android:top="-1dp" android:left="-1dp" android:right="-1dp"> | |
<shape android:shape="rectangle"> |
OlderNewer