Search in sources :

Example 1 with CustomToolbarListener

use of com.applozic.mobicomkit.uiwidgets.uilistener.CustomToolbarListener 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 2 with CustomToolbarListener

use of com.applozic.mobicomkit.uiwidgets.uilistener.CustomToolbarListener in project Applozic-Android-SDK by AppLozic.

the class MobiComQuickConversationFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View list = inflater.inflate(R.layout.mobicom_message_list, container, false);
    recyclerView = (RecyclerView) list.findViewById(R.id.messageList);
    recyclerView.setBackgroundColor(getResources().getColor(R.color.conversation_list_all_background));
    if (messageList != null && !messageList.contains(null)) {
        messageList.add(null);
    }
    recyclerAdapter = new QuickConversationAdapter(getContext(), messageList, null);
    recyclerAdapter.setAlCustomizationSettings(alCustomizationSettings);
    linearLayoutManager = new AlLinearLayoutManager(getContext());
    linearLayoutManager.setOrientation(AlLinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext());
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setAdapter(recyclerAdapter);
    toolbar = (Toolbar) getActivity().findViewById(R.id.my_toolbar);
    toolbar.setClickable(false);
    fabButton = (ImageButton) list.findViewById(R.id.fab_start_new);
    loading = true;
    LinearLayout individualMessageSendLayout = (LinearLayout) list.findViewById(R.id.individual_message_send_layout);
    LinearLayout extendedSendingOptionLayout = (LinearLayout) list.findViewById(R.id.extended_sending_option_layout);
    individualMessageSendLayout.setVisibility(View.GONE);
    extendedSendingOptionLayout.setVisibility(View.GONE);
    emptyTextView = (TextView) list.findViewById(R.id.noConversations);
    emptyTextView.setTextColor(Color.parseColor(alCustomizationSettings.getNoConversationLabelTextColor().trim()));
    fabButton.setVisibility(alCustomizationSettings.isStartNewFloatingButton() ? View.VISIBLE : View.GONE);
    swipeLayout = (SwipeRefreshLayout) list.findViewById(R.id.swipe_container);
    swipeLayout.setColorScheme(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
    recyclerView.setLongClickable(true);
    registerForContextMenu(recyclerView);
    ((CustomToolbarListener) getActivity()).setToolbarTitle(ApplozicService.getContext(getContext()).getString(R.string.conversation));
    return list;
}
Also used : QuickConversationAdapter(com.applozic.mobicomkit.uiwidgets.conversation.adapter.QuickConversationAdapter) AlLinearLayoutManager(com.applozic.mobicomkit.uiwidgets.conversation.AlLinearLayoutManager) DividerItemDecoration(com.applozic.mobicomkit.uiwidgets.conversation.activity.DividerItemDecoration) CustomToolbarListener(com.applozic.mobicomkit.uiwidgets.uilistener.CustomToolbarListener) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Aggregations

View (android.view.View)2 TextView (android.widget.TextView)2 CustomToolbarListener (com.applozic.mobicomkit.uiwidgets.uilistener.CustomToolbarListener)2 GradientDrawable (android.graphics.drawable.GradientDrawable)1 Bundle (android.os.Bundle)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 CardView (androidx.cardview.widget.CardView)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 AlLinearLayoutManager (com.applozic.mobicomkit.uiwidgets.conversation.AlLinearLayoutManager)1 DividerItemDecoration (com.applozic.mobicomkit.uiwidgets.conversation.activity.DividerItemDecoration)1 QuickConversationAdapter (com.applozic.mobicomkit.uiwidgets.conversation.adapter.QuickConversationAdapter)1 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)1