From ae57b0e8ca15e818e66b4edd4696804d81796327 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期五, 03 一月 2025 09:53:44 +0800 Subject: [PATCH] 2025年01月03日09:53:42 --- app/src/main/java/com/hdl/photovoltaic/uni/CSplashView.java | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 1 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/CSplashView.java b/app/src/main/java/com/hdl/photovoltaic/uni/CSplashView.java index d13f2c0..cc4fa22 100755 --- a/app/src/main/java/com/hdl/photovoltaic/uni/CSplashView.java +++ b/app/src/main/java/com/hdl/photovoltaic/uni/CSplashView.java @@ -1,11 +1,23 @@ package com.hdl.photovoltaic.uni; +import android.app.Activity; +import android.content.ComponentName; import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.IBinder; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.hdl.photovoltaic.HDLApp; +import com.hdl.photovoltaic.IUniappAidlInterface; import com.hdl.photovoltaic.R; +import com.hdl.photovoltaic.config.UserConfigManage; +import com.hdl.photovoltaic.utils.ProcessManagerUtils; + +import java.lang.ref.WeakReference; import io.dcloud.feature.sdk.Interface.IDCUniMPAppSplashView; @@ -17,10 +29,44 @@ // 鍦ˋctivity涓紝鍙互鐩存帴浣跨敤this鑾峰彇LayoutInflater LayoutInflater inflater = LayoutInflater.from(context); // 閫氳繃inflate鏂规硶灏嗗竷灞�鏂囦欢杞崲涓篤iew瀵硅薄 - splashView = inflater.inflate(R.layout.activity_c_splash, null); + splashView = inflater.inflate(R.layout.activity_b_splash, null); + //璁剧疆瀵艰埅鏉¤儗鏅鑹� + Activity activity = (Activity) context; + activity.getWindow().setNavigationBarColor(HDLApp.getInstance().getColor(R.color.text_FF1C1C1E)); + //鍙兘閫氳繃杩欑鏂瑰紡璋冪敤 + Intent intent = new Intent(); + intent.setPackage("com.hdl.photovoltaic"); + intent.setAction("UniappService.ACTION"); + context.bindService(intent, stringservice, Context.BIND_AUTO_CREATE); + return splashView; } + + static ServiceConnection stringservice = new ServiceConnection() { + private WeakReference<Context> contextWeakReference; + + @Override + public void onServiceConnected(ComponentName componentName, IBinder iBinder) { + IUniappAidlInterface iUniappAidlInterface = IUniappAidlInterface.Stub.asInterface(iBinder); + try { + iUniappAidlInterface.sendMsg("寤虹珛杩炴帴"); + } catch (Exception e) { + } + } + + @Override + public void onServiceDisconnected(ComponentName componentName) { + Log.i("BSplashView", "杩炴帴宸叉柇寮�"); + Context context = contextWeakReference.get(); + ProcessManagerUtils.killAllProcess(contextWeakReference.get()); + } + + public void setContextWeakReference(WeakReference<Context> contextWeakReference) { + this.contextWeakReference = contextWeakReference; + } + }; + @Override public void onCloseSplash(ViewGroup rootView) { if (rootView != null) -- Gitblit v1.8.0