@Override
        public void onClick(View v) {
          switch (v.getId()) {
            case R.id.dialog_layout_add_truck_item_button_add:
              if (!CommonUtilities.isNetworkAvailable(mContext)) {
                Toast.makeText(mContext, "Network connection unavailable.", Toast.LENGTH_SHORT)
                    .show();
                break;
              }
              quantityToAdd = Double.parseDouble(addPartDialogQuantity.getText().toString());

              if (quantityToAdd <= 0) {
                Toast.makeText(mContext, "Quantity Can't Be Null!", Toast.LENGTH_SHORT).show();
                return;
              }

              if (!addPartDialog.isShowing()) addPartDialog.dismiss();

              new SubmitTruckItemTask().execute();
              break;
            case R.id.dialog_layout_add_truck_item_button_cancel:
              if (addPartDialog.isShowing()) addPartDialog.dismiss();
              break;
            default:
              // Nothing
              break;
          }
        }
 private void showPrivacyOptionsDialog(boolean isShow) {
   if (privacyOptionDialog == null) {
     privacyOptionDialog = new Dialog(this);
     privacyOptionDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
     privacyOptionDialog.setContentView(R.layout.privacy_options_dialog);
     privacyOptionDialog.findViewById(R.id.id_chat_settings).setOnClickListener(this);
     privacyOptionDialog.findViewById(R.id.id_call_settings).setOnClickListener(this);
     privacyOptionDialog.findViewById(R.id.id_block_list).setOnClickListener(this);
   }
   if (privacyOptionDialog != null && !privacyOptionDialog.isShowing() && isShow)
     privacyOptionDialog.show();
   if (privacyOptionDialog != null && privacyOptionDialog.isShowing() && !isShow)
     privacyOptionDialog.cancel();
 }
示例#3
0
  /**
   * @param context
   * @param isShowMsg �Ƿ���ʾ��ʾ��Ϣ
   */
  public void checkAppUpdate(Context context, final boolean isShowMsg, Handler hanlder, int what) {
    Log.d("tag", "wmz:checkAppUpdate");
    this.mContext = context;
    getCurrentVersion();
    if (isShowMsg) {
      if (mProDialog == null)
        mProDialog = ProgressDialog.show(mContext, null, "ProgressDialog...", true, true);
      else if (mProDialog.isShowing()
          || (latestOrFailDialog != null && latestOrFailDialog.isShowing())) return;
    }

    final Handler mHandler =
        new Handler() {
          public void handleMessage(Message msg) {

            if (msg.what == 1) {
              Log.d("tag", "wmz:1");
              if (msg.obj == null) return;

            } else if (isShowMsg) {
              showLatestOrFailDialog(DIALOG_TYPE_FAIL);
            }
          }
        };

    mCheckVersionUrl = "http://192.168.1.148:8080/Demo/CheckVersion";
    // ConnectServerManager.checkVersion(mCheckVersionUrl, hanlder, what);
    new Thread(mCheckVersionRunnable).start();
  }
示例#4
0
 @Override
 protected void onPause() {
   super.onPause();
   if (connectionNotConfiguredProperlyDialog.isShowing()) {
     connectionNotConfiguredProperlyDialog.dismiss();
   }
 }
示例#5
0
  private void showDialogToOpenAccountSettings(String msg, final Intent intent) {
    if (connectionNotConfiguredProperlyDialog.isShowing()) {
      return;
    }

    connectionNotConfiguredProperlyDialog.setContentView(R.layout.settings_dialog);
    connectionNotConfiguredProperlyDialog.setTitle(getString(R.string.configuration));

    TextView label = (TextView) connectionNotConfiguredProperlyDialog.findViewById(R.id.text);
    label.setText(msg);

    Button continueButton =
        (Button) connectionNotConfiguredProperlyDialog.findViewById(R.id.continueButton);
    continueButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            connectionNotConfiguredProperlyDialog.dismiss();
            startActivity(intent);
          }
        });

    Button ignoreButton =
        (Button) connectionNotConfiguredProperlyDialog.findViewById(R.id.ignoreButton);
    ignoreButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            connectionNotConfiguredProperlyDialog.dismiss();
          }
        });

    connectionNotConfiguredProperlyDialog.show();
  }
示例#6
0
 private void showDialog() {
   if (pd != null && pd.isShowing()) {
     pd.dismiss();
   }
   pd = CommonDialog.ProgressDialog(this);
   pd.show();
 }
