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 MLRoundedImageView extends ImageView { | |
public MLRoundedImageView(Context context) { | |
super(context); | |
} | |
public MLRoundedImageView(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
import android.graphics.Bitmap; | |
import android.graphics.Bitmap.Config; | |
import android.graphics.BitmapShader; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.RectF; | |
import android.graphics.Shader; | |
// enables hardware accelerated rounded corners | |
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/ |
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
/* | |
* Copyright 2014 Julian Shen | |
* | |
* 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 |
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.blogspot.ksoichiro.linktest; | |
import android.text.Layout; | |
import android.text.Spannable; | |
import android.text.SpannableString; | |
import android.text.Spanned; | |
import android.text.TextUtils; | |
import android.text.method.LinkMovementMethod; | |
import android.text.style.ClickableSpan; |
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 CustomEditText extends EditText { | |
private KeyImeChange keyImeChangeListener; | |
public ListenerEditText(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public void setKeyImeChangeListener(KeyImeChange listener){ | |
keyImeChangeListener = listener; |
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 ObjectSerializer { | |
public static String serialize(Serializable obj) throws IOException { | |
if (obj == null){ | |
return ""; | |
} | |
try { | |
ByteArrayOutputStream serialObj = new ByteArrayOutputStream(); | |
ObjectOutputStream objStream = new ObjectOutputStream(serialObj); |
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
<FrameLayout | |
android:id="@+id/main_content" | |
android:layout_width="match_parent" | |
android:layout_height="300dip" > | |
<WebView | |
android:id="@+id/webview" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" /> | |
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
private int measureContentWidth(ListAdapter adapter) { | |
// Menus don't tend to be long, so this is more sane than it looks. | |
int width = 0; | |
View itemView = null; | |
int itemType = 0; | |
final int widthMeasureSpec = | |
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); | |
final int heightMeasureSpec = | |
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); | |
final int count = adapter.getCount(); |
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 final class SampleFactory { | |
private static final Constructor<?> _CONSTRUCTOR; | |
private static final String _DEFAULT_IMPLEMENTION = "com.example.vincent.customImpl"; | |
static { | |
Class<?> clazz = null; | |
String impl = System.getProperty(_DEFAULT_IMPLEMENTION); | |
if(impl != null){ | |
try{ | |
clazz = Class.forName(impl); |
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
////////////////////////////////////////////////////////// | |
//// @usage getClassField("mPageMargin", ViewPager.class) | |
////////////////////////////////////////////////////////// | |
public int getClassField(String fieldName, Class<?> clz) { | |
try { | |
Field thisField = clz.getDeclaredField(fieldName); | |
return thisField.getInt(thisField); | |
} catch (Exception e) { | |
throw new RuntimeException("Not found field " + fieldName + ", Error : " + e.getMessage()); | |
} |
OlderNewer