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 String cameraFileName; | |
@Override | |
public void choiceAvatarFromCamera() { | |
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | |
cameraFileName = Constants.DOWNLOAD_IMAGE_PATH + System.currentTimeMillis(); | |
File file = new File(Constants.DOWNLOAD_IMAGE_PATH); | |
if(!file.exists()){ | |
file.mkdirs(); | |
} | |
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(cameraFileName))); |
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
/** | |
* Attempts to get the ViewHolder for the given position, either from the Recycler scrap, | |
* cache, the RecycledViewPool, or creating it directly. | |
* <p> | |
* If a deadlineNs other than {@link #FOREVER_NS} is passed, this method early return | |
* rather than constructing or binding a ViewHolder if it doesn't think it has time. | |
* If a ViewHolder must be constructed and not enough time remains, null is returned. If a | |
* ViewHolder is aquired and must be bound but not enough time remains, an unbound holder is | |
* returned. Use {@link ViewHolder#isBound()} on the returned object to check for this. | |
* |
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 static void updateActivity(String locate, Context context) { | |
// 本地语言设置 | |
Locale myLocale = new Locale(locate); | |
Resources res = context.getResources(); | |
DisplayMetrics dm = res.getDisplayMetrics(); | |
Configuration conf = res.getConfiguration(); | |
conf.locale = myLocale; | |
// 更新全局Configuration | |
res.updateConfiguration(conf, dm); |
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.java.test.thread; | |
import java.util.concurrent.atomic.AtomicInteger; | |
/** | |
* Created by John on 18/3/19. | |
* 使用三个线程使得ABC 循环输出十次 | |
*/ | |
public class PrintABC { |
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.dianxinos.wifimgr.widget; | |
import android.graphics.Camera; | |
import android.graphics.Matrix; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.view.animation.Animation; | |
import android.view.animation.DecelerateInterpolator; | |
import android.view.animation.Interpolator; | |
import android.view.animation.Transformation; |
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 String commonUpload(Context cxt, String url, Map<String, String> params, | |
List<UploadFile> uploadFiles, Map<String, String> properties, String encoding) throws IOException { | |
// 定义POST体中分割线 | |
String BOUNDARY = "124324471239807512395795"; | |
String PREFIX = "--"; | |
String ENDLINE = "\r\n"; | |
String CONTENT_TYPE = "multipart/form-data"; | |
// long contentLen = 0; | |
// 1. 拼接HTTP 请求头 | |
HttpURLConnection httpConn = NetworkUtils.openHttpURLConnection(cxt, url); |
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
from flask import Flask, render_template, jsonify, request | |
from threading import Timer, Thread | |
from time import sleep | |
app = Flask(__name__) | |
@app.route("/api/<method>") | |
def api(method): | |
data = { |
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.android.orm; | |
import android.database.Cursor; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.List; |
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.demo.view; | |
import java.util.ArrayList; | |
import java.util.List; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
public class AutoLoadAdapter<T> extends BaseAdapter { |
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
java.util.Timer timer = new java.util.Timer(true); | |
// true 说明这个timer以daemon方式运行(优先级低, | |
// 程序结束timer也自动结束),注意,javax.swing | |
// 包中也有一个Timer类,如果import中用到swing包, | |
// 要注意名字的冲突。 | |
TimerTask task = new TimerTask() { | |
public void run() { | |
... //每次需要执行的代码放到这里面。 | |
} |
NewerOlder