565).into(((ItemMessageFriendHolder) holder).imageContent);
                    }
                });

                Bitmap currentAvatar = bitmapHashMapAvatar.get(conversation.getMessages().get(position).idSender);
                if (currentAvatar!= null) {
                    ((ItemMessageFriendHolder) holder).avatar.setImageBitmap(currentAvatar);
                } else {
                    final String id = conversation.getMessages().get(position).idSender;
                    if (referenceHashMapAvatar.get(id) == null) {
                        referenceHashMapAvatar.put(id, usersReference.child(id).child("avatar"));
                        referenceHashMapAvatar.get(id).addListenerForSingleValueEvent(new ValueEventListener() {
                            @Override
                            public void onDataChange(DataSnapshot dataSnapshot) {
                                if (dataSnapshot.getValue()!= null) {
                                    String avatarString = (String) dataSnapshot.getValue();
                                    if (!avatarString.equals(StaticConfig.STR_DEFAULT_BASE64)) {
                                        byte[] decodedString = Base64.decode(avatarString, Base64.DEFAULT);
                                        ChatActivity.bitmapAvatarFriend.put(id, BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length));
                                    } else {
                                        ChatActivity.bitmapAvatarFriend.put(id, BitmapFactory.decodeResource(context.getResources(), R.drawable.default_avatar));
                                    }
                                    notifyDataSetChanged();
                                }
                            }

                            @Override
                            public void onCancelled(DatabaseError databaseError) {

                            }
                        });
                    }
                }
            }

        } else if (holder instanceof ItemMessageUserHolder) {

            if (today.equals(time)) {
                ((ItemMessageUserHolder) holder).txtTime.setText(new SimpleDateFormat("HH:mm").format(new Date(conversation.getMessages().get(position).timestamp)));
            } else {
                ((ItemMessageUserHolder) holder).txtTime.setText(new SimpleDateFormat("MMM d").format(new Date(conversation.getMessages().get(position).timestamp)));
            }

            if (conversation.getMessages().get(position).type == Message.TEXT) {
                ((ItemMessageUserHolder) holder).imageContent.setVisibility(View.INVISIBLE);
                ((ItemMessageUserHolder) holder).txtContent.setVisibility(View.VISIBLE);
                ((ItemMessageUserHolder) holder).txtContent.setText(CipherHandler.decrypt(conversation.getMessages().get(position).text));
                ((ItemMessageUserHolder) holder).txtContent.setOnLongClickListener(new View.OnLongClickListener() {
                    @Override
                    public boolean onLongClick(View view) {
                        ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
                        ClipData clip = ClipData.newPlainText("message", CipherHandler.decrypt(conversation.getMessages().get(position).text));
                        clipboard.setPrimaryClip(clip);
                        Toast.makeText(context, "Message Copied!", Toast.LENGTH_SHORT).show();
                        return true;
                    }
                });
                if (bitmapAvatarUser!= null) {
                    ((ItemMessageUserHolder) holder).avatar.setImageBitmap(bitmapAvatarUser);
                }
            } else if (conversation.getMessages().get(position).type == Message.IMAGE) {
                ((ItemMessageUserHolder) holder).txtContent.setVisibility(View.INVISIBLE);
                ((ItemMessageUserHolder) holder).txtContent.setPadding(0, 0, 0, 0);
                ((ItemMessageUserHolder) holder).imageContent.setVisibility(View.VISIBLE);
                Picasso.with(context).load(CipherHandler.decrypt(conversation.getMessages().get(position).text)).fit().centerCrop().networkPolicy(NetworkPolicy.OFFLINE).placeholder(R.drawable.default_image).config(Bitmap.Config.RGB_565).into(((ItemMessageUserHolder) holder).imageContent, new Callback() {
                    @Override
                    public void onSuccess() {

                    }

                    @Override
                    public void onError() {
                        Picasso.with(context).load(CipherHandler.decrypt(conversation.getMessages().get(position).text)).fit().centerCrop().placeholder(R.drawable.default_image).config(Bitmap.Config.RGB_565).into(((ItemMessageUserHolder) holder).imageContent);
                    }
                });

                if (bitmapAvatarUser!= null) {
                    ((ItemMessageUserHolder) holder).avatar.setImageBitmap(bitmapAvatarUser);
                }
            }
        }

    }

    @Override
    public int getItemCount() {
        return conversation.getMessages().size();
    }

    @Override
    public int getItemViewType(int position) {
        String currentUid = FirebaseAuth.getInstance().getCurrentUser().getUid();
        if (conversation.getMessages().get(position).idSender.equals(currentUid)) {
            return ChatActivity.VIEW_TYPE_USER_MESSAGE;
        } else {
            return ChatActivity.VIEW_TYPE_FRIEND_MESSAGE;
        }
    }
}

class ItemMessageUserHolder extends RecyclerView.ViewHolder {
    public TextView txtContent;
    public TextView txtTime;
    public CircleImageView avatar;
    public ImageView imageContent;

    public ItemMessageUserHolder(View view) {
        super(view);
        txtContent = view.findViewById(R.id.textContentUser);
        txtTime = view.findViewById(R.id.timeContentUser);
        imageContent = view.findViewById(R.id.imageContentUser);
        avatar = view.findViewById(R.id.image_view_user);
    }
}

class ItemMessageFriendHolder extends RecyclerView.ViewHolder {
    public TextView txtContent;
    public TextView txtTime;
    public CircleImageView avatar;
    public ImageView imageContent;

    public ItemMessageFriendHolder(View view) {
        super(view);
        txtContent = view.findViewById(R.id.textContentFriend);
        txtTime = view.findViewById(R.id.timeContentFriend);
        imageContent = view.findViewById(R.id.imageContentFriend);
        avatar = view.findViewById(R.id.image_view_friend);
    }
}
I have recently been noticing my 2 1/2 year old squinting when looking at distant objects. I was wondering if anyone else has children of this age with vision problems and how they diagnosed it, or if it even is diagnosable at this age.
I have a call into the pediatrician, but am awaiting a phone call back...
My daughter was diagnosed at 2 years old with "far sighteness". Her right eye was turning in toward her nose while watching tv. At first I thought she was doing it deliberately...but it became more and more frequent. She saw an optomologist who fitted her with glasses and she is now (at 14 years old) near sighted and wearing contacts. They can detect vision problems in children around 2 years old. Good luck!
You can have your childs vision checked even as an infant. I did not know this and didn't discover my sons vision problems until he was 7 year old. I found a wonderful pediatric eye doctor who has done wonders for my son and hundreds of other children as well. Her Phone number is ###-###-####. Good luck and I pray for all the best for your child.
I have not had problems with my kids at toddler age, but I do know that their eyes are always changing. Your doctor will probably refer you to an eye doctor for further review of your child's eyes.
Do you have a boy or a girl? Do you know if you are expecting a boy or girl for the 2nd one? How exciting!
Of my six kids three of them wear glasses and we noticed the second child when she was about 3.. All you need to do is take your child to have an eye exam the office will test them with objects that they can recongnize. Its harmless and it is very important to get them checked out early.. Let me know if you need the name of an eye dr.
I just wanted to let you know that they check the babies eyesight at birth. So, if they can do that, then I would deffinately have the eyes checked. You know your child the best. If you think there is a problem or concern get it checked out. If your pediatrician can't help call an eye specialist, preferrable a pediatric optomologist. anything is possible. I had my 11 year old checked just last year and the doctor mentioned possibly that she could have been deprived oxygen at birth and that can effect the developement of the eyes. How he could tell that 11 years