Esempio n. 1
0
  /**
   * 显示开启悬浮窗提示
   *
   * @param context
   */
  public static void showOpenFloatDialog(final Context context) {

    Dialog dialog =
        new CustomDialog.Builder(context)
            .setTitle(context.getString(R.string.open_float))
            .setMessage(context.getString(R.string.open_float_desc))
            .setPositiveButton(
                context.getString(R.string.confirm),
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    MIUIHelper.getInstance().openFloatWindowSetting(context);
                    dialog.dismiss();
                  }
                })
            .setNegativeButton(
                context.getString(R.string.cancel),
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.cancel();
                  }
                })
            .create();
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
  }
Esempio n. 2
0
  /**
   * 显示创建快捷方式的提示
   *
   * @param context
   */
  public static void showCreateShortDialog(final Context context) {

    Dialog dialog =
        new CustomDialog.Builder(context)
            .setTitle(context.getString(R.string.create_short))
            .setMessage(context.getString(R.string.create_short_desc))
            .setPositiveButton(
                context.getString(R.string.confirm),
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    if (!Util.hasShortCut(context)) {
                      Util.createShortCut(
                          context, context.getString(R.string.app_name), CallFrom.LOCAL);
                    }
                    dialog.dismiss();
                  }
                })
            .setNegativeButton(
                context.getString(R.string.cancel),
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.cancel();
                  }
                })
            .create();
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
  }
 private void initView() {
   dialog = new UploadDialog(this, R.style.UploadDialog, R.string.upload_dialog_textView);
   dialog.setCanceledOnTouchOutside(false);
   userPhotoButton = (RelativeLayout) findViewById(R.id.mineInformation_userPhoto);
   userNameButton = (RelativeLayout) findViewById(R.id.mineInformation_userName);
   userSexButton = (RelativeLayout) findViewById(R.id.mineInformation_userSex);
   userBirthdayButton = (RelativeLayout) findViewById(R.id.mineInformation_userBirthday);
   userDepartmentButton = (RelativeLayout) findViewById(R.id.mineInformation_userDepartment);
   userJobButton = (RelativeLayout) findViewById(R.id.mineInformation_userJob);
   userTelephoneButton = (RelativeLayout) findViewById(R.id.mineInformation_userTelephone);
   userPhoto = (SmartImageView) findViewById(R.id.mineInformation_userPhoto_realPhoto);
   userName = (TextView) findViewById(R.id.mineInformation_userName_realName);
   userSex = (TextView) findViewById(R.id.mineInformation_userSex_realSex);
   userBirthday = (TextView) findViewById(R.id.mineInformation_userBirthday_realBirthday);
   userDepartment = (TextView) findViewById(R.id.mineInformation_userDepartment_realDepartment);
   userJob = (TextView) findViewById(R.id.mineInformation_userJob_realJob);
   userTelephone = (TextView) findViewById(R.id.mineInformation_userTelephone_realTelephone);
   cancelButton = (TextView) findViewById(R.id.mineInformation_cancelButton);
   cancelButton.setOnClickListener(this);
   userPhotoButton.setOnClickListener(this);
   userNameButton.setOnClickListener(this);
   userSexButton.setOnClickListener(this);
   userBirthdayButton.setOnClickListener(this);
   userDepartmentButton.setOnClickListener(this);
   userJobButton.setOnClickListener(this);
   userTelephoneButton.setOnClickListener(this);
 }
Esempio n. 4
0
  /**
   * Called when the user clicks on one of the icons in the map. It uses a Toast to say hello.
   *
   * @param pIndex is the Find's index in the ArrayList
   */
  @Override
  protected boolean onTap(int pIndex) {
    Dialog dialog = new Dialog(mContext);
    dialog.setCanceledOnTouchOutside(true);

    OverlayItem item = mOverlays.get(pIndex);
    dialog.setContentView(R.layout.custom_dialog);
    dialog.setTitle(item.getTitle());

    TextView text = (TextView) dialog.findViewById(R.id.text);
    text.setText(item.getSnippet());
    ImageView image = (ImageView) dialog.findViewById(R.id.image);

    image.setImageResource(R.drawable.small_letter);
    dialog.show();

    // Get contact
    StringTokenizer st = new StringTokenizer(item.getTitle(), "  ,      ");
    String temp = st.nextToken();
    final String contact = st.nextToken();

    final Button button = (Button) dialog.findViewById(R.id.more_info_button);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Intent myIntent = new Intent();
            myIntent.setClassName("edu.stanford.jdiprete", "edu.stanford.jdiprete.DialogOnclick");
            myIntent.putExtra("contact", contact);
            myIntent.putExtra("captureId", captureId);
            mContext.startActivity(myIntent);
          }
        });
    return true;
  }
