wjc
2024-12-23 f753d8366041354da60b8096060f3ab5159e3880
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
41
42
43
44
package com.hdl.photovoltaic.uni;
 
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
 
import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.config.UserConfigManage;
 
import io.dcloud.feature.sdk.Interface.IDCUniMPAppSplashView;
 
public class BSplashView implements IDCUniMPAppSplashView {
    View splashView;
 
    @Override
    public View getSplashView(Context context, String appid, String s1, String s2) {
        // 在Activity中,可以直接使用this获取LayoutInflater
        LayoutInflater inflater = LayoutInflater.from(context);
        // 通过inflate方法将布局文件转换为View对象
        splashView = inflater.inflate(R.layout.activity_b_splash, null);
        try {
            int colorInt = HDLApp.getInstance().getColor(R.color.text_FF161616);
            if (UserConfigManage.getInstance().getUniBottomSafeDistanceBackgroundColor() == 1) {
                colorInt = HDLApp.getInstance().getColor(R.color.text_FF161616);
            } else if (UserConfigManage.getInstance().getUniBottomSafeDistanceBackgroundColor() == 2) {
                colorInt = HDLApp.getInstance().getColor(R.color.text_FF161616);
            }
            //设置导航条背景颜色
            Activity activity = (Activity) context;
            activity.getWindow().setNavigationBarColor(colorInt);
        } catch (Exception ignored) {
        }
        return splashView;
    }
 
    @Override
    public void onCloseSplash(ViewGroup rootView) {
        if (rootView != null)
            rootView.removeView(splashView);
    }
}