コード例 #1
0
  public Dialog showCustomAlert(
      Activity activity,
      String title,
      String message,
      boolean cancelable,
      String positiveButton,
      String negativeButton) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    if (title != null) {
      builder = builder.setTitle(title);
    }
    if (message != null) {
      builder = builder.setMessage(message);
    }
    builder = builder.setCancelable(cancelable);

    if (positiveButton != null) {
      builder = builder.setPositiveButton(positiveButton, dialogClickListener);
    }
    if (negativeButton != null) {
      builder = builder.setNegativeButton(negativeButton, dialogClickListener);
    }

    Dialog d = builder.create();
    dialogs.add(d);
    d.show();

    return d;
  }
コード例 #2
0
  @NonNull
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(getArguments().getString("title"));

    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_minutes, null, false);
    ButterKnife.bind(this, view);
    numberPicker.setMinValue(0);
    numberPicker.setMaxValue(300);
    numberPicker.setValue(getArguments().getInt("minutes"));
    builder.setView(view);

    builder.setPositiveButton(
        getArguments().getString("positiveBtn"),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {
            numberPicker.clearFocus();
            int minutes = numberPicker.getValue();
            callback.onDialogMinutesPositiveClick(getArguments().getInt("dialogId"), minutes);
          }
        });

    Dialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    return dialog;
  }
コード例 #3
0
ファイル: UpdateManager.java プロジェクト: uwitec/hckpApp
  /** 显示下载对话框 */
  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();
  }
コード例 #4
0
  public static void dlg_register_main(Activity actv) {
    /*----------------------------
    * Steps
    * 1. Get a dialog
    * 2. List view
    * 3. Set listener => list
    * 9. Show dialog
    ----------------------------*/

    Dialog dlg =
        dlg_template_cancel(
            actv,
            R.layout.dlg_register_main,
            R.string.generic_register,
            R.id.dlg_register_main_btn_cancel,
            Methods.DialogButtonTags.dlg_generic_dismiss);

    /*----------------------------
    * 2. List view
    * 		1. Get view
    * 		2. Prepare list data
    * 		3. Prepare adapter
    * 		4. Set adapter
    ----------------------------*/
    ListView lv = (ListView) dlg.findViewById(R.id.dlg_register_main_lv_list);

    /*----------------------------
    * 2.2. Prepare list data
    ----------------------------*/
    List<String> registerItems = new ArrayList<String>();

    registerItems.add(actv.getString(R.string.dlg_register_main_items));
    registerItems.add(actv.getString(R.string.dlg_register_main_stores));
    registerItems.add(actv.getString(R.string.dlg_register_main_genres));

    /** ******************************* 2.3. Prepare adapter ******************************* */
    ArrayAdapter<String> adp =
        new ArrayAdapter<String>(
            actv,
            android.R.layout.simple_list_item_1,
            //				R.layout.list_row_dlg_register_main,
            registerItems);

    /*----------------------------
    * 2.4. Set adapter
    ----------------------------*/
    lv.setAdapter(adp);

    lv.setTag(Methods.DialogItemTags.dlg_register_main);

    /*----------------------------
    * 3. Set listener => list
    ----------------------------*/
    lv.setOnItemClickListener(new DialogOnItemClickListener(actv, dlg));

    /*----------------------------
    * 9. Show dialog
    ----------------------------*/
    dlg.show();
  } // public static void dlg_register_main(Activity actv)
コード例 #5
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();
    }
  }
コード例 #6
0
ファイル: SignupPage.java プロジェクト: 1181631922/video
 /** 修改图片 */
 private void showChangeIconDialog() {
   final Dialog dialog = new Dialog(getContext(), R.style.WhiteDialog);
   dialog.setContentView(R.layout.tpl_icon_select_dialog);
   dialog
       .findViewById(R.id.dialog_camera)
       .setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               dialog.dismiss();
               openCamera();
             }
           });
   dialog
       .findViewById(R.id.dialog_picture)
       .setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               dialog.dismiss();
               getPicture();
             }
           });
   dialog.show();
 }
コード例 #7
0
ファイル: MainActivity.java プロジェクト: superfony/WZDPS
  private void dialog() {

    LayoutInflater inflater = LayoutInflater.from(activity);
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.exit_dialog, null);

    dialog = new AlertDialog.Builder(activity).create();
    dialog.setCancelable(false);
    dialog.show();
    dialog.getWindow().setContentView(layout);

    Button exit_cancel = (Button) layout.findViewById(R.id.exit_cancel);
    Button drop_out = (Button) layout.findViewById(R.id.drop_out);

    drop_out.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
            activity.finish();
          }
        });
    exit_cancel.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
  }
