add function about loading...
Showing
14 changed files
with
166 additions
and
70 deletions
... | @@ -56,6 +56,14 @@ cc.Class({ | ... | @@ -56,6 +56,14 @@ cc.Class({ |
56 | }, | 56 | }, |
57 | }, | 57 | }, |
58 | 58 | ||
59 | start(){ | ||
60 | // 第二步:场景加载之后,隐藏原生纯色背景View | ||
61 | // 这里延迟1秒是为了更好的体验,实际可以不用 | ||
62 | this.scheduleOnce(() => { | ||
63 | this.hideNativeSplash(); | ||
64 | }, 1); | ||
65 | }, | ||
66 | |||
59 | onLoad: function () { | 67 | onLoad: function () { |
60 | this._super(); | 68 | this._super(); |
61 | this._scrollview = this.node.getComponent(cc.ScrollView); | 69 | this._scrollview = this.node.getComponent(cc.ScrollView); |
... | @@ -63,7 +71,7 @@ cc.Class({ | ... | @@ -63,7 +71,7 @@ cc.Class({ |
63 | this._oSceneContext._iPageIndex = 1; | 71 | this._oSceneContext._iPageIndex = 1; |
64 | this._oSceneContext._iCurrentLeftIndex = 0; | 72 | this._oSceneContext._iCurrentLeftIndex = 0; |
65 | this._oInit = {}; | 73 | this._oInit = {}; |
66 | this._iSceneStatus=0; | 74 | this._iSceneStatus = 0; |
67 | 75 | ||
68 | // this.checkUpdate(); //热更新检查是否有新版本 //放到初始化焦点框后 | 76 | // this.checkUpdate(); //热更新检查是否有新版本 //放到初始化焦点框后 |
69 | 77 | ||
... | @@ -293,9 +301,9 @@ cc.Class({ | ... | @@ -293,9 +301,9 @@ cc.Class({ |
293 | ); | 301 | ); |
294 | if (currentNode.getComponent(FocusInfo)) { | 302 | if (currentNode.getComponent(FocusInfo)) { |
295 | let fiBlock = currentNode.getComponent(FocusInfo); //弄tvlink | 303 | let fiBlock = currentNode.getComponent(FocusInfo); //弄tvlink |
296 | if(currentNode.name=="promotionItem_9fd6d854-2a72-42d5-a2c0-1ce824cf406c"){ //针对课程表搞出来一个tvlink | 304 | if (currentNode.name == "promotionItem_9fd6d854-2a72-42d5-a2c0-1ce824cf406c") { //针对课程表搞出来一个tvlink |
297 | fiBlock.setTVLink('{"click":[{"action":"ChangeScene","parameters":{"sceneName":"sceneClass"}}]}'); | 305 | fiBlock.setTVLink('{"click":[{"action":"ChangeScene","parameters":{"sceneName":"sceneClass"}}]}'); |
298 | }else{ | 306 | } else { |
299 | // fiBlock.setTVLink(currentRemote.tvlink); | 307 | // fiBlock.setTVLink(currentRemote.tvlink); |
300 | fiBlock.setTVLink('{"click":[{"action":"ChangeScene","parameters":{"sceneName":"sceneCategory"}}]}'); | 308 | fiBlock.setTVLink('{"click":[{"action":"ChangeScene","parameters":{"sceneName":"sceneCategory"}}]}'); |
301 | } | 309 | } |
... | @@ -343,19 +351,19 @@ cc.Class({ | ... | @@ -343,19 +351,19 @@ cc.Class({ |
343 | 351 | ||
344 | //初始化焦点框 | 352 | //初始化焦点框 |
345 | initFocus: function () { | 353 | initFocus: function () { |
346 | this._aFocusTargets[1]=[]; | 354 | this._aFocusTargets[1] = []; |
347 | 355 | ||
348 | let fiHotUpdateClose=cc.find('update/update_panel/close',this.node).addComponent(FocusInfo); //热更新关闭按钮 | 356 | let fiHotUpdateClose = cc.find('update/update_panel/close', this.node).addComponent(FocusInfo); //热更新关闭按钮 |
349 | fiHotUpdateClose.init('',false,null,null,1.0); | 357 | fiHotUpdateClose.init('', false, null, null, 1.0); |
350 | this._aFocusTargets[1]['hot_update_close']=cc.find('update/update_panel/close',this.node); | 358 | this._aFocusTargets[1]['hot_update_close'] = cc.find('update/update_panel/close', this.node); |
351 | 359 | ||
352 | let fiHotUpdateBtn=cc.find('update/update_panel/update_btn',this.node).addComponent(FocusInfo); //热更新按钮 | 360 | let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).addComponent(FocusInfo); //热更新按钮 |
353 | fiHotUpdateBtn.init('',false,null,null,1.0); | 361 | fiHotUpdateBtn.init('', false, null, null, 1.0); |
354 | this._aFocusTargets[1]['hot_update_btn']=cc.find('update/update_panel/update_btn',this.node); | 362 | this._aFocusTargets[1]['hot_update_btn'] = cc.find('update/update_panel/update_btn', this.node); |
355 | 363 | ||
356 | let fiCloseBtn=cc.find('update/update_panel/close_btn',this.node).addComponent(FocusInfo); //热更新按钮 | 364 | let fiCloseBtn = cc.find('update/update_panel/close_btn', this.node).addComponent(FocusInfo); //热更新按钮 |
357 | fiCloseBtn.init('',false,null,null,1.0); | 365 | fiCloseBtn.init('', false, null, null, 1.0); |
358 | this._aFocusTargets[1]['hot_close_btn']=cc.find('update/update_panel/close_btn',this.node); | 366 | this._aFocusTargets[1]['hot_close_btn'] = cc.find('update/update_panel/close_btn', this.node); |
359 | 367 | ||
360 | var nodeInitFocus = cc.find(this._oSceneContext.focusPath, this.node); | 368 | var nodeInitFocus = cc.find(this._oSceneContext.focusPath, this.node); |
361 | // cc.log("初始化 "+nodeInitFocus.name); | 369 | // cc.log("初始化 "+nodeInitFocus.name); |
... | @@ -553,15 +561,15 @@ cc.Class({ | ... | @@ -553,15 +561,15 @@ cc.Class({ |
553 | case cc.macro.KEY.space: | 561 | case cc.macro.KEY.space: |
554 | case Common.ANDROID_KEY.enter: | 562 | case Common.ANDROID_KEY.enter: |
555 | if (0 == this._fiCurrentFocus.node.name.indexOf('close') || 0 == this._fiCurrentFocus.node.name.indexOf('close_btn')) { | 563 | if (0 == this._fiCurrentFocus.node.name.indexOf('close') || 0 == this._fiCurrentFocus.node.name.indexOf('close_btn')) { |
556 | this._iSceneStatus=0; | 564 | this._iSceneStatus = 0; |
557 | cc.find("update", this.node).active = false; //关闭更新面板 | 565 | cc.find("update", this.node).active = false; //关闭更新面板 |
558 | let fiAfterNode=cc.find(this._oSceneContext.focusPath,this.node).getComponent(FocusInfo); //热更新按钮 | 566 | let fiAfterNode = cc.find(this._oSceneContext.focusPath, this.node).getComponent(FocusInfo); //热更新按钮 |
559 | this._cFocus.flyFocus(this._fiCurrentFocus, fiAfterNode, Common.MOVE_DIRECTION_RIGHT, null, null); | 567 | this._cFocus.flyFocus(this._fiCurrentFocus, fiAfterNode, Common.MOVE_DIRECTION_RIGHT, null, null); |
560 | } | 568 | } |
561 | else if(0 == this._fiCurrentFocus.node.name.indexOf('update_btn')){ | 569 | else if (0 == this._fiCurrentFocus.node.name.indexOf('update_btn')) { |
562 | this.hotUpdate(); | 570 | this.hotUpdate(); |
563 | } | 571 | } |
564 | else{ | 572 | else { |
565 | this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK); | 573 | this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK); |
566 | } | 574 | } |
567 | break; | 575 | break; |
... | @@ -608,7 +616,7 @@ cc.Class({ | ... | @@ -608,7 +616,7 @@ cc.Class({ |
608 | // } | 616 | // } |
609 | // break; | 617 | // break; |
610 | default: | 618 | default: |
611 | this.doTVLinkAction(aOperationList[i]); | 619 | this.doTVLinkAction(aOperationList[i]); |
612 | break; | 620 | break; |
613 | } | 621 | } |
614 | } | 622 | } |
... | @@ -731,9 +739,9 @@ cc.Class({ | ... | @@ -731,9 +739,9 @@ cc.Class({ |
731 | this.panel.fileProgress.progress = 0; | 739 | this.panel.fileProgress.progress = 0; |
732 | // this.panel.byteProgress.progress = 0; | 740 | // this.panel.byteProgress.progress = 0; |
733 | 741 | ||
734 | this._iSceneStatus=1; //焦点框跳转层级 | 742 | this._iSceneStatus = 1; //焦点框跳转层级 |
735 | cc.find("update", this.node).active = true; //显示出来更新面板 | 743 | cc.find("update", this.node).active = true; //显示出来更新面板 |
736 | let fiHotUpdateBtn=cc.find('update/update_panel/update_btn',this.node).getComponent(FocusInfo); //热更新按钮 | 744 | let fiHotUpdateBtn = cc.find('update/update_panel/update_btn', this.node).getComponent(FocusInfo); //热更新按钮 |
737 | this._cFocus.flyFocus(this._fiCurrentFocus, fiHotUpdateBtn, Common.MOVE_DIRECTION_RIGHT, null, null); | 745 | this._cFocus.flyFocus(this._fiCurrentFocus, fiHotUpdateBtn, Common.MOVE_DIRECTION_RIGHT, null, null); |
738 | 746 | ||
739 | break; | 747 | break; |
... | @@ -776,8 +784,7 @@ cc.Class({ | ... | @@ -776,8 +784,7 @@ cc.Class({ |
776 | updateCb: function (event) { | 784 | updateCb: function (event) { |
777 | var needRestart = false; | 785 | var needRestart = false; |
778 | var failed = false; | 786 | var failed = false; |
779 | switch (event.getEventCode()) | 787 | switch (event.getEventCode()) { |
780 | { | ||
781 | case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST: | 788 | case jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST: |
782 | this.panel.info.string = 'No local manifest file found, hot update skipped.'; | 789 | this.panel.info.string = 'No local manifest file found, hot update skipped.'; |
783 | failed = true; | 790 | failed = true; |
... | @@ -849,4 +856,15 @@ cc.Class({ | ... | @@ -849,4 +856,15 @@ cc.Class({ |
849 | } | 856 | } |
850 | }, | 857 | }, |
851 | 858 | ||
859 | hideNativeSplash: function () { | ||
860 | if (cc.sys.os == cc.sys.OS_ANDROID) { | ||
861 | // 反射调用原生的隐藏方法 | ||
862 | jsb.reflection.callStaticMethod( | ||
863 | "org/cocos2dx/javascript/AppActivity", | ||
864 | "hideSplash", | ||
865 | "()V" | ||
866 | ); | ||
867 | } | ||
868 | } | ||
869 | |||
852 | }); | 870 | }); | ... | ... |
... | @@ -54,7 +54,7 @@ | ... | @@ -54,7 +54,7 @@ |
54 | android:configChanges="orientation|keyboardHidden|screenSize" | 54 | android:configChanges="orientation|keyboardHidden|screenSize" |
55 | android:label="@string/app_name" | 55 | android:label="@string/app_name" |
56 | android:usesCleartextTraffic="true" | 56 | android:usesCleartextTraffic="true" |
57 | android:theme="@android:style/Theme.NoTitleBar.Fullscreen" | 57 | android:theme="@style/ImageSplashStyle" |
58 | android:launchMode="singleTask" | 58 | android:launchMode="singleTask" |
59 | android:taskAffinity="" > | 59 | android:taskAffinity="" > |
60 | <intent-filter> | 60 | <intent-filter> | ... | ... |
... | @@ -138,4 +138,5 @@ dependencies { | ... | @@ -138,4 +138,5 @@ dependencies { |
138 | implementation project(':libcocos2dx') | 138 | implementation project(':libcocos2dx') |
139 | implementation files('libs/TopdrawSDK.jar') | 139 | implementation files('libs/TopdrawSDK.jar') |
140 | implementation 'com.mcxiaoke.volley:library:+' | 140 | implementation 'com.mcxiaoke.volley:library:+' |
141 | implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.7' | ||
141 | } | 142 | } | ... | ... |
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/res/drawable/bg_loading.png
0 → 100644

246 KB

11 KB
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/res/layout/activity_loading.xml
0 → 100644
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | android:id="@+id/loading" | ||
4 | android:layout_width="match_parent" | ||
5 | android:layout_height="match_parent"> | ||
6 | |||
7 | <ImageView | ||
8 | android:layout_width="match_parent" | ||
9 | android:layout_height="match_parent" | ||
10 | android:src="@drawable/bg_loading" /> | ||
11 | |||
12 | <pl.droidsonroids.gif.GifImageView | ||
13 | android:layout_width="wrap_content" | ||
14 | android:layout_height="wrap_content" | ||
15 | android:layout_gravity="center" | ||
16 | android:src="@drawable/loading" /> | ||
17 | |||
18 | </FrameLayout> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -44,6 +44,9 @@ import android.provider.Settings; | ... | @@ -44,6 +44,9 @@ import android.provider.Settings; |
44 | import android.util.Log; | 44 | import android.util.Log; |
45 | import android.view.LayoutInflater; | 45 | import android.view.LayoutInflater; |
46 | import android.view.View; | 46 | import android.view.View; |
47 | import android.view.WindowManager; | ||
48 | import android.widget.FrameLayout; | ||
49 | import android.widget.ImageView; | ||
47 | import android.widget.ProgressBar; | 50 | import android.widget.ProgressBar; |
48 | import android.widget.TextView; | 51 | import android.widget.TextView; |
49 | import android.widget.Toast; | 52 | import android.widget.Toast; |
... | @@ -54,51 +57,34 @@ import com.android.volley.VolleyError; | ... | @@ -54,51 +57,34 @@ import com.android.volley.VolleyError; |
54 | import com.android.volley.toolbox.JsonObjectRequest; | 57 | import com.android.volley.toolbox.JsonObjectRequest; |
55 | 58 | ||
56 | public class AppActivity extends Cocos2dxActivity { | 59 | public class AppActivity extends Cocos2dxActivity { |
57 | private static final String TAG="AppActivity"; | 60 | private static final String TAG = "AppActivity"; |
58 | private static AppActivity _activity; | 61 | private static AppActivity _activity; |
59 | private static View view=null; | 62 | private static View view = null; |
63 | private static View viewLoading = null; | ||
60 | public static final String ROOT_DIR = "/mnt/sdcard/mythroad11"; | 64 | public static final String ROOT_DIR = "/mnt/sdcard/mythroad11"; |
61 | private UpdateManager mUpdateManager; | 65 | private UpdateManager mUpdateManager; |
62 | private int serverVersion ; //从服务器获取的版本号 | 66 | private int serverVersion; //从服务器获取的版本号 |
63 | private int clientVersion ; //客户端当前的版本号 | 67 | private int clientVersion; //客户端当前的版本号 |
64 | private String serverVersionName ; //客户端当前的版本名称 | 68 | private String serverVersionName; //客户端当前的版本名称 |
65 | private String apkDownloadUrl ; //apk下载地址 | 69 | private String apkDownloadUrl; //apk下载地址 |
70 | |||
71 | private static ImageView splashBgImageView = null; | ||
72 | |||
66 | @Override | 73 | @Override |
67 | protected void onCreate(Bundle savedInstanceState) { | 74 | protected void onCreate(Bundle savedInstanceState) { |
68 | super.onCreate(savedInstanceState); | 75 | super.onCreate(savedInstanceState); |
69 | 76 | ||
70 | Log.d(TAG,"网络链接:"+isNetworkAvalible(AppActivity.this)); | 77 | checkNetwork(); //检查网络 |
71 | if(!isNetworkAvalible(AppActivity.this)){ | 78 | |
72 | TextView msg = new TextView(AppActivity.this); | 79 | getClientCode(); //检查升级 |
73 | msg.setText(" 当前未连接网络,请设置网络后登陆!"); | ||
74 | new AlertDialog.Builder(AppActivity.this) | ||
75 | .setIcon(R.mipmap.ic_launcher) | ||
76 | .setTitle("网络状态提示") | ||
77 | .setView(msg) | ||
78 | .setPositiveButton("确定", | ||
79 | new DialogInterface.OnClickListener() { | ||
80 | public void onClick(DialogInterface dialog, | ||
81 | int whichButton) { | ||
82 | startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); | ||
83 | try { | ||
84 | new Thread().sleep(2000); | ||
85 | } catch (Exception e) { | ||
86 | e.printStackTrace(); | ||
87 | } | ||
88 | AppActivity.this.finish(); | ||
89 | System.exit(0); | ||
90 | android.os.Process.killProcess(android.os.Process.myPid()); | ||
91 | } | ||
92 | }).create().show(); | ||
93 | } | ||
94 | getClientCode(); | ||
95 | getServerCode(); | 80 | getServerCode(); |
96 | 81 | ||
97 | _activity=this; | 82 | _activity = this; |
98 | TopdrawSDKWrapper.getInstance().init(this); | 83 | TopdrawSDKWrapper.getInstance().init(this); |
99 | MyApplication.appActivity = this; | 84 | MyApplication.appActivity = this; |
100 | 85 | ||
101 | view= LayoutInflater.from(this).inflate(R.layout.activity_main,null); | 86 | //添加加载小游戏进度条 |
87 | view = LayoutInflater.from(this).inflate(R.layout.activity_main, null); | ||
102 | mFrameLayout.addView(view); | 88 | mFrameLayout.addView(view); |
103 | 89 | ||
104 | // Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508 | 90 | // Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508 |
... | @@ -112,6 +98,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -112,6 +98,7 @@ public class AppActivity extends Cocos2dxActivity { |
112 | 98 | ||
113 | // DO OTHER INITIALIZATION BELOW | 99 | // DO OTHER INITIALIZATION BELOW |
114 | SDKWrapper.getInstance().init(this); | 100 | SDKWrapper.getInstance().init(this); |
101 | showSplash(); | ||
115 | } | 102 | } |
116 | 103 | ||
117 | @Override | 104 | @Override |
... | @@ -201,9 +188,38 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -201,9 +188,38 @@ public class AppActivity extends Cocos2dxActivity { |
201 | super.onStart(); | 188 | super.onStart(); |
202 | } | 189 | } |
203 | 190 | ||
204 | public View getProgressBarView(){ | 191 | public View getProgressBarView() { |
205 | return view; | 192 | return view; |
206 | } | 193 | } |
194 | |||
195 | //检查网络 | ||
196 | private void checkNetwork() { | ||
197 | Log.d(TAG, "网络链接:" + isNetworkAvalible(AppActivity.this)); | ||
198 | if (!isNetworkAvalible(AppActivity.this)) { | ||
199 | TextView msg = new TextView(AppActivity.this); | ||
200 | msg.setText(" 当前未连接网络,请设置网络后登陆!"); | ||
201 | new AlertDialog.Builder(AppActivity.this) | ||
202 | .setIcon(R.mipmap.ic_launcher) | ||
203 | .setTitle("网络状态提示") | ||
204 | .setView(msg) | ||
205 | .setPositiveButton("确定", | ||
206 | new DialogInterface.OnClickListener() { | ||
207 | public void onClick(DialogInterface dialog, | ||
208 | int whichButton) { | ||
209 | startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); | ||
210 | try { | ||
211 | new Thread().sleep(2000); | ||
212 | } catch (Exception e) { | ||
213 | e.printStackTrace(); | ||
214 | } | ||
215 | AppActivity.this.finish(); | ||
216 | System.exit(0); | ||
217 | android.os.Process.killProcess(android.os.Process.myPid()); | ||
218 | } | ||
219 | }).create().show(); | ||
220 | } | ||
221 | } | ||
222 | |||
207 | private void getClientCode() { | 223 | private void getClientCode() { |
208 | try { | 224 | try { |
209 | String pkName = this.getPackageName(); | 225 | String pkName = this.getPackageName(); |
... | @@ -211,11 +227,12 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -211,11 +227,12 @@ public class AppActivity extends Cocos2dxActivity { |
211 | } catch (Exception e) { | 227 | } catch (Exception e) { |
212 | e.printStackTrace(); | 228 | e.printStackTrace(); |
213 | clientVersion = -1; | 229 | clientVersion = -1; |
214 | }finally { | 230 | } finally { |
215 | Log.v("zjn","---clientVersion:"+ clientVersion); | 231 | Log.v("zjn", "---clientVersion:" + clientVersion); |
216 | } | 232 | } |
217 | } | 233 | } |
218 | private void getServerCode(){ | 234 | |
235 | private void getServerCode() { | ||
219 | VolleyUtil.instance(this).add(new JsonObjectRequest(Request.Method.GET, UpdateManager.UPDATE_CHECK_ENDPOINT, "", | 236 | VolleyUtil.instance(this).add(new JsonObjectRequest(Request.Method.GET, UpdateManager.UPDATE_CHECK_ENDPOINT, "", |
220 | new Response.Listener<JSONObject>() { | 237 | new Response.Listener<JSONObject>() { |
221 | @Override | 238 | @Override |
... | @@ -227,7 +244,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -227,7 +244,7 @@ public class AppActivity extends Cocos2dxActivity { |
227 | apkDownloadUrl = results.getJSONObject(0).getString("url"); | 244 | apkDownloadUrl = results.getJSONObject(0).getString("url"); |
228 | String md5Str = results.getJSONObject(0).getString("hash_md5"); | 245 | String md5Str = results.getJSONObject(0).getString("hash_md5"); |
229 | mUpdateManager = new UpdateManager(AppActivity.this); | 246 | mUpdateManager = new UpdateManager(AppActivity.this); |
230 | mUpdateManager.showNoticeDialog(serverVersion,clientVersion,serverVersionName,apkDownloadUrl,md5Str); | 247 | mUpdateManager.showNoticeDialog(serverVersion, clientVersion, serverVersionName, apkDownloadUrl, md5Str); |
231 | } catch (Exception e) { | 248 | } catch (Exception e) { |
232 | e.printStackTrace(); | 249 | e.printStackTrace(); |
233 | } | 250 | } |
... | @@ -239,6 +256,7 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -239,6 +256,7 @@ public class AppActivity extends Cocos2dxActivity { |
239 | } | 256 | } |
240 | })); | 257 | })); |
241 | } | 258 | } |
259 | |||
242 | public static boolean isNetworkAvalible(Context context) { | 260 | public static boolean isNetworkAvalible(Context context) { |
243 | ConnectivityManager connectivityManager = (ConnectivityManager) context | 261 | ConnectivityManager connectivityManager = (ConnectivityManager) context |
244 | .getSystemService(Context.CONNECTIVITY_SERVICE); | 262 | .getSystemService(Context.CONNECTIVITY_SERVICE); |
... | @@ -257,4 +275,36 @@ public class AppActivity extends Cocos2dxActivity { | ... | @@ -257,4 +275,36 @@ public class AppActivity extends Cocos2dxActivity { |
257 | return false; | 275 | return false; |
258 | } | 276 | } |
259 | 277 | ||
278 | private static void showSplash() { | ||
279 | //搞启动黑屏问题 | ||
280 | // splashBgImageView = new ImageView(_activity); | ||
281 | // splashBgImageView.setImageResource(R.drawable.bg_loading); | ||
282 | // _activity.addContentView(splashBgImageView,new WindowManager.LayoutParams( | ||
283 | // FrameLayout.LayoutParams.MATCH_PARENT, | ||
284 | // FrameLayout.LayoutParams.MATCH_PARENT | ||
285 | // )); | ||
286 | |||
287 | viewLoading = LayoutInflater.from(_activity).inflate(R.layout.activity_loading, null); | ||
288 | _activity.addContentView(viewLoading, new WindowManager.LayoutParams( | ||
289 | FrameLayout.LayoutParams.MATCH_PARENT, | ||
290 | FrameLayout.LayoutParams.MATCH_PARENT | ||
291 | )); | ||
292 | } | ||
293 | |||
294 | /** | ||
295 | * 这是给 CC JS 调用的隐藏原生开屏背景的方法 | ||
296 | */ | ||
297 | public static void hideSplash() { | ||
298 | _activity.runOnUiThread(new Runnable() { | ||
299 | @Override | ||
300 | public void run() { | ||
301 | // if (splashBgImageView != null) { | ||
302 | // splashBgImageView.setVisibility(View.GONE); | ||
303 | // } | ||
304 | if (viewLoading != null) { | ||
305 | viewLoading.setVisibility(View.GONE); | ||
306 | } | ||
307 | } | ||
308 | }); | ||
309 | } | ||
260 | } | 310 | } | ... | ... |
... | @@ -277,6 +277,7 @@ | ... | @@ -277,6 +277,7 @@ |
277 | <orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" /> | 277 | <orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" /> |
278 | <orderEntry type="sourceFolder" forTests="false" /> | 278 | <orderEntry type="sourceFolder" forTests="false" /> |
279 | <orderEntry type="library" name="Gradle: __local_aars__:D.\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\libs\TopdrawSDK.jar:unspecified@jar" level="project" /> | 279 | <orderEntry type="library" name="Gradle: __local_aars__:D.\LocalTopdrawSchool\build\jsb-link\frameworks\runtime-src\proj.android-studio\app\libs\TopdrawSDK.jar:unspecified@jar" level="project" /> |
280 | <orderEntry type="library" name="Gradle: pl.droidsonroids.gif:android-gif-drawable:1.2.7@aar" level="project" /> | ||
280 | <orderEntry type="library" name="Gradle: __local_aars__:D.\CocosCreator_2.0.10\resources\cocos2d-x\cocos\platform\android\java\libs\com.android.vending.expansion.zipfile.jar:unspecified@jar" level="project" /> | 281 | <orderEntry type="library" name="Gradle: __local_aars__:D.\CocosCreator_2.0.10\resources\cocos2d-x\cocos\platform\android\java\libs\com.android.vending.expansion.zipfile.jar:unspecified@jar" level="project" /> |
281 | <orderEntry type="library" name="Gradle: __local_aars__:D.\CocosCreator_2.0.10\resources\cocos2d-x\cocos\platform\android\java\libs\android-async-http-1.4.9.jar:unspecified@jar" level="project" /> | 282 | <orderEntry type="library" name="Gradle: __local_aars__:D.\CocosCreator_2.0.10\resources\cocos2d-x\cocos\platform\android\java\libs\android-async-http-1.4.9.jar:unspecified@jar" level="project" /> |
282 | <orderEntry type="library" name="Gradle: com.mcxiaoke.volley:library:1.0.19@jar" level="project" /> | 283 | <orderEntry type="library" name="Gradle: com.mcxiaoke.volley:library:1.0.19@jar" level="project" /> | ... | ... |
... | @@ -5004,6 +5004,12 @@ type: cc.Asset, | ... | @@ -5004,6 +5004,12 @@ type: cc.Asset, |
5004 | default: null | 5004 | default: null |
5005 | } | 5005 | } |
5006 | }, | 5006 | }, |
5007 | start: function() { | ||
5008 | var e = this; | ||
5009 | this.scheduleOnce(function() { | ||
5010 | e.hideNativeSplash(); | ||
5011 | }, 1); | ||
5012 | }, | ||
5007 | onLoad: function() { | 5013 | onLoad: function() { |
5008 | this._super(); | 5014 | this._super(); |
5009 | this._scrollview = this.node.getComponent(cc.ScrollView); | 5015 | this._scrollview = this.node.getComponent(cc.ScrollView); |
... | @@ -5499,6 +5505,9 @@ jsb.fileUtils.setSearchPaths(n); | ... | @@ -5499,6 +5505,9 @@ jsb.fileUtils.setSearchPaths(n); |
5499 | cc.audioEngine.stopAll(); | 5505 | cc.audioEngine.stopAll(); |
5500 | cc.game.restart(); | 5506 | cc.game.restart(); |
5501 | } | 5507 | } |
5508 | }, | ||
5509 | hideNativeSplash: function() { | ||
5510 | cc.sys.os == cc.sys.OS_ANDROID && jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "hideSplash", "()V"); | ||
5502 | } | 5511 | } |
5503 | }); | 5512 | }); |
5504 | cc._RF.pop(); | 5513 | cc._RF.pop(); | ... | ... |
1 | // 在 main.js 的开头添加如下代码 | ||
2 | if (jsb) { | ||
3 | var hotUpdateSearchPaths = localStorage.getItem('HotUpdateSearchPaths'); | ||
4 | if (hotUpdateSearchPaths) { | ||
5 | jsb.fileUtils.setSearchPaths(JSON.parse(hotUpdateSearchPaths)); | ||
6 | } | ||
7 | } | ||
8 | |||
9 | // QQPlay window need to be inited first | 1 | // QQPlay window need to be inited first |
10 | if (false) { | 2 | if (false) { |
11 | BK.Script.loadlib('GameRes://libs/qqplay-adapter.js'); | 3 | BK.Script.loadlib('GameRes://libs/qqplay-adapter.js'); | ... | ... |
This file is too large to display.
No preview for this file type
... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
23 | "group-list": [ | 23 | "group-list": [ |
24 | "default" | 24 | "default" |
25 | ], | 25 | ], |
26 | "last-module-event-record-time": 1568625456259, | 26 | "last-module-event-record-time": 1569319114648, |
27 | "simulator-orientation": false, | 27 | "simulator-orientation": false, |
28 | "simulator-resolution": { | 28 | "simulator-resolution": { |
29 | "height": 640, | 29 | "height": 640, | ... | ... |
-
Please register or sign in to post a comment