package com.dynamsoft.dbr.generalsettings.home;

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

import androidx.appcompat.app.AppCompatActivity;

import com.dynamsoft.dbr.generalsettings.R;
import com.dynamsoft.dbr.generalsettings.models.SettingsCache;
import com.dynamsoft.dbr.generalsettings.scanner.ScannerActivity;
import com.dynamsoft.license.LicenseManager;

public class HomeActivity extends AppCompatActivity {

    private static final String TAG = "HomeActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        if (savedInstanceState == null) {
            // Initialize the license.
            // The license string here is a trial license.
            // You can request an extension via the following link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=android
            LicenseManager.initLicense("t01014wAAAB3+NhyOh6aJZsdmylfrsMRKw+0ZUcl6GiHlsAOfOy3kunF4nl+uhfp+CVcHoNrFwanJ0kJ8W+NXOSsxypWScb/0HYeAyrhhXn/g7EiDWpK1AT5q/VF/cqijuSc07mBrLYU=", (isSuccess, error) -> {
                if (!isSuccess) {
                    error.printStackTrace();
                }
            });
        }

        findViewById(R.id.btn_start).setOnClickListener(v -> startActivity(new Intent(this, ScannerActivity.class)));

        SettingsCache.getCurrentSettings().loadFromPreferences(this);
    }

}
