android.support.v7.app.AlertDialog的实例源码

项目:CatchSpy    文件:EditListAdapter.java   
public void addWords() {
    LayoutInflater inflater = activity.getLayoutInflater();
    View mView = inflater.inflate(R.layout.dialog_edit_extra_words,(ViewGroup) activity.findViewById(R.id.dialog_layout_edit_words));
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(R.string.add);
    final TextInputEditText word_1 = mView.findViewById(R.id.edittext_edit_word_1);
    final TextInputEditText word_2 = mView.findViewById(R.id.edittext_edit_word_2);
    builder.setPositiveButton(android.R.string.yes,new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog,int which) {
            String edit_1 = word_1.getText().toString();
            String edit_2 = word_2.getText().toString();
            if (!edit_1.isEmpty() && !edit_2.isEmpty()) {
                ExtraWord.add(new String[]{edit_1,edit_2});
                hasEdited = true;
                notifyDataSetChanged();
            } else {
                Toast.makeText(activity,R.string.edit_extra_words_error,Toast.LENGTH_SHORT).show();
            }
        }
    });
    builder.setNegativeButton(android.R.string.no,null);
    builder.setView(mView);
    builder.show();
}
项目:papara-android    文件:MainActivity.java   
private void showResultDialog(final String message,int code) {

        try {
            final AlertDialog dialog = new AlertDialog.Builder(this)
                    .setTitle(getString(com.mobillium.paparasdk.R.string.title))
                    .setMessage(message + " (" + code + ")")
                    .setPositiveButton(getString(R.string.done),new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface,int i) {
                            dialogInterface.dismiss();
                        }
                    })
                    .create();

            dialog.setCanceledOnTouchOutside(false);
            dialog.show();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
