| | |
| | | package cn.com.basic.face.fragment; |
| | | |
| | | import android.graphics.Bitmap; |
| | | import android.os.Bundle; |
| | | import android.view.Surface; |
| | | import android.view.SurfaceView; |
| | | import android.view.View; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | import android.widget.TextView; |
| | | import android.widget.VideoView; |
| | | |
| | | import com.bsk.zhangbo.demoforbsk.R; |
| | | |
| | | import cn.com.basic.face.base.BaseFragment; |
| | | |
| | | import com.bsk.zhangbo.demoforbsk.util.RtspFaceNative; |
| | | import cn.com.basic.face.base.MainActivity; |
| | | import cn.com.basic.face.util.RtspFaceNative; |
| | | |
| | | import cn.com.basic.face.service.SurveillanceMng; |
| | | import cn.com.basic.face.widget.surveilance.SurveillanceBottomListView; |
| | | |
| | | import com.lidroid.xutils.view.annotation.ViewInject; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | public class SurveillanceFragment extends BaseFragment { |
| | | |
| | |
| | | @ViewInject(R.id.fragment_supervisory_bottom_attendance_list_view) |
| | | private SurveillanceBottomListView fragment_supervisory_bottom_attendance_list_view; |
| | | @ViewInject(R.id.fragment_supervisory_enter_camera) |
| | | VideoView fragment_supervisory_enter_camera; |
| | | SurfaceView fragment_supervisory_enter_camera; |
| | | @ViewInject(R.id.fragment_supervisory_exit_camera) |
| | | VideoView fragment_supervisory_exit_camera; |
| | | SurfaceView fragment_supervisory_exit_camera; |
| | | @ViewInject(R.id.fragment_surveillance_enter_timer) |
| | | private TextView fragment_surveillance_enter_timer; |
| | | @ViewInject(R.id.fragment_surveillance_exit_timer) |
| | | private TextView fragment_surveillance_exit_timer; |
| | | |
| | | static boolean useNative = false; |
| | | |
| | | static { |
| | | if (useNative) { |
| | | System.loadLibrary("cvface_api"); |
| | | System.loadLibrary("opencv_java3"); |
| | | System.loadLibrary("protobuf-lite"); |
| | | System.loadLibrary("protobuf"); |
| | | System.loadLibrary("protoc"); |
| | | System.loadLibrary("rtspface"); |
| | | RtspFaceNative.init(); |
| | | RtspFaceNative.setLocalIP("192.168.1.10"); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Thread.sleep(2000); |
| | | if (useNative) { |
| | | RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); |
| | | RtspFaceNative.setSurface(2, fragment_supervisory_exit_camera.getHolder().getSurface()); |
| | | RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); |
| | | RtspFaceNative.createPlayer(2, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); |
| | | MainActivity.getInstance().runOnUiThread(new Runnable() { |
| | | public void run() { |
| | | RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); |
| | | //RtspFaceNative.setSurface(2, fragment_supervisory_exit_camera.getHolder().getSurface()); |
| | | RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); |
| | | //RtspFaceNative.createPlayer(2, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); |
| | | RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); |
| | | } |
| | | }); |
| | | |
| | | } else { |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | final SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss分"); |
| | | while (true) { |
| | | Thread.sleep(1000); |
| | | MainActivity.getInstance().runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | fragment_surveillance_enter_timer.setText(sdf.format(new Date())); |
| | | fragment_surveillance_exit_timer.setText(sdf.format(new Date())); |
| | | } |
| | | }); |
| | | } |
| | | } catch (InterruptedException e) { |
| | | } |
| | | } |
| | | }).start(); |
| | |
| | | public void setMenuVisibility(boolean menuVisible) { |
| | | super.setMenuVisibility(menuVisible); |
| | | if (menuVisible && fragment_supervisory_bottom_visit_list_view != null) { |
| | | reloadBottomList(); |
| | | //reloadBottomList(); |
| | | } |
| | | } |
| | | |
| | | private void reloadBottomList() { |
| | | SurveillanceMng.getInstance().findSupervisoryBottomList(fragment_supervisory_bottom_visitor_radio_button.isChecked()); |
| | | SurveillanceMng.getInstance().findSurveillanceBottomList(fragment_supervisory_bottom_visitor_radio_button.isChecked()); |
| | | } |
| | | |
| | | } |