package com.cygnusa.hyperm;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.cygnusa.hyperm.util.GlobalData;
import com.cygnusa.hyperm.util.StorePreference;

public class ProductHomeActivity extends AppCompatActivity {
    Handler handler;
    TextView txtFname;
    private StorePreference storePreference;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_product_home);
        ImageView imageView = findViewById(R.id.bgImg);
        Glide.with(this).load(R.drawable.welcome).into(imageView);
        ImageView imageView1 = findViewById(R.id.bgImg1);
        Glide.with(this).load(R.drawable.place_holder).into(imageView1);
        ImageView bgImg2 = findViewById(R.id.bgImg2);
        Glide.with(this).load(R.drawable.logo_trans).into(bgImg2);
        initViews();
    }

    private void initViews() {
        storePreference = new StorePreference(this);
        handler = new Handler();
        txtFname = findViewById(R.id.firstname);
        String upperString = "";
        if (storePreference.getStringValue(GlobalData.PRODUCT_NAME) != null || !storePreference.getStringValue(GlobalData.PRODUCT_NAME).equalsIgnoreCase(""))
            txtFname.setText(firstLetterCaps(storePreference.getStringValue(GlobalData.PRODUCT_NAME)));

        handler.postDelayed(new Runnable() {

            @Override
            public void run() {

                startExploreMoreActivity();
            }
        }, 3000);
    }
     public String firstLetterCaps ( String data )
    {
        String firstLetter = data.substring(0,1).toUpperCase();
        String restLetters = data.substring(1).toLowerCase();
        return firstLetter + restLetters;
    }


    private void startExploreMoreActivity() {
        startActivity(new Intent(ProductHomeActivity.this, ProductWelcomeScreenActivity.class));
        finish();
    }
}
