package cc.winboll.studio.positions.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.positions.R;
import cc.winboll.studio.positions.utils.APPPlusUtils;
import cc.winboll.studio.positions.utils.AppConfigsUtil;
import cc.winboll.studio.positions.AppLevel;

/**
 * @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
 * @Date 2025/11/15 13:45
 * @Describe 应用快捷方式活动类
 */
public class ShortcutActionActivity extends Activity {
    
    public static final String TAG = "ShortcutActionActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 处理应用级别的切换请求
        handleSwitchRequest();
		finish();
	}
	
	

//	@Override
//	public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
//		super.onPostCreate(savedInstanceState, persistentState);
//		finish();
//	}

//	@Override
//	protected void onStart() {
//		super.onStart();
//	}
    
	/**
     * 处理应用图标快捷菜单的请求
     */
    private void handleSwitchRequest() {
        Intent intent = getIntent();
        if (intent != null && "open_appplus".equals(intent.getDataString())) {
            ToastUtils.show("已添加" + getString(R.string.app_name) + "附加组件");
			AppConfigsUtil.getInstance(getApplicationContext()).setAppLevel(AppLevel.LAOJUN);
			APPPlusUtils.openAPPPlus(this);
			//moveTaskToBack(true);
        }
		if (intent != null && "close_appplus".equals(intent.getDataString())) {
            ToastUtils.show("已移除" + getString(R.string.app_name) + "附加组件");
			AppConfigsUtil.getInstance(getApplicationContext()).setAppLevel(AppLevel.WUKONG);
			APPPlusUtils.closeAPPPlus(this);
			//moveTaskToBack(true);
        }
    }
}
