Java 错误:枚举开关大小写标签必须是枚举常量的非限定名称
错误:枚举开关大小写标签必须是枚举常量的非限定名称 错误:案例标签重复 不,救救我Java 错误:枚举开关大小写标签必须是枚举常量的非限定名称,java,android,Java,Android,错误:枚举开关大小写标签必须是枚举常量的非限定名称 错误:案例标签重复 不,救救我 public class CardViewStyleSetting extends ThemedSetting { public CardViewStyleSetting(ThemedActivity activity) { super(activity); } public void show() { AlertDialog.Builder build
public class CardViewStyleSetting extends ThemedSetting {
public CardViewStyleSetting(ThemedActivity activity) {
super(activity);
}
public void show() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), getActivity().getDialogStyle());
final View dialogLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_album_card_style, null);
TextView dialogTitle = dialogLayout.findViewById(R.id.dialog_card_view_style_title);
((CardView) dialogLayout.findViewById(R.id.dialog_card_view_style)).setCardBackgroundColor(getActivity().getCardBackgroundColor());
dialogTitle.setBackgroundColor(getActivity().getPrimaryColor());
final RadioGroup rGroup = dialogLayout.findViewById(R.id.radio_group_card_view_style);
final CheckBox chkShowMediaCount = dialogLayout.findViewById(R.id.show_media_count);
final CheckBox chkShowAlbumPath = dialogLayout.findViewById(R.id.show_album_path);
RadioButton rCompact = dialogLayout.findViewById(R.id.radio_card_compact);
RadioButton rFlat = dialogLayout.findViewById(R.id.radio_card_flat);
RadioButton rMaterial = dialogLayout.findViewById(R.id.radio_card_material);
chkShowMediaCount.setChecked(Prefs.showMediaCount());
chkShowAlbumPath.setChecked(Prefs.showAlbumPath());
getActivity().themeRadioButton(rCompact);
getActivity().themeRadioButton(rFlat);
getActivity().themeRadioButton(rMaterial);
getActivity().themeCheckBox(chkShowMediaCount);
getActivity().themeCheckBox(chkShowAlbumPath);
rGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
final View v;
switch (i) {
case R.id.radio_card_compact:
v = LayoutInflater.from(getActivity()).inflate(CardViewStyle.COMPACT.getLayout(), null);
v.findViewById(R.id.ll_album_info).setBackgroundColor(ColorPalette.getTransparentColor(getActivity().getBackgroundColor(), 150));
break;
case R.id.radio_card_flat:
v = LayoutInflater.from(getActivity()).inflate(CardViewStyle.FLAT.getLayout(), null);
v.findViewById(R.id.ll_album_info).setBackgroundColor(ColorPalette.getTransparentColor(getActivity().getBackgroundColor(), 150));
break;
case R.id.radio_card_material: default:
v = LayoutInflater.from(getActivity()).inflate(CardViewStyle.MATERIAL.getLayout(), null);
v.findViewById(R.id.ll_album_info).setBackgroundColor(getActivity().getCardBackgroundColor());
break;
}
ImageView img = v.findViewById(R.id.album_preview);
img.setBackgroundColor(getActivity().getPrimaryColor());
Glide.with(getActivity())
.load(R.drawable.donald_header)
.into(img);
String hexPrimaryColor = ColorPalette.getHexColor(getActivity().getPrimaryColor());
String hexAccentColor = ColorPalette.getHexColor(getActivity().getAccentColor());
if (hexAccentColor.equals(hexPrimaryColor))
hexAccentColor = ColorPalette.getHexColor(ColorPalette.getDarkerColor(getActivity().getAccentColor()));
String textColor = getActivity().getBaseTheme().equals(Theme.LIGHT) ? "#2B2B2B" : "#FAFAFA";
String albumPhotoCountHtml = "<b><font color='" + hexAccentColor + "'>420</font></b>";
((TextView) v.findViewById(R.id.album_media_count)).setText(StringUtils.html(albumPhotoCountHtml));
((TextView) v.findViewById(R.id.album_media_label)).setTextColor(getActivity().getTextColor());
((TextView) v.findViewById(R.id.album_path)).setTextColor(getActivity().getSubTextColor());
v.findViewById(R.id.ll_media_count).setVisibility( chkShowMediaCount.isChecked() ? View.VISIBLE : View.GONE);
chkShowMediaCount.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
v.findViewById(R.id.ll_media_count).setVisibility(b ? View.VISIBLE : View.GONE);
}
});
v.findViewById(R.id.album_path).setVisibility( chkShowAlbumPath.isChecked() ? View.VISIBLE : View.GONE);
chkShowAlbumPath.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
v.findViewById(R.id.album_path).setVisibility(b ? View.VISIBLE : View.GONE);
}
});
((TextView) v.findViewById(R.id.album_name)).setText(StringUtils.html("<i><font color='" + textColor + "'>PraiseDuarte</font></i>"));
((TextView) v.findViewById(R.id.album_path)).setText("~/home/PraiseDuarte");
((CardView) v).setUseCompatPadding(true);
((CardView) v).setRadius(2);
((LinearLayout) dialogLayout.findViewById(R.id.ll_preview_album_card)).removeAllViews();
((LinearLayout) dialogLayout.findViewById(R.id.ll_preview_album_card)).addView(v);
}
});
switch (Prefs.getCardStyle()) {
case CardViewStyle.COMPACT: rCompact.setChecked(true); break;
case CardViewStyle.FLAT: rFlat.setChecked(true); break;
case CardViewStyle.MATERIAL: default: rMaterial.setChecked(true); break;
}
builder.setNegativeButton(getActivity().getString(R.string.cancel).toUpperCase(), null);
builder.setPositiveButton(getActivity().getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
CardViewStyle cardViewStyle;
switch (rGroup.getCheckedRadioButtonId()) {
case R.id.radio_card_material:
default:
cardViewStyle = CardViewStyle.MATERIAL;
break;
case R.id.radio_card_flat:
cardViewStyle = CardViewStyle.FLAT;
break;
case R.id.radio_card_compact:
cardViewStyle = CardViewStyle.COMPACT;
break;
}
Prefs.setCardStyle(cardViewStyle);
Prefs.setShowMediaCount(chkShowMediaCount.isChecked());
Prefs.setShowAlbumPath(chkShowAlbumPath.isChecked());
Toast.makeText(getActivity(), getActivity().getString(R.string.restart_app), Toast.LENGTH_SHORT).show();
}
});
builder.setView(dialogLayout);
builder.show();
}
}
公共类CardViewStyleSetting扩展了该设置{
公共卡查看样式设置(主题活动){
超级(活动);
}
公开展览({
AlertDialog.Builder=新建AlertDialog.Builder(getActivity(),getActivity().getDialogStyle());
最终视图dialogLayout=LayoutInflater.from(getActivity()).flate(R.layout.dialog\u相册\u卡片\u样式,空);
TextView dialogTitle=dialogLayout.findViewById(R.id.dialog\u card\u view\u style\u title);
((CardView)dialogLayout.findViewById(R.id.dialog_card_view_style)).setCardBackgroundColor(getActivity().getCardBackgroundColor());
dialogTitle.setBackgroundColor(getActivity().getPrimaryColor());
最终射线组rGroup=dialogLayout.findViewById(R.id.radio\u group\u card\u view\u样式);
最后一个复选框chkShowMediaCount=dialogLayout.findviewbyd(R.id.show\u media\u count);
最终复选框chkShowAlbumPath=dialogLayout.findViewById(R.id.show\u album\u path);
RadioButton rCompact=dialogLayout.findViewById(R.id.radio\u card\u compact);
RadioButton rFlat=dialogLayout.findViewById(R.id.radio\u card\u flat);
RadioButton rMaterial=dialogLayout.findViewById(R.id.radio\u card\u材质);
chkShowMediaCount.setChecked(Prefs.showMediaCount());
chkShowAlbumPath.setChecked(Prefs.showAlbumPath());
getActivity().themeRadioButton(rCompact);
getActivity().themeRadioButton(rFlat);
getActivity().themeRadioButton(Material);
getActivity().themeCheckBox(chkShowMediaCount);
getActivity().themeCheckBox(chkShowAlbumPath);
rGroup.setOnCheckedChangeListener(新的RadioGroup.OnCheckedChangeListener(){
@凌驾
检查更改后的公共无效(放射组放射组,int i){
最后意见五;
开关(一){
外壳R.id.无线电卡\u紧凑型:
v=LayoutInflater.from(getActivity()).flate(CardViewStyle.COMPACT.getLayout(),null);
v、 findViewById(R.id.ll_album_info).setBackgroundColor(ColorPalette.getTransparentColor(getActivity().getBackgroundColor(),150));
打破
外壳R.id.无线电卡\u平面:
v=LayoutInflater.from(getActivity()).flate(CardViewStyle.FLAT.getLayout(),null);
v、 findViewById(R.id.ll_album_info).setBackgroundColor(ColorPalette.getTransparentColor(getActivity().getBackgroundColor(),150));
打破
案例R.id.radio\u卡\u材质:默认值:
v=LayoutFlater.from(getActivity()).Flate(CardViewStyle.MATERIAL.getLayout(),null);
v、 findViewById(R.id.ll_相册_信息).setBackgroundColor(getActivity().getCardBackgroundColor());
打破
}
ImageView img=v.findviewbyd(R.id.album\u预览);
img.setBackgroundColor(getActivity().getPrimaryColor());
Glide.with(getActivity())
.负载(可拉深的右端头)
.into(img);
字符串hexPrimaryColor=colorplate.getHexColor(getActivity().getPrimaryColor());
字符串hexAccentColor=colorplate.getHexColor(getActivity().getAccentColor());
if(hexAccentColor.equals(hexPrimaryColor))
hexAccentColor=ColorPalette.getHexColor(ColorPalette.getDarkerColor(getActivity().getAccentColor());
字符串textColor=getActivity().getBaseTheme().equals(Theme.LIGHT)?“#2b2b”:“#FAFAFA”;
字符串albumPhotoCountHtml=“420”;
((TextView)v.findViewById(R.id.album_media_count)).setText(StringUtils.html(albumPhotoCountHtml));
((TextView)v.findViewById(R.id.album_media_label)).setTextColor(getActivity().getTextColor());
((TextView)v.findviewbyd(R.id.album_path)).setTextColor(getActivity().getSubTextColor());
v、 findViewById(R.id.ll_media_count).setVisibility(chkShowMediaCount.isChecked()?View.VISIBLE:View.GONE);
chkShowMediaCount.setOnCheckedChangeListener(新建CompoundButton.OnCheckedChangeListener(){
@凌驾
检查更改后的公共无效(复合按钮复合按钮,布尔b){
v、 findViewById(R.id.ll_media_count).setVisibility(b?View.VISIBLE:View.GONE);
}
});
v、 findViewById(R.id.album_path).setVisibility(chkShowAlbumPath.isChecked()?View.VISIBLE:View.GONE);
chkShowAlbumPath.setOnCheckedChangeListener(新的CompoundButton.OnCheckedChangeListener(){
@凌驾
检查更改后的公共无效(复合按钮复合按钮,布尔b){
v、 findviewbyd(R.id.album_path).setVisibility(b?View.VISIBLE:View.GONE);
}
});
((TextView)v.findviewbyd(R.id.album_name)).setText(StringUtils.html(“PraiseDuarte”);
((TextView)v.findviewbyd(R.id.album_path)).setText(“~/home/PraiseDuarte”);
((CardView)v).setUseCompatPadding(true);
(CardView)v.设置半径(2);
((LinearLayout)dialogLayout.findViewById(R.id.ll_预览_相册_卡)).removeAllViews();
((LinearLayout)dialogLayout.findviewbyd(R.id.ll\u preview\u album\u card)).addView(v);
}
});
开关(Prefs.getCardStyle()){
case CardViewStyle.COMPACT:rCompact.setChecked(true);中断;
case CardViewStyle.FLAT:rFlat.setChecked(true);中断;
case CardViewStyle.M
switch (Prefs.getCardStyle()) {
case COMPACT: rCompact.setChecked(true); break;
case FLAT: rFlat.setChecked(true); break;
case MATERIAL: default: rMaterial.setChecked(true); break;
}