示例#7
0
 private void dataAlert(int data_state) {
   if (data_state == DATA_STATE_DISCONNECTED) {
     if (mAlert != null && !mAlert.isShowing()) {
       mAlert.show();
     }
   }
 }
示例#8
0
  private void updateFlicks(String sort_order) {
    if (mUtils.isDataAvaialable()) {
      dataState(DATA_STATE_CONNECTED);
      mAlertCancelledState = false;
      mNoDataTextView.setVisibility(View.GONE);
      if (mAlert != null && mAlert.isShowing()) mAlert.dismiss();

      if (!mIsDoneDownloadingData && mSharedPref != null) {
        mFlickDataFetchTask = new FlickDataFetchAsyncTask(getActivity(), sort_order, this);
        mFlickDataFetchTask.execute();
      }
    } else {
      if (!mAlertCancelledState) {
        dataAlert(DATA_STATE_DISCONNECTED);
      } else {
        Toast.makeText(
                mContext,
                getResources().getString(R.string.data_unavailable_msg),
                Toast.LENGTH_SHORT)
            .show();
      }
      mNoDataTextView.setVisibility(View.VISIBLE);
      dataState(DATA_STATE_DISCONNECTED);
      updateGridBasedOnDataConnectionState();
    }
  }
示例#9
0
 @Override
 public void onStop() {
   if (mDialog != null && mDialog.isShowing()) {
     mDialog.dismiss();
   }
   super.onPause();
 }
  public boolean checkTestRunning(final Runnable runnable) {
    if (service == null || !service.isTestRunning()) return false;

    if (dialog == null || !dialog.isShowing()) {
      final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
      builder.setTitle(R.string.test_dialog_abort_title);
      builder.setMessage(R.string.test_dialog_abort_extended_text);
      builder.setPositiveButton(
          R.string.test_dialog_abort_yes,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(final DialogInterface dialog, final int which) {
              if (extendedResultButtonCancel != null && extendedResultButtonCancel.isShown())
                extendedResultButtonCancel.setEnabled(false);

              if (service != null) service.stopTest();

              if (runnable != null) runnable.run();
            }
          });
      builder.setNegativeButton(R.string.test_dialog_abort_no, null);
      dialog = builder.create();
      dialog.show();
    }
    return true;
  }
示例#11
0
  @Override
  public void onPrepared(MediaPlayer mp) {

    if (isPrepare) {
      if (playType == PLAY_TYPE_LOD || playType == PLAY_TYPE_ONDEMAND) {
        // TODO 数据库操作 记忆续播
        MPConPlayManager cPm =
            MPConPlayUtils.findConnectionPlay(currentPosition, parentName, getChildName());
        if (cPm != null && cPm.getEpisodePos() == currentPosition && cPm.getPlayIndex() != 0) {
          mp.seekTo(cPm.getPlayIndex());
        }

        mHandler.sendEmptyMessage(SHOW_CONTROL_ANIMATION);
      }

      mp.start();
      isPrepare = false;

      if (mDialog != null && mDialog.isShowing()) {
        mDialog.dismiss();
      }
      // 判断是否是本地播放或在线点播
      if (playType == PLAY_TYPE_LOD || playType == PLAY_TYPE_ONDEMAND) {
        if (mp.isPlaying() && !mSeekBar.isPressed()) {

          mHandler.sendEmptyMessage(UPDATA_PLAY_TIME);
        }
      }

      mProgressBar.setVisibility(View.INVISIBLE);

      mPlayer.setScreenOnWhilePlaying(true);
    }
  }
 @Test
 public void showDialog_shouldShowDialog() throws Exception {
   final DialogCreatingActivity activity = create(DialogCreatingActivity.class);
   activity.showDialog(1);
   Dialog dialog = ShadowDialog.getLatestDialog();
   assertTrue(dialog.isShowing());
 }
示例#13
0
 public static Dialog show(Dialog loadingDialog, Context context) {
   loadingDialog = createLoadingDialog(context, null);
   System.out.println(loadingDialog.getOwnerActivity());
   if (!loadingDialog.isShowing()) {
     loadingDialog.show();
   }
   return loadingDialog;
 }
示例#14
0
 // 模式化窗口。用作遮罩层
 public void showDialog() {
   if (dialog == null) {
     dialog = DialogUtil.createLoadingDialog(getActivity(), "请稍候...");
   }
   if (!dialog.isShowing()) {
     dialog.show();
   }
 }