项目:KUtils-master    文件:Buildable.java   
protected BuildBean buildMdLoadingVertical(BuildBean bean) {
    AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext);
    View root = View.inflate(bean.mContext,R.layout.dialogui_loading_vertical,null);
    View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
    ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
    TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
    tvMsg.setText(bean.msg);
    if (bean.isWhiteBg) {
        llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
        pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum));
        tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
    } else {
        llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
        pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum_light));
        tvMsg.setTextColor(Color.WHITE);
    }
    builder.setView(root);
    AlertDialog dialog = builder.create();
    bean.alertDialog = dialog;
    return bean;
}
项目:Bigbang    文件:ColorPickerDialogBuilder.java   
private ColorPickerDialogBuilder(Context context,int theme) {
    defaultMargin = getDimensionAsPx(context,R.dimen.default_slider_margin);
    final int dialogMarginBetweenTitle = getDimensionAsPx(context,R.dimen.default_slider_margin_btw_title);

    builder = new AlertDialog.Builder(context,theme);
    pickerContainer = new LinearLayout(context);
    pickerContainer.setOrientation(LinearLayout.VERTICAL);
    pickerContainer.setGravity(Gravity.CENTER_HORIZONTAL);
    pickerContainer.setPadding(defaultMargin,dialogMarginBetweenTitle,defaultMargin,defaultMargin);

    LinearLayout.LayoutParams layoutParamsForColorPickerView = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,0);
    layoutParamsForColorPickerView.weight = 1;
    colorPickerView = new ColorPickerView(context);

    pickerContainer.addView(colorPickerView,layoutParamsForColorPickerView);

    builder.setView(pickerContainer);
}
项目:TrackPlan-app    文件:MainActivity.java   
void gotosetper(float percentageall)
{
    LayoutInflater inflater = getLayoutInflater();
    View alertLayout = inflater.inflate(R.layout.layoutforperall,null);
    TextView pe=(TextView)alertLayout.findViewById(R.id.peralllll);
    AlertDialog.Builder alert = new AlertDialog.Builder(this);




    // this is set the view from XML inside AlertDialog
    alert.setView(alertLayout);
    // disallow cancel of AlertDialog on click of back button and outside touch


    final AlertDialog dialog = alert.create();
    dialog.show();
    pe.setText("Your Overall percentage is : "+percentageall+"%"+"\n");
    Button ok=(Button)alertLayout.findViewById(R.id.button11);
    ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
}
项目:BookReader-master    文件:ReadActivity.java   
@OnClick(R.id.tvBookReadDownload)
public void downloadBook() {
    gone(rlReadAaSet);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("缓存多少章?")
            .setItems(new String[]{"后面五十章","后面全部","全部"},new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog,int which) {
                    switch (which) {
                        case 0:
                            DownloadBookService.post(new DownloadQueue(bookId,mChapterList,currentChapter + 1,currentChapter + 50));
                            break;
                        case 1:
                            DownloadBookService.post(new DownloadQueue(bookId,mChapterList.size()));
                            break;
                        case 2:
                            DownloadBookService.post(new DownloadQueue(bookId,1,mChapterList.size()));
                            break;
                        default:
                            break;
                    }
                }
            });
    builder.show();
}
项目:MuslimMateAndroid    文件:Utility.java   
public static void getInput(Context context,String title,DialogInterface.OnClickListener onOkListener)
{
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(title);

    final EditText input = new EditText(context);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    input.setId(R.id.text1);
    builder.setView(input);

    builder.setPositiveButton("OK",onOkListener);

    builder.setNegativeButton("Cancel",int which) {
            dialog.cancel();
        }
    });

    builder.show();
}
项目:mDL-ILP    文件:PersoActivity.java   
@Override
protected void onPostExecute(Certificate certificate) {
    progressDialog.dismiss();

    if (certificate != null) {
        StorageUtils.saveObject(PersoActivity.this,getString(R.string.tls_client_cert_key),certificate);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(PersoActivity.this);
        builder.setTitle(R.string.perso_problem_title);
        builder.setMessage(R.string.perso_problem_register);
        builder.setPositiveButton("OK",new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog,int which) {
                finish();
            }
        });
        builder.create().show();
    }
}
项目:Cable-Android    文件:RegistrationProgressActivity.java   
private void initializeLinks() {
  TextView        failureText     = (TextView) findViewById(R.id.sms_failed_text);
  String          pretext         = getString(R.string.registration_progress_activity__signal_timed_out_while_waiting_for_a_verification_sms_message);
  String          link            = getString(R.string.RegistrationProblemsActivity_possible_problems);
  SpannableString spannableString = new SpannableString(pretext + " " + link);

  spannableString.setSpan(new ClickableSpan() {
    @Override
    public void onClick(View widget) {
      new AlertDialog.Builder(RegistrationProgressActivity.this)
              .setTitle(R.string.RegistrationProblemsActivity_possible_problems)
              .setView(R.layout.registration_problems)
              .setNeutralButton(android.R.string.ok,null)
              .show();
    }
  },pretext.length() + 1,spannableString.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

  failureText.setText(spannableString);
  failureText.setMovementMethod(LinkMovementMethod.getInstance());
}
项目:MontageCam    文件:AspectRatioFragment.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final AspectRatio[] ratios = (AspectRatio[]) args.getParcelableArray(ARG_ASPECT_RATIOS);
    if (ratios == null) {
        throw new RuntimeException("No ratios");
    }
    Arrays.sort(ratios);
    final AspectRatio current = args.getParcelable(ARG_CURRENT_ASPECT_RATIO);
    final AspectRatioAdapter adapter = new AspectRatioAdapter(ratios,current);
    return new AlertDialog.Builder(getActivity()).setAdapter(adapter,new DialogInterface
            .OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog,int position) {
            mListener.onAspectRatioSelected(ratios[position]);
        }
    }).create();
}
项目:Udhari    文件:QrCodeActivity.java   
@Override
public void handleResult(Result result) {
    if (result.getText().split(":").length > 2) {
        ContentValues contentValues = new ContentValues();
        contentValues.put(DatabaseContract.TableTransactions.COL_DATE,getAmount(result.getText(),DATE)); // bug
        contentValues.put(DatabaseContract.TableTransactions.COL_AMOUNT,AMOUNT)); // bug

        AddTxService.insertNewTx(getApplicationContext(),contentValues);
        Intent goBackToMain = new Intent(this,MainActivity.class);
        startActivity(goBackToMain);
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Scan Result");
        builder.setMessage("Not a valid value");
        builder.show();
    }
}
项目:Transmis    文件:DialogBuilder.java   
@SuppressLint("InflateParams")
public static AlertDialog showEditTextDialog(BaseActivity activity,String content,boolean isPassword,EditTextDialogCallback callback) {
    View layout = LayoutInflater.from(activity).inflate(R.layout.view_dialog_edit_text,null);
    EditText input = (EditText) layout.findViewById(R.id.edit_text);
    input.setText(content);
    if (isPassword) {
        input.setInputType(InputType.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
    }
    input.setSelection(input.getText().length());

    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(title);
    builder.setView(layout);
    builder.setPositiveButton("确定",(dialog,which) -> {
        if (callback != null) {
            callback.onSuccess(input.getText().toString());
        }
    });
    builder.setNegativeButton("取消",which) -> dialog.dismiss());

    return builder.show();
}
项目:Channelize    文件:ToDoListAdapter.java   
private void showPopupMenu(View view) {
    final CharSequence[] items = {"Edit","Delete"};
    view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

    builder.setTitle(mTextName.getText());
    builder.setItems(items,int which) {
            int position = getAdapterPosition();
            switch (which){
                case 0://Edit
                    listener.editTask(position);
                    break;
                case 1://Delete
                    listener.deleteTask(position);
                    break;
            }
        }
    });
    builder.show();
}
项目:RxGallery    文件:MainActivity.java   
public void takePhoto(View view) {
    String[] items = new String[]{getString(R.string.output_dialog_external),getString(R.string.output_dialog_mediastore)};

    new AlertDialog.Builder(this)
            .setTitle(getString(R.string.output_dialog_title))
            .setSingleChoiceItems(items,-1,int which) {
                    Uri outputUri = null;
                    if (which == 0) {
                        outputUri = getExternalStorageUri();
                    }
                    takePhoto(outputUri);
                    dialog.dismiss();
                }
            }).show();
}
项目:MyCalendar    文件:AddEditDetailCancelDialogFragment.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    if (!initData()) {
        this.getDialog().cancel();
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
    // Get the layout inflater
    LayoutInflater inflater = mActivity.getLayoutInflater();

    @SuppressLint("InflateParams") View view = inflater.inflate(R.layout.dialog_fragment_add_edit_detail_cancel,null);

    initView(view);

    builder.setView(view)
            .setTitle(getTitle());

    setButton(builder);

    return builder.create();
}
项目:GitHub    文件:ReadActivity.java   
@OnClick(R.id.tvBookReadDownload)
public void downloadBook() {
    gone(rlReadAaSet);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("缓存多少章?")
            .setItems(new String[]{"后面五十章",mChapterList.size()));
                            break;
                        default:
                            break;
                    }
                }
            });
    builder.show();
}
项目:readingNotes    文件:ListDiaryFragment.java   
@Override
public boolean onItemLongClick(AdapterView<?> parent,View view,int position,long id) {
    final int location = position;
    new AlertDialog.Builder(activity)
            .setTitle("警告")
            .setMessage("确定删除此条数据吗?")
            .setPositiveButton("是",int which) {
                    SQLiteDatabase sqLiteDatabase = openHelper.getReadableDatabase();
                    DiaryDao diaryDao = new DiaryDao(sqLiteDatabase);
                    diaryDao.delete(diaryList.get(location));
                    diaryList.remove(location);
                    sqLiteDatabase.close();
                    dataList.remove(location);
                    simpleAdapter.notifyDataSetChanged();
                }
            })
            .setNegativeButton("否",null)
            .show();
    return true;
}
项目:AndroidUtilCode-master    文件:KeyboardDialog.java   
public void show(){
    final Activity activity = mActivityWeakReference.get();
    if (activity != null) {
        final View dialogView = LayoutInflater.from(activity).inflate(R.layout.dialog_keyboard,null);
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        etInput = (EditText) dialogView.findViewById(R.id.et_input);
        dialog = builder.setView(dialogView).create();
        dialog.setCanceledOnTouchOutside(false);
        dialogView.findViewById(R.id.btn_hide_soft_input).setOnClickListener(this);
        dialogView.findViewById(R.id.btn_show_soft_input).setOnClickListener(this);
        dialogView.findViewById(R.id.btn_toggle_soft_input).setOnClickListener(this);
        dialogView.findViewById(R.id.btn_close_dialog).setOnClickListener(this);
        dialog.show();
        KeyboardUtils.showSoftInput(activity);
    }
}
项目:GitHub    文件:MessageDialog.java   
@SuppressLint("InflateParams")
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = LayoutInflater.from(getActivity())
            .inflate(R.layout.dialog_message,null);

    TextView messageView = (TextView) dialogView.findViewById(R.id.message);
    messageView.setMovementMethod(LinkMovementMethod.getInstance());
    messageView.setText(Html.fromHtml(getArguments().getString(ARG_MESSAGE)));

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),R.style.AppTheme_AlertDialog);
    builder.setTitle(getArguments().getString(ARG_TITLE))
            .setIcon(getArguments().getInt(ARG_ICON))
            .setView(dialogView)
            .setPositiveButton(R.string.OK,new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog,int which) {
                    dialog.dismiss();
                }
            });

    return builder.create();
}
项目:javaide    文件:ColorPickerDialogBuilder.java   
private ColorPickerDialogBuilder(Context context,layoutParamsForColorPickerView);

    builder.setView(pickerContainer);
}
项目:MovingGdufe-Android    文件:MeFragment.java   
@OnClick(R.id.tv_me_share) void clickShare() {
    android.app.AlertDialog.Builder builder=new android.app.AlertDialog.Builder(getActivity());
    builder.setIcon(R.mipmap.app_icon);
    builder.setTitle("爱分享的人运气总不会差");
    builder.setItems(R.array.shareList,new DialogInterface.OnClickListener(){
        public void onClick(DialogInterface dialog,int which) {
            int scene = SendMessageToWX.Req.WXSceneSession;
            if(which == 1) {
                scene = SendMessageToWX.Req.WXSceneTimeline;
            }else if(which == 2){
                scene = SendMessageToWX.Req.WXSceneFavorite;
            }
            ShareUtils.install(getActivity());
            ShareUtils.shareWeb(getActivity(),getResources().getString(R.string.app_name)+",你的掌上校园伴侣","广财专用APP,学生开发,课表饭卡校园网,一样不少",AppConfig.WXSHARE_URL,scene);
        }
    });
    builder.create().show();
}
项目:GitHub    文件:CustomTileDimensions.java   
@OnClick(R.id.custom_tile_height_size)
public void onHeightClick() {
  final NumberPicker view = new NumberPicker(this);
  view.setMinValue(24);
  view.setMaxValue(64);
  view.setWrapSelectorWheel(false);
  view.setValue(currentTileHeight);
  new AlertDialog.Builder(this)
          .setView(view)
          .setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener() {
            @Override
            public void onClick(@NonNull DialogInterface dialog,int which) {
              currentTileHeight = view.getValue();
              widget.setTileHeightDp(currentTileHeight);
            }
          })
          .show();
}
项目:readingNotes    文件:OtherListDiaryFragment.java   
@Override
public boolean onItemLongClick(AdapterView<?> parent,null)
            .show();
    return true;
}
项目:SmartButler    文件:SettingActivity.java   
private void showVersionDialog()
{
    AlertDialog.Builder builder=new AlertDialog.Builder(SettingActivity.this);
    builder.setTitle(getString(R.string.new_version_existed));
    builder.setMessage(getString(R.string.update_or_not));
    builder.setPositiveButton(getString(R.string.update_dialog_positive),new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog,int which)
        {
            //用户点击更新按钮则跳转到更新界面
            Intent intent=new Intent(SettingActivity.this,UpdateActivity.class);
            intent.putExtra("downloadUrl",latestDownloadUrl);
            startActivity(intent);
        }
    });
    builder.setNegativeButton(getString(R.string.update_dialog_nagetive),null);
    //显示Dialog
    builder.create().show();
}
项目:CameraKitView    文件:AspectRatioFragment.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final AspectRatio[] ratios = (AspectRatio[]) args.getParcelableArray(ARG_ASPECT_RATIOS);
    if (ratios == null) {
        throw new RuntimeException("No ratios");
    }
    Arrays.sort(ratios);
    final AspectRatio current = args.getParcelable(ARG_CURRENT_ASPECT_RATIO);
    final AspectRatioAdapter adapter = new AspectRatioAdapter(ratios,current);
    return new AlertDialog.Builder(getActivity())
        .setAdapter(adapter,int position) {
                mListener.onAspectRatioSelected(ratios[position]);
            }
        })
        .create();
}
项目:TripBuyer    文件:ReleaseTravelActivity.java   
private void showSetPasswordDialog(final Context mContext) {

        final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        View mView = LayoutInflater.from(mContext).inflate(R.layout.item_timepicker,null);

        inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
        ll = (LinearLayout) mView.findViewById(R.id.ll);
        ll.addView(getDataPick());
        //tv1 = (TextView) mView.findViewById(R.id.tv1);//
        //tv2 = (TextView) mView.findViewById(R.id.tv2);//
        TextView sure = (TextView) mView.findViewById(R.id.sure);
        sure.setOnClickListener(new View.OnClickListener() {
            @Override public void onClick(View view) {
                setPasswordDialog.dismiss();
            }
        });
        builder.setView(mView);
        builder.setCancelable(true);
        setPasswordDialog = builder.create();
        setPasswordDialog.show();

    }
