Java Code Examples for com.qmuiteam.qmui.widget.dialog.QMUIDialog#MultiCheckableDialogBuilder

The following examples show how to use com.qmuiteam.qmui.widget.dialog.QMUIDialog#MultiCheckableDialogBuilder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AboutActivity.java    From v9porn with MIT License 6 votes vote down vote up
private void actionCleanFile(QMUIDialog.MultiCheckableDialogBuilder builder) {
    int selectIndexLength = builder.getCheckedItemIndexes().length;
    List<File> fileDirList = new ArrayList<>();
    for (int i = 0; i < selectIndexLength; i++) {
        int indexCheck = builder.getCheckedItemIndexes()[i];
        switch (indexCheck) {
            case 0:
                fileDirList.add(AppCacheUtils.getRxCacheDir(AboutActivity.this));
                break;
            case 1:
                fileDirList.add(AppCacheUtils.getVideoCacheDir(AboutActivity.this));
                break;
            case 2:
                fileDirList.add(AppCacheUtils.getGlideDiskCacheDir(AboutActivity.this));
            default:
        }
    }
    if (fileDirList.size() == 0) {
        showMessage("未选择任何条目,无法清除缓存", TastyToast.INFO);
        return;
    }
    presenter.cleanCacheFile(fileDirList);
}
 
Example 2
Source File: AboutActivity.java    From v9porn with MIT License 6 votes vote down vote up
private void actionCleanFile(QMUIDialog.MultiCheckableDialogBuilder builder) {
    int selectIndexLength = builder.getCheckedItemIndexes().length;
    List<File> fileDirList = new ArrayList<>();
    for (int i = 0; i < selectIndexLength; i++) {
        int indexCheck = builder.getCheckedItemIndexes()[i];
        switch (indexCheck) {
            case 0:
                fileDirList.add(AppCacheUtils.getRxCacheDir(AboutActivity.this));
                break;
            case 1:
                fileDirList.add(AppCacheUtils.getVideoCacheDir(AboutActivity.this));
                break;
            case 2:
                fileDirList.add(AppCacheUtils.getGlideDiskCacheDir(AboutActivity.this));
            default:
        }
    }
    if (fileDirList.size() == 0) {
        showMessage("未选择任何条目,无法清除缓存", TastyToast.INFO);
        return;
    }
    presenter.cleanCacheFile(fileDirList);
}
 
Example 3
Source File: AddAndEditPoetryActivity.java    From PoetryWeather with Apache License 2.0 6 votes vote down vote up
/**
 * 匹配天气多选输入框
 */
@SuppressLint("LongLogTag")
private void showWeatherPoetryMultiChoiceDialog(){
    final QMUIDialog.MultiCheckableDialogBuilder builder = new QMUIDialog.MultiCheckableDialogBuilder(AddAndEditPoetryActivity.this)
            .setCheckedItems(weatherItems)
            .addItems(items, (dialog, which) -> {

            });
    builder.addAction("取消", (dialog, index) -> dialog.dismiss());
    builder.addAction("提交", (dialog, index) -> {
        String text = "";
        sWeatherPoetry = "";
        weatherItems = builder.getCheckedItemIndexes();
        for (int i = 0; i < weatherItems.length; i++) {
            text += items[builder.getCheckedItemIndexes()[i]]+" ";
            sWeatherPoetry += items[builder.getCheckedItemIndexes()[i]] + " ";
        }
        Log.d(TAG, "sWeatherPoetry: "+sWeatherPoetry);
        weatherPoetryListView.setDetailText(text);
        dialog.dismiss();
    });
    builder.create().show();
}
 
Example 4
Source File: PersonActivity.java    From PoetryWeather with Apache License 2.0 5 votes vote down vote up
/**
 * 多选框弹窗
 */
private void showMultiChoiceDialog() {
    final String[] items = new String[]{"清婉秀丽", "激越高亢", "语言绮丽"};
    final QMUIDialog.MultiCheckableDialogBuilder builder = new QMUIDialog.MultiCheckableDialogBuilder(PersonActivity.this)
            .addItems(items, (dialog, which) -> {});
    Log.d(TAG, "showMultiChoiceDialog: "+preferenceFlag.length);
    builder.setCheckedItems(preferenceFlag);
    builder.addAction("取消", (dialog, index) -> dialog.dismiss());
    builder.addAction("提交", (dialog, index) -> {
        String result = "您选择了 ";
        preference = "";
        for (int i = 0; i < builder.getCheckedItemIndexes().length; i++) {
            result += "" + items[builder.getCheckedItemIndexes()[i]] + " ";
            preference += items[builder.getCheckedItemIndexes()[i]] + " ";
        }
        //sharedPreferences存数组
        preferenceFlag = builder.getCheckedItemIndexes();
        Log.d(TAG, "showMultiChoiceDialog: indexes"+builder.getCheckedItemIndexes().length);
        JSONArray jsonArray = new JSONArray();
        for (int c : preferenceFlag) {
            jsonArray.put(c);
            Log.d(TAG, "showMultiChoiceDialog: c"+c);
        }
        Log.d(TAG, "showMultiChoiceDialog: jsonArray"+jsonArray.length());
        sharedPreferencesEdit("preferenceFlag",jsonArray.toString());
        sharedPreferencesEdit("preference",preference);
        preferenceListView.setDetailText(preference);
        Toast.makeText(PersonActivity.this, result, Toast.LENGTH_SHORT).show();
        dialog.dismiss();
    });
    builder.create(mCurrentDialogStyle).show();
}