package com.zkjc.common.base;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.jess.arms.base.BaseFragment;
import com.jess.arms.base.delegate.IFragment;
import com.jess.arms.integration.lifecycle.FragmentLifecycleable;
import com.jess.arms.mvp.IPresenter;
import com.xdja.watermarklibrary.WaterMarkUtils;

public abstract class ZkjcBaseFragment<P extends IPresenter> extends BaseFragment<P> implements IFragment, FragmentLifecycleable {

    protected SharedPreferences sharedPreferences;

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        if(null == sharedPreferences) sharedPreferences = getActivity().getSharedPreferences("sys", Context.MODE_PRIVATE);
        String prefix = "";
        if(TextUtils.isEmpty(sharedPreferences.getString("jh", "")))
            prefix = sharedPreferences.getString("cardNo", "") + sharedPreferences.getString("name", "");
        else
            prefix = sharedPreferences.getString("jh", "") + sharedPreferences.getString("name", "");
        String waterMark = "　　" + prefix;
        WaterMarkUtils.addWaterMark(getActivity(), waterMark, 350);
    }

}
