admin
2021-05-08 f93ff67ed4681f416a653370aa1e7995a56940ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.huawei.android.hms.agent.common;
 
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
 
/**
 * 基础activity,用来处理公共的透明参数
 */
public class BaseAgentActivity extends Activity {
 
    public static final String EXTRA_IS_FULLSCREEN = "should_be_fullscreen";
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestActivityTransparent();
    }
 
    /**
     * 启用透明的跳板Activity
     */
    private void requestActivityTransparent() {
        try {
            Intent intent = getIntent();
            if (intent != null && intent.getBooleanExtra(EXTRA_IS_FULLSCREEN, false)) {
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
            }
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            Window window = getWindow();
            if (window != null) {
                window.addFlags(0x04000000);
            }
        } catch (Exception e) {
            HMSAgentLog.w("requestActivityTransparent exception:" + e.getMessage());
        }
    }
}