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;
}
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;
}
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));
}
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();
;
}
});
}
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;
}
}
});
}
Aggregations