package com.friendvilla.shayaristock;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;

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

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;

public class HomeActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        Toolbar toolbar = (Toolbar) findViewById(R.id.htoolbar);
        setSupportActionBar(toolbar);
        CardView attitude = (CardView) findViewById(R.id.attitude);
        CardView birthday = (CardView) findViewById(R.id.birthday);
        CardView friendship = (CardView) findViewById(R.id.friendship);
        CardView memories = (CardView) findViewById(R.id.memories);
        CardView morning = (CardView) findViewById(R.id.morning);
        CardView night = (CardView) findViewById(R.id.night);
        CardView devotional = (CardView) findViewById(R.id.devotional);
        CardView romantic = (CardView) findViewById(R.id.romantic);
        CardView sad = (CardView) findViewById(R.id.sad);
        CardView wish = (CardView) findViewById(R.id.wish);
        attitude.setOnClickListener(this); birthday.setOnClickListener(this);
        friendship.setOnClickListener(this); memories.setOnClickListener(this);
        morning.setOnClickListener(this); night.setOnClickListener(this);
        devotional.setOnClickListener(this); romantic.setOnClickListener(this);
        sad.setOnClickListener(this); wish.setOnClickListener(this);

        AdView adView = (AdView) findViewById(R.id.adView);
        MobileAds.initialize(HomeActivity.this, getResources().getString(R.string.AppID));
        AdRequest adRequest = new AdRequest.Builder().build();
        adView.loadAd(adRequest);
    }

    @Override
    public void onClick(View v) {
        Intent swtch = new Intent(HomeActivity.this,ShayariActivity.class);
        int id = v.getId();
        switch (id) {
            case R.id.attitude:
                swtch.putExtra("Category", "attitude");
                break;
            case R.id.birthday:
                swtch.putExtra("Category", "birthday");
                break;
            case R.id.friendship:
                swtch.putExtra("Category", "friendship");
                break;
            case R.id.memories:
                swtch.putExtra("Category", "memories");
                break;
            case R.id.morning:
                swtch.putExtra("Category", "good morning");
                break;
            case R.id.night:
                swtch.putExtra("Category", "good night");
                break;
            case R.id.devotional:
                swtch.putExtra("Category", "devotional");
                break;
            case R.id.romantic:
                swtch.putExtra("Category", "romantic");
                break;
            case R.id.sad:
                swtch.putExtra("Category", "sad");
                break;
            case R.id.wish:
                swtch.putExtra("Category", "wish");
                break;
        }
        startActivity(swtch);
    }
}