Esempio n. 5
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    final int selectedPosition = getArguments().getInt(BUNDLE_ARGUMENTS_SELECTED_POSITION);

    Dialog dialog =
        new AlertDialog.Builder(getActivity())
            .setTitle(R.string.delete_sound_dialog)
            .setNegativeButton(
                R.string.cancel_button,
                new OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                  }
                })
            .setPositiveButton(
                R.string.ok,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    handleDeleteSound(selectedPosition);
                  }
                })
            .create();

    dialog.setCanceledOnTouchOutside(true);

    return dialog;
  }
Esempio n. 6
0
  private void showFromDialog() {
    final Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().setWindowAnimations(R.style.PauseDialogAnimation);
    dialog.setTitle(R.string.time_dialog_from);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setContentView(R.layout.dialog_time_layout);

    Button okButton = (Button) dialog.findViewById(R.id.dialogTimeOkButton);
    Button cancelButton = (Button) dialog.findViewById(R.id.dialogTimeCancelButton);

    final TimePicker timePicker = (TimePicker) dialog.findViewById(R.id.timePicker);

    okButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.HOUR, timePicker.getCurrentHour());
            calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute());
            profile.setFromTime(calendar.getTimeInMillis());
            dialog.dismiss();
            showToDialog();
          }
        });
    cancelButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });

    dialog.show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("本地视频");
    setContentView(R.layout.local_video_main);
    mDbHelper = new DbHelper<VideoInfo>();
    mVideoList = mDbHelper.queryForAll(VideoInfo.class); // 从数据库获取数据记录

    mListView = (SlideListView) findViewById(R.id.my_listview);
    mFileAdapter = new FileAdapter(this);
    mListView.setAdapter(mFileAdapter);
    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(LoaclVideoActivity.this, SubUnityPlayerActivity.class);
            //                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            //                intent.putExtra("oneshot", 0);
            //                intent.putExtra("configchange", 0);
            //                Uri uri = Uri.fromFile(new File(mVideoList.get(position).path));
            //                intent.setDataAndType(uri, "video/*");
            intent.putExtra("url", "file://" + mVideoList.get(position).path);
            startActivity(intent);
          }
        });

    vandaAlert = VandaAlert.createLoadingDialog(LoaclVideoActivity.this, "正在扫描...");
    vandaAlert.setCanceledOnTouchOutside(false);
  }
Esempio n. 8
0
  public static void accessDialog(Context ctx) {
    final Context context = ctx;
    final Dialog dialog =
        new IntroduceDialog(context, R.layout.dialog_clear_history, R.style.Theme_dialog);
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
    TextView t1 = (TextView) dialog.findViewById(R.id.dialog_title);
    TextView t2 = (TextView) dialog.findViewById(R.id.dialog_content);
    t1.setText("È·ÈÏÍ˳ö");
    t2.setText("ÄúÕæµÄÒªÍ˳öËѹ·ÔĶÁÂð£¿");

    Button pButton = (Button) dialog.findViewById(R.id.dialog_ok);
    Button cButton = (Button) dialog.findViewById(R.id.dialog_cancer);
    pButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.dismiss();
            ((Activity) context).finish();
          }
        });

    cButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    String currentRom = getArguments().getString(ARG_CURRENT_ROM);
    String targetRom = getArguments().getString(ARG_TARGET_ROM);
    String message =
        String.format(getString(R.string.set_kernel_mismatched_rom), currentRom, targetRom);

    Dialog dialog =
        new MaterialDialog.Builder(getActivity())
            .content(message)
            .positiveText(R.string.proceed)
            .negativeText(R.string.cancel)
            .callback(
                new ButtonCallback() {
                  @Override
                  public void onPositive(MaterialDialog dialog) {
                    ConfirmMismatchedSetKernelDialogListener owner = getOwner();
                    if (owner != null) {
                      owner.onConfirmMismatchedSetKernel();
                    }
                  }
                })
            .build();

    setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);

    return dialog;
  }
  // NewItemDialogFragment is called by the AddNewFragment Fragment
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View theView = inflater.inflate(R.layout.fragment_change_item_dialog, container, false);

    View saveItemChangesBtn = theView.findViewById(R.id.saveItemChangesBtn);
    saveItemChangesBtn.setOnClickListener(this);
    saveItemChangesBtn.hasFocus();

    View cancelItemChangesBtn = theView.findViewById(R.id.cancelItemChangesBtn);
    cancelItemChangesBtn.setOnClickListener(this);

    View deleteItemBtn = theView.findViewById(R.id.deleteItemBtn);
    deleteItemBtn.setOnClickListener(this);
    args = getArguments();
    editItemTextField = (EditText) theView.findViewById(R.id.editItemText);
    editItemTextField.setText(args.getString("EditItemText"));

    // setup the dialog
    Dialog dialog = getDialog();
    dialog.setTitle("Edit " + args.getString("EditItemType"));
    dialog.setCanceledOnTouchOutside(false);

    return theView;
  }