コード例 #8
0
ファイル: LoginActivity.java プロジェクト: marsyang1991/Story
 private void showDialog() {
   if (pd != null && pd.isShowing()) {
     pd.dismiss();
   }
   pd = CommonDialog.ProgressDialog(this);
   pd.show();
 }
コード例 #9
0
  public Options(Activity myActivity) {
    this.splashMenu = (SplashMenu) myActivity;
    mDialog = new Dialog(myActivity);
    mDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    mDialog.setContentView(R.layout.options);

    mSelectionMessage = myActivity.getString(R.string.model_type_selected);

    final RadioButton robot_type_1 = (RadioButton) mDialog.findViewById(R.id.robot_type_1);
    final RadioButton robot_type_2 = (RadioButton) mDialog.findViewById(R.id.robot_type_2);
    final RadioButton robot_type_3 = (RadioButton) mDialog.findViewById(R.id.robot_type_3);

    switch (splashMenu.getRobotType()) {
      case R.id.robot_type_2:
        robot_type_2.setChecked(true);
        break;

      case R.id.robot_type_3:
        robot_type_3.setChecked(true);
        break;

      default:
        robot_type_1.setChecked(true);
        break;
    }

    robot_type_1.setOnClickListener(radio_listener);
    robot_type_2.setOnClickListener(radio_listener);
    robot_type_3.setOnClickListener(radio_listener);
    robot_type_3.setEnabled(false);
  }
コード例 #10
0
 @Test
 public void showDialog_shouldShowDialog() throws Exception {
   final DialogCreatingActivity activity = create(DialogCreatingActivity.class);
   activity.showDialog(1);
   Dialog dialog = ShadowDialog.getLatestDialog();
   assertTrue(dialog.isShowing());
 }
コード例 #11
0
 /**
  * 增彩结果提示框
  *
  * @param title
  * @param string
  */
 public void resultDialog(String title, String string) {
   LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
   View v = inflater.inflate(R.layout.gift_result_dialog_view, null);
   TextView content = (TextView) v.findViewById(R.id.gift_result_view_text);
   content.setText(string);
   Dialog dialog =
       new AlertDialog.Builder(this)
           .setView(v)
           .setCancelable(false)
           .setTitle(title)
           .setPositiveButton(
               "确定",
               new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
                   // buyImplement.touzhuNet();
                   checkedPersons.clear();
                   editPhone.setText("");
                   if (successPersons.size() > 0) {
                     sendSMS();
                   }
                   GiftActivity.this.finish();
                 }
               })
           .create();
   dialog.show();
 }
コード例 #12
0
ファイル: MPlayer.java プロジェクト: gesulong/Android_lib
  @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);
    }
  }
コード例 #13
0
ファイル: LoginActivity.java プロジェクト: zhaoliguang/hfbus
  void exit() {
    Dialog dialog = null;
    DialogPrompt.Builder customBuilder = new DialogPrompt.Builder(this);

    customBuilder
        .setMessage("确定要退出系统吗?")
        .setNegativeButton(
            "稍后再说",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
                dialog = null;
              }
            })
        .setPositiveButton(
            "确定退出",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {

                dialog.cancel();
                dialog = null;
                LoginActivity.this.finish();
                HFBusApp.mApp.exit();
              }
            });
    dialog = customBuilder.create();
    dialog.show();
  }
コード例 #14
0
 private void clearDialog() {
   Dialog dialog = dialogWrapper.getDialog();
   if (dialog != null) {
     dialog.dismiss();
     dialog = null;
   }
 }
コード例 #15
0
  private void showUnitSpinner(final String[] data) {

    final Dialog a = new Dialog(this);
    Window w = a.getWindow();
    a.requestWindowFeature(Window.FEATURE_NO_TITLE);
    a.setContentView(R.layout.spinner);
    w.setBackgroundDrawableResource(android.R.color.transparent);

    TextView lblselect = (TextView) w.findViewById(R.id.dialogtitle);
    lblselect.setTypeface(Utils.getBold(getActivity()));
    lblselect.setText(R.string.unit_selection);

    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, data);
    ListView lv = (ListView) w.findViewById(R.id.lvSpinner);
    lv.setAdapter(adapter);

    lv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> adapterview, View view, int position, long l) {

            a.dismiss();

            Utils.setPref(getActivity(), Constant.SELECTED_UNIT_STORAGE, data[position]);
            mAdapter.addAll(converter.getFavUnit());
            tvUnitSelVal.setText(data[position]);
          }
        });

    a.show();
  }
