package com.secspace.lib.common.tips;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;

import com.secspace.lib.common.R;
import com.secspace.lib.common.base.BaseActivity;
import com.secspace.lib.common.utils.SettingsUtil;

import static com.secspace.lib.common.tips.PermissionTipHelper.CAN_DRAW_OVERLAYS_TIP;
import static com.secspace.lib.common.tips.PermissionTipHelper.NOTIFICATION_TIP;
import static com.secspace.lib.common.tips.PermissionTipHelper.RES_KEY;

/**
 * Created by bxy on 2018/7/9.
 */

public class PermissionTipActivity extends BaseActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.common_activity_permission_tip);
        final int resId = getIntent().getIntExtra(RES_KEY, 0);
        LinearLayout linearLayout = findViewById(R.id.ll_permission_tip);

        linearLayout.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (CAN_DRAW_OVERLAYS_TIP == resId) {
                    SettingsUtil.startOverlay(PermissionTipActivity.this);
                } else if (NOTIFICATION_TIP == resId) {
                    SettingsUtil.activeNotificationCenter(PermissionTipActivity.this);
                }
                finish();
                return false;
            }
        });

        transparent();
        if (resId == 0) {
            return;
        }
        linearLayout.setBackgroundResource(resId);
    }

    @Override
    public int getLayoutId() {
        return 0;
    }

    @Override
    public void initView() {

    }
}
