package com.xxfc.rv.other;

import android.app.Activity;

import com.rv.component.utils.Cookie;
import com.yuyife.okgo.OkGoUtil;

public class CustomActivityManager {
    private static final String SP_KEY_ACTIVITY_STACK_TOP = "sp_key_activity_stack_top";

    public static String getTopActivity() {
        // 这里从SP中读取栈顶Activity名字
        return Cookie.getStringValue(OkGoUtil.application, SP_KEY_ACTIVITY_STACK_TOP);
    }

    public static void setTopActivity(Activity topActivity) {
        if (topActivity != null) {
            // 这里把栈顶Activity名字存入SP
            Cookie.save(OkGoUtil.application, SP_KEY_ACTIVITY_STACK_TOP, topActivity.getLocalClassName());
        }
    }

    public static void clearTopActivity() {
        // 这里清除SP数据
        Cookie.clearStringValue(SP_KEY_ACTIVITY_STACK_TOP);
    }
}
