Search in sources :

Example 6 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project instructure-android by instructure.

the class SubmissionCommentRowFactory method buildRowView.

// ///////////////////////////////////////////////////////////////
// Row Factories
// ///////////////////////////////////////////////////////////////
public static View buildRowView(View convertView, LayoutInflater inflater, SubmissionComment comment, final Activity context, boolean isUser) {
    final ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        if (isUser) {
            convertView = inflater.inflate(R.layout.list_item_user_comment, null);
        } else {
            convertView = inflater.inflate(R.layout.list_item_other_comment, null);
        }
        holder.avatar = (CircleImageView) convertView.findViewById(R.id.avatar);
        holder.comment = (HelveticaTextView) convertView.findViewById(R.id.commentText);
        holder.date = (HelveticaTextView) convertView.findViewById(R.id.date);
        holder.attachmentsHolder = (LinearLayout) convertView.findViewById(R.id.attachmentsHolder);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    String avatarURL = comment.getAuthor().getAvatarImageUrl();
    if (avatarURL != null) {
        Picasso.with(context).load(avatarURL).into(holder.avatar, new Callback() {

            @Override
            public void onSuccess() {
            }

            @Override
            public void onError() {
                holder.avatar.setImageResource(R.drawable.ic_cv_user);
            }
        });
    }
    holder.comment.setText(comment.getComment());
    holder.date.setText(DateHelpers.getShortDate(context, comment.getComparisonDate()) + context.getString(R.string.at) + DateHelpers.getFormattedTime(context, comment.getComparisonDate()) + ", " + comment.getAuthor().getDisplayName());
    holder.attachmentsHolder.removeAllViews();
    List<Attachment> attachments = comment.getAttachments();
    if (attachments != null) {
        for (final Attachment attachment : attachments) {
            if (attachment.getThumbnailUrl() != null && attachment.getUrl() != null) {
                ImageView imageView = getAttachmentImageView(context);
                imageView.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        ((SubmissionListener) context).onMediaOpened(attachment.getMimeType(), attachment.getUrl(), attachment.getFilename());
                    }
                });
                Picasso.with(context).load(attachment.getThumbnailUrl()).into(imageView);
                holder.attachmentsHolder.addView(imageView);
            }
        }
    }
    final MediaComment mediaComment = comment.getMedia_comment();
    if (mediaComment != null) {
        final String url = APIHelpers.getFullDomain(context) + "/media_objects/" + mediaComment.getMediaId() + "/thumbnail?height=140&width=140";
        ImageView imageView = getAttachmentImageView(context);
        imageView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                ((SubmissionListener) context).onMediaOpened(mediaComment.getMimeType(), mediaComment.getUrl(), mediaComment.getFileName());
            }
        });
        Picasso.with(context).load(url).into(imageView);
        holder.attachmentsHolder.addView(imageView);
    }
    return convertView;
}
Also used : MediaComment(com.instructure.canvasapi.model.MediaComment) Callback(com.squareup.picasso.Callback) Attachment(com.instructure.canvasapi.model.Attachment) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) HelveticaTextView(com.instructure.speedgrader.views.HelveticaTextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View)

Example 7 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView 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());
        ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(contact.getDisplayName());
        ((AppCompatActivity) getActivity()).getSupportActionBar().setSubtitle("");
        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) CardView(android.support.v7.widget.CardView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) TextView(android.widget.TextView) View(android.view.View) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 8 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project Applozic-Android-SDK by AppLozic.

the class ChannelCreateActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.channel_create_activty_layout);
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    connectivityReceiver = new ConnectivityReceiver();
    userPreference = MobiComUserPreference.getInstance(ChannelCreateActivity.this);
    mActionBar = getSupportActionBar();
    if (!TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimary()) && !TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimaryDark())) {
        mActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(alCustomizationSettings.getThemeColorPrimary())));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(Color.parseColor(alCustomizationSettings.getThemeColorPrimaryDark()));
        }
    }
    mActionBar.setTitle(R.string.channel_create_title);
    mActionBar.setDisplayShowHomeEnabled(true);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    finishActivityReceiver = new FinishActivityReceiver();
    registerReceiver(finishActivityReceiver, new IntentFilter(ACTION_FINISH_CHANNEL_CREATE));
    layout = (LinearLayout) findViewById(R.id.footerAd);
    applozicPermissions = new ApplozicPermissions(this, layout);
    channelName = (EditText) findViewById(R.id.channelName);
    circleImageView = (CircleImageView) findViewById(R.id.channelIcon);
    uploadImageButton = (CircleImageView) findViewById(R.id.applozic_channel_profile_camera);
    uploadImageButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            processImagePicker();
        }
    });
    int drawableResourceId = getResources().getIdentifier(alCustomizationSettings.getAttachCameraIconName(), "drawable", getPackageName());
    uploadImageButton.setImageResource(drawableResourceId);
    fileClientService = new FileClientService(this);
    if (getIntent() != null) {
        groupType = getIntent().getIntExtra(GROUP_TYPE, Channel.GroupType.PUBLIC.getValue().intValue());
    }
    /* groupType = getIntent().getIntExtra(GROUP_TYPE, Channel.GroupType.PRIVATE.getValue().intValue());
        if(groupType.equals(Channel.GroupType.BROADCAST.getValue().intValue())){
            circleImageView.setImageResource(R.drawable.applozic_ic_applozic_broadcast);
            uploadImageButton.setVisibility(View.GONE);
        }*/
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ApplozicPermissions(com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) FileClientService(com.applozic.mobicomkit.api.attachment.FileClientService) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) ColorDrawable(android.graphics.drawable.ColorDrawable) Toolbar(android.support.v7.widget.Toolbar)

