package com.navinfo.outdoor.activity;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.viewpager.widget.ViewPager;

import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.ImagePagerAdapter;
import com.navinfo.outdoor.base.BaseActivity;

import java.util.ArrayList;

/**
 * 点击查看大图
 */
public class ImageShowActivity extends BaseActivity implements View.OnClickListener {
    private ViewPager image_pager;
    private TextView page_number;
    private ImageView download;
    private ArrayList<String> imgUrl;
    private ImagePagerAdapter mAdapter;
    @Override
    protected int getLayout() {
        return R.layout.activity_image_show;
    }

    @Override
    protected void initData() {
        super.initData();
        imgUrl = getIntent().getStringArrayListExtra("info");
        Log.d("ImageShowActivity", "initData-----------------: "+imgUrl);
        page_number.setText("1" + "/" + imgUrl.size());
    }

    @Override
    protected void initView() {
        super.initView();
        image_pager = (ViewPager) findViewById(R.id.image_pager);
        page_number = (TextView) findViewById(R.id.page_number);
        download = (ImageView) findViewById(R.id.download);
        download.setOnClickListener(this);
        initViewPager();
    }


    private void initViewPager() {
        if (imgUrl != null && imgUrl.size() != 0) {
            mAdapter = new ImagePagerAdapter(getApplicationContext(), imgUrl);
            image_pager.setAdapter(mAdapter);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.download:

                break;
        }
    }
}
