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 deviceWidth; | |
WindowManager wm = (WindowManager) textView.getContext().getSystemService(Context.WINDOW_SERVICE); | |
Display display = wm.getDefaultDisplay(); | |
if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2){ | |
Point size = new Point(); | |
display.getSize(size); | |
deviceWidth = size.x; | |
} else { | |
deviceWidth = display.getWidth(); | |
} |
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
WindowManager wm = (WindowManager) textView.getContext().getSystemService(Context.WINDOW_SERVICE); | |
Display display = wm.getDefaultDisplay(); | |
if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2){ | |
Point size = new Point(); | |
display.getSize(size); | |
deviceWidth = size.x; | |
} else { | |
deviceWidth = display.getWidth(); | |
} |
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 library (.aar / .jar) | |
//////////////////////////////// | |
repositories { | |
jcenter() | |
mavenCentral() | |
mavenLocal() | |
flatDir{ | |
dirs 'libs' | |
} |
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
//////////////////// | |
// Layout xml file. | |
/////////////////// | |
<com.example.widget.MapInfoWindowWrapper | |
android:id="@+id/map_wrapper" | |
android:layout_width="match_parent" | |
android:layout_height="350dp"> | |
<MapView | |
android:id="@+id/mapview" |
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 int resolveSize(int size, int measureSpec) { | |
int result = size; | |
int specMode = MeasureSpec.getMode(measureSpec); | |
int specSize = MeasureSpec.getSize(measureSpec); | |
switch (specMode) { | |
case MeasureSpec.UNSPECIFIED: | |
result = size; | |
break; | |
case MeasureSpec.AT_MOST: | |
result = Math.min(size, specSize); |
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
// Reference : http://stackoverflow.com/questions/6410200/android-detect-if-user-touches-and-drags-out-of-button-region | |
private Rect rect; // Variable rect to hold the bounds of the view | |
public boolean onTouch(View v, MotionEvent event) { | |
if(event.getAction() == MotionEvent.ACTION_DOWN){ | |
// Construct a rect of the view's bounds | |
rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); | |
} | |
if(event.getAction() == MotionEvent.ACTION_MOVE){ |
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
// Reference : http://pqovopq.seesaa.net/article/387726362.html | |
static private void setCursorWindowSize(int size){ | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { | |
try { | |
final Class cls = Class.forName("android.database.CursorWindow"); | |
final Field fld = cls.getDeclaredField("sCursorWindowSize"); | |
fld.setAccessible(true); | |
int before = fld.getInt(null); // default=2048*1024 | |
fld.setInt(null, size * 1024); // extend to | |
int after = fld.getInt(null); |
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.util.Vector; | |
import org.xml.sax.XMLReader; | |
import android.text.Editable; | |
import android.text.Html; | |
import android.text.Spannable; | |
import android.text.style.BulletSpan; | |
import android.text.style.LeadingMarginSpan; | |
import android.text.style.TypefaceSpan; |
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
/* | |
* <declare-styleable name="slideViewSyle"> | |
* <attr name="direction" format="enum"> | |
* <enum name="top" value="0"/> | |
* <enum name="bottom" value="1" /> | |
* <enum name="left" value="2" /> | |
* <enum name="right" value="3" /> | |
* </attr> | |
* </declare-styleable> | |
* |
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 ScrollMapView extends MapView { | |
private final static String TAG = "ScrollMapView"; | |
public ScrollMapView(Context context) { | |
super(context); | |
} | |
public ScrollMapView(Context context, AttributeSet attributeSet) { | |
super(context, attributeSet); |
NewerOlder