Esempio n. 11
0
  public static Dialog showProgressDialog(Context mContext, String text, boolean cancelable) {
    Dialog mDialog = new Dialog(mContext, R.style.ProgressBarTheme);
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    LayoutInflater mInflater = LayoutInflater.from(mContext);
    mDialog
        .getWindow()
        .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    View layout = mInflater.inflate(R.layout.custom_progressbar, null);
    mDialog.setContentView(layout);

    TextView tvProgressMessage = (TextView) layout.findViewById(R.id.tvProgressMessage);

    if (text.equals("")) tvProgressMessage.setVisibility(View.GONE);
    else tvProgressMessage.setText(text);

    mDialog.setCancelable(cancelable);
    mDialog.setCanceledOnTouchOutside(false);
    /*
     * mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND
     * );
     */
    mDialog.show();

    return mDialog;
  }
Esempio n. 12
0
  /**
   * * showProcessHUD 显示进度指示
   *
   * @param title 显示提示title
   */
  protected void showProcessHUD(String title) {
    // 加载进度条
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View v = inflater.inflate(R.layout.ztb_custom_dialog, null);
    ImageView spaceshipImage = (ImageView) v.findViewById(R.id.dialog_loading_img);
    TextView titleTV = (TextView) v.findViewById(R.id.dialog_loading_title);
    if (!TextUtils.isEmpty(title)) {
      titleTV.setText(title);
      titleTV.setVisibility(View.VISIBLE);
    } else {
      titleTV.setVisibility(View.GONE);
    }
    Animation hyperspaceJumpAnimation =
        AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_anim);
    spaceshipImage.startAnimation(hyperspaceJumpAnimation);

    mPD = new Dialog(getActivity(), R.style.loading_dialog);
    mPD.addContentView(
        v,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

    mPD.setCancelable(true);
    mPD.setCanceledOnTouchOutside(false);
    mPD.show();
  }
Esempio n. 13
0
 /** 显示版本更新通知对话框 */
 private void showNoticeDialog() {
   AlertDialog.Builder builder = new Builder(mContext);
   builder.setTitle("软件版本更新");
   builder.setMessage(updateMsg);
   builder.setPositiveButton(
       "立即更新",
       new OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           dialog.dismiss();
           showDownloadDialog();
         }
       });
   builder.setNegativeButton(
       "以后再说",
       new OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           dialog.dismiss();
           stopSelf();
         }
       });
   noticeDialog = builder.create();
   noticeDialog.setCanceledOnTouchOutside(false);
   noticeDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
   noticeDialog.show();
 }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final Dialog dialog = getDialog();
    dialog.setCanceledOnTouchOutside(true);
  }
