예제 #1
0
 public void onEventMainThread(ConnectSuccessEvent event) {
   if (timer != null) {
     timer.cancel();
     timer = null;
     loadingLenght = 99;
     tv_connecting.setVisibility(View.GONE);
   }
   isPhoneIsAp = false;
   //        statrtPlay();
   DeviceInfo.getInstance()
       .setContext(new WeakReference<Context>(CameraFragment.this.getActivity()));
   DeviceInfo.getInstance().getDeviceInfo();
   bt_take_photo.setEnabled(true);
   bt_go_photo.setEnabled(true);
 }
예제 #2
0
 @UiThread
 void connectSuccess() {
   bt_go_photo.setEnabled(true);
   bt_take_photo.setEnabled(true);
   ((HomeActivity) mActivity).hideBottombar();
   ((HomeActivity) mActivity).showAppBarWithDisConnect();
   rl_connect_page.setVisibility(View.GONE);
   bt_click_connect.setVisibility(View.VISIBLE);
   iv_loading_icon.setVisibility(View.GONE);
   tv_find_edr.setVisibility(View.VISIBLE);
   tv_little_tip.setVisibility(View.GONE);
   tv_little_tip_detail.setVisibility(View.GONE);
   iv_close_connect.setVisibility(View.GONE);
   AnimationUtils.cancelAnmation(iv_loading_icon);
   mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
 }
예제 #3
0
 @UiThread
 void resumeConnectPage() {
   bt_go_photo.setEnabled(false);
   bt_take_photo.setEnabled(false);
   iv_first_icon.setVisibility(View.GONE);
   iv_two_icon.setVisibility(View.GONE);
   iv_three_icon.setVisibility(View.GONE);
   rl_connect_page.setVisibility(View.VISIBLE);
   bt_click_connect.setVisibility(View.VISIBLE);
   bt_click_connect.setClickable(true);
   bt_click_connect.setEnabled(true);
   iv_loading_icon.setVisibility(View.GONE);
   tv_find_edr.setVisibility(View.VISIBLE);
   tv_little_tip.setVisibility(View.GONE);
   tv_little_tip_detail.setVisibility(View.GONE);
   iv_close_connect.setVisibility(View.GONE);
   AnimationUtils.cancelAnmation(iv_loading_icon);
   ((HomeActivity) mActivity).showBottombar();
   ((HomeActivity) mActivity).hideAppBar();
   mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 }
예제 #4
0
 /**
  * 初始化成功 startSession成功 , 获取sd卡的状态成功
  *
  * @param event
  */
 public void onEventMainThread(ConnectToCameraEvent event) {
   Logger.e("onEventMainThread isConnectCamera=" + event.isConnectCamera());
   if (event.isConnectCamera() && admin.isWifiEnabled()) {
     statrtPlay();
     connectSuccess();
     startReFreshAnimation();
     DeviceInfo.getInstance()
         .setContext(new WeakReference<Context>(CameraFragment.this.getActivity()));
     DeviceInfo.getInstance().getDeviceInfo();
     bt_take_photo.setEnabled(true);
     bt_go_photo.setEnabled(true);
     Logger.e("onEventMainThread FRAGMENTISHIDEN=" + FRAGMENTISHIDEN);
     autoDownLoadDataTask();
   } else {
     resumeConnectPage();
     if (mPlayer != null) {
       //                if (mPlayer.isPlaying()){
       mPlayer.stop();
       //                }
     }
   }
 }
예제 #5
0
 @UiThread
 void canTakePhotoIconInMainThread() {
   bt_take_photo.setEnabled(true);
 }
예제 #6
0
  @Click(R.id.bt_take_photo)
  void takePhoto() {
    if (LeautoCameraAppLication.isApConnectCamera) {
      if (Constant.isSDCardPresent) {
        bt_take_photo.setEnabled(false);
        showLoadingIgnoreKeyBack(getResources().getString(R.string.passing));
        handler_.postDelayed(runnable, 30000);
        CameraMessage takePhoto =
            new CameraMessage(
                CommandID.AMBA_TAKE_PHOTO,
                new CameraMessageCallback() {
                  @Override
                  public void onReceiveErrorMessage(
                      CameraMessage cameraMessage, JSONObject jsonObject) {
                    hideLoading();
                    canTakePhotoIconInMainThread();
                    showToastSafe(getResources().getString(R.string.take_photo_error));
                  }

                  @Override
                  public void onReceiveMessage(CameraMessage cameraMessage, JSONObject jsonObject) {
                    String path = jsonObject.optString("param");
                    filePath = "/tmp/SD0" + path.split(":")[1].replace("\\", "/");
                    int index = filePath.lastIndexOf("/");
                    photoName = filePath.substring(index);
                    String thumbPhoto = photoName.replace("A", "T").substring(1);
                    HomePhotoInfo homePhotoInfo =
                        new HomePhotoInfo(thumbPhoto, HomePhotoInfo.NORMAL_PIC);
                    homePhotoInfos.add(0, homePhotoInfo);

                    canTakePhotoIconInMainThread();
                    hideLoading();
                    showPhoto();
                    handler_.removeCallbacks(runnable);

                    //                        CameraMessage setInfo = new
                    // CameraMessage(CommandID.AMBA_SET_CLINT_INFO, new CameraMessageCallback() {
                    //                            @Override
                    //                            public void onReceiveErrorMessage(CameraMessage
                    // cameraMessage, JSONObject jsonObject) {
                    //                                hideLoading();
                    //                                canTakePhotoIconInMainThread();
                    //                                showToastSafe("拍照失败");
                    //                            }
                    //
                    //                            @Override
                    //                            public void onReceiveMessage(CameraMessage
                    // cameraMessage, JSONObject jsonObject) {
                    //                                remoteCamHelper.getFile(filePath, new
                    // SendCommandCallback() {
                    //                                    @Override
                    //                                    public void onFail(CameraMessage
                    // cameraMessage, JSONObject jsonObject) {
                    //                                        canTakePhotoIconInMainThread();
                    //                                    }
                    //
                    //                                    @Override
                    //                                    public void onSuccess(CameraMessage
                    // cameraMessage, JSONObject jsonObject) {
                    //                                        canTakePhotoIconInMainThread();
                    //                                        hideLoading();
                    //                                        showPhoto();
                    //                                        handler_.removeCallbacks(runnable);
                    ////                                if (!photoIsShow) {
                    ////                                }
                    //                                    }
                    //                                });
                    //                            }
                    //
                    //                            @Override
                    //                            public void onReceiveNotification(JSONObject
                    // jsonObject) {
                    //                            }
                    ////                        });
                    //                       setInfo.put("type", "TCP");
                    //                        setInfo.put("param", Constant.phoneIP);
                    //                        remoteCamHelper.sendCommand(setInfo);
                  }

                  @Override
                  public void onReceiveNotification(JSONObject jsonObject) {}
                });
        remoteCamHelper.sendCommand(takePhoto);
      } else {
        showToastSafe(getResources().getString(R.string.idcard_loss));
      }
    } else {
      bt_take_photo.setEnabled(false);
      showToastSafe(mActivity.getString(R.string.phone_and_camera_not_connect));
    }
  }