package com.kdanmobile.pdfreaderviewapp

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.os.Environment
import android.widget.Toast
import java.io.File

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val external = Environment.getExternalStorageDirectory()
        val kdanPdfReaderFolder = File(external, "KdanPDFReader")
        val quickStartPdf = File(kdanPdfReaderFolder, "Quick Start.pdf")
        if (!quickStartPdf.exists()) {
            Toast.makeText(this, "Cannot find Quick Start.pdf", Toast.LENGTH_SHORT).show()
            return
        }

//        val intent = Intent(this, ReaderActivity2::class.java)
//        intent.putExtra(TestReaderActivity.KEY, quickStartPdf.absolutePath)

        val intent = Intent(this, MyReaderActivity::class.java)
        intent.putExtra(MyReaderActivity.KEY_FILE_ABSOLUTE, quickStartPdf.absolutePath)

        startActivity(intent)
    }
}