Esempio n. 15
0
  private void dependToShowDialog() {
    if (!SomeUtil.hasSystemFeatureGPS(this)) {
      // 系统没有 GPS 模块就不弹出开启 GPS 的对话框
      return;
    }
    if (!SomeUtil.isGPSOn(this)) {
      mDialog = new Dialog(this, R.style.Dialog_style_dim2);
      View view = View.inflate(this, R.layout.dialog_my_vehicle_condition, null);
      TextView txt1 = (TextView) view.findViewById(R.id.txt_dialog_my_vehicle_condition_heading);
      TextView txt2 = (TextView) view.findViewById(R.id.txt_dialog_my_vehicle_condition_subheading);
      ImageView ivYes = (ImageView) view.findViewById(R.id.iv_dialog_my_vehicle_condition_yes);
      ImageView ivNo = (ImageView) view.findViewById(R.id.iv_dialog_my_vehicle_condition_no);

      txt1.setText(getResources().getString(R.string.myVehicleCondition_heading_no_gps));
      txt2.setText(getResources().getString(R.string.myVehicleCondition_subheading_no_gps));
      ivYes.setOnClickListener(mDialogOnClickListener);
      ivNo.setOnClickListener(mDialogOnClickListener);

      mDialog.setContentView(view);
      mDialog.setCanceledOnTouchOutside(true);
      mDialog.getWindow().setType((WindowManager.LayoutParams.TYPE_SYSTEM_ALERT));
      mDialog.show();
    } else {
      mLocationClient.start();
    }
  }
Esempio n. 16
0
  public MyDialog(Context context, String title, String message) {

    LayoutInflater inflater = LayoutInflater.from(context);
    View view = inflater.inflate(R.layout.dialog_layout, null);

    mDialog = new Dialog(context, R.style.dialog);
    mDialog.setContentView(view);
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.setOnKeyListener(
        new DialogInterface.OnKeyListener() {
          @Override
          public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK) {
              return true;
            }
            return false;
          }
        });
    dialog_title = (TextView) view.findViewById(R.id.dialog_title);
    dialog_message = (TextView) view.findViewById(R.id.dialog_message);
    dialog_title.setText(title);
    dialog_message.setText(message);

    positive = (TextView) view.findViewById(R.id.yes);
    negative = (TextView) view.findViewById(R.id.no);
  }
Esempio n. 17
0
  /** 显示下载对话框 */
  private void showDownloadDialog() {
    Builder builder = new Builder(mContext);
    builder.setTitle("正在下载新版本");

    final LayoutInflater inflater = LayoutInflater.from(mContext);
    View v = inflater.inflate(R.layout.update_progress, null);
    mProgress = (ProgressBar) v.findViewById(R.id.update_progress);
    mProgressText = (TextView) v.findViewById(R.id.update_progress_text);

    builder.setView(v);
    builder.setNegativeButton(
        "取消",
        new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            interceptFlag = true;
          }
        });
    builder.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            dialog.dismiss();
            interceptFlag = true;
          }
        });
    downloadDialog = builder.create();
    downloadDialog.setCanceledOnTouchOutside(false);
    downloadDialog.show();

    downloadApk();
  }
 private void HttpReuqestFailure() {
   if (getActivity() != null) {
     circleProgress.stopAnim();
     circleProgress.reset();
     progress.setVisibility(View.GONE);
     rlCourseInformation.setVisibility(View.VISIBLE);
     Dialog dialog =
         new AlertDialog.Builder(getActivity())
             .setTitle("请求失败")
             .setMessage("请求失败,点击确定重新获取")
             .setNeutralButton(
                 "确定",
                 new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int which) {
                     RequestCourses();
                   }
                 })
             .setPositiveButton(
                 "返回",
                 new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int which) {
                     dialog.dismiss();
                     getActivity().finish();
                   }
                 })
             .create();
     dialog.setCanceledOnTouchOutside(false);
     dialog.show();
   }
 }
Esempio n. 19
0
 private void initDialog() {
   if (dialog != null) {
     dialog.cancel();
   }
   dialog = new Dialog(mContext, R.style.loddingDilog);
   dialog.setContentView(mDialogView);
   dialog.setCanceledOnTouchOutside(true);
 }
