PhotoView click to enlarge picture effect

The PhotoView used is this version, which is relatively small and easy to use, much thinner than the other version on github:
https://github.com/bm-x/PhotoView

The basic test code is as follows:
import java.util.ArrayList;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.widget.common.recycler.BaseRecyclerAdapter;
import com.widget.common.recycler.SpacesItemDecoration;
import com.widget.common.recycler.ViewHolder;
import com.widget.photoView.Info;
import com.widget.photoView.PhotoView;

/**
 * Test PhotoView code
 * @author pythoner
 *
 */
public class GridImageActivity extends BaseActivity {

	private Context context;
	private RecyclerView recyclerView;
	private BaseRecyclerAdapter<Integer> adapter;
	private PhotoView photoView;//The transformed picture
	private PhotoView curPhotoView;//Source image
	private Info mRectF;//Source image location information
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate (savedInstanceState);
		setContentView(R.layout.activity_grid_image);
		context = this;
		initActionBar("Picture List", null, null);
		initViews();
	}

	@Override
	public void initViews() {
		// TODO Auto-generated method stub
		initRecyclerView();
		photoView=(PhotoView)findViewById(R.id.photoView);
		photoView.enable();// You need to start zooming and you need to manually turn it on
		photoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // Transform from its own position to the position of the source image
            	photoView.animaTo(mRectF, new Runnable() {
                    @Override
                    public void run() {
                    	photoView.setVisibility(View.GONE);
                    	curPhotoView.setVisibility(View.VISIBLE);
                    }
                });
            }
        });
	}

	private void initRecyclerView() {
		recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
		// recyclerView.addItemDecoration(new DividerGridItemDecoration(this));
		recyclerView.addItemDecoration(new SpacesItemDecoration(16));
		recyclerView.setItemAnimator(new DefaultItemAnimator());
		GridLayoutManager manager = new GridLayoutManager(this, 3);
		recyclerView.setLayoutManager(manager);

		final ArrayList<Integer> list = new ArrayList<Integer>();
		list.add(R.drawable.bg_login);
		list.add(R.drawable.chat_bg_default);
		list.add(R.drawable.bg_diagonal);
		list.add(R.drawable.bg_diagonal);
		list.add(R.drawable.chat_bg_default);
		list.add(R.drawable.bg_login);
		list.add(R.drawable.bg_login);
		list.add(R.drawable.chat_bg_default);
		list.add(R.drawable.bg_diagonal);
		list.add(R.drawable.bg_diagonal);
		list.add(R.drawable.chat_bg_default);
		list.add(R.drawable.bg_login);

		recyclerView.setAdapter(adapter = new BaseRecyclerAdapter<Integer>(
				context, list) {

			@Override
			public int onCreateViewLayoutID(int viewType) {
				// TODO Auto-generated method stub
				return R.layout.item_grid_image;
			}

			@Override
			public void onBindViewHolder(ViewHolder holder, final Integer item,
					final int position) {
				// TODO Auto-generated method stub
				final PhotoView item_0=holder.getView(R.id.item_0);
				item_0.disenable();
				item_0.setImageResource(item);
				
				item_0.setOnClickListener(new View.OnClickListener() {
		            @Override
		            public void onClick(View v) {
		            	curPhotoView=item_0;
		            	item_0.setVisibility(View.GONE);
		            	photoView.setVisibility(View.VISIBLE);
		            	photoView.setImageResource(item);
		                //Get the source location information
		                mRectF = item_0.getInfo();
		                //Transform from the source position to its own position
		                photoView.animaFrom(mRectF);
		            }
		        });
				
			}
		});

	}

	@Override
    public void onBackPressed() {
        if (photoView.getVisibility() == View.VISIBLE) {
        	photoView.animaTo(mRectF, new Runnable() {
                @Override
                public void run() {
                	photoView.setVisibility(View.GONE);
                	curPhotoView.setVisibility(View.VISIBLE);
                }
            });
        } else {
            super.onBackPressed();
        }
    }
	
	@Override
	public void updateViews(Object obj) {
		// TODO Auto-generated method stub
	}

}


<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <include layout="@layout/actionbar_comm" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical" />
    </LinearLayout>

    <com.widget.photoView.PhotoView
        android:id="@+id/photoView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent"
        android:scaleType="fitCenter"
        android:src="@drawable/bg_login"
        android:visibility="gone" />

</FrameLayout>


GridImageView grid image control
https://github.com/AWCJ/GridImageView

ImageWatcher
image viewer, providing better service for daLao who are pursuing user experience. It can
1. Switch to the image with a seamless and smooth animation when clicking on the image. The picture viewing interface also exits the picture viewing interface with a seamless and smooth animation
. 2. Support multi-picture viewing, quick page turning, double-click to enlarge, click to exit, and both hands to zoom and rotate the picture.
3. Drag down to exit the operation of viewing pictures. And the effect is the biggest selling point of this View (imitation of WeChat)
https://github.com/iielse/DemoProjects/tree/master/P02_ImageWatcher



Imitation of Weibo, WeChat, qq Click the thumbnail to preview the high-definition image component

TransferImage is an imitation The high-definition image viewing control for Weibo, WeChat, and QQ realizes the transition animation after clicking the thumbnail in the list control (ListView, RecycleView, GridView, etc.), loading high-definition images, and displaying the loading progress bar when loading high-definition images. , a component that displays a high-definition image after loading is complete. At the same time, closing TransferImage will also have corresponding transition animation.

If there is any imperfection in this library, please mention Issues, and I will fix and improve it as soon as possible.

Supported or included functions:

Open and close transition animation of TransferImage, support for custom
image loading Built-in A picture loader using the Glide framework, supports custom
pictures supports gesture operations, can zoom, double-click, and move
the progress bar when pictures are loaded, supports custom
Image index indicator, support custom
https://github.com/Hitomis/TransferImage

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326392307&siteId=291194637