コード例 #16
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();
  }
コード例 #17
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mpref = this.getSharedPreferences("mypref", 0);
    handler = new Handler();
    bargeStatus = new ArrayList<String>();
    bargeNames = new ArrayList<String>();
    bargeTimes = new ArrayList<String>();
    latList = new ArrayList<Integer>();
    lonList = new ArrayList<Integer>();
    toBargeMap = new Intent(BargeList.this, BargeMap.class);
    bargeList = getListView();
    bargeList.setClickable(true);
    bargeList.setItemsCanFocus(false);

    helpcolor = new Dialog(BargeList.this);
    helpcolor.setContentView(R.layout.helpcolor);
    helpcolor.setTitle("Help");
    Button helpok = (Button) helpcolor.findViewById(R.id.helpok);
    helpok.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            helpcolor.dismiss();
          }
        });
  }
コード例 #18
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setOnKeyListener(
        new DialogInterface.OnKeyListener() {

          @Override
          public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            switch (keyCode) {
              case KeyEvent.KEYCODE_BACK:
                // dialog can be canceled only by back pressed.
                if (mCancelable) dialog.cancel();
                return true;
              case KeyEvent.KEYCODE_SEARCH:
                return true;
              default:
                return false;
            }
          }
        });

    if (mOnCreateDialogListener != null) {
      mOnCreateDialogListener.onCreateDialog(this, dialog);
    }

    return dialog;
  }
コード例 #19
0
ファイル: MainActivity.java プロジェクト: superfony/WZDPS
 // 显示“视频下载安装”对话框
 protected void showApprovaDialog() {
   LayoutInflater inflater = LayoutInflater.from(activity);
   View layout = inflater.inflate(R.layout.approva_dialog, null);
   approvaDialog = new AlertDialog.Builder(activity).create();
   approvaDialog.setCancelable(false);
   approvaDialog.show();
   approvaDialog.getWindow().setContentView(layout);
   approvaDialog.setCancelable(true);
   TextView edit_approva = (TextView) layout.findViewById(R.id.edit_approva);
   ImageView close_btn = (ImageView) layout.findViewById(R.id.close_btn);
   // Button exit_cancel = (Button) layout.findViewById(R.id.exit_cancel);
   edit_approva.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View arg0) {
           approvaDialog.dismiss();
         }
       });
   close_btn.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           approvaDialog.dismiss();
         }
       });
 }
コード例 #20
0
  @Implementation
  public final boolean showDialog(int id, Bundle bundle) {
    Dialog dialog = null;
    this.lastShownDialogId = id;

    dialog = dialogForId.get(id);

    if (dialog == null) {
      final ActivityInvoker invoker = new ActivityInvoker();
      dialog = (Dialog) invoker.call("onCreateDialog", Integer.TYPE).with(id);

      if (bundle == null) {
        invoker.call("onPrepareDialog", Integer.TYPE, Dialog.class).with(id, dialog);
      } else {
        invoker
            .call("onPrepareDialog", Integer.TYPE, Dialog.class, Bundle.class)
            .with(id, dialog, bundle);
      }

      dialogForId.put(id, dialog);
    }

    dialog.show();

    return true;
  }
コード例 #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //	Toast.makeText(this, "onCreate ", Toast.LENGTH_SHORT).show();
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_map);
    // Show the Up button in the action bar.
    setupActionBar();

    // Getting Google Play availability status
    int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());

    // Showing status
    if (status != ConnectionResult.SUCCESS) { // Google Play Services are
      // not available

      int requestCode = 10;
      Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
      dialog.show();

    } else { // Google Play Services are available
      // Getting reference to the SupportMapFragment of activity_main.xml
      SupportMapFragment fm =
          (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);

      // Getting GoogleMap object from the fragment
      googleMap = fm.getMap();

      // Enabling MyLocation Layer of Google Map
      googleMap.setMyLocationEnabled(true);

      googleMap.setOnInfoWindowClickListener(this);
    }
  }