Esempio n. 20
0
  private Dialog createDialog() {

    Dialog dialog = new Dialog(this, R.style.NobackDialog);
    View view = LayoutInflater.from(this).inflate(R.layout.dialog_time_picker, null);
    Button btn_submit = (Button) view.findViewById(R.id.btn_dialog_submit);
    final WheelView hours = (WheelView) view.findViewById(R.id.wheel_hour);
    hours.setViewAdapter(new NumericWheelAdapter(this, 0, 23));
    hours.setCyclic(true);
    final WheelView mins = (WheelView) view.findViewById(R.id.wheel_mins);
    mins.setViewAdapter(new NumericWheelAdapter(this, 0, 59, "%02d"));
    mins.setCyclic(true);
    int curHours = 0;
    int curMinutes = 0;
    Map<String, uSDKDeviceAttribute> attrs = mDevice.getAttributeMap();
    switch (mCurrentType) {
      case 1:
        if (!TextUtils.isEmpty(getTime(attrs, 1))) {
          curHours = Integer.parseInt(getTime(attrs, 1).split(":")[0]);
          curMinutes = Integer.parseInt(getTime(attrs, 1).split(":")[1]);
        }
        break;
      case 2:
        if (!TextUtils.isEmpty(getTime(attrs, 2))) {
          curHours = Integer.parseInt(getTime(attrs, 2).split(":")[0]);
          curMinutes = Integer.parseInt(getTime(attrs, 2).split(":")[1]);
        }
        break;
    }
    hours.setCurrentItem(curHours);
    mins.setCurrentItem(curMinutes);
    OnWheelClickedListener click =
        new OnWheelClickedListener() {
          public void onItemClicked(WheelView wheel, int itemIndex) {
            wheel.setCurrentItem(itemIndex, true);
          }
        };
    hours.addClickingListener(click);
    mins.addClickingListener(click);
    btn_submit.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            mSetTime = formatTime(hours.getCurrentItem(), mins.getCurrentItem());
            mDialog.dismiss();
            switch (mCurrentType) {
              case 1:
                mSetTime0 = mSetTime;
                mOvenTime.setText(mSetTime0);
                sendCommand(mDevice, "20v00f", mSetTime0);
                break;
            }
          }
        });
    dialog.setContentView(view);
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
  }
Esempio n. 21
0
 public static Dialog waitingDialog(Context ctx, String title, String content) {
   Dialog dialog = new IntroduceDialog(ctx, R.layout.dialog_waiting, R.style.Theme_dialog);
   dialog.setCanceledOnTouchOutside(true);
   TextView t1 = (TextView) dialog.findViewById(R.id.dialog_title);
   TextView t2 = (TextView) dialog.findViewById(R.id.dialog_content);
   t1.setText(title);
   t2.setText(content);
   return dialog;
 }
  public ProgressDialog(Context context, Exercise exercise) {
    mExercise = exercise;
    mAvailableLevels = mExercise.getSection().getAvailableLevels();
    mChosenLevel = mExercise.getSection().getCurrentLevel();

    mDialog = new Dialog(context);
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setContentView(R.layout.view_dialog_level);
    mDialog.setCanceledOnTouchOutside(true);
  }
  private void createDbDeleteList() {
    // ファイル選択用ダイアログの作成
    AlertDialog.Builder dbList = new AlertDialog.Builder(getActivity());
    String title = getResources().getString(R.string.choice_file);
    dbList.setTitle(title);
    // DBファイルのリスト作成
    final String[] dbFileList = makeFileList(".db");
    // 項目の設定
    dbList.setItems(
        dbFileList,
        new DialogInterface.OnClickListener() {
          // 項目選択時のリスナー
          public void onClick(DialogInterface parent, final int pos) {
            // 現在のDBは削除できない
            final File dbFile = new File(MainActivity.getApplicationDir(), dbFileList[pos]);
            if (!canDeleteDbFile(dbFile.getName())) {
              String str = getResources().getString(R.string.db_delete_fail);
              Toast.makeText(getActivity(), str, Toast.LENGTH_SHORT).show();
              return;
            }
            // 確認ダイアログを出す
            String msg = getResources().getString(R.string.confirm_delete);
            new YesNoDialog(
                    getActivity(),
                    new DialogInterface.OnClickListener() {

                      public void onClick(DialogInterface child, int which) {
                        // DBを削除
                        dbFile.delete();
                        // トーストを表示
                        String str = getResources().getString(R.string.db_deleted);
                        Toast.makeText(getActivity(), str, Toast.LENGTH_SHORT).show();
                        // DBリストの初期化
                        initDbList();
                      }
                    },
                    null,
                    msg)
                .show();
          }
        });
    // キャンセルボタンを作成
    String cancel = getResources().getString(R.string.cancel);
    dbList.setNegativeButton(
        cancel,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    dbList.setCancelable(true);
    Dialog dialog = dbList.create();
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
  }
Esempio n. 24
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.setCanceledOnTouchOutside(true);
    dialog.setCancelable(false);
    createContentView(dialog);

    return dialog;
  }
