@Override
 public void onRequestPermissionsResult(
     int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
   super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
     switch (requestCode) {
       case AppKeyMap.CUPCAKE: // 联系厂家
         String engineer = (String) permissionMap.get("engineer");
         if (!TextUtils.isEmpty(engineer)) {
           AppTools.CALL(engineer);
         }
         break;
       case AppKeyMap.DONUT: // 联系用户
         String user = (String) permissionMap.get("user");
         if (!TextUtils.isEmpty(user)) {
           AppTools.CALL(user);
         }
         break;
       case AppKeyMap.FROYO: // 地址
         double lat = (double) permissionMap.get("lat");
         double lng = (double) permissionMap.get("lng");
         String address = (String) permissionMap.get("address");
         if (lat != 0.0d && lng != 0.0d && !TextUtils.isEmpty(address)) {
           startLocationActivity(lat, lng, address);
         }
         break;
       case AppKeyMap.GINGERBREAD: // 短信转发
         smsForword();
         break;
     }
   }
 }
 @Override
 public void onJsonObjectSuccess(BaseBean o, NetworkParams paramsCode) {
   // 首次进来获取数据
   if (paramsCode == NetworkParams.CUPCAKE) { // 获取全局数据
     OrderDetailBean orderDetailBean = (OrderDetailBean) o;
     final OrderDetailBean.DataEntity data = orderDetailBean.getData();
     fillProductList(orderDetailBean, data);
     fillGuideList(data);
     orderDetailLayout.setDetail(data);
   } else if (paramsCode == NetworkParams.DONUT) { // 预约签到的返回
     AppTools.showNormalSnackBar(parentView, getString(R.string.order_detail_already_sign_in));
     networkModel.orderDetail(orderId, "1", NetworkParams.CUPCAKE);
   } else if (paramsCode == NetworkParams.ICECREAMSANDWICH) {
     orderDetailLayout.llytEvaluate.setVisibility(View.GONE);
     orderDetailLayout.llytEvaluation.setVisibility(View.VISIBLE);
     AppTools.sendBroadcast(null, AppKeyMap.WAITING_COST_ACTION);
     Intent intent =
         new Intent()
             .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP)
             .setClass(this, MainActivity.class);
     startActivity(intent);
     AppTools.sendBroadcast(new Bundle(), AppKeyMap.REFRESH_AND_JUMPTO_SERVICED_PAGE); // 意在刷新
   } else if (paramsCode == NetworkParams.LOLLIPOP) {
     start(MainActivity.class);
     AppTools.sendBroadcast(new Bundle(), AppKeyMap.REFRESH_AND_JUMPTO_SERVICED_PAGE); // 意在刷新
   } else if (paramsCode == NetworkParams.HONEYCOMB) { // 未读清除成功
     AppTools.sendBroadcast(new Bundle(), AppKeyMap.REFRESH_AND_JUMPTO_SERVICED_PAGE); // 意在刷新
   }
 }
 @Override
 protected void onClick(int id, View view) {
   final OrderDetailBean.DataEntity detail = orderDetailLayout.getDetail();
   if (detail == null) {
     return;
   }
   String orderId = detail.getOrderid();
   switch (id) {
     case R.id.btn_sign_appointment: // 签到
       if (AppTools.isNetworkConnected()) {
         AppTools.showNormalSnackBar(parentView, getString(R.string.main_locating));
         AppTools.locate(this);
       } else {
         AppTools.showSettingSnackBar(parentView, getString(R.string.no_network_is_detected));
       }
       break;
     case R.id.btn_edit_appointment: // 修改预约
       alterPopupWindow.showAtLocation(parentView, Gravity.BOTTOM, 0, 0);
       break;
     case R.id.btn_appointment_again: // 再次预约
       appointAgain();
       break;
     case R.id.btn_confirm_done: // 完成工单
       completeAcce();
       break;
     case R.id.btn_engineer:
       contactEngineer(detail);
       break;
     case R.id.btn_user:
       contactUser(detail);
       break;
     case R.id.tv_location:
       locationActivityLogic(detail);
       break;
     case R.id.btn_track:
       startActivity(
           new Intent().putExtra("orderId", orderId).setClass(this, OrderTrackingActivity.class));
       break;
     case R.id.textView: // 联系客服
       contactService(orderId);
       BGABadgeTextView bt = (BGABadgeTextView) view;
       bt.hiddenBadge();
       break;
     case R.id.btn_expenses:
       startActivity(new Intent(this, ExpensesDetailActivity.class).putExtra("orderId", orderId));
       break;
     case R.id.btn_msg: // 短信转发
       if (PermissionTools.alreadyHasPermission(
           this, AppKeyMap.GINGERBREAD, Manifest.permission.SEND_SMS)) {
         smsForword();
       }
       break;
   }
 }
 private void completeAcce() {
   String pwd = gridPasswordView.getPassWord();
   if (TextUtils.isEmpty(pwd)) {
     AppTools.showNormalSnackBar(parentView, getString(R.string.please_input_service_code));
   } else {
     networkModel.completeOrder(
         orderId, gridPasswordView.getPassWord(), NetworkParams.ICECREAMSANDWICH);
   }
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   orderDetailLayout = (OrderDetailLayout) viewDataBinding;
   if (getIntent() != null) {
     orderId = getIntent().getStringExtra("orderId");
   }
   AppTools.registerBroadcast(
       new RefreshDataBroadcast(), AppKeyMap.REFRESH_AND_JUMPTO_SERVICED_PAGE);
 }
 protected List<MyOrderBean.ListEntity> getLocalList(String saveKey) {
   return new Prefser(AppTools.getSharePreferences())
       .get(
           saveKey,
           new TypeToken<List<MyOrderBean.ListEntity>>() {
             @Override
             public Type getType() {
               return super.getType();
             }
           },
           new ArrayList<MyOrderBean.ListEntity>());
 }
 private void initRecyclerView() {
   guideRecyclerView.setAdapter(guideAdapter);
   guideRecyclerView.addItemDecoration(AppTools.defaultHorizontalDecoration());
   guideRecyclerView.setLayoutManager(new LinearLayoutManager(this));
   recyclerView.addItemDecoration(
       new HorizontalDividerItemDecoration.Builder(this)
           .colorResId(R.color.color_bg_gravy)
           .sizeResId(R.dimen.large_margin_15dp)
           .build());
   recyclerView.setLayoutManager(linearLayoutManager);
   recyclerView.setAdapter(commonBinderAdapter);
 }
 protected void saveListToLocal(String saveKey) {
   Prefser prefser = new Prefser(AppTools.getSharePreferences());
   prefser.put(saveKey, list);
 }
 @Override
 protected void onPause() {
   super.onPause();
   AppTools.stopLocate();
 }