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
<LinearLayout | |
android:id="@+id/tutorial_viewpager_container" | |
android:orientation="vertical" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:gravity="center" | |
android:background="@drawable/tutorial_rounded_corner_background"> | |
<android.support.v4.view.ViewPager | |
android:id="@+id/tutorial_viewpager" | |
android:background="@android:color/transparent" |
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 net.leolink.android.gist; | |
public class MultiStateDrawable extends LayerDrawable { | |
// The color filter to apply when the button is pressed | |
protected ColorFilter _pressedFilter = new LightingColorFilter(Color.GRAY, 1); | |
public MultiStateDrawable(Drawable d) { | |
super(new Drawable[] { d }); | |
} |
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 class SoftKeyboardHandledLinearLayout extends LinearLayout { | |
private boolean isKeyboardShown; | |
private SoftKeyboardVisibilityChangeListener listener; | |
public SoftKeyboardHandledLinearLayout(Context context) { | |
super(context); | |
} | |
public SoftKeyboardHandledLinearLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); |
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
/** | |
* Forked from: http://androidxref.com/4.1.1/xref/frameworks/base/core/java/com/android/internal/widget/DialogTitle.java | |
* Created by LeoLink on 2014-06-30. | |
*/ | |
public class SingleLineTextView extends TextView { | |
public SingleLineTextView(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
setSingleLine(); | |
setEllipsize(TextUtils.TruncateAt.END); |
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
/** | |
* This f**king code was created by Leo on 11/12/14. | |
*/ | |
public class AutoWrapLayout extends RelativeLayout { | |
private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1); | |
private static final int DEFAULT_MARGIN = 5; // dp | |
private int margin; | |
private LinkedList<String> dataList; |
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 class CustomEllipsizeTextView extends TextView { | |
private static final int MAX_LINE = 2; | |
private static final String ELLIPSIZE_STRING = "..."; | |
private String originalText; | |
private int maxLines = MAX_LINE; | |
private String postfix; | |
private boolean postfixAdded; |
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 String toHexString(int decimal) { | |
String codes = "0123456789ABCDEF"; | |
StringBuilder builder = new StringBuilder(8); | |
builder.setLength(8); | |
for (int i = 7; i >= 0; i--) { | |
// E.g: let decimal = 229 -> its value when expressed in binary is 11100101 | |
// And binary form of 0xF is 1111 (equals to ..00000001111) |
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
int value = -229; | |
System.out.println(value); | |
System.out.println(value >> 5); | |
System.out.println(value >>> 5); | |
System.out.println(Integer.toBinaryString(value)); | |
System.out.println(Integer.toBinaryString(value >> 5)); // `>>` preserves integer's sign | |
System.out.println(Integer.toBinaryString(value >>> 5)); // `>>>` doesn't preserve integer's sign, just shift everything to the right then fill all the empty bit on the left with 0 | |
//======================= RESULT | |
-229 |
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
# General | |
export LANG=en_US.UTF-8 | |
export LC_CTYPE=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
# Path to your oh-my-zsh installation. | |
export ZSH=~/Dropbox/MY/Preferences/Unix/\[dot\]oh-my-zsh | |
export MANPATH="/usr/local/man:$MANPATH" | |
export SSH_KEY_PATH="~/.ssh/dsa_id" | |
# zsh custom folder | |
ZSH_CUSTOM="$ZSH/custom" |
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.os.Handler; | |
import android.os.Looper; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.TimeUnit; |
OlderNewer