Esempio n. 25
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();
    }
  }
Esempio n. 26
0
 /** @Description 初始化音量对话框 */
 private void initSoundVolumeDlg() {
   soundVolumeDialog = new Dialog(this, R.style.SoundVolumeStyle);
   soundVolumeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
   soundVolumeDialog
       .getWindow()
       .setFlags(
           WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   soundVolumeDialog.setContentView(R.layout.tt_sound_volume_dialog);
   soundVolumeDialog.setCanceledOnTouchOutside(true);
   soundVolumeImg = (ImageView) soundVolumeDialog.findViewById(R.id.sound_volume_img);
   soundVolumeLayout = (LinearLayout) soundVolumeDialog.findViewById(R.id.sound_volume_bk);
 }
  public void showUpdateDialog(final String title, final String s) {
    final Dialog bteldialog = new Dialog(this);
    bteldialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    bteldialog.setCanceledOnTouchOutside(true);
    bteldialog.setContentView(R.layout.custom_dialog_two_button);
    if (title != null) {
      ((TextView) bteldialog.findViewById(R.id.id_dialog_title)).setText(title);
    }
    ((TextView) bteldialog.findViewById(R.id.id_dialog_message)).setText(s);
    ((TextView) bteldialog.findViewById(R.id.id_send)).setText("Update Now");
    ((TextView) bteldialog.findViewById(R.id.id_cancel)).setText("Later");
    ((TextView) bteldialog.findViewById(R.id.id_send))
        .setOnTouchListener(
            new OnTouchListener() {

              @Override
              public boolean onTouch(View v, MotionEvent event) {
                bteldialog.cancel();
                //				startActivity(new Intent(Intent.ACTION_VIEW,
                // Uri.parse("market://details?id=com.superchat")));
                try {

                  Intent intent = new Intent(Intent.ACTION_VIEW);
                  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  intent.setData(Uri.parse("market://details?id=com.superchat"));
                  startActivity(intent);

                } catch (Exception anfe) {
                  try {
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.setData(
                        Uri.parse("http://play.google.com/store/apps/details?id=com.superchat"));
                    startActivity(intent);
                  } catch (Exception e) {
                  }
                }
                return false;
              }
            });
    ((TextView) bteldialog.findViewById(R.id.id_cancel))
        .setOnTouchListener(
            new OnTouchListener() {

              @Override
              public boolean onTouch(View v, MotionEvent event) {
                bteldialog.cancel();
                return false;
              }
            });
    bteldialog.show();
  }
Esempio n. 28
0
 @Override
 public Dialog onCreateDialog(Bundle savedInstanceState) {
   final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
   builder.setView(initView());
   builder.setTitle(R.string.select);
   builder.setPositiveButton(android.R.string.ok, mOnDialogClickListener);
   builder.setNegativeButton(android.R.string.cancel, mOnDialogClickListener);
   builder.setNeutralButton(R.string.refresh, null);
   final Dialog dialog = builder.create();
   dialog.setCancelable(true);
   dialog.setCanceledOnTouchOutside(true);
   return dialog;
 }
Esempio n. 29
0
 /** 显示范围选择dialog */
 @SuppressLint("InflateParams")
 private void showSelectDialog() {
   if (selectDialog != null) {
     selectDialog.show();
     return;
   }
   selectDialog = new Dialog(mContext, R.style.dialog);
   View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_distance, null);
   selectDialog.setContentView(
       view, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
   selectDialog.setCanceledOnTouchOutside(true);
   selectDialog.show();
 }
Esempio n. 30
0
  /*
   * 显示loading dialog
   */
  public static void showProgressDialog(Context context) {

    if (progressDialog == null) {
      progressDialog = new Dialog(context, R.style.progress_dialog);
      progressDialog.setContentView(R.layout.progress_dialog);
      progressDialog.setCancelable(true);
      progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
      TextView msg = (TextView) progressDialog.findViewById(R.id.id_tv_loadingmsg);
      msg.setText("卖力加载中");
      progressDialog.setCanceledOnTouchOutside(false);
    }
    progressDialog.show();
  }