package com.newloanapp.instantloanapp.loancash.loanguide.loanapp.personalloanapply.loan.star.loanapply.activities;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.res.ResourcesCompat;

import com.applovin.mediation.ads.MaxAdView;
import com.applovin.sdk.AppLovinSdk;
import com.newloanapp.instantloanapp.loancash.loanguide.loanapp.personalloanapply.loan.star.loanapply.Constant;
import com.newloanapp.instantloanapp.loancash.loanguide.loanapp.personalloanapply.loan.star.loanapply.R;

public class ExitActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_exit);
        AppLovinSdk.getInstance( this ).setMediationProvider("max");
        AppLovinSdk.initializeSdk( this, configuration -> {
            MaxAdView maxAdView = new MaxAdView(getString(R.string.banner_id),this);
            ((LinearLayout)findViewById(R.id.adView)).addView(maxAdView);
            maxAdView.loadAd();
        });
        Constant.Ads ads = Constant.HomeAdsInitialization();
        ((ImageView)findViewById(R.id.img)).setImageDrawable(ResourcesCompat.getDrawable(getResources(),ads.getLogo(),null));
        ((ImageView)findViewById(R.id.bnr)).setImageDrawable(ResourcesCompat.getDrawable(getResources(),ads.getBanner(),null));
        ((TextView)findViewById(R.id.txt)).setText(ads.getTitle());
        findViewById(R.id.click).setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(ads.getLink()))));
        findViewById(R.id.iv_Heart).startAnimation(AnimationUtils.loadAnimation(this,R.anim.pulse));
        findViewById(R.id.txt_exit).setOnClickListener(view -> finish());
    }
}