Example 9 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project Lets-Chat by kshitiz1007.

the class ChatActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    mChatAddButton = (ImageButton) findViewById(R.id.chatAddButton);
    mChatSendButton = (ImageButton) findViewById(R.id.chatSendButton);
    mMessageView = (EditText) findViewById(R.id.chatMessageView);
    // -----GETING FROM INTENT----
    mChatUser = getIntent().getStringExtra("user_id");
    String userName = getIntent().getStringExtra("user_name");
    // ---SETTING ONLINE------
    mDatabaseReference = FirebaseDatabase.getInstance().getReference().child("users");
    // ----ADDING ACTION BAR-----
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setDisplayHomeAsUpEnabled(true);
    // ---INFLATING APP BAR LAYOUT INTO ACTION BAR----
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
    View actionBarView = inflater.inflate(R.layout.app_bar_layout, null);
    actionBar.setCustomView(actionBarView);
    // ---ADDING DATA ON ACTION BAR----
    mUserName = (TextView) actionBarView.findViewById(R.id.textView3);
    mUserLastSeen = (TextView) actionBarView.findViewById(R.id.textView5);
    mUserImage = (CircleImageView) actionBarView.findViewById(R.id.circleImageView);
    mUserName.setText(userName);
    mRootReference = FirebaseDatabase.getInstance().getReference();
    mImageStorage = FirebaseStorage.getInstance().getReference();
    mAuth = FirebaseAuth.getInstance();
    mCurrentUserId = mAuth.getCurrentUser().getUid();
    mMessageAdapter = new MessageAdapter(messagesList);
    mMessagesList = (RecyclerView) findViewById(R.id.recycleViewMessageList);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.message_swipe_layout);
    mLinearLayoutManager = new LinearLayoutManager(ChatActivity.this);
    // mMessagesList.setHasFixedSize(true);
    mMessagesList.setLayoutManager(mLinearLayoutManager);
    mMessagesList.setAdapter(mMessageAdapter);
    loadMessages();
    // ----ADDING LAST SEEN-----
    mRootReference.child("users").child(mChatUser).addValueEventListener(new ValueEventListener() {

        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            String onlineValue = dataSnapshot.child("online").getValue().toString();
            String imageValue = dataSnapshot.child("thumb_image").getValue().toString();
            Picasso.with(ChatActivity.this).load(imageValue).placeholder(R.drawable.user_img).into(mUserImage);
            if (onlineValue.equals("true")) {
                mUserLastSeen.setText("online");
            } else {
                GetTimeAgo getTimeAgo = new GetTimeAgo();
                long lastTime = Long.parseLong(onlineValue);
                String lastSeen = getTimeAgo.getTimeAgo(lastTime, getApplicationContext());
                mUserLastSeen.setText(lastSeen);
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
        }
    });
    // ----ADDING SEEN OF MESSAGES----
    mRootReference.child("chats").child(mCurrentUserId).addValueEventListener(new ValueEventListener() {

        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            if (!dataSnapshot.hasChild(mChatUser)) {
                Map chatAddMap = new HashMap();
                chatAddMap.put("seen", false);
                chatAddMap.put("time_stamp", ServerValue.TIMESTAMP);
                Map chatUserMap = new HashMap();
                chatUserMap.put("chats/" + mChatUser + "/" + mCurrentUserId, chatAddMap);
                chatUserMap.put("chats/" + mCurrentUserId + "/" + mChatUser, chatAddMap);
                mRootReference.updateChildren(chatUserMap, new DatabaseReference.CompletionListener() {

                    @Override
                    public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
                        if (databaseError == null) {
                            Toast.makeText(getApplicationContext(), "Successfully Added chats feature", Toast.LENGTH_SHORT).show();
                        } else
                            Toast.makeText(getApplicationContext(), "Cannot Add chats feature", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            Toast.makeText(getApplicationContext(), "Something went wrong.. Please go back..", Toast.LENGTH_SHORT).show();
        }
    });
    // ----SEND MESSAGE--BUTTON----
    mChatSendButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            String message = mMessageView.getText().toString();
            if (!TextUtils.isEmpty(message)) {
                String current_user_ref = "messages/" + mCurrentUserId + "/" + mChatUser;
                String chat_user_ref = "messages/" + mChatUser + "/" + mCurrentUserId;
                DatabaseReference user_message_push = mRootReference.child("messages").child(mCurrentUserId).child(mChatUser).push();
                String push_id = user_message_push.getKey();
                Map messageMap = new HashMap();
                messageMap.put("message", message);
                messageMap.put("seen", false);
                messageMap.put("type", "text");
                messageMap.put("time", ServerValue.TIMESTAMP);
                messageMap.put("from", mCurrentUserId);
                Map messageUserMap = new HashMap();
                messageUserMap.put(current_user_ref + "/" + push_id, messageMap);
                messageUserMap.put(chat_user_ref + "/" + push_id, messageMap);
                mRootReference.updateChildren(messageUserMap, new DatabaseReference.CompletionListener() {

                    @Override
                    public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
                        if (databaseError != null) {
                            Log.e("CHAT_ACTIVITY", "Cannot add message to database");
                        } else {
                            Toast.makeText(ChatActivity.this, "Message sent", Toast.LENGTH_SHORT).show();
                            mMessageView.setText("");
                        }
                    }
                });
            }
        }
    });
    /*
        //----THE WRAP CONTENT OF IMAGE VIEW IS GIVING ERROR--- SO REMOVING THIS FUNCTIONALITY-------


       mChatAddButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent galleryIntent=new Intent();
                galleryIntent.setType("image/*");
                galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(galleryIntent,"Select Image"),GALLERY_PICK);
            }
        });
        */
    // ----LOADING 10 MESSAGES ON SWIPE REFRESH----
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            itemPos = 0;
            mCurrentPage++;
            loadMoreMessages();
            ;
        }
    });
}
Also used : HashMap(java.util.HashMap) DatabaseReference(com.google.firebase.database.DatabaseReference) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DataSnapshot(com.google.firebase.database.DataSnapshot) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DatabaseError(com.google.firebase.database.DatabaseError) LayoutInflater(android.view.LayoutInflater) ValueEventListener(com.google.firebase.database.ValueEventListener) HashMap(java.util.HashMap) Map(java.util.Map) ActionBar(android.support.v7.app.ActionBar)