示例#15
0
 /**
  * *********************************************** @Title: showDialog @Description: TODO(遮罩层展示)
  *
  * @param msg 提示信息
  * @return void 返回类型
  * @throws
  * @date 2015-1-14 ***********************************************
  */
 public void showDialog(String msg) {
   if (dialog == null) {
     dialog = DialogUtil.createLoadingDialog(getActivity(), msg);
   }
   if (!dialog.isShowing()) {
     dialog.show();
   }
 }
 @Test
 public void dismissDialog_shouldDismissPreviouslyShownDialog() throws Exception {
   final DialogCreatingActivity activity = create(DialogCreatingActivity.class);
   activity.showDialog(1);
   activity.dismissDialog(1);
   Dialog dialog = ShadowDialog.getLatestDialog();
   assertFalse(dialog.isShowing());
 }
示例#17
0
 protected void dismissDialogs() {
   while (this.mDialogs.size() > 0) {
     Dialog dialog = (Dialog) this.mDialogs.get(0);
     if (dialog != null && dialog.isShowing()) {
       dialog.dismiss();
       this.mDialogs.remove(dialog);
     }
   }
 }
示例#18
0
  public void tooShort() {
    if (mDialog != null && mDialog.isShowing()) {
      mIcon.setVisibility(View.VISIBLE);
      mVoice.setVisibility(View.GONE);
      mLable.setVisibility(View.VISIBLE);

      mIcon.setImageResource(R.drawable.voice_to_short);
      mLable.setText("录音时间过短");
    }
  }
示例#19
0
  /** 隐藏dialog */
  public void dismissProgressDialog() {
    try {

      if (progressDialog != null && progressDialog.isShowing()) {
        progressDialog.dismiss();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#20
0
 protected void dismissSpinner() {
   if (dialog != null && dialog.isShowing()) {
     try {
       dialog.dismiss();
     } catch (IllegalArgumentException e) {
       // In certain case dialog already disattached from window.
     }
     dialog = null;
   }
 }
示例#21
0
  public void recording() {
    if (mDialog != null && mDialog.isShowing()) {
      mIcon.setVisibility(View.VISIBLE);
      mVoice.setVisibility(View.VISIBLE);
      mLable.setVisibility(View.VISIBLE);

      mIcon.setImageResource(R.drawable.recorder);
      mLable.setText("手指上滑,取消发送");
    }
  }
示例#22
0
  public void wantToCancel() {
    if (mDialog != null && mDialog.isShowing()) {
      mIcon.setVisibility(View.VISIBLE);
      mVoice.setVisibility(View.GONE);
      mLable.setVisibility(View.VISIBLE);

      mIcon.setImageResource(R.drawable.cancel);
      mLable.setText("松开手指,取消发送");
    }
  }
  @Override
  protected void onDestroy() {
    super.onDestroy();
    if (null != mDialog && mDialog.isShowing()) {
      mDialog.dismiss();
    }

    // 关闭音乐播放服务
    // stopService(CommUtils.getMaskIntent(this, null, LocalPlayerService.class));
  }
示例#24
0
 @Override
 protected void onDestroy() {
   if (_qrCodeDialog != null) {
     _qrCodeDialog.dismiss();
   }
   if (_addDialog != null && _addDialog.isShowing()) {
     _addDialog.dismiss();
   }
   super.onDestroy();
 }
示例#25
0
 @Override
 public void onClick(View view) {
   if (isEnabled()) {
     if (null != dialog && dialog.isShowing()) {
       dialog.dismiss();
     }
     dialog = createDialog();
     dialog.show();
   }
 }
示例#26
0
  protected void showChangeLogoRem() {
    if (null == selectLogoDialog) {
      selectLogoDialog = new Dialog(this, R.style.dialog);
      ViewGroup mRoot =
          (ViewGroup)
              LayoutInflater.from(this).inflate(R.layout.select_photo_dialog_content_view, null);
      int width = getWindowManager().getDefaultDisplay().getWidth();
      selectLogoDialog.setContentView(mRoot, new LayoutParams(width, LayoutParams.WRAP_CONTENT));
      Button btnCamera = (Button) mRoot.findViewById(R.id.btnCamera);
      Button btnAlbum = (Button) mRoot.findViewById(R.id.btnAlbum);
      Button btnCancel = (Button) mRoot.findViewById(R.id.btnCancel);
      btnCamera.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              selectLogoDialog.cancel();
              // 使用相机拍照
              doPickPhotoAction();
            }
          });
      btnAlbum.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              selectLogoDialog.cancel();
              // 从相册中去获取
              try {
                Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
                intent.setType("image/*");
                startActivityForResult(intent, AVATAR_PHOTO_PICKED_WITH_DATA);
              } catch (ActivityNotFoundException e) {
                Toast.makeText(HomePageActivity.this, "没有找到照片", Toast.LENGTH_SHORT).show();
              }
            }
          });
      btnCancel.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              selectLogoDialog.cancel();
            }
          });
    }
    Window window = selectLogoDialog.getWindow();
    window.setGravity(Gravity.BOTTOM);
    window.setWindowAnimations(R.style.mystyle);
    selectLogoDialog.setCanceledOnTouchOutside(true);
    if (null != selectLogoDialog && !selectLogoDialog.isShowing() && !isFinishing()) {
      selectLogoDialog.show();
    }
  }
