Enlarge Image View When Clicked in Android

I am using Picasso for a while now and I'm very satisfied with it. However I'm in need of enlarging an imageview's image which is loaded by Picasso from firebase. The codes below is in an adapter.java which is called inside the MainActivity.java

UserRef = FirebaseDatabase.getInstance().getReference().child("user").child(fromUserID);
        UserRef.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                String senderName = snapshot.child("name").getValue().toString();
                String userid = fromUserID;
                if (snapshot.hasChild("avata")){
                 final String receiverImage = snapshot.child("avata").getValue().toString();

                        if (fromUserID.equals(messageSenderId)) {
                            messageViewholder.senderMessageName.setVisibility(View.VISIBLE);
                            messageViewholder.senderImageView.setVisibility(View.VISIBLE);

                            if (fromMessageType.equals("text")) {
                                messageViewholder.senderMessageText.setVisibility(View.VISIBLE);
                                messageViewholder.senderMessageText.setText(messages.getMessage());
                            }else if (fromMessageType.equals("image")) {
                                messageViewholder.senderMessageImage.setVisibility(View.VISIBLE);
                                Picasso.get().load(messages.getMessage()).into(messageViewholder.senderMessageImage);

                            }

Here is the xml

   <ImageView
        android:id="@+id/receiver_message_image"
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:layout_toEndOf="@id/receiver_image"
        android:layout_below="@id/receiver_message_name"
        android:layout_marginStart="5dp"
        android:visibility="gone"
        android:adjustViewBounds="true"
        android:layout_marginEnd="20dp" />


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation