com.jaredrummler.android.colorpicker.ColorPickerDialog Java Examples
The following examples show how to use
com.jaredrummler.android.colorpicker.ColorPickerDialog.
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: MainActivity.java From ColorPicker with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_color_picker_dialog: ColorPickerDialog.newBuilder() .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setAllowPresets(false) .setDialogId(DIALOG_ID) .setColor(Color.BLACK) .setShowAlphaSlider(true) .show(this); return true; case R.id.menu_github: try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jaredrummler/ColorPicker"))); } catch (ActivityNotFoundException ignored) { } return true; } return super.onOptionsItemSelected(item); }
Example #2
Source File: MemeCreateActivity.java From memetastic with GNU General Public License v3.0 | 5 votes |
private void showColorDialog(int id, @ColorInt int color) { ColorPickerDialog.newBuilder() .setDialogId(id) .setColor(color) .setPresets(MemeLibConfig.MEME_COLORS.ALL) .setCustomButtonText(R.string.palette) .setPresetsButtonText(R.string.presets) .setDialogTitle(R.string.select_color) .setSelectedButtonText(android.R.string.ok) .show(this); }
Example #3
Source File: ReadStyleActivity.java From MyBookshelf with GNU General Public License v3.0 | 4 votes |
/** * 事件触发绑定 */ @Override protected void bindEvent() { swDarkStatusIcon.setChecked(darkStatusIcon); swDarkStatusIcon.setOnCheckedChangeListener((compoundButton, b) -> { darkStatusIcon = b; initImmersionBar(); }); //文字背景点击事件 llContent.setOnClickListener((view) -> { if (llBottom.getVisibility() == View.GONE) { llBottom.setVisibility(View.VISIBLE); } else { llBottom.setVisibility(View.GONE); }}); //选择文字颜色 tvSelectTextColor.setOnClickListener(view -> ColorPickerDialog.newBuilder() .setColor(textColor) .setShowAlphaSlider(false) .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setDialogId(SELECT_TEXT_COLOR) .show(ReadStyleActivity.this)); //选择背景颜色 tvSelectBgColor.setOnClickListener(view -> ColorPickerDialog.newBuilder() .setColor(bgColor) .setShowAlphaSlider(false) .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setDialogId(SELECT_BG_COLOR) .show(ReadStyleActivity.this)); //背景图列表 bgImgListAdapter = new BgImgListAdapter(this); bgImgListAdapter.initList(); bgImgList.setAdapter(bgImgListAdapter); bgImgList.setOnItemClickListener((adapterView, view, i, l) -> { if (i == 0) { selectImage(); } else { bgPath = bgImgListAdapter.getItemAssetsFile(i - 1); setAssetsBg(bgPath); } }); //选择背景图片 tvSelectBgImage.setOnClickListener(view -> selectImage()); //恢复默认 tvDefault.setOnClickListener(view -> { bgCustom = 0; textColor = readBookControl.getDefaultTextColor(textDrawableIndex); bgDrawable = readBookControl.getDefaultBgDrawable(textDrawableIndex, this); upText(); upBg(); }); }
Example #4
Source File: ReadStyleActivity.java From HaoReader with GNU General Public License v3.0 | 4 votes |
/** * 事件触发绑定 */ @Override protected void bindEvent() { swDarkStatusIcon.setChecked(darkStatusIcon); swDarkStatusIcon.setOnCheckedChangeListener((compoundButton, b) -> { darkStatusIcon = b; initImmersionBar(); }); //选择文字颜色 tvSelectTextColor.setOnClickListener(view -> ColorPickerDialog.newBuilder() .setColor(textColor) .setShowAlphaSlider(false) .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setDialogId(SELECT_TEXT_COLOR) .show(ReadStyleActivity.this)); //选择背景颜色 tvSelectBgColor.setOnClickListener(view -> ColorPickerDialog.newBuilder() .setColor(bgColor) .setShowAlphaSlider(false) .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setDialogId(SELECT_BG_COLOR) .show(ReadStyleActivity.this)); //选择背景图片 tvSelectBgImage.setOnClickListener(view -> { new PermissionsCompat.Builder(ReadStyleActivity.this) .addPermissions(Permissions.Group.STORAGE) .rationale("存储") .onGranted(requestCode -> imageSelectorResult()) .request(); }); //恢复默认 tvDefault.setOnClickListener(view -> { bgCustom = 0; textColor = readBookControl.getDefaultTextColor(textDrawableIndex); bgColor = readBookControl.getDefaultBgColor(textDrawableIndex); bgDrawable = readBookControl.getDefaultBgDrawable(textDrawableIndex, this); upText(); upBg(); }); }