This file contains hidden or 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 從google相簿app回來,需要另外處理取得Uri | |
* @param photoUri | |
* @return Uri | |
*/ | |
public static Uri getExternalMediaUriFormContentUri(Uri photoUri){ | |
if(photoUri.getAuthority() != null){ | |
if(photoUri.getAuthority().equals("com.google.android.apps.photos.contentprovider")){ | |
List<String> paths = photoUri.getPathSegments(); | |
if(paths != null && paths.size() > 0){ |
This file contains hidden or 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
MediaProjectionManager mediaProjectionManager = | |
(MediaProjectionManager) getApplication().getSystemService( | |
Context.MEDIA_PROJECTION_SERVICE); | |
startActivityForResult( | |
mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION_REQUEST_CODE); |
This file contains hidden or 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
AndroidManifest.xml | |
----------------------------------- | |
<activity | |
android:name=".DemoActivity" | |
android:screenOrientation="unspecified" | |
android:configChanges="orientation|screenSize" | |
/> | |
DemoActivity.java | |
------------------------------- |
This file contains hidden or 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.animation.Animator; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.ViewConfiguration; | |
import java.util.Timer; | |
import java.util.TimerTask; |
This file contains hidden or 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 abstract class CommonAdapter<T> extends BaseAdapter { | |
public List<T> data; | |
public Context mContext; | |
public CommonAdapter(Context context) { | |
this.mContext = context; | |
} | |
public void setData(List<T> data) { | |
this.data = data; |
This file contains hidden or 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
含有英文大小寫和數字,且長度在8~12 | |
^(?!.*[^a-zA-Z0-9])(?=.*\d)(?=.*[a-zA-Z])(?=.*[A-Z])(?=.*[a-z]).{8,12}$ | |
至少一個英文不分大小寫及一個數字 , 8~12位 | |
/^(?!.*[^a-zA-Z0-9])(?=.*\d)(?=.*[a-zA-Z]).{8,12}$/ | |
email格式 | |
/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/ | |
禁止中,英,數,減號( - )以外的字元,至少要連續中文4個字,至少一位數字,字元數共8~40位 |
This file contains hidden or 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.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Path; | |
import android.graphics.PointF; | |
import android.support.v4.content.ContextCompat; | |
import android.util.AttributeSet; | |
import android.widget.RelativeLayout; |
This file contains hidden or 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 | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
if (requestCode == REQUEST_RMISSION) { | |
if (Settings.canDrawOverlays(this)) { | |
addProtectView(); | |
} | |
} | |
} |
This file contains hidden or 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 static final String ReservedChars = "|\\?*<\":>+[]/'"; |
This file contains hidden or 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 getZipJsonFile(Context context){ | |
try { | |
JSONObject result = new JSONObject(); | |
String response = HttpProcessor.get(context, "https://api.opencube.tw/twzipcode/get-citys", 1); | |
Log.d(response); | |
JSONObject jsonObject = new JSONObject(response.trim()); | |
JSONArray jsonArray = jsonObject.getJSONArray("data"); | |
for(int i = 0; i< jsonArray.length(); i++){ | |
String city = jsonArray.getString(i); |
OlderNewer