Search in sources :

Example 6 with CardView

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;
}
Also used : Button(android.widget.Button) CardView(androidx.cardview.widget.CardView) TextView(android.widget.TextView) View(android.view.View) CardView(androidx.cardview.widget.CardView) TextView(android.widget.TextView) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 7 with CardView

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;
}
Also used : Bundle(android.os.Bundle) CustomToolbarListener(com.applozic.mobicomkit.uiwidgets.uilistener.CustomToolbarListener) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) TextView(android.widget.TextView) View(android.view.View) CardView(androidx.cardview.widget.CardView) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 8 with CardView

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)));
        }
    }
}
Also used : CardView(androidx.cardview.widget.CardView)

Example 9 with CardView

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);
}
Also used : CardView(androidx.cardview.widget.CardView)

Example 10 with 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();
}
Also used : Toast(android.widget.Toast) CardView(androidx.cardview.widget.CardView) Drawable(android.graphics.drawable.Drawable) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) CardView(androidx.cardview.widget.CardView)

Aggregations

CardView (androidx.cardview.widget.CardView)22 View (android.view.View)17 TextView (android.widget.TextView)13 ViewGroup (android.view.ViewGroup)7 ImageView (android.widget.ImageView)6 Context (android.content.Context)5 Nullable (androidx.annotation.Nullable)5 RecyclerView (androidx.recyclerview.widget.RecyclerView)5 Objects (java.util.Objects)5 NonNull (androidx.annotation.NonNull)3 ArrayList (java.util.ArrayList)3 Set (java.util.Set)3 ColorStateList (android.content.res.ColorStateList)2 Drawable (android.graphics.drawable.Drawable)2 Bundle (android.os.Bundle)2 Spannable (android.text.Spannable)2 SpannableString (android.text.SpannableString)2 AttributeSet (android.util.AttributeSet)2 LayoutInflater (android.view.LayoutInflater)2 Menu (android.view.Menu)2