xuxiuxi
2017-05-15 f374477e81be3ac5a9dadc25d3b68ee3773d84ac


git-svn-id: http://192.168.1.226/svn/proxy@635 454eff88-639b-444f-9e54-f578c98de674
2个文件已修改
183 ■■■■■ 已修改文件
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/res/layout/fragment_surveillance.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java
@@ -60,10 +60,6 @@
    private TextView fragment_surveillance_enter_timer;
    @ViewInject(R.id.fragment_surveillance_exit_timer)
    private TextView fragment_surveillance_exit_timer;
    @ViewInject(R.id.fragment_supervisory_enter_progress_bar)
    private ProgressBar fragment_supervisory_enter_progress_bar;
    @ViewInject(R.id.fragment_supervisory_exit_progress_bar)
    private ProgressBar fragment_supervisory_exit_progress_bar;
    static boolean useNative = false;
@@ -124,106 +120,92 @@
    @Override
    protected void initViews(View view, Bundle savedInstanceState) {
        fragment_supervisory_enter_camera.getHolder().addCallback(new SurfaceHolder.Callback() {
            @Override
            public void surfaceCreated(SurfaceHolder holder) {
                fragment_supervisory_enter_progress_bar.setVisibility(View.INVISIBLE);
                RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.IN), fragment_supervisory_enter_camera.getHolder().getSurface());
                RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.IN), DeviceMng.getInstance().getCamera1Address());
                RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.IN), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
                if (useNative) {
                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.IN), fragment_supervisory_enter_camera.getHolder().getSurface());
                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.IN), DeviceMng.getInstance().getCamera1Address());
                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.IN), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
                }
            }
            @Override
            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
            }
            @Override
            public void surfaceDestroyed(SurfaceHolder holder) {
                //fragment_supervisory_enter_progress_bar.setVisibility(View.VISIBLE);
            }
            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
            public void surfaceDestroyed(SurfaceHolder holder) {}
        });
        fragment_supervisory_exit_camera.getHolder().addCallback(new SurfaceHolder.Callback() {
            @Override
            public void surfaceCreated(SurfaceHolder holder) {
                fragment_supervisory_exit_progress_bar.setVisibility(View.INVISIBLE);
                RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.OUT), fragment_supervisory_exit_camera.getHolder().getSurface());
                RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.OUT), DeviceMng.getInstance().getCamera2Address());
                RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.OUT), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
            }
            @Override
            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
            }
            @Override
            public void surfaceDestroyed(SurfaceHolder holder) {
                //fragment_supervisory_exit_progress_bar.setVisibility(View.VISIBLE);
            }
        });
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    if (useNative) {
                        MainActivity.getInstance().runOnUiThread(new Runnable() {
                            public void run() {
                                try {
//                                    File file2 = MainActivity.getInstance().getExternalFilesDir(null);
//                                    File[] files = file2.listFiles();
//                                    for (File file : files) {
//                                        System.out.println(file.getAbsolutePath());
//                                    }
//                                    String s1 = getStringFromFile("/sdcard/license.lic");
//                                    String str = convertStreamToString(MainActivity.getInstance().getAssets().open("license.lic"));
//                                    RtspFaceNative.dbgSetStfaceLicense(str);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            }
                            public String convertStreamToString(InputStream is) throws Exception {
                                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                                StringBuilder sb = new StringBuilder();
                                String line = null;
                                while ((line = reader.readLine()) != null) {
                                    sb.append(line).append("\n");
                                }
                                reader.close();
                                return sb.toString();
                            }
                            public String getStringFromFile (String filePath) throws Exception {
                                File fl = new File(filePath);
                                FileInputStream fin = new FileInputStream(fl);
                                String ret = convertStreamToString(fin);
                                //Make sure you close all streams.
                                fin.close();
                                return ret;
                            }
                        });
                    } else {
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                if (useNative) {
                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.OUT), fragment_supervisory_exit_camera.getHolder().getSurface());
                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.OUT), DeviceMng.getInstance().getCamera2Address());
                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.OUT), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
                }
                try {
                    final SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日  HH:mm:ss分");
//                    while (true) {
//                        Thread.sleep(1000);
            }
            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
            public void surfaceDestroyed(SurfaceHolder holder) {}
        });
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                try {
//                    if (useNative) {
//                        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()));
//                                try {
////                                    File file2 = MainActivity.getInstance().getExternalFilesDir(null);
////                                    File[] files = file2.listFiles();
////                                    for (File file : files) {
////                                        System.out.println(file.getAbsolutePath());
////                                    }
////                                    String s1 = getStringFromFile("/sdcard/license.lic");
////                                    String str = convertStreamToString(MainActivity.getInstance().getAssets().open("license.lic"));
////                                    RtspFaceNative.dbgSetStfaceLicense(str);
//                                } catch (Exception e) {
//                                    e.printStackTrace();
//                                }
//
//                            }
//                            public String convertStreamToString(InputStream is) throws Exception {
//                                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
//                                StringBuilder sb = new StringBuilder();
//                                String line = null;
//                                while ((line = reader.readLine()) != null) {
//                                    sb.append(line).append("\n");
//                                }
//                                reader.close();
//                                return sb.toString();
//                            }
//                            public String getStringFromFile (String filePath) throws Exception {
//                                File fl = new File(filePath);
//                                FileInputStream fin = new FileInputStream(fl);
//                                String ret = convertStreamToString(fin);
//                                //Make sure you close all streams.
//                                fin.close();
//                                return ret;
//                            }
//                        });
//
//                    } else {
//                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();
//                } 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 (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//        }).start();
        new SurveillanceMng.SurveillanceListThread().start();
    }
VisitFace/DemoForBsk/app/src/main/res/layout/fragment_surveillance.xml
@@ -61,7 +61,6 @@
                    android:text="2016年12月5日  17:03:42分"
                    android:visibility="gone"
                    />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
@@ -73,13 +72,6 @@
                    android:text="摄像机进"
                    android:layout_marginRight="@dimen/w122dp"/>
            </RelativeLayout>
            <ProgressBar
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:visibility="invisible"
                android:id="@+id/fragment_supervisory_enter_progress_bar"
                />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="@dimen/view_size_0"
@@ -92,7 +84,6 @@
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/h50dp"
@@ -109,7 +100,6 @@
                    android:id="@+id/fragment_surveillance_exit_timer"
                    android:visibility="gone"
                    />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
@@ -121,13 +111,6 @@
                    android:text="摄像机出"
                    android:layout_marginRight="@dimen/w12dp"/>
            </RelativeLayout>
            <ProgressBar
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:visibility="invisible"
                android:id="@+id/fragment_supervisory_exit_progress_bar"
                />
        </RelativeLayout>
    </LinearLayout>