package com.test.mydemo3.activity

import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.provider.MediaStore
import android.util.Log
import android.util.SparseBooleanArray
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.ListView
import android.widget.Toast
import com.airbnb.lottie.utils.Utils
import com.kongzue.dialogx.dialogs.WaitDialog
import com.test.mydemo3.R
import com.test.mydemo3.base.BaseActivity
import com.test.mydemo3.model.FileBean
import com.test.mydemo3.model.FilesItemBean
import com.test.mydemo3.util.FileUtil
import java.io.File

class ScanLargeFilesActivity : BaseActivity() {

    private lateinit var mFilesItemListView: ListView
    private var mFileItemList = ArrayList<FileBean>()

    override fun getLayout(): Int {
        return R.layout.activity_scan_large_files
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setTitle("Scan Large Files")
        isNewShow(false)
        mInitView()
    }

    fun mInitView(){
        mFilesItemListView = findViewById<ListView>(R.id.files_item_listview)

        WaitDialog.show("Please Wait!")
        Thread(Runnable {
            mFileItemList = FileUtil.search10MFiles(this, 10 * 1024 * 1024)
            runOnUiThread {
                setAdapter(mFilesItemListView, mFileItemList)
                WaitDialog.dismiss()
            }
        }).start()
        setOnClickBtn()
    }

    override fun onBackPressed() {
        WaitDialog.dismiss()
        super.onBackPressed()
        isNewShow(false)
    }
}