Example 10 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project expression by happy-yuxuan.

the class MyInfoFragment method findView.

// 初始化布局
private void findView(View view) {
    dialog = new CustomDialog(getActivity(), WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, R.layout.dialog_photo, R.style.Theme_dialog, Gravity.BOTTOM, R.style.pop_anim_style);
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(true);
    listview = (ListView) view.findViewById(R.id.list_myinfo);
    cv_head = (CircleImageView) view.findViewById(R.id.cv_head);
    cv_head.setBorderColor(Color.BLUE);
    cv_head.setOnClickListener(this);
    // 初始化头像
    initImgHead();
    btn_cancel = (Button) dialog.findViewById(R.id.btn_cancel);
    btn_cancel.setOnClickListener(this);
    btn_camera = (Button) dialog.findViewById(R.id.btn_camera);
    btn_camera.setOnClickListener(this);
    btn_picture = (Button) dialog.findViewById(R.id.btn_picture);
    btn_picture.setOnClickListener(this);
    listview.setAdapter(new MyInfoAdapter(getData(), getActivity()));
    // 设置listview Item 点击事件
    listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            String itemTextString = data.get(arg2).getTv_item_myinfo();
            switch(itemTextString) {
                // 我的订单
                case "我的订单":
                    startActivity(new Intent(getActivity(), UMyOrdersActivity.class));
                    break;
                // 我的信息
                case "我的信息":
                    startActivity(new Intent(getActivity(), UMyInfomationActivity.class));
                    break;
                // 我去派件
                case "我去派件":
                    startActivity(new Intent(getActivity(), UMyPaiJianActivity.class));
                    break;
                // 历史订单
                case "历史订单":
                    startActivity(new Intent(getActivity(), UHistoryRecordActivity.class));
                    break;
                // 关于我们
                case "关于我们":
                    startActivity(new Intent(getActivity(), UAboutWeActivity.class));
                    break;
                // 设置
                case "设置":
                    startActivity(new Intent(getActivity(), USetingActivity.class));
                    break;
                default:
                    break;
            }
        }
    });
}
Also used : MyInfoAdapter(com.yuxuan.admin.expression.adapter.MyInfoAdapter) CustomDialog(com.yuxuan.admin.expression.view.CustomDialog) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

CircleImageView (de.hdodenhof.circleimageview.CircleImageView)30 View (android.view.View)27 TextView (android.widget.TextView)23 ImageView (android.widget.ImageView)13 ActionBar (android.support.v7.app.ActionBar)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)6 Intent (android.content.Intent)5 Bitmap (android.graphics.Bitmap)5 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)5 RecyclerView (android.support.v7.widget.RecyclerView)5 BmobUser (cn.bmob.v3.BmobUser)4 DescriptionAnimation (com.daimajia.slider.library.Animations.DescriptionAnimation)4 BaseSliderView (com.daimajia.slider.library.SliderTypes.BaseSliderView)4 User (com.nightonke.saver.model.User)4 CustomSliderView (com.nightonke.saver.ui.CustomSliderView)4 IntentFilter (android.content.IntentFilter)3 ColorDrawable (android.graphics.drawable.ColorDrawable)3 Handler (android.os.Handler)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3