示例#27
0
  public void updateVoiceLevel(int level) {
    if (mDialog != null && mDialog.isShowing()) {
      // mIcon.setVisibility(View.VISIBLE);
      // mVoice.setVisibility(View.VISIBLE);
      // mLable.setVisibility(View.VISIBLE);

      int resId =
          mContext.getResources().getIdentifier("v" + level, "drawable", mContext.getPackageName());
      mVoice.setImageResource(resId);
    }
  }
  @Override
  public void onClick(View v) {
    // Ignore all clicks on the list once a dialog has been
    // created. This is needed to guard against quikly pressing
    // the buttons multiple times.
    if (mDialog != null && mDialog.isShowing()) {
      return;
    }

    int id = v.getId();
    if (id == R.id.button_remove_repeat) {
      int iList = (Integer) v.getTag();
      mListData.remove(iList);
      mListAdapter.notifyDataSetChanged();
    } else if (id == R.id.button_add_new) {
      // Find a new value for the repeat and add a
      // repeat item based on it. This is done by simply
      // adding the default repeat value to the maximum
      // value in the list and then bounding it using the
      // maximum repeat value (which is max(duration) - 1)
      int maxRepeat = 0;
      for (int i = LIST_POS_REPEAT_START; i < mListData.size(); i++) {
        int repeat = mListData.get(i);
        if (repeat > maxRepeat) {
          maxRepeat = repeat;
        }
      }
      int duration = mListData.get(LIST_POS_DURATION);
      maxRepeat += NotifConfig.defaultRepeat;
      if (maxRepeat >= duration) {
        maxRepeat = duration - 1;
      }
      // Add the new repeat item to the list
      mListData.add(LIST_POS_REPEAT_START, new Integer(maxRepeat));
      mListAdapter.notifyDataSetChanged();
    } else if (id == R.id.trig_edit_done) {
      // Copy the values from the UI to the description class,
      // convert to string and then send back the result
      mNotifDesc.setDuration(mListData.get(LIST_POS_DURATION));
      mNotifDesc.setSuppression(mListData.get(LIST_POS_SUPPRESSION));
      if (LIST_POS_REPEAT_START < mListData.size()) {
        mNotifDesc.setRepeats(mListData.subList(LIST_POS_REPEAT_START, mListData.size()));
      } else {
        mNotifDesc.setRepeats(new ArrayList<Integer>());
      }
      Intent intent = new Intent();
      intent.putExtra(KEY_NOTIF_CONFIG, mNotifDesc.toString());
      setResult(0, intent);
      finish();
    } else if (id == R.id.trig_edit_cancel) {
      finish();
    }
  }
  @Test
  public void removeUsingTransaction_shouldDismissTheDialog() throws Exception {
    dialogFragment.show(fragmentManager, null);

    FragmentTransaction t = fragmentManager.beginTransaction();
    t.remove(dialogFragment);
    t.commit();

    Dialog dialog = ShadowDialog.getLatestDialog();
    assertFalse(dialog.isShowing());
    assertTrue(shadowOf(dialog).hasBeenDismissed());
  }
示例#30
0
 @Override
 public void onClick(View view) {
   snoozing = false;
   Intent intent = new Intent();
   intent.setAction(TimerService.BundleKey.UPDATE_TIMER_SETTINGS);
   intent.putExtra(TimerService.BundleKey.STOP, true);
   getActivity().sendBroadcast(intent);
   if (snoozeDialog != null && snoozeDialog.isShowing()) {
     snoozeDialog.dismiss();
     vg.removeView(snoozeDialog.getWindow().getDecorView());
   }
 }