コード例 #22
0
  @Override
  protected void onPrepareDialog(int id, Dialog dialog) {
    super.onPrepareDialog(id, dialog);

    if (Log.DEBUG) Log.v("onPrepareDialog()");
    // User interacted so remove all locks and cancel reminders
    ClearAllReceiver.removeCancel(getApplicationContext());
    ClearAllReceiver.clearAll(false);
    ReminderReceiver.cancelReminder(getApplicationContext());

    switch (id) {
      case DIALOG_QUICKREPLY:
        showSoftKeyboard(qrEditText);

        // Set width of dialog to fill_parent
        LayoutParams mLP = dialog.getWindow().getAttributes();

        // TODO: this should be limited in case the screen is large
        mLP.width = LayoutParams.FILL_PARENT;
        dialog.getWindow().setAttributes(mLP);
        break;

      case DIALOG_PRESET_MSG:
        break;
    }
  }
コード例 #23
0
ファイル: UpdateService.java プロジェクト: woodin5/Test
 /** 显示版本更新通知对话框 */
 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();
 }
コード例 #24
0
  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;
  }
コード例 #25
0
ファイル: FlightDataFragment.java プロジェクト: jandrop/Tower
  /**
   * Ensures that the device has the correct version of the Google Play Services.
   *
   * @return true if the Google Play Services binary is valid
   */
  private boolean isGooglePlayServicesValid(boolean showErrorDialog) {
    // Check for the google play services is available
    final int playStatus = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getContext());
    final boolean isValid = playStatus == ConnectionResult.SUCCESS;

    if (!isValid && showErrorDialog) {
      final Dialog errorDialog =
          GooglePlayServicesUtil.getErrorDialog(
              playStatus,
              getActivity(),
              GOOGLE_PLAY_SERVICES_REQUEST_CODE,
              new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                  if (isAdded()) {
                    getActivity().finish();
                  }
                }
              });

      if (errorDialog != null) errorDialog.show();
    }

    return isValid;
  }
コード例 #26
0
  @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;
  }
コード例 #27
0
  private void useTheme(final Context context) {
    SharedPreferences preferences =
        context.getSharedPreferences(Theme.PREFS_NAME_THEME_SETTING, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = preferences.edit();
    editor.putString(Theme.PREFS_KEY_PACKAGE_NAME, entry.getPackageName());
    editor.putInt(Theme.PREFS_KEY_RESOURCE_TYPE, Theme.RESOURCES_FROM_APK);
    editor.putString(Theme.PREFS_KEY_THEME_NAME, entry.getName());
    editor.commit();

    Dialog dialog =
        new AlertDialog.Builder(context)
            .setTitle(R.string.title_dialog_alert)
            .setMessage("重启应用皮肤才能生效,确认要退出应用吗?")
            .setPositiveButton(
                R.string.btn_confirm,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    exitApp(context);
                  }
                })
            .setNegativeButton(
                R.string.btn_cancel,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                  }
                })
            .create();
    dialog.show();
  }
コード例 #28
0
ファイル: SGTPuzzles.java プロジェクト: nbzhou/sgtpuzzles
 public void showHelp(String topic) {
   final Dialog d = new Dialog(this, android.R.style.Theme);
   final WebView wv = new WebView(this);
   d.setOnKeyListener(
       new DialogInterface.OnKeyListener() {
         public boolean onKey(DialogInterface di, int key, KeyEvent evt) {
           if (evt.getAction() != KeyEvent.ACTION_DOWN || key != KeyEvent.KEYCODE_BACK)
             return false;
           if (wv.canGoBack()) wv.goBack();
           else d.cancel();
           return true;
         }
       });
   d.setContentView(wv);
   wv.setWebChromeClient(
       new WebChromeClient() {
         public void onReceivedTitle(WebView w, String title) {
           d.setTitle(title);
         }
         // onReceivedTitle doesn't happen on back button :-(
         public void onProgressChanged(WebView w, int progress) {
           if (progress == 100) d.setTitle(w.getTitle());
         }
       });
   wv.getSettings().setBuiltInZoomControls(true);
   wv.loadUrl(MessageFormat.format(getString(R.string.docs_url), new Object[] {topic}));
   d.show();
 }
コード例 #29
0
 /*package*/ void onPrepareDialog(int id, Dialog d, Bundle options) {
   switch (id) {
     case DIALOG_PROGRESS:
       d.setCancelable(options.getBoolean(KEY_DIALOG_PROGRESS_CANCELABLE, true));
       d.setOnCancelListener(null);
   }
 }
コード例 #30
0
 @NonNull
 @Override
 public Dialog onCreateDialog(Bundle savedInstanceState) {
   Dialog dialog = super.onCreateDialog(savedInstanceState);
   dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
   return dialog;
 }