use of androidx.cardview.widget.CardView in project AmazeFileManager by TeamAmaze.
the class Utils method showCutCopySnackBar.
public static Snackbar showCutCopySnackBar(MainActivity mainActivity, CharSequence text, int length, @StringRes int actionTextId, Runnable actionCallback, Runnable cancelCallback) {
final Snackbar snackbar = Snackbar.make(mainActivity.findViewById(R.id.content_frame), "", length);
View customSnackView = View.inflate(mainActivity.getApplicationContext(), R.layout.snackbar_view, null);
snackbar.getView().setBackgroundColor(Color.TRANSPARENT);
Snackbar.SnackbarLayout snackBarLayout = (Snackbar.SnackbarLayout) snackbar.getView();
snackBarLayout.setPadding(0, 0, 0, 0);
Button actionButton = customSnackView.findViewById(R.id.snackBarActionButton);
Button cancelButton = customSnackView.findViewById(R.id.snackBarCancelButton);
TextView textView = customSnackView.findViewById(R.id.snackBarTextTV);
actionButton.setText(actionTextId);
textView.setText(text);
actionButton.setOnClickListener(v -> actionCallback.run());
cancelButton.setOnClickListener(v -> cancelCallback.run());
snackBarLayout.addView(customSnackView, 0);
((CardView) snackBarLayout.findViewById(R.id.snackBarCardView)).setCardBackgroundColor(mainActivity.getAccent());
snackbar.show();
return snackbar;
}
use of androidx.cardview.widget.CardView in project Applozic-Android-SDK by AppLozic.
the class UserProfileFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.user_profile_fragment_layout, container, false);
name_cardView = (CardView) view.findViewById(R.id.applzoic_name_cardView);
email_cardView = (CardView) view.findViewById(R.id.applzoic_email_cardview);
status_cardView = (CardView) view.findViewById(R.id.applzoic_last_sean_status_cardView);
phone_cardView = (CardView) view.findViewById(R.id.applozic_user_phone_cardview);
name = (TextView) view.findViewById(R.id.userName);
status = (TextView) view.findViewById(R.id.applozic_user_status);
email = (TextView) view.findViewById(R.id.email);
phone = (TextView) view.findViewById(R.id.phone);
contactImage = (CircleImageView) view.findViewById(R.id.contactImage);
alphabeticTextView = (TextView) view.findViewById(R.id.alphabeticImage);
Bundle bundle = getArguments();
if (bundle != null) {
contact = (Contact) bundle.getSerializable(ConversationUIService.CONTACT);
contact = baseContactService.getContactById(contact.getContactIds());
((CustomToolbarListener) getActivity()).setToolbarTitle(contact.getDisplayName());
name.setText(contact.getDisplayName());
char firstLetter = contact.getDisplayName().toUpperCase().charAt(0);
String contactNumber = contact.getDisplayName().toUpperCase();
if (firstLetter != '+') {
alphabeticTextView.setText(String.valueOf(firstLetter));
} else if (contactNumber.length() >= 2) {
alphabeticTextView.setText(String.valueOf(contactNumber.charAt(1)));
}
Character colorKey = AlphaNumberColorUtil.alphabetBackgroundColorMap.containsKey(firstLetter) ? firstLetter : null;
GradientDrawable bgShape = (GradientDrawable) alphabeticTextView.getBackground();
bgShape.setColor(getActivity().getResources().getColor(AlphaNumberColorUtil.alphabetBackgroundColorMap.get(colorKey)));
if (contact.isDrawableResources()) {
int drawableResourceId = getResources().getIdentifier(contact.getrDrawableName(), "drawable", getActivity().getPackageName());
contactImage.setImageResource(drawableResourceId);
} else {
contactImageLoader.loadImage(contact, contactImage, alphabeticTextView);
}
name.setText(contact.getDisplayName());
if (!TextUtils.isEmpty(contact.getEmailId())) {
email_cardView.setVisibility(View.VISIBLE);
email.setText(contact.getEmailId());
}
if (!TextUtils.isEmpty(contact.getStatus())) {
status_cardView.setVisibility(View.VISIBLE);
status.setText(contact.getStatus());
}
if (!TextUtils.isEmpty(contact.getContactNumber())) {
phone_cardView.setVisibility(View.VISIBLE);
phone.setText(contact.getContactNumber());
} else {
phone_cardView.setVisibility(View.GONE);
}
}
return view;
}
use of androidx.cardview.widget.CardView in project Phonograph by kabouzeid.
the class HorizontalAlbumAdapter method setColors.
@Override
protected void setColors(int color, ViewHolder holder) {
if (holder.itemView != null) {
CardView card = (CardView) holder.itemView;
card.setCardBackgroundColor(color);
if (holder.title != null) {
holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
}
if (holder.text != null) {
holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
}
}
}
use of androidx.cardview.widget.CardView in project OneSignal-Android-SDK by OneSignal.
the class InAppMessageView method setUpDraggableLayout.
private void setUpDraggableLayout(final Context context, RelativeLayout.LayoutParams relativeLayoutParams, DraggableRelativeLayout.Params draggableParams) {
draggableRelativeLayout = new DraggableRelativeLayout(context);
if (relativeLayoutParams != null)
draggableRelativeLayout.setLayoutParams(relativeLayoutParams);
draggableRelativeLayout.setParams(draggableParams);
draggableRelativeLayout.setListener(new DraggableRelativeLayout.DraggableListener() {
@Override
public void onDismiss() {
if (messageController != null) {
messageController.onMessageWillDismiss();
}
finishAfterDelay(null);
}
@Override
public void onDragStart() {
isDragging = true;
}
@Override
public void onDragEnd() {
isDragging = false;
}
});
if (webView.getParent() != null)
((ViewGroup) webView.getParent()).removeAllViews();
CardView cardView = createCardView(context);
cardView.setTag(IN_APP_MESSAGE_CARD_VIEW_TAG);
cardView.addView(webView);
draggableRelativeLayout.setPadding(marginPxSizeLeft, marginPxSizeTop, marginPxSizeRight, marginPxSizeBottom);
draggableRelativeLayout.setClipChildren(false);
draggableRelativeLayout.setClipToPadding(false);
draggableRelativeLayout.addView(cardView);
}
use of androidx.cardview.widget.CardView in project OneSignal-Android-SDK by OneSignal.
the class Toaster method makeCustomViewToast.
public void makeCustomViewToast(String bread, ToastType toastType) {
View toastView = ((Activity) context).getLayoutInflater().inflate(R.layout.toaster_toast_card_layout, null, false);
CardView toastCardView = toastView.findViewById(R.id.toaster_toast_card_view);
ImageView toastIcon = toastView.findViewById(R.id.toaster_toast_image_view);
TextView toastTextView = toastView.findViewById(R.id.toaster_toast_text_view);
int color = context.getResources().getColor(toastType.getColor());
toastCardView.setCardBackgroundColor(color);
toastTextView.setTypeface(font.saralaBold);
toastTextView.setText(bread);
Drawable icon = context.getResources().getDrawable(toastType.getIcon());
toastIcon.setImageDrawable(icon);
Toast toast = Toast.makeText(context, Text.EMPTY, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, (int) (InterfaceUtil.getScreenHeight(context) * 0.25f));
toast.setView(toastView);
toast.show();
}
Aggregations