定制 itvlauncher.apk 只保留 应用页面
一.vendor ockchipcommonappsitvlauncher
1.1.加载布局资源的 地方 K:ITVLauncher-masterassetslayouthot_moretv_layer.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!-- ------------------- -------------------------------------------------------------------------------------- | | | | | | | | | | | | | | | | | 1 | | | | | | 7 | | | | | | | | | |-----------------| | 2 | 3 | 4 | 5 |-------------------| | | | | | | | | | | | | | | | | | 0 | | | | | | 6 | | | | | | | | | | | | | | | | | ------------------ --------------------------------------------------------------------------------------- --> <plist version="1.0"> <dict> <!-- 355x200 --> <key>item0</key> <dict> <key>x</key> <integer>0</integer> <key>y</key> <integer>0</integer> <key>ref</key> <integer>0</integer> <key>width</key> <string>0.27734</string> <key>height</key> <string>0.2778</string> </dict> <!-- 355x200 --> <key>item1</key> <dict> <key>x</key> <integer>0</integer> <key>y</key> <integer>1</integer> <key>ref</key> <integer>0</integer> <key>width</key> <string>0.27734</string> <key>height</key> <string>0.2778</string> </dict> <!-- 270x405 --> <key>item2</key> <dict> <key>x</key> <integer>1</integer> <key>y</key> <integer>0</integer> <key>ref</key> <integer>0</integer> <key>width</key> <string>0.2109</string> <key>height</key> <string>0.5625</string> </dict> <!-- 270x405 --> <key>item3</key> <dict> <key>x</key> <integer>2</integer> <key>y</key> <integer>0</integer> <key>ref</key> <integer>2</integer> <key>width</key> <string>0.2109</string> <key>height</key> <string>0.5625</string> </dict> <!-- 270x405 --> <key>item4</key> <dict> <key>x</key> <integer>3</integer> <key>y</key> <integer>0</integer> <key>ref</key> <integer>3</integer> <key>width</key> <string>0.2109</string> <key>height</key> <string>0.5625</string> </dict> <!-- 270x405 --> <key>item5</key> <dict> <key>x</key> <integer>4</integer> <key>y</key> <integer>0</integer> <key>ref</key> <integer>4</integer> <key>width</key> <string>0.2109</string> <key>height</key> <string>0.5625</string> </dict> <!-- 355x200 --> <key>item6</key> <dict> <key>x</key> <integer>5</integer> <key>y</key> <integer>0</integer> <key>ref</key> <integer>5</integer> <key>width</key> <string>0.27734</string> <key>height</key> <string>0.2778</string> </dict> <!-- 355x200 --> <key>item7</key> <dict> <key>x</key> <integer>5</integer> <key>y</key> <integer>1</integer> <key>ref</key> <integer>6</integer> <key>width</key> <string>0.27734</string> <key>height</key> <string>0.2778</string> </dict> </dict> </plist>
1.2.依赖于libitvbox.so 加载布局资源
ITVLauncher-mastercocos2dx_patchcocos2dx-nativecocos2dxprojectsRKTVBoxHDClasseslayerHotLayer.cpp
bool HotLayer::init() { if(!CCLayer::init()) { return false; } CCHttpClient::getInstance()->setTimeoutForConnect(5); CCHttpClient::getInstance()->setTimeoutForRead(5); mInitHotImg = true; setContentLayout("hot_moretv_layer.plist", "grid_focus.png"); initDataSource(); return true; }
1.3.修改布局资源 重新编译lib库
1. 从cocos2dx官网下载cocos2dx 2.2.4, http://www.cocos2d-x.org/ 2. 从谷歌官网下载android-ndk-r8d 3. 几个关键目录: 3.1 {$USER_ROOT}/android_dev/cocos2dx-2.2.4 游戏引擎根目录 3.2 {$USER_ROOT}/android_dev/android-ndk-r8d NDK跟目录 4. 将游戏引擎的修改合并到{$USER_ROOT}/android_dev/cocos2dx-2.2.4目录 cocos2dx/cocos2dx/keypad_dispatcher 覆盖{$USER_ROOT}/android_dev/cocos2dx-2.2.4/cocos2dx/keypad_dispatcher cocos2dx/cocos2dx/platform/android/jni 覆盖{$USER_ROOT}/android_dev/cocos2dx-2.2.4/cocos2dx/platform/android/jni cocos2dx/external/cocoswidget 拷贝到{$USER_ROOT}/android_dev/cocos2dx-2.2.4/external/cocoswidget cocos2dx/external/jsoncpp 拷贝到{$USER_ROOT}/android_dev/cocos2dx-2.2.4/external/jsoncpp 5. 将Laucher工程文件拷贝到 将源码包中,cocos2dx/projects/RKTVBoxHD 拷贝到{$USER_ROOT}/android_dev/cocos2dx-2.2.4/projects/目录 6. 进入{$USER_ROOT}/android_dev/cocos2dx-2.2.4/projects/RKTVBoxHD/proj.android目录, 修改build_native.sh脚本,配置NDK_ROOT 和 COCOS2DX_ROOT,请配置为绝对目录,例如: NDK_ROOT={$USER_ROOT}/android_dev/android-ndk-r8d COCOS2DX_ROOT={$USER_ROOT}/android_dev/cocos2dx-2.2.4 配置完成后,执行# source build_native.sh 即可编译出动态库proj.android/libs/armeabi/libitvbox.so 7. 将libitvbox.so拷贝到android工程,使用Android Studio编译出APK. 修改Native源码后,请重复步骤7生效。