项目:CollegeDoc    文件:Subjects.java   
public void confirmation_dialogbox(final DatabaseReference databaseReference1,final String new_subject)
{
    DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog,int which) {
            switch (which){
                case DialogInterface.BUTTON_POSITIVE:
                    databaseReference1.push().setValue(new_subject);
                    //Yes button clicked
                    break;

                case DialogInterface.BUTTON_NEGATIVE:
                    //No button clicked
                    break;
            }
        }
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage("Are you sure want to create new subject with name "+new_subject+" ?").setPositiveButton("Yes",dialogClickListener)
            .setNegativeButton("No",dialogClickListener).show();
}
项目:AndroidDonate    文件:MainActivity.java   
private void showDonateTipDialog() {
    new AlertDialog.Builder(this)
            .setTitle("微信捐赠操作步骤")
            .setMessage("点击确定按钮后会跳转微信扫描二维码界面:\n\n" + "1. 点击右上角的菜单按钮\n\n" + "2. 点击'从相册选取二维码'\n\n" + "3. 选择第一张二维码图片即可\n\n")
            .setPositiveButton("确定",int which) {
                    if (isGooglePlay){
                        gotoTipShowActivity("微信捐赠","在实际操作中用户必须手动输入金额。" + endString,R.drawable.p3);
                    }else {
                        donateWeixin();
                    }

                }
            })
            .setNegativeButton("取消",null)
            .show();
}
项目:SpySms    文件:MainActivity.java   
@Override
public void smsDetails(String from,String message) {
    try {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("New SMS from: " + from);
        builder
                .setMessage(message)
                .setCancelable(true);
        AlertDialog alertDialog = builder.create();
        alertDialog.show();
    } catch (Exception e) {
        e.getLocalizedMessage();
    }

    Snackbar.make(fab,"New Sms from " + from + "\n " + message,Snackbar.LENGTH_LONG)
            .setActionTextColor(Color.GREEN)
            .show();

    Toast.makeText(getApplicationContext(),Toast.LENGTH_LONG).show();
}
项目:chromium-for-android-56-debug-video    文件:SignOutDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE;
    if (getArguments() != null) {
        mGaiaServiceType = getArguments().getInt(
                SHOW_GAIA_SERVICE_TYPE_EXTRA,mGaiaServiceType);
    }

    String managementDomain = SigninManager.get(getActivity()).getManagementDomain();
    String message;
    if (managementDomain == null) {
        message = getActivity().getResources().getString(R.string.signout_message);
    } else {
        message = getActivity().getResources().getString(
                R.string.signout_managed_account_message,managementDomain);
    }

    return new AlertDialog.Builder(getActivity(),R.style.AlertDialogTheme)
            .setTitle(R.string.signout_title)
            .setPositiveButton(R.string.signout_dialog_positive_button,this)
            .setNegativeButton(R.string.cancel,this)
            .setMessage(message)
            .create();
}
项目:Checkerboard-IMU-Comparator    文件:MainActivity.java   
private void showCalibrationResultDialog(){
    AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
    alert.setTitle(getString(R.string.calibration_results_dialog_title));
    alert.setMessage(getString(
            R.string.calibration_results_dialog_message) +" "+
            checkerboardPatternComputingInitializer.getRejectedImage() +
            "/"
            + checkerboardPatternComputingInitializer.getNecessaryImagesNumber());
    alert.setPositiveButton(getString(R.string.calibration_results_dialog_positive_button_text),int which) {
            dialog.dismiss();
        }
    });
    AlertDialog alertDialog = alert.create();
    alertDialog.show();
}
项目:LittleLight    文件:InventoryFragment.java   
@Override
public boolean onActionItemClicked(ActionMode mode,MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_send:
            List<Item> toTransfer = new ArrayList<>();
            for (ItemBagView instance : bagViewMap.values()) {
                for (Integer itemPosition : instance.getSelectedItems()) {
                    toTransfer.add(instance.getItem(itemPosition));
                }
            }

            new AlertDialog.Builder(getActivity())
                    .setTitle("Transfer to:")
                    .setAdapter(new ItemBagDestinationAdapter(getContext(),R.layout.view_itembagdestination_row,destinations),which) -> {
                        presenter.sendItems(toTransfer,destinations.get(which).itemBagId);
                        mode.finish();
                    })
                    .show();
    }
    return true;
}
项目:CardSimulator    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button,so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.about) {
        ((TextView)new AlertDialog.Builder(this).setTitle(getString(R.string.about))
                .setMessage(Html.fromHtml(getString(R.string.aboutmsg)))
                .setPositiveButton(getString(R.string.ok),new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog,int which) {

                    }
                })
                .show().findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
        return true;
    }
    if(id == R.id.license){
        ld.show();
        return true;
    }

    return super.onOptionsItemSelected(item);
}
项目:Neuronizer    文件:BaseDialogs.java   
public static void showHtmlDialog(Context context,String htmlMessage) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
    final View dialogView = inflater.inflate(R.layout.dialog_rich_text,null);
    dialogBuilder.setView(dialogView);
    RichEditor richEditor = dialogView.findViewById(R.id.richEditor_dialog);
    richEditor.setHtml(htmlMessage);
    richEditor.setInputEnabled(false);
    richEditor.setFocusable(false);
    setupRichEditor(richEditor);

    dialogBuilder.setTitle(context.getResources().getString(R.string.details_title,title));
    dialogBuilder.setPositiveButton(R.string.done,null);
    dialogBuilder.create().show();
}
项目:CatchSpy    文件:ImportActivity.java   
private void advancedImportDialog(Context context) {
    LayoutInflater inflater = getLayoutInflater();
    View mView = inflater.inflate(R.layout.dialog_advanced_import,(ViewGroup) findViewById(R.id.dialog_layout_import_advanced));
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.import_advanced);
    final TextInputEditText group = mView.findViewById(R.id.edittext_import_advanced_group);
    final TextInputEditText word = mView.findViewById(R.id.edittext_import_advanced_word);
    final CheckBox ignoreChangeLine = mView.findViewById(R.id.checkbox_import_advanced_ignore_change_line);
    builder.setPositiveButton(R.string.import_file,int which) {
            String groupReg = group.getText().toString();
            String wordReg = word.getText().toString();
            if (!groupReg.isEmpty()) {
                if (!wordReg.isEmpty()) {
                    int result = ImportMethod.extraFileRegImporter(DictionaryPath,DictionaryName,groupReg,wordReg,ignoreChangeLine.isChecked());
                    if (result == Config.IMPORT_OK) {
                        Toast.makeText(ImportActivity.this,R.string.import_success,Toast.LENGTH_SHORT).show();
                        finish();
                    } else if (result == Config.IMPORT_FILE_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content),R.string.import_file_error,Snackbar.LENGTH_SHORT).show();
                    } else if (result == Config.IMPORT_OUTPUT_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content),R.string.import_output_error,Snackbar.LENGTH_SHORT).show();
                    } else if (result == Config.IMPORT_GROUP_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content),R.string.import_advanced_group_match_error,Snackbar.LENGTH_SHORT).show();
                    } else if (result == Config.IMPORT_WORDS_ERROR) {
                        Snackbar.make(findViewById(R.id.import_layout_content),R.string.import_advanced_word_match_error,Snackbar.LENGTH_SHORT).show();
                    }
                } else {
                    Snackbar.make(findViewById(R.id.import_layout_content),Snackbar.LENGTH_SHORT).show();
                }
            } else {
                Snackbar.make(findViewById(R.id.import_layout_content),Snackbar.LENGTH_SHORT).show();
            }
        }
    });
    builder.setNegativeButton(android.R.string.no,null);
    builder.setView(mView);
    builder.show();
}
项目:CatchSpy    文件:ExtraDictionarySettingsFragment.java   
private void addNewDictionary() {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View mView = inflater.inflate(R.layout.dialog_edittext,(ViewGroup) getActivity().findViewById(R.id.layout_dialog_edit_text));
    final TextInputEditText editText = mView.findViewById(R.id.edittext_dialog);
    editText.setHint(R.string.default_new_dictionary_name);
    String name = getString(R.string.default_new_dictionary_name) + "_" + System.currentTimeMillis();
    editText.setText(name);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.settings_extra_words_add);
    builder.setPositiveButton(android.R.string.yes,int which) {
            String result = editText.getText().toString();
            if (result.replace(" ","").equalsIgnoreCase("")) {
                Toast.makeText(getActivity(),R.string.settings_extra_words_add_error,Toast.LENGTH_SHORT).show();
            } else {
                try {
                    File file = new File(Config.DEFAULT_APPLICATION_DATA_DIR + result);
                    if (!file.exists()) {
                        if (file.createNewFile()) {
                            if (IOMethod.writeFile(new JSONObject().put(Config.DEFAULT_EXTRA_WORDS_DATA_NAME,new JSONArray()).toString(),file.getAbsolutePath())) {
                                String newName = Code.unicodeEncode(result) + "-" + Code.getFileMD5String(file.getAbsolutePath());
                                if (IOMethod.renameFile(file.getAbsolutePath(),newName)) {
                                    editWords(file.getParent() + File.separator + newName,result);
                                    return;
                                }
                            }
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                Toast.makeText(getActivity(),null);
    builder.setView(mView);
    builder.show();
}
项目:Rxjava2.0Demo    文件:MPermissionUtils.java   
/**
 * 显示提示对话框
 */
public static void showTipsDialog(final Context context) {
    new AlertDialog.Builder(context)
            .setTitle("提示信息")
            .setMessage("当前应用缺少必要权限,该功能暂时无法使用。如若需要,请单击【确定】按钮前往设置中心进行权限授权。")
            .setNegativeButton("取消",null)
            .setPositiveButton("确定",int which) {
                    startAppSettings(context);
                }
            }).show();
}
项目:Inshorts    文件:ArticleListActivity.java   
private void showFilterDialogue() {
    //get alert dialog view
    View alertDialogView = Utils.getAlertDialogView(this);

    //get alert dialog instance
    AlertDialog dialog = Utils.getAlertDialog(this,alertDialogView,this::refreshList);

    dialog.show();
}
项目:Xndroid    文件:DisplaySettingsFragment.java   
private void textSizePicker() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    LinearLayout view = (LinearLayout) inflater.inflate(R.layout.dialog_seek_bar,null);
    final SeekBar bar = view.findViewById(R.id.text_size_seekbar);
    final TextView sample = new TextView(getActivity());
    sample.setText(R.string.untitled);
    sample.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT));
    sample.setGravity(Gravity.CENTER_HORIZONTAL);
    view.addView(sample);
    bar.setOnSeekBarChangeListener(new TextSeekBarListener(sample));
    final int MAX = 5;
    bar.setMax(MAX);
    bar.setProgress(MAX - mPreferenceManager.getTextSize());
    builder.setView(view);
    builder.setTitle(R.string.title_text_size);
    builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0,int arg1) {
            mPreferenceManager.setTextSize(MAX - bar.getProgress());
        }

    });
    Dialog dialog = builder.show();
    BrowserDialog.setDialogSize(mActivity,dialog);
}
项目:ScreenShotAnywhere    文件:MainActivity.java   
private void showDialog(String message,DialogInterface.OnClickListener apply,DialogInterface.OnClickListener denial) {
    new AlertDialog.Builder(MainActivity.this)
            .setMessage(message)
            .setPositiveButton("Apply",apply)
            .setNegativeButton("Denial",denial)
            .create()
            .show();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


com.google.gson.internal.bind.ArrayTypeAdapter的实例源码
com.google.gson.JsonSyntaxException的实例源码
com.google.gson.JsonDeserializer的实例源码
com.google.gson.internal.ConstructorConstructor的实例源码
com.google.gson.JsonPrimitive的实例源码
com.google.gson.LongSerializationPolicy的实例源码
com.google.gson.internal.GsonInternalAccess的实例源码
com.google.gson.JsonIOException的实例源码
com.google.gson.internal.StringMap的实例源码
com.google.gson.JsonObject的实例源码
com.google.gson.internal.bind.TimeTypeAdapter的实例源码
com.google.gson.FieldAttributes的实例源码
com.google.gson.internal.bind.TreeTypeAdapter的实例源码
com.google.gson.internal.LinkedHashTreeMap的实例源码
com.google.gson.TypeAdapterFactory的实例源码
com.google.gson.JsonSerializer的实例源码
com.google.gson.FieldNamingPolicy的实例源码
com.google.gson.JsonElement的实例源码
com.google.gson.internal.JsonReaderInternalAccess的实例源码
com.google.gson.TypeAdapter的实例源码