package epson.print;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.epson.iprint.prtlogger.NewLoggerController;

/**
 * 欢迎界面
 */
public class WellcomeScreenActivity extends AppCompatActivity {
    Context mContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        mContext = this;
        NewLoggerController.stopLoggerIfNotAgreed(this);
        new Thread() {
            int wait = 0;

            public void run() {
                Intent intent;
                try {
                    super.run();
                    if (EPPrinterManager.checkV3RemotePrinterData(mContext)) {
                        EPPrinterManager.convertV3RemotePrinter(mContext);
                    }
                    while (wait < 1000) {
                        sleep(100);
                        wait += 100;
                    }
                    intent = new Intent(mContext, IprintHome.class);
                } catch (Exception unused) {
                    intent = new Intent(mContext, IprintHome.class);
                } catch (Throwable th) {
                    WellcomeScreenActivity wellcomeScreenActivity2 = WellcomeScreenActivity.this;
                    wellcomeScreenActivity2.startActivity(new Intent(wellcomeScreenActivity2, IprintHome.class));
                    WellcomeScreenActivity.this.finish();
                    throw th;
                }
                mContext.startActivity(intent);
                WellcomeScreenActivity.this.finish();
            }
        }.start();
    }
}