package com.swiftcleaner.chovey.view.fragment;

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

import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatButton;
import androidx.fragment.app.Fragment;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.clean.file.b.business.newAdmob.AdmobHelps;
import com.swiftcleaner.chovey.R;
import com.swiftcleaner.chovey.business.admob.AdmobManager;
import com.swiftcleaner.chovey.business.admob.NativeView;
import com.swiftcleaner.chovey.view.MainActivity;
import com.swiftcleaner.chovey.view.activity.GuideActivity;

import io.reactivex.rxjava3.annotations.Nullable;

public class GuideEndFragment extends Fragment {

    private AppCompatButton buttonNext;
    private FrameLayout nativeView;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_guide_end, container, false);
        buttonNext = view.findViewById(R.id.end_button);
        nativeView = view.findViewById(R.id.fl_ad);


        buttonNext.setOnClickListener(v -> {
            // 通知Activity切换到下一个页面
            if (getActivity() instanceof GuideActivity) {
                ((GuideActivity) getActivity()).nextPage();
            }
        });

        return view;
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.d("showNativeAd","111");
        AdmobHelps.INSTANCE.showNativeAd(requireActivity(),nativeView,R.layout.layout_ad_native_small,AdmobHelps.INSTANCE.isShowAdNativeBottom(),false);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        buttonNext = null;
    }
}