use of android.support.v7.widget.CardView in project FanLayoutManager by Cleveroad.
the class SportCardsAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final SportCardViewHolder holder, int position) {
SportCardModel item = mItems.get(position);
holder.tvSportTitle.setText(item.getSportTitle());
holder.tvSportSubtitle.setText(item.getSportSubtitle());
holder.tvSportRound.setText(item.getSportRound());
holder.ivSportPreview.setImageResource(item.getImageResId());
holder.tvTime.setText(item.getTime());
holder.tvDayPart.setText(item.getDayPart());
((CardView) holder.itemView).setCardBackgroundColor(ContextCompat.getColor(mContext, item.getBackgroundColorResId()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.ivSportPreview.setTransitionName("shared" + String.valueOf(position));
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClicked(holder.getAdapterPosition(), holder.ivSportPreview);
}
}
});
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SecurityActivity method setPasswordDialog.
private void setPasswordDialog() {
final AlertDialog.Builder passwordDialog = new AlertDialog.Builder(SecurityActivity.this, getDialogStyle());
final View PasswordDialogLayout = getLayoutInflater().inflate(org.horaapps.leafpic.R.layout.dialog_set_password, null);
final TextView passwordDialogTitle = (TextView) PasswordDialogLayout.findViewById(org.horaapps.leafpic.R.id.password_dialog_title);
final CardView passwordDialogCard = (CardView) PasswordDialogLayout.findViewById(org.horaapps.leafpic.R.id.password_dialog_card);
final EditText editTextPassword = (EditText) PasswordDialogLayout.findViewById(org.horaapps.leafpic.R.id.password_edittxt);
final EditText editTextConfirmPassword = (EditText) PasswordDialogLayout.findViewById(org.horaapps.leafpic.R.id.confirm_password_edittxt);
passwordDialogTitle.setBackgroundColor(getPrimaryColor());
passwordDialogCard.setBackgroundColor(getCardBackgroundColor());
editTextPassword.getBackground().mutate().setColorFilter(getTextColor(), PorterDuff.Mode.SRC_ATOP);
editTextPassword.setTextColor(getTextColor());
editTextPassword.setHintTextColor(getSubTextColor());
setCursorDrawableColor(editTextPassword, getTextColor());
editTextConfirmPassword.getBackground().mutate().setColorFilter(getTextColor(), PorterDuff.Mode.SRC_ATOP);
editTextConfirmPassword.setTextColor(getTextColor());
editTextConfirmPassword.setHintTextColor(getSubTextColor());
setCursorDrawableColor(editTextConfirmPassword, getTextColor());
passwordDialog.setView(PasswordDialogLayout);
AlertDialog dialog = passwordDialog.create();
dialog.setCancelable(false);
dialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(org.horaapps.leafpic.R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
swActiveSecurity.setChecked(false);
SP.putBoolean(getString(org.horaapps.leafpic.R.string.preference_use_password), false);
}
});
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(org.horaapps.leafpic.R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
boolean changed = false;
if (editTextPassword.length() > 3) {
if (editTextPassword.getText().toString().equals(editTextConfirmPassword.getText().toString())) {
SP.putString(getString(org.horaapps.leafpic.R.string.preference_password_value), editTextPassword.getText().toString());
securityObj.updateSecuritySetting();
Toast.makeText(getApplicationContext(), org.horaapps.leafpic.R.string.remember_password_message, Toast.LENGTH_SHORT).show();
changed = true;
} else
Toast.makeText(getApplicationContext(), org.horaapps.leafpic.R.string.password_dont_match, Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), org.horaapps.leafpic.R.string.error_password_length, Toast.LENGTH_SHORT).show();
swActiveSecurity.setChecked(changed);
SP.putBoolean(getString(org.horaapps.leafpic.R.string.preference_use_password), changed);
toggleEnabledChild(changed);
}
});
dialog.show();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class SettingsActivity method customizePictureViewer.
private void customizePictureViewer() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_media_viewer_theme, null);
final SwitchCompat swApplyTheme_Viewer = (SwitchCompat) dialogLayout.findViewById(R.id.apply_theme_3th_act_enabled);
((CardView) dialogLayout.findViewById(R.id.third_act_theme_card)).setCardBackgroundColor(getCardBackgroundColor());
//or GetPrimary
dialogLayout.findViewById(R.id.third_act_theme_title).setBackgroundColor(getPrimaryColor());
((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title)).setTextColor(getTextColor());
((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title_Sub)).setTextColor(getSubTextColor());
((IconicsImageView) dialogLayout.findViewById(R.id.ll_apply_theme_3thAct_icon)).setColor(getIconColor());
swApplyTheme_Viewer.setChecked(isApplyThemeOnImgAct());
swApplyTheme_Viewer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updateSwitchColor(swApplyTheme_Viewer, getAccentColor());
}
});
updateSwitchColor(swApplyTheme_Viewer, getAccentColor());
final LineColorPicker transparencyColorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.pickerTransparent);
transparencyColorPicker.setColors(ColorPalette.getTransparencyShadows(getPrimaryColor()));
transparencyColorPicker.setSelectedColor(ColorPalette.getTransparentColor(getPrimaryColor(), getTransparency()));
/**TEXT VIEWS**/
((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title)).setTextColor(getTextColor());
((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title_Sub)).setTextColor(getSubTextColor());
dialogBuilder.setView(dialogLayout);
dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), null);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences.Editor editor = SP.getEditor();
editor.putBoolean(getString(R.string.preference_apply_theme_pager), swApplyTheme_Viewer.isChecked());
int c = Color.alpha(transparencyColorPicker.getColor());
editor.putInt(getString(R.string.preference_transparency), 255 - c);
editor.commit();
updateTheme();
}
});
dialogBuilder.show();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class AlertDialogsHelper method getInsertTextDialog.
public static AlertDialog getInsertTextDialog(final ThemedActivity activity, AlertDialog.Builder dialogBuilder, EditText editText, @StringRes int title) {
View dialogLayout = activity.getLayoutInflater().inflate(org.horaapps.leafpic.R.layout.dialog_insert_text, null);
TextView textViewTitle = (TextView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.rename_title);
((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.dialog_chose_provider_title)).setCardBackgroundColor(activity.getCardBackgroundColor());
textViewTitle.setBackgroundColor(activity.getPrimaryColor());
textViewTitle.setText(title);
ThemeHelper.setCursorDrawableColor(editText, activity.getTextColor());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
editText.setLayoutParams(layoutParams);
editText.setSingleLine(true);
editText.getBackground().mutate().setColorFilter(activity.getTextColor(), PorterDuff.Mode.SRC_IN);
editText.setTextColor(activity.getTextColor());
try {
Field f = TextView.class.getDeclaredField("mCursorDrawableRes");
f.setAccessible(true);
f.set(editText, null);
} catch (Exception ignored) {
}
((RelativeLayout) dialogLayout.findViewById(org.horaapps.leafpic.R.id.container_edit_text)).addView(editText);
dialogBuilder.setView(dialogLayout);
return dialogBuilder.create();
}
use of android.support.v7.widget.CardView in project LeafPic by HoraApps.
the class AlertDialogsHelper method getTextDialog.
public static AlertDialog getTextDialog(final ThemedActivity activity, AlertDialog.Builder textDialogBuilder, @StringRes int title, @StringRes int Message) {
View dialogLayout = activity.getLayoutInflater().inflate(org.horaapps.leafpic.R.layout.dialog_text, null);
TextView dialogTitle = (TextView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.text_dialog_title);
TextView dialogMessage = (TextView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.text_dialog_message);
((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.message_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
dialogTitle.setBackgroundColor(activity.getPrimaryColor());
dialogTitle.setText(title);
dialogMessage.setText(Message);
dialogMessage.setTextColor(activity.getTextColor());
textDialogBuilder.setView(dialogLayout);
return textDialogBuilder.create();
}
Aggregations