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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'org.aspectj:aspectjtools:1.8.13' | |
} | |
} | |
final def log = project.logger |
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 Bitmap convertViewToBitmap(View view) { | |
view.destroyDrawingCache(); | |
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), | |
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); | |
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); | |
view.setDrawingCacheEnabled(true); | |
return view.getDrawingCache(true); | |
} |
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 uri = Uri.parse("market://details?id=" + getPackageName()); | |
Intent intent = new Intent(Intent.ACTION_VIEW, uri); | |
ResolveInfo resolveInfo = getPackageManager().resolveActivity(intent, 0); | |
if (resolveInfo == null) { | |
// There is no market | |
} else { | |
startActivity(it); | |
} |
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
@Override | |
public void startActivity(Intent intent) { | |
if (intent.toString().indexOf("mailto") != -1) { // Any way to judge that this is to sead an email | |
PackageManager pm = getPackageManager(); | |
// The first Method | |
List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0); | |
if (activities == null || activities.size() == 0) { | |
// Do anything you like, or just return | |
return; | |
} |
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
float[] v = new float[9]; | |
matrix.getValues(v); | |
// translation is simple | |
float tX = v[Matrix.MTRANS_X]; | |
float tY = v[Matrix.MTRANS_Y]; | |
// calculate real scale | |
float scaleX = values[Matrix.MSCALE_X]; | |
float skewY = values[Matrix.MSKEW_Y]; | |
float realScale = (float) Math.sqrt(scaleX * scaleX + skewY * skewY); |
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
1.Install smbfs | |
sudo apt-get install smbfs | |
2.mount | |
sudo smbmount //serverip/server_user localpath -o uid=local_uid,gid=local_gid,user=server_user,pass=server_pass,iocharset=utf8 | |
3.umount | |
sudo umount -d localpath |
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
sudo ifconfig eth0 down | |
sudo ifconfig eth0 up |