package com.example.beijing_daxing.dialog;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.bumptech.glide.Glide;
import com.example.beijing_daxing.R;


/**
 * @author wanghao
 * @date 2023/2/1  17:06
 */
public class LookPictureDialog extends Dialog {

    private Context context;
    private String path;
    private ImageView imageView;

    public LookPictureDialog(@NonNull Context context) {
        super(context, R.style.dialog);
        this.context = context;
    }

    public void setPath(String path) {
        this.path = path;
    }

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_look_picture);

        imageView = findViewById(R.id.picture_imageview);
        findViewById(R.id.confirm_back).setOnClickListener(v -> {
            dismiss();
        });
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    }


    @Override
    public void show() {
        super.show();
        Glide.with(context).load(path).into(imageView);
    }


}
