| | |
| | | import cn.com.basic.face.util.WindowsUtil; |
| | | import cn.com.basic.face.widget.MyGLSurfaceView; |
| | | import com.camnter.easyrecyclerview.widget.EasyRecyclerView; |
| | | import com.lidroid.xutils.view.annotation.ViewInject; |
| | | import com.orhanobut.logger.Logger; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | public class SupervisoryFragment extends BaseFragment { |
| | | |
| | | private RadioGroup mRadioGroup; |
| | | private RadioButton mRadioButton1, mRadioButton2; |
| | | private View mRadioLine1, mRadioLine2; |
| | | static { |
| | | //System.loadLibrary("rtspface");//xiuxi |
| | | } |
| | | |
| | | @ViewInject(R.id.fragment_supervisory_bottom_left_radio_group) |
| | | private RadioGroup fragment_supervisory_bottom_left_radio_group; |
| | | @ViewInject(R.id.fragment_supervisory_bottom_visitor_radio_button) |
| | | private RadioButton fragment_supervisory_bottom_visitor_radio_button; |
| | | @ViewInject(R.id.fragment_supervisory_bottom_attendance_radio_button) |
| | | private RadioButton fragment_supervisory_bottom_attendance_radio_button; |
| | | @ViewInject(R.id.fragment_supervisory_bottom_visitor_background) |
| | | private View fragment_supervisory_bottom_visitor_background; |
| | | @ViewInject(R.id.fragment_supervisory_bottom_attendance_background) |
| | | private View fragment_supervisory_bottom_attendance_background; |
| | | @ViewInject(R.id.fragment_supervisory_bottom_register_list) |
| | | private EasyRecyclerView fragment_supervisory_bottom_register_list; |
| | | @ViewInject(R.id.fragment_supervisory_bottom_visitor_list) |
| | | private EasyRecyclerView fragment_supervisory_bottom_visitor_list; |
| | | |
| | | private SupervisoryAdapter mAdapter; |
| | | private List mList; |
| | | private EasyRecyclerView mRecyclerViewRegister, mRecyclerViewUser; |
| | | |
| | | //播放 |
| | | |
| | | String mSourceString = "clips/testfile.mp4"; |
| | | |
| | | SurfaceView mSurfaceView1; |
| | | SurfaceView mSurfaceView2; |
| | | SurfaceView fragment_supervisory_enter_camera; |
| | | SurfaceView fragment_supervisory_exit_camera; |
| | | SurfaceHolder mSurfaceHolder1; |
| | | |
| | | VideoSink mSelectedVideoSink; |
| | |
| | | boolean mCreated = false; |
| | | boolean mIsPlaying = false; |
| | | |
| | | /** Load jni .so on initialization */ |
| | | static { |
| | | //System.loadLibrary("rtspface");//xiuxi |
| | | } |
| | | |
| | | |
| | | |
| | | private static SupervisoryFragment instance = new SupervisoryFragment(); |
| | |
| | | |
| | | @Override |
| | | protected void initViews(View view, Bundle savedInstanceState) { |
| | | mRadioGroup = (RadioGroup) view.findViewById(R.id.fragment_supervisory_bottom_left_radio_group); |
| | | mRadioButton1 = (RadioButton) view.findViewById(R.id.fragment_supervisory_bottom_visitor_radio_button); |
| | | mRadioButton2 = (RadioButton) view.findViewById(R.id.fragment_supervisory_bottom_attendance_radio_button); |
| | | mRadioLine1 = view.findViewById(R.id.fragment_supervisory_bottom_visitor_background); |
| | | mRadioLine2 = view.findViewById(R.id.fragment_supervisory_bottom_attendance_background); |
| | | mRecyclerViewRegister = (EasyRecyclerView) view.findViewById(R.id.recyclerview_register); |
| | | mRecyclerViewUser = (EasyRecyclerView) view.findViewById(R.id.recyclerview_user); |
| | | mRadioButton1.setChecked(true); |
| | | mRecyclerViewRegister.addItemDecoration(new SpaceItemDecoration()); |
| | | fragment_supervisory_bottom_left_radio_group = (RadioGroup) view.findViewById(R.id.fragment_supervisory_bottom_left_radio_group); |
| | | fragment_supervisory_bottom_visitor_radio_button = (RadioButton) view.findViewById(R.id.fragment_supervisory_bottom_visitor_radio_button); |
| | | fragment_supervisory_bottom_attendance_radio_button = (RadioButton) view.findViewById(R.id.fragment_supervisory_bottom_attendance_radio_button); |
| | | fragment_supervisory_bottom_visitor_background = view.findViewById(R.id.fragment_supervisory_bottom_visitor_background); |
| | | fragment_supervisory_bottom_attendance_background = view.findViewById(R.id.fragment_supervisory_bottom_attendance_background); |
| | | fragment_supervisory_bottom_register_list = (EasyRecyclerView) view.findViewById(R.id.fragment_supervisory_bottom_register_list); |
| | | fragment_supervisory_bottom_visitor_list = (EasyRecyclerView) view.findViewById(R.id.fragment_supervisory_bottom_visitor_list); |
| | | fragment_supervisory_bottom_visitor_radio_button.setChecked(true); |
| | | fragment_supervisory_bottom_register_list.addItemDecoration(new SpaceItemDecoration()); |
| | | GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 2); |
| | | gridLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); |
| | | mRecyclerViewRegister.setLayoutManager(gridLayoutManager); |
| | | fragment_supervisory_bottom_register_list.setLayoutManager(gridLayoutManager); |
| | | mAdapter = new SupervisoryAdapter(getActivity()); |
| | | |
| | | |
| | | mSurfaceView2 = (SurfaceView) view.findViewById(R.id.fragment_supervisory_exit_camera); |
| | | mSurfaceView1 = (SurfaceView) view.findViewById(R.id.fragment_supervisory_enter_camera); |
| | | fragment_supervisory_exit_camera = (SurfaceView) view.findViewById(R.id.fragment_supervisory_exit_camera); |
| | | fragment_supervisory_enter_camera = (SurfaceView) view.findViewById(R.id.fragment_supervisory_enter_camera); |
| | | RtspFaceNative.init(); |
| | | RtspFaceNative.setSurface(1, mSurfaceView1.getHolder().getSurface()); |
| | | RtspFaceNative.setSurface(2, mSurfaceView2.getHolder().getSurface()); |
| | | RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); |
| | | RtspFaceNative.setSurface(2, fragment_supervisory_exit_camera.getHolder().getSurface()); |
| | | |
| | | mSurfaceHolder1 = mSurfaceView1.getHolder(); |
| | | mSurfaceHolder1 = fragment_supervisory_enter_camera.getHolder(); |
| | | |
| | | mSurfaceHolder1.addCallback(new SurfaceHolder.Callback() { |
| | | |
| | |
| | | |
| | | |
| | | //openGL |
| | | if(mSurfaceView2 instanceof MyGLSurfaceView) { |
| | | ((MyGLSurfaceView)mSurfaceView2).onResume(); |
| | | if(fragment_supervisory_exit_camera instanceof MyGLSurfaceView) { |
| | | ((MyGLSurfaceView) fragment_supervisory_exit_camera).onResume(); |
| | | } |
| | | if (mGLView1VideoSink == null) { |
| | | mGLView1VideoSink = new GLViewVideoSink(mSurfaceView2); |
| | | mGLView1VideoSink = new GLViewVideoSink(fragment_supervisory_exit_camera); |
| | | } |
| | | mSelectedVideoSink = mGLView1VideoSink; |
| | | |
| | |
| | | //setPlayingStreamingMediaPlayer(mIsPlaying); |
| | | } |
| | | |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | @Override |
| | | protected void initListeners() { |
| | | mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { |
| | | fragment_supervisory_bottom_left_radio_group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(RadioGroup group, int checkedId) { |
| | | switch (checkedId) { |
| | | case R.id.fragment_supervisory_bottom_visitor_radio_button: |
| | | mRadioLine1.setVisibility(View.VISIBLE); |
| | | mRadioLine2.setVisibility(View.INVISIBLE); |
| | | mRecyclerViewRegister.setVisibility(View.VISIBLE); |
| | | mRecyclerViewUser.setVisibility(View.GONE); |
| | | fragment_supervisory_bottom_visitor_background.setVisibility(View.VISIBLE); |
| | | fragment_supervisory_bottom_attendance_background.setVisibility(View.INVISIBLE); |
| | | fragment_supervisory_bottom_register_list.setVisibility(View.VISIBLE); |
| | | fragment_supervisory_bottom_visitor_list.setVisibility(View.GONE); |
| | | break; |
| | | case R.id.fragment_supervisory_bottom_attendance_radio_button: |
| | | mRadioLine1.setVisibility(View.INVISIBLE); |
| | | mRadioLine2.setVisibility(View.VISIBLE); |
| | | mRecyclerViewRegister.setVisibility(View.GONE); |
| | | mRecyclerViewUser.setVisibility(View.VISIBLE); |
| | | fragment_supervisory_bottom_visitor_background.setVisibility(View.INVISIBLE); |
| | | fragment_supervisory_bottom_attendance_background.setVisibility(View.VISIBLE); |
| | | fragment_supervisory_bottom_register_list.setVisibility(View.GONE); |
| | | fragment_supervisory_bottom_visitor_list.setVisibility(View.VISIBLE); |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected void initData() { |
| | | // switchSurface(); |
| | | public void setMenuVisibility(boolean menuVisible) { |
| | | super.setMenuVisibility(menuVisible); |
| | | if (menuVisible) { |
| | | // reloadBottomList(); |
| | | } |
| | | } |
| | | |
| | | private void reloadBottomList() { |
| | | mList = new ArrayList(); |
| | | // for (int i = 0; i < 125; i++) { |
| | | // FacePhotoItem item = new FacePhotoItem(); |
| | | // //item.setType(); |
| | | // item.setName("张三"+i); |
| | | // if (i % 3 == 0) { |
| | | // item.setStatus("来访登记"); |
| | | // } else { |
| | | // item.setStatus("签离"); |
| | | // } |
| | | // if (i % 5 == 0) { |
| | | // item.setWarning(""); |
| | | // } else { |
| | | // item.setWarning("警告"); |
| | | // } |
| | | // mList.add(item); |
| | | // } |
| | | CheckInMng.getInstance().findVisitorList(); |
| | | mAdapter = new SupervisoryAdapter(getActivity()); |
| | | mAdapter.setList(mList); |
| | | mRecyclerViewRegister.setAdapter(mAdapter); |
| | | fragment_supervisory_bottom_register_list.setAdapter(mAdapter); |
| | | } |
| | | |
| | | private class SpaceItemDecoration extends RecyclerView.ItemDecoration { |
| | |
| | | @Override |
| | | public void onPause() { |
| | | mIsPlaying = false; |
| | | if(mSurfaceView2 instanceof MyGLSurfaceView) { |
| | | ((MyGLSurfaceView)mSurfaceView2).onPause(); |
| | | if(fragment_supervisory_exit_camera instanceof MyGLSurfaceView) { |
| | | ((MyGLSurfaceView) fragment_supervisory_exit_camera).onPause(); |
| | | } |
| | | //setPlayingStreamingMediaPlayer(false);//xiuxi |
| | | super.onPause(); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | if(mSurfaceView2 instanceof MyGLSurfaceView) { |
| | | ((MyGLSurfaceView)mSurfaceView2).onResume(); |
| | | if(fragment_supervisory_exit_camera instanceof MyGLSurfaceView) { |
| | | ((MyGLSurfaceView) fragment_supervisory_exit_camera).onResume(); |
| | | } |
| | | } |
| | | |