ZoomManager.java
FocusManager.java
public void onSingleTapUp(int x, int y) {
xxxxxxxxxx
xxxxxxxxxx
}
CameraAppUiImpl.java
另外,还加一个假对焦隔几秒会再次对焦的功能,模似自动对焦。
CameraActivity.java
Task task;
Timer timer;class Task extends TimerTask {@Overridepublic void run() {android.util.Log.d("tangjun", "onResume() TimerTask()");Message msg = new Message();msg.what = 1;mHandler.sendMessage(msg);}
}private final Handler mHandler = new Handler() {public void handleMessage(Message msg) {switch (msg.what) {case 1:if (msg != null) {getFocusManager().onSingleTapUp(300, 300);}break;}};
};@Override
protected void onResume() {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx//add by syd beginint currentId = mCameraDeviceCtrl.getCameraId();if(currentId == 1 && timer == null && task == null){timer = new Timer();task = new Task();timer.schedule(task, 2 * 1000, 6000);}//add by syd end
}@Override
protected void onPause() {
xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxx//add by syd beginif(timer != null && task != null){timer.cancel();task.cancel();timer = null;task = null;}//add by syd end
}