mirror of
https://github.com/lizongying/my-tv.git
synced 2026-10-26 22:26:29 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf8d7f00a8 | ||
|
|
bcfca9e28c | ||
|
|
31ec13eed7 | ||
|
|
5a78913407 | ||
|
|
bb38cf5033 | ||
|
|
51d9c4c2a7 | ||
|
|
70da1d8241 | ||
|
|
ef17427f64 | ||
|
|
c1143afb4e | ||
|
|
68f158e556 | ||
|
|
4ef95d60c4 | ||
|
|
b782d1f841 | ||
|
|
7e57aa8c03 | ||
|
|
c16a4bcb9c | ||
|
|
0286d118ed | ||
|
|
fc83defe31 | ||
|
|
6fc73efd47 | ||
|
|
b157f1eb28 | ||
|
|
2b172ae615 | ||
|
|
39e5cc7c1f | ||
|
|
df5b006024 | ||
|
|
fe888c36ac | ||
|
|
5aa08f51a1 | ||
|
|
fe92fa5853 | ||
|
|
3d8ab65955 | ||
|
|
5485a686bc | ||
|
|
716efb5a83 | ||
|
|
ca82d5409f | ||
|
|
3936629af8 |
@@ -37,6 +37,13 @@ jobs:
|
||||
# override default build-tools version (29.0.3) -- optional
|
||||
BUILD_TOOLS_VERSION: "34.0.0"
|
||||
|
||||
- name: Get History
|
||||
id: get_history
|
||||
run: |
|
||||
chmod +x history.sh
|
||||
output=$(./history.sh)
|
||||
echo "$output" > history.md
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
@@ -47,6 +54,7 @@ jobs:
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
body_path: history.md
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
@@ -56,4 +64,19 @@ jobs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
|
||||
asset_name: my-tv-${{ github.ref_name }}.apk
|
||||
asset_content_type: application/vnd.android.package-archive
|
||||
asset_content_type: application/vnd.android.package-archive
|
||||
|
||||
- name: Gitee Create Release
|
||||
run: |
|
||||
latest_commit=$(git rev-parse HEAD)
|
||||
history=$(cat history.md)
|
||||
curl -v POST https://gitee.com/api/v5/repos/${{ github.repository }}/releases \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"access_token": "${{ secrets.GITEE_ACCESS_TOKEN}}",
|
||||
"tag_name": "${{ github.ref_name }}",
|
||||
"name": "Release ${{ github.ref_name }}",
|
||||
"body": "'"$history"'",
|
||||
"prerelease": false,
|
||||
"target_commitish": "'"$latest_commit"'"
|
||||
}'
|
||||
+211
-97
@@ -1,151 +1,265 @@
|
||||
## 更新日志
|
||||
## 更新日誌
|
||||
|
||||
### v2.1.0
|
||||
|
||||
* 恢復播放
|
||||
|
||||
### 以下已不可用
|
||||
|
||||
### v2.0.9
|
||||
|
||||
* 修復部分設備閃退的問題
|
||||
* 修復設置頁可能顯示不全的問題
|
||||
|
||||
### v2.0.5
|
||||
|
||||
* 設置頁增加恢復默認按鈕,目前只用於同步系統時間
|
||||
|
||||
### v2.0.4
|
||||
|
||||
* 修復不能播放的問題
|
||||
* 包含國際頻道
|
||||
|
||||
### v2.0.3
|
||||
|
||||
* 修復不能播放的問題
|
||||
* 不包含國際頻道
|
||||
|
||||
### v2.0.0
|
||||
|
||||
* 解決卡頓問題
|
||||
* 解決網格樣式時,點擊空白處不退出的問題
|
||||
* 解決頻道列表樣式切換可能不生效的問題
|
||||
|
||||
### v1.9.8(通用)
|
||||
|
||||
* 優化在線升級
|
||||
* 優化可能狀態錯誤的問題
|
||||
|
||||
### v1.9.6(通用)
|
||||
|
||||
* 優化在線升級
|
||||
* 優化可能狀態錯誤的問題
|
||||
|
||||
### v1.9.4(通用)
|
||||
|
||||
* 修復默認時間不顯示問題
|
||||
* 設置頁居中
|
||||
* 頻道號和時間對齊
|
||||
|
||||
### v1.9.2(通用)
|
||||
|
||||
* 修復一個重試的錯誤
|
||||
|
||||
### v1.9.0(通用)
|
||||
|
||||
* 減少視頻播放失敗情況
|
||||
* 全面屏手機居中顯示
|
||||
|
||||
### v1.8.8(通用)
|
||||
|
||||
* 樣式優化
|
||||
|
||||
### v1.8.6(通用)
|
||||
|
||||
* 增加錯誤顯示
|
||||
* 節目預告優化
|
||||
* 頻道列表頁單擊切換頻道
|
||||
|
||||
### v1.8.4(通用)
|
||||
|
||||
* 解決部分情況下打開後黑屏問題
|
||||
* 延長頻道信息顯示時間,增加信息顯示長度
|
||||
* 調整頻道列表間距
|
||||
* 其他樣式優化
|
||||
|
||||
### v1.8.2(通用)
|
||||
|
||||
* 修復無法播放問題
|
||||
|
||||
### v1.8.0(通用)
|
||||
|
||||
* 修復返回鍵無法退出問題
|
||||
* 設置中增加退出按鈕
|
||||
* 修改非電視上的樣式
|
||||
* 修復低版本閃退問題
|
||||
|
||||
### v1.7.8(通用)
|
||||
|
||||
* 修復播放過程中的卡頓問題
|
||||
* 增加時間顯示
|
||||
* 頻道號優化
|
||||
* 遙控器左鍵打開頻道列表
|
||||
* 遙控器右鍵打開設置菜單
|
||||
* 頻道列表空白處點擊隱藏頻道列表
|
||||
|
||||
### v1.7.6(通用)
|
||||
|
||||
* 臨時去掉部分頻道,提高頻道的可用性
|
||||
* 部分頻道增加節目單
|
||||
|
||||
### v1.7.5(安卓5及以上專用)
|
||||
|
||||
* 修復播放過程中的卡頓問題
|
||||
* 增加時間顯示
|
||||
* 頻道號優化
|
||||
* 設置中增加退出按鈕
|
||||
|
||||
### v1.7.4(通用)
|
||||
|
||||
* 修復368
|
||||
|
||||
### v1.7.3(安卓5及以上專用)
|
||||
|
||||
* 臨時去掉部分頻道,提高頻道的可用性
|
||||
* 部分頻道增加節目單
|
||||
* 遙控器左鍵進入節目列表
|
||||
* 遙控器右鍵進入菜單
|
||||
|
||||
### v1.7.2(通用)
|
||||
|
||||
* 支持节目列表网格样式和行样式切换,软件重启后生效
|
||||
* 节目列表样式变更
|
||||
* 支持節目列表網格樣式和行樣式切換,軟件重啟後生效
|
||||
* 節目列表樣式變更
|
||||
|
||||
### v1.7.1(安卓5及以上专用)
|
||||
### v1.7.1(安卓5及以上專用)
|
||||
|
||||
* 解决设置页更新闪退的问题
|
||||
* 凤凰卫视回归
|
||||
* 解决368问题
|
||||
* 解決設置頁更新閃退的問題
|
||||
* 鳳凰衛視回歸
|
||||
* 解決368問題
|
||||
|
||||
### v1.7.0(通用)
|
||||
|
||||
* 网络请求优化
|
||||
* 網絡請求優化
|
||||
|
||||
### v1.6.9(安卓5及以上专用)
|
||||
### v1.6.9(安卓5及以上專用)
|
||||
|
||||
* 去掉港澳台和国际频道
|
||||
* 解决部分情况下3、6、8等频道无法播放的问题
|
||||
* 解决部分情况下启动后黑屏问题
|
||||
* 去掉港澳台和國際頻道
|
||||
* 解決部分情況下3、6、8等頻道無法播放的問題
|
||||
* 解決部分情況下啟動後黑屏問題
|
||||
|
||||
### v1.6.8(通用)
|
||||
|
||||
* 修复部分设备崩溃的问题
|
||||
* 修复部分设备凤凰卫视无法播放的问题
|
||||
* 修復部分設備崩潰的問題
|
||||
* 修復部分設備鳳凰衛視無法播放的問題
|
||||
|
||||
### v1.6.7(安卓5及以上专用)
|
||||
### v1.6.7(安卓5及以上專用)
|
||||
|
||||
* 手机双击打开配置
|
||||
* 自动更新
|
||||
* 手機雙擊打開配置
|
||||
* 自動更新
|
||||
|
||||
### v1.6.6(通用)
|
||||
|
||||
* 更新重庆卫视图标
|
||||
* 凤凰卫视增强画质
|
||||
* 凤凰卫视增加EPG
|
||||
* 更新重慶衛視圖標
|
||||
* 鳳凰衛視增強畫質
|
||||
* 鳳凰衛視增加EPG
|
||||
|
||||
### v1.6.5(安卓5及以上专用)
|
||||
### v1.6.5(安卓5及以上專用)
|
||||
|
||||
* 增加CETV1图标
|
||||
* 稳定性提升
|
||||
* 增加CETV1圖標
|
||||
* 穩定性提升
|
||||
|
||||
### v1.6.4(通用)
|
||||
|
||||
* 增加CETV1
|
||||
* 增加凤凰卫视
|
||||
* 默认关闭开机启动
|
||||
* 增加鳳凰衛視
|
||||
* 默認關閉開機啟動
|
||||
|
||||
### v1.6.3(安卓5及以上专用)
|
||||
### v1.6.3(安卓5及以上專用)
|
||||
|
||||
* 增加CETV1
|
||||
* 凤凰卫视增强画质
|
||||
* 默认关闭开机启动
|
||||
* 延迟菜单自动关闭时间
|
||||
* 解决一些可能导致首次打开时黑屏的问题
|
||||
* 鳳凰衛視增強畫質
|
||||
* 默認關閉開機啟動
|
||||
* 延遲菜單自動關閉時間
|
||||
* 解決一些可能導致首次打開時黑屏的問題
|
||||
|
||||
### v1.6.2(通用)
|
||||
|
||||
* 修复按键无效的问题
|
||||
* 新的频道列表样式
|
||||
* 修復按鍵無效的問題
|
||||
* 新的頻道列表樣式
|
||||
|
||||
### v1.6.1(安卓5及以上专用)
|
||||
### v1.6.1(安卓5及以上專用)
|
||||
|
||||
* 增加凤凰卫视
|
||||
* 增加鳳凰衛視
|
||||
|
||||
### v1.6.0(通用)
|
||||
|
||||
* 通用(春晚緊急修復)
|
||||
|
||||
### v1.5.9(安卓5及以上专用)
|
||||
### v1.5.9(安卓5及以上專用)
|
||||
|
||||
* 解决天猫魔盒闪退问题
|
||||
* 解決天貓魔盒閃退問題
|
||||
|
||||
### v1.5.8(通用)
|
||||
|
||||
* 修复央视6画质差的问题
|
||||
* 增加兵团卫视
|
||||
* 播放失败重试
|
||||
* 修復央視6畫質差的問題
|
||||
* 增加兵團衛視
|
||||
* 播放失敗重試
|
||||
|
||||
### v1.5.7(安卓5及以上专用)
|
||||
### v1.5.7(安卓5及以上專用)
|
||||
|
||||
* 修复播放失败的问题
|
||||
* 修復播放失敗的問題
|
||||
|
||||
### v1.5.6(通用)
|
||||
|
||||
* 解决部分设备系统时间不对导致播放失败的问题
|
||||
* 解決部分設備系統時間不對導致播放失敗的問題
|
||||
|
||||
### v1.5.5(安卓5及以上专用)
|
||||
### v1.5.5(安卓5及以上專用)
|
||||
|
||||
* 修复播放失败的问题
|
||||
* 修复APP恢复后频道号、频道列表不自动消失的问题
|
||||
* 修復播放失敗的問題
|
||||
* 修復APP恢復後頻道號、頻道列表不自動消失的問題
|
||||
|
||||
### v1.5.4(通用)
|
||||
|
||||
* 修复播放失败的问题
|
||||
* 修復播放失敗的問題
|
||||
|
||||
### 以下已不可用
|
||||
### v1.5.3(安卓5及以上專用)
|
||||
|
||||
### v1.5.3(安卓5及以上专用)
|
||||
|
||||
* 修复部分情况下APP切换后无法继续播放的问题
|
||||
* 优化重试逻辑
|
||||
* 修復部分情況下APP切換後無法繼續播放的問題
|
||||
* 優化重試邏輯
|
||||
|
||||
### v1.5.2(通用)
|
||||
|
||||
* 修复APP恢复后频道号、频道列表不自动消失的问题
|
||||
* 修復APP恢復後頻道號、頻道列表不自動消失的問題
|
||||
|
||||
### v1.5.1(安卓5及以上专用)
|
||||
### v1.5.1(安卓5及以上專用)
|
||||
|
||||
* 性能优化
|
||||
* 性能優化
|
||||
|
||||
### v1.5.0(通用)
|
||||
|
||||
* 修复部分情况下APP切换后无法继续播放的问题
|
||||
* 修復部分情況下APP切換後無法繼續播放的問題
|
||||
|
||||
### v1.4.9(安卓5及以上专用)
|
||||
### v1.4.9(安卓5及以上專用)
|
||||
|
||||
* 同步v1.4.8
|
||||
|
||||
### v1.4.8(通用)
|
||||
|
||||
* 频道号从1开始,CCTV5+为18
|
||||
* 頻道號從1開始,CCTV5+為18
|
||||
* 提高CCTV6清晰度
|
||||
* 增加天津卫视、新疆卫视
|
||||
* 增加天津衛視、新疆衛視
|
||||
|
||||
### v1.4.7(安卓5及以上专用)
|
||||
### v1.4.7(安卓5及以上專用)
|
||||
|
||||
* 修复部分用户CCTV13播放过程中卡住的问题
|
||||
* 调整CCTV的频道顺序
|
||||
* 修復部分用戶CCTV13播放過程中卡住的問題
|
||||
* 調整CCTV的頻道順序
|
||||
|
||||
### v1.4.6(通用)
|
||||
|
||||
* 10以下频道不再需要先按0
|
||||
* 10以下頻道不再需要先按0
|
||||
|
||||
### v1.4.5(安卓5及以上专用)
|
||||
### v1.4.5(安卓5及以上專用)
|
||||
|
||||
* 数字选台配置
|
||||
* 數字選台配置
|
||||
|
||||
### v1.4.4(通用)
|
||||
|
||||
* 优化图标显示
|
||||
* 增加换台反转
|
||||
* 優化圖標顯示
|
||||
* 增加換台反轉
|
||||
|
||||
### v1.4.3(安卓5及以上专用)
|
||||
### v1.4.3(安卓5及以上專用)
|
||||
|
||||
* 支持频道反转配置
|
||||
* 支持頻道反轉配置
|
||||
|
||||
### v1.4.2(通用)
|
||||
|
||||
@@ -153,40 +267,40 @@
|
||||
|
||||
### v1.4.1
|
||||
|
||||
* 解决部分用户无法打开菜单的问题
|
||||
* 解決部分用戶無法打開菜單的問題
|
||||
|
||||
### v1.4.0
|
||||
|
||||
* 解决极个别高版本机型黑屏问题
|
||||
* 解決極個別高版本機型黑屏問題
|
||||
|
||||
### v1.3.9
|
||||
|
||||
* 提高稳定性
|
||||
* 提高连接速度
|
||||
* 提高穩定性
|
||||
* 提高連接速度
|
||||
|
||||
### v1.3.4
|
||||
|
||||
* 部分错误会提示用户
|
||||
* 菜单3秒钟后自动关闭
|
||||
* 部分錯誤會提示用戶
|
||||
* 菜單3秒鐘後自動關閉
|
||||
|
||||
### v1.3.3
|
||||
|
||||
* 部分错误会提示用户
|
||||
* 菜单3秒钟后自动关闭
|
||||
* 部分錯誤會提示用戶
|
||||
* 菜單3秒鐘後自動關閉
|
||||
|
||||
### v1.3.2
|
||||
|
||||
* 增加重试,减少因网络问题导致的播放失败
|
||||
* 优化横幅banner
|
||||
* 增加重試,減少因網絡問題導致的播放失敗
|
||||
* 優化橫幅banner
|
||||
|
||||
### v1.3.1
|
||||
|
||||
* 增加CCTV 8K 超高清频道
|
||||
* 增加国际频道栏目
|
||||
* 增加CCTV 8K 超高清頻道
|
||||
* 增加國際頻道欄目
|
||||
|
||||
### v1.3.0
|
||||
|
||||
* 处理368可能失败的情形
|
||||
* 處理368可能失敗的情形
|
||||
|
||||
### v1.2.9
|
||||
|
||||
@@ -198,32 +312,32 @@
|
||||
|
||||
### v1.2.7
|
||||
|
||||
* 此版本是为了测试安卓6.0以下版本,如之前可以正常运行,请勿安装。
|
||||
* 此版本是為了測試安卓6.0以下版本,如之前可以正常運行,請勿安裝。
|
||||
|
||||
### v1.2.6
|
||||
|
||||
* 支持安卓4.2
|
||||
* 解决部分频道无法播放的问题
|
||||
* 修复切换时有时没有恢复播放的问题
|
||||
* 左右键不再切换源
|
||||
* 增大频道信息标题尺寸,缩小与节目信息的间隔
|
||||
* 解決部分頻道無法播放的問題
|
||||
* 修復切換時有時沒有恢復播放的問題
|
||||
* 左右鍵不再切換源
|
||||
* 增大頻道信息標題尺寸,縮小與節目信息的間隔
|
||||
|
||||
### v1.2.5
|
||||
|
||||
* 美化频道信息显示
|
||||
* 优化节目单获取
|
||||
* 美化頻道信息顯示
|
||||
* 優化節目單獲取
|
||||
|
||||
### v1.2.4
|
||||
|
||||
* 改变换台滑动方向,上一个频道下滑,下一个频道上滑
|
||||
* 软件退出时,退出播放器
|
||||
* 播放相同的频道,不再重复加载
|
||||
* 暂时移除部分频道
|
||||
* 改變換台滑動方向,上一個頻道下滑,下一個頻道上滑
|
||||
* 軟件退出時,退出播放器
|
||||
* 播放相同的頻道,不再重複加載
|
||||
* 暫時移除部分頻道
|
||||
|
||||
### v1.2.3
|
||||
|
||||
* 固定视频比列为16:9
|
||||
* 隐藏全面屏底部的小横条
|
||||
* 移除移动专区
|
||||
* 修复一个闪退问题
|
||||
* 更换图标和应用名
|
||||
* 固定視頻比例為16:9
|
||||
* 隱藏全面屏底部的小橫條
|
||||
* 移除移動專區
|
||||
* 修復一個閃退問題
|
||||
* 更換圖標和應用名
|
||||
@@ -1,6 +1,6 @@
|
||||
.PHONY: all
|
||||
|
||||
all: info
|
||||
all: info gen-version
|
||||
|
||||
branch := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
commit := $(shell git rev-parse --short HEAD)
|
||||
@@ -9,3 +9,11 @@ info:
|
||||
@echo 'SHELL='$(SHELL)
|
||||
@echo 'branch='$(branch)
|
||||
@echo 'commit='$(commit)
|
||||
|
||||
gen-version:
|
||||
git describe --tags --always
|
||||
git describe --tags --always | sed 's/v/ /g' | sed 's/\./ /g' | sed 's/-/ /g' | awk '{print ($$1*16777216)+($$2*65536)+($$3*256)+$$4}'
|
||||
|
||||
#make gen v=v2.0.0
|
||||
gen:
|
||||
echo $(v) | sed 's/v/ /g' | sed 's/\./ /g' | sed 's/-/ /g' | awk '{print "{\"version_code\": " ($$1*16777216)+($$2*65536)+($$3*256)+$$4 ", \"version_name\": \"" "v$(v)" "\"}"}' > version.json
|
||||
@@ -4,17 +4,16 @@
|
||||
|
||||
## 使用
|
||||
|
||||
下载安装:
|
||||
[github](https://github.com/lizongying/my-tv/releases/)
|
||||
[gitee](https://gitee.com/lizongying/my-tv/releases/)
|
||||
|
||||
小米电视可以使用小米电视助手进行安装
|
||||
|
||||
如电视可以启用ADB,也可以通过ADB进行安装:
|
||||
|
||||
```shell
|
||||
adb install my-tv.apk
|
||||
```
|
||||
1. 下载
|
||||
* [github](https://github.com/lizongying/my-tv/releases/)
|
||||
* [gitee](https://gitee.com/lizongying/my-tv/releases/)
|
||||
2. 安裝
|
||||
* U盘安装
|
||||
* 小米电视可以使用小米电视助手进行安装
|
||||
* 如电视可以启用ADB,也可以通过ADB进行安装
|
||||
```shell
|
||||
adb install my-tv.apk
|
||||
```
|
||||
|
||||

|
||||

|
||||
@@ -27,17 +26,23 @@ adb install my-tv.apk
|
||||
## TODO
|
||||
|
||||
* 音量不同
|
||||
* 大湾区卫视、广东4k超高清、广东珠江、三沙卫视
|
||||
* 大湾区卫视、广东4k超高清、广东珠江、三沙卫视、翡翠
|
||||
* CHC高清三个电影频道
|
||||
* 地方频道
|
||||
* 收藏夹
|
||||
* 自定义源
|
||||
* 海外
|
||||
* 1.5.0 无法安装,1.5.1 可以安装
|
||||
* 节目增加预告
|
||||
* 频道列表优化
|
||||
* epg更新后菜单更新
|
||||
* 防止菜单第一个获取焦点
|
||||
* 隐藏频道
|
||||
* 亮度调节
|
||||
* 音量调节
|
||||
* 軟解
|
||||
|
||||
## 版权说明
|
||||
|
||||
本项目仅供学习研究,禁止用于商业用途,请于下载二十四小时内删除。
|
||||
|
||||
本项目可能随时终止,请大家谨慎使用,建议使用官方渠道进行观看。
|
||||
|
||||
本项目使用的部分代码、图片、文字等资源来源于网络,如有侵权,请联系删除。
|
||||
|
||||
## 赞赏
|
||||
|
||||
|
||||
+36
-11
@@ -26,6 +26,7 @@ android {
|
||||
cmake {
|
||||
arguments "-DIS_SO_BUILD=${project.hasProperty('IS_SO_BUILD') ? project.IS_SO_BUILD : true}"
|
||||
|
||||
// abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
}
|
||||
}
|
||||
@@ -77,10 +78,9 @@ static def VersionCode() {
|
||||
def replace = [v: "", ".": " ", "-": " "]
|
||||
def arr = (process.text.trim().replace(replace) + " 0").split(" ")
|
||||
def versionCode = arr[0].toInteger() * 16777216 + arr[1].toInteger() * 65536 + arr[2].toInteger() * 256 + arr[3].toInteger()
|
||||
println("VersionCode $versionCode")
|
||||
return versionCode
|
||||
} catch (ignored) {
|
||||
return 0
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,19 +88,29 @@ static def VersionName() {
|
||||
try {
|
||||
def process = "git describe --tags --always".execute()
|
||||
process.waitFor()
|
||||
return process.text.trim() - "v"
|
||||
def versionName = process.text.trim() - "v"
|
||||
if (versionName.isEmpty()) {
|
||||
versionName = "1.0.0"
|
||||
}
|
||||
return versionName
|
||||
} catch (ignored) {
|
||||
return "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// minSdk17
|
||||
def media3_version = "1.2.1"
|
||||
|
||||
implementation "androidx.media3:media3-ui:$media3_version"
|
||||
|
||||
// For media playback using ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer:$media3_version"
|
||||
implementation ("com.google.guava:guava:31.1-android")
|
||||
implementation ("androidx.media3:media3-common:$media3_version") {
|
||||
exclude group: 'com.google.common', module: 'guava'
|
||||
}
|
||||
implementation ("androidx.media3:media3-exoplayer:$media3_version")
|
||||
|
||||
// For HLS playback support with ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
|
||||
@@ -109,17 +119,32 @@ dependencies {
|
||||
def retrofit2_version = "2.6.4"
|
||||
|
||||
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
|
||||
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
|
||||
// Gson 2.10.1 and older: API level 19
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
implementation("com.squareup.retrofit2:converter-gson:$retrofit2_version") {
|
||||
exclude group: 'com.google.code.gson', module: 'gson'
|
||||
}
|
||||
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit2_version"
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
||||
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
||||
implementation 'androidx.leanback:leanback:1.2.0-alpha02'
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||
|
||||
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
||||
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.leanback:leanback:1.2.0-alpha02'
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0-RC")
|
||||
|
||||
implementation 'com.google.android.exoplayer:exoplayer-ui:2.13.3'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.13.3'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-hls:2.13.3'
|
||||
implementation 'javax.annotation:javax.annotation-api:1.3.2'
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
resolutionStrategy {
|
||||
force 'com.google.code.gson:gson:2.10.1'
|
||||
force 'com.google.guava:guava:31.1-android'
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="true" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
|
||||
<application
|
||||
android:name=".MyTVApplication"
|
||||
android:allowBackup="true"
|
||||
android:largeHeap="true"
|
||||
android:icon="@drawable/logo"
|
||||
android:logo="@drawable/logo"
|
||||
android:banner="@drawable/banner"
|
||||
android:icon="@drawable/logo"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:largeHeap="true"
|
||||
android:logo="@drawable/logo"
|
||||
android:networkSecurityConfig="@xml/network"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:theme="@style/Theme.MyTV">
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MyTV"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:keepScreenOn="true"
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:keepScreenOn="true"
|
||||
android:screenOrientation="landscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.windowLayoutInDisplayCutoutMode"
|
||||
android:value="shortEdges" />
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".BootReceiver"
|
||||
android:exported="true">
|
||||
@@ -40,15 +51,28 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".NetworkChangeReceiver"
|
||||
<receiver
|
||||
android:name=".NetworkChangeReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<provider
|
||||
android:name=".InitializerProvider"
|
||||
android:authorities="${applicationId}.InitializerProvider"
|
||||
android:exported="false"/>
|
||||
android:exported="false" />
|
||||
|
||||
<meta-data android:name="android.max_aspect" android:value="2.5" />
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -1,18 +1,21 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.graphics.Color
|
||||
import android.view.ContextThemeWrapper
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewConfiguration
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.ScaleAnimation
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.leanback.widget.ImageCardView
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.core.view.setPadding
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.lizongying.mytv.databinding.CardBinding
|
||||
import com.lizongying.mytv.models.TVListViewModel
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class CardAdapter(
|
||||
@@ -25,15 +28,31 @@ class CardAdapter(
|
||||
private var listener: ItemListener? = null
|
||||
private var focused: View? = null
|
||||
|
||||
var visiable = false
|
||||
var focusable = false
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val cardView = object :
|
||||
ImageCardView(ContextThemeWrapper(parent.context, R.style.CustomImageCardTheme)) {}
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
val binding = CardBinding.inflate(inflater, parent, false)
|
||||
|
||||
val application = mainFragment.requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.card.layoutParams.width = application.px2Px(binding.card.layoutParams.width)
|
||||
binding.card.layoutParams.height = application.px2Px(binding.card.layoutParams.height)
|
||||
binding.icon.layoutParams.height = application.px2Px(binding.icon.layoutParams.height)
|
||||
binding.icon.setPadding(application.px2Px(binding.icon.paddingTop))
|
||||
binding.main.layoutParams.height = application.px2Px(binding.main.layoutParams.height)
|
||||
binding.main.setPadding(application.px2Px(binding.main.paddingTop))
|
||||
binding.title.textSize = application.px2PxFont(binding.title.textSize)
|
||||
binding.desc.textSize = application.px2PxFont(binding.desc.textSize)
|
||||
val layoutParams = binding.desc.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.topMargin = application.px2Px(binding.desc.marginTop)
|
||||
binding.desc.layoutParams = layoutParams
|
||||
|
||||
val cardView = binding.root
|
||||
cardView.isClickable = true
|
||||
cardView.isFocusable = true
|
||||
cardView.isFocusableInTouchMode = true
|
||||
cardView.updatePadding(1, 1, 1, 1)
|
||||
return ViewHolder(cardView)
|
||||
return ViewHolder(cardView, binding)
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
@@ -41,14 +60,14 @@ class CardAdapter(
|
||||
recyclerView.invalidate()
|
||||
}
|
||||
|
||||
private fun startScaleAnimation(view: View, fromScale: Float, toScale: Float, duration: Long) {
|
||||
private fun startScaleAnimation(view: View) {
|
||||
val scaleAnimation = ScaleAnimation(
|
||||
fromScale, toScale,
|
||||
fromScale, toScale,
|
||||
0.9f, 1.0f,
|
||||
0.9f, 1.0f,
|
||||
ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
|
||||
ScaleAnimation.RELATIVE_TO_SELF, 0.5f
|
||||
)
|
||||
scaleAnimation.duration = duration
|
||||
scaleAnimation.duration = 200
|
||||
scaleAnimation.fillAfter = false
|
||||
view.startAnimation(scaleAnimation)
|
||||
}
|
||||
@@ -57,7 +76,7 @@ class CardAdapter(
|
||||
val item = tvListViewModel.getTVViewModel(position)
|
||||
|
||||
val tvViewModel = item as TVViewModel
|
||||
val cardView = viewHolder.view as ImageCardView
|
||||
val cardView = viewHolder.view
|
||||
cardView.tag = tvViewModel
|
||||
|
||||
val onFocusChangeListener = View.OnFocusChangeListener { view, hasFocus ->
|
||||
@@ -65,16 +84,12 @@ class CardAdapter(
|
||||
listener?.onItemHasFocus(item)
|
||||
focused = cardView
|
||||
|
||||
startScaleAnimation(cardView, 0.9f, 1.0f, 200)
|
||||
//
|
||||
// if (mainFragment.shouldHasFocus(view.tag as TVViewModel)) {
|
||||
// }
|
||||
|
||||
// if (visiable) {
|
||||
// startScaleAnimation(cardView, 0.9f, 1.0f, 200)
|
||||
// } else {
|
||||
// visiable = true
|
||||
// }
|
||||
if (focusable) {
|
||||
startScaleAnimation(cardView)
|
||||
viewHolder.focus(true)
|
||||
}
|
||||
} else {
|
||||
viewHolder.focus(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +99,34 @@ class CardAdapter(
|
||||
listener?.onItemClicked(item)
|
||||
}
|
||||
|
||||
var downX = 0f
|
||||
var downY = 0f
|
||||
val touchSlop = ViewConfiguration.get(cardView.context).scaledTouchSlop
|
||||
|
||||
cardView.setOnTouchListener { _, event ->
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
downX = event.x
|
||||
downY = event.y
|
||||
true
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
val upX = event.x
|
||||
val upY = event.y
|
||||
val deltaX = abs(upX - downX)
|
||||
val deltaY = abs(upY - downY)
|
||||
if (deltaX < touchSlop && deltaY < touchSlop) {
|
||||
// 如果位移量小于阈值,则执行点击操作
|
||||
cardView.performClick()
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
cardView.setOnKeyListener { _, keyCode, event: KeyEvent? ->
|
||||
if (event?.action == KeyEvent.ACTION_DOWN) {
|
||||
return@setOnKeyListener listener?.onKey(keyCode) ?: false
|
||||
@@ -91,28 +134,62 @@ class CardAdapter(
|
||||
false
|
||||
}
|
||||
|
||||
cardView.titleText = tvViewModel.getTV().title
|
||||
viewHolder.binding.title.text = tvViewModel.getTV().title
|
||||
|
||||
Glide.with(viewHolder.view.context)
|
||||
.load(tvViewModel.getTV().logo)
|
||||
.centerInside()
|
||||
.into(cardView.mainImageView)
|
||||
|
||||
cardView.mainImageView.setBackgroundColor(Color.WHITE)
|
||||
cardView.setMainImageScaleType(ImageView.ScaleType.CENTER_INSIDE)
|
||||
viewHolder.binding.icon.let {
|
||||
Glide.with(viewHolder.view.context)
|
||||
.load(tvViewModel.getTV().logo)
|
||||
.centerInside()
|
||||
.into(it)
|
||||
}
|
||||
|
||||
val epg = tvViewModel.epg.value?.filter { it.beginTime < Utils.getDateTimestamp() }
|
||||
if (!epg.isNullOrEmpty()) {
|
||||
cardView.contentText = epg.last().title
|
||||
viewHolder.binding.desc.text = epg.last().title
|
||||
} else {
|
||||
cardView.contentText = ""
|
||||
viewHolder.binding.desc.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = tvListViewModel.size()
|
||||
|
||||
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
class ViewHolder(itemView: View, var binding: CardBinding) : RecyclerView.ViewHolder(itemView) {
|
||||
val view = itemView
|
||||
|
||||
fun focus(hasFocus: Boolean) {
|
||||
if (hasFocus) {
|
||||
binding.main.setBackgroundResource(R.drawable.rounded_light_bottom)
|
||||
} else {
|
||||
binding.main.setBackgroundResource(R.drawable.rounded_dark_bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateEPG() {
|
||||
for (i in 0 until recyclerView.childCount) {
|
||||
val childView = recyclerView.getChildAt(i)
|
||||
|
||||
val viewHolder = recyclerView.getChildViewHolder(childView) as ViewHolder
|
||||
|
||||
if (viewHolder.view.tag != null && viewHolder.view.tag is TVViewModel) {
|
||||
val tvViewModel = viewHolder.view.tag as TVViewModel
|
||||
|
||||
val epg = tvViewModel.epg.value?.filter { it.beginTime < Utils.getDateTimestamp() }
|
||||
|
||||
if (!epg.isNullOrEmpty()) {
|
||||
val title = epg.last().title
|
||||
if (viewHolder.binding.desc.text != title) {
|
||||
viewHolder.binding.desc.text = title
|
||||
Log.i(TAG, "updateEPG $title")
|
||||
}
|
||||
} else {
|
||||
if (viewHolder.binding.desc.text != "") {
|
||||
viewHolder.binding.desc.text = ""
|
||||
Log.i(TAG, "updateEPG")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun toPosition(position: Int) {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.marginEnd
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.lizongying.mytv.databinding.ChannelBinding
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
@@ -14,8 +17,9 @@ class ChannelFragment : Fragment() {
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val handler = Handler()
|
||||
private val delay: Long = 3000
|
||||
private val delay: Long = 5000
|
||||
private var channel = 0
|
||||
private var channelCount = 0
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
@@ -23,24 +27,45 @@ class ChannelFragment : Fragment() {
|
||||
): View {
|
||||
_binding = ChannelBinding.inflate(inflater, container, false)
|
||||
_binding!!.root.visibility = View.GONE
|
||||
(activity as MainActivity).fragmentReady()
|
||||
|
||||
val application = requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.channel.layoutParams.width = application.px2Px(binding.channel.layoutParams.width)
|
||||
binding.channel.layoutParams.height = application.px2Px(binding.channel.layoutParams.height)
|
||||
|
||||
val layoutParams = binding.channel.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.topMargin = application.px2Px(binding.channel.marginTop)
|
||||
layoutParams.marginEnd = application.px2Px(binding.channel.marginEnd)
|
||||
binding.channel.layoutParams = layoutParams
|
||||
|
||||
binding.content.textSize = application.px2PxFont(binding.content.textSize)
|
||||
binding.time.textSize = application.px2PxFont(binding.time.textSize)
|
||||
|
||||
binding.main.layoutParams.width = application.shouldWidthPx()
|
||||
binding.main.layoutParams.height = application.shouldHeightPx()
|
||||
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
fun show(tvViewModel: TVViewModel) {
|
||||
handler.removeCallbacks(hideRunnable)
|
||||
handler.removeCallbacks(playRunnable)
|
||||
binding.channelContent.text = (tvViewModel.getTV().id.plus(1)).toString()
|
||||
binding.content.text = (tvViewModel.getTV().id.plus(1)).toString()
|
||||
view?.visibility = View.VISIBLE
|
||||
handler.postDelayed(hideRunnable, delay)
|
||||
}
|
||||
|
||||
fun show(channel: String) {
|
||||
this.channel = "${binding.channelContent.text}$channel".toInt()
|
||||
if (channelCount > 1) {
|
||||
return
|
||||
}
|
||||
channelCount++
|
||||
this.channel = "${this.channel}$channel".toInt()
|
||||
handler.removeCallbacks(hideRunnable)
|
||||
handler.removeCallbacks(playRunnable)
|
||||
if (binding.channelContent.text == "") {
|
||||
binding.channelContent.text = channel
|
||||
if (channelCount < 2) {
|
||||
binding.content.text = "${this.channel}"
|
||||
view?.visibility = View.VISIBLE
|
||||
handler.postDelayed(playRunnable, delay)
|
||||
} else {
|
||||
@@ -62,14 +87,18 @@ class ChannelFragment : Fragment() {
|
||||
}
|
||||
|
||||
private val hideRunnable = Runnable {
|
||||
binding.channelContent.text = ""
|
||||
binding.content.text = ""
|
||||
view?.visibility = View.GONE
|
||||
channel = 0
|
||||
channelCount = 0
|
||||
}
|
||||
|
||||
private val playRunnable = Runnable {
|
||||
(activity as MainActivity).play(channel - 1)
|
||||
binding.channelContent.text = ""
|
||||
binding.content.text = ""
|
||||
view?.visibility = View.GONE
|
||||
channel = 0
|
||||
channelCount = 0
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
@@ -7,24 +7,33 @@ import androidx.fragment.app.DialogFragment
|
||||
|
||||
class ConfirmationFragment(
|
||||
private val listener: ConfirmationListener,
|
||||
private val message: String
|
||||
private val message: String,
|
||||
private val update: Boolean
|
||||
) : DialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return activity?.let {
|
||||
val builder = AlertDialog.Builder(it)
|
||||
builder.setTitle("确定更新吗?")
|
||||
.setMessage(message)
|
||||
.setPositiveButton(
|
||||
"确定"
|
||||
) { _, _ ->
|
||||
listener.onConfirm()
|
||||
}
|
||||
.setNegativeButton(
|
||||
"取消"
|
||||
) { _, _ ->
|
||||
listener.onCancel()
|
||||
}
|
||||
builder.setTitle(message)
|
||||
if (update) {
|
||||
builder.setMessage("确定更新吗?")
|
||||
.setPositiveButton(
|
||||
"确定"
|
||||
) { _, _ ->
|
||||
listener.onConfirm()
|
||||
}
|
||||
.setNegativeButton(
|
||||
"取消"
|
||||
) { _, _ ->
|
||||
listener.onCancel()
|
||||
}
|
||||
} else {
|
||||
builder.setMessage("")
|
||||
.setNegativeButton(
|
||||
"好的"
|
||||
) { _, _ ->
|
||||
}
|
||||
}
|
||||
builder.create()
|
||||
} ?: throw IllegalStateException("Activity cannot be null")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.marginStart
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.lizongying.mytv.databinding.ErrorBinding
|
||||
|
||||
class ErrorFragment : Fragment() {
|
||||
private var _binding: ErrorBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = ErrorBinding.inflate(inflater, container, false)
|
||||
|
||||
val application = requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.logo.layoutParams.width = application.px2Px(binding.logo.layoutParams.width)
|
||||
binding.logo.layoutParams.height = application.px2Px(binding.logo.layoutParams.height)
|
||||
|
||||
val layoutParams = binding.msg.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.topMargin = application.px2Px(binding.msg.marginTop)
|
||||
binding.msg.layoutParams = layoutParams
|
||||
|
||||
binding.msg.textSize = application.px2PxFont(binding.msg.textSize)
|
||||
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
fun show(msg: String) {
|
||||
binding.msg.text = msg
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ErrorFragment"
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ val Context.appVersionCode: Long
|
||||
* Return the version name of the app which is defined in build.gradle.
|
||||
* eg:1.0.0
|
||||
*/
|
||||
val Context.appVersionName: String get() = packageInfo.versionName ?: ""
|
||||
val Context.appVersionName: String get() = packageInfo.versionName
|
||||
|
||||
val Context.appSignature: String
|
||||
get() {
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.leanback.widget.ImageCardView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class GrayOverlayItemDecoration(private val context: Context) : RecyclerView.ItemDecoration() {
|
||||
|
||||
private val grayOverlayPaint = Paint().apply {
|
||||
color = ContextCompat.getColor(context, R.color.gray_overlay)
|
||||
style = Paint.Style.FILL
|
||||
}
|
||||
|
||||
override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
|
||||
super.onDrawOver(c, parent, state)
|
||||
|
||||
val childCount = parent.childCount
|
||||
for (i in 0 until childCount) {
|
||||
val child = parent.getChildAt(i)
|
||||
if (!child.hasFocus()) {
|
||||
(child as ImageCardView).setInfoAreaBackgroundColor(ContextCompat.getColor(context, R.color.blur))
|
||||
// child.alpha = 0.5f
|
||||
// 计算遮罩层的大小
|
||||
// val overlayRect = Rect(
|
||||
// child.left,
|
||||
// child.top,
|
||||
// child.right,
|
||||
// child.bottom
|
||||
// )
|
||||
// // 绘制灰色遮罩层
|
||||
// c.drawRect(overlayRect, grayOverlayPaint)
|
||||
} else {
|
||||
(child as ImageCardView).setInfoAreaBackgroundColor(ContextCompat.getColor(context, R.color.focus))
|
||||
// child.alpha = 1f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
// 在此处设置偏移量为0,以防止遮罩层影响项的布局
|
||||
outRect.setEmpty()
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.marginBottom
|
||||
import androidx.core.view.marginStart
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.core.view.setPadding
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.bumptech.glide.Glide
|
||||
import com.lizongying.mytv.databinding.InfoBinding
|
||||
@@ -16,31 +21,64 @@ class InfoFragment : Fragment() {
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val handler = Handler()
|
||||
private val delay: Long = 3000
|
||||
private val delay: Long = 5000
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = InfoBinding.inflate(inflater, container, false)
|
||||
|
||||
val application = requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.info.layoutParams.width = application.px2Px(binding.info.layoutParams.width)
|
||||
binding.info.layoutParams.height = application.px2Px(binding.info.layoutParams.height)
|
||||
|
||||
val layoutParams = binding.info.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.bottomMargin = application.px2Px(binding.info.marginBottom)
|
||||
binding.info.layoutParams = layoutParams
|
||||
|
||||
binding.logo.layoutParams.width = application.px2Px(binding.logo.layoutParams.width)
|
||||
binding.logo.setPadding(application.px2Px(binding.logo.paddingTop))
|
||||
binding.main.layoutParams.width = application.px2Px(binding.main.layoutParams.width)
|
||||
binding.main.setPadding(application.px2Px(binding.main.paddingTop))
|
||||
|
||||
val layoutParamsMain = binding.main.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsMain.marginStart = application.px2Px(binding.main.marginStart)
|
||||
binding.main.layoutParams = layoutParamsMain
|
||||
|
||||
val layoutParamsDesc = binding.desc.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsDesc.topMargin = application.px2Px(binding.desc.marginTop)
|
||||
binding.desc.layoutParams = layoutParamsDesc
|
||||
|
||||
binding.title.textSize = application.px2PxFont(binding.title.textSize)
|
||||
binding.desc.textSize = application.px2PxFont(binding.desc.textSize)
|
||||
|
||||
binding.container.layoutParams.width = application.shouldWidthPx()
|
||||
binding.container.layoutParams.height = application.shouldHeightPx()
|
||||
|
||||
_binding!!.root.visibility = View.GONE
|
||||
(activity as MainActivity).fragmentReady()
|
||||
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
fun show(tvViewModel: TVViewModel) {
|
||||
binding.textView.text = tvViewModel.getTV().title
|
||||
if (_binding == null) {
|
||||
return
|
||||
}
|
||||
binding.title.text = tvViewModel.getTV().title
|
||||
|
||||
Glide.with(this)
|
||||
.load(tvViewModel.getTV().logo)
|
||||
.into(binding.infoLogo)
|
||||
.into(binding.logo)
|
||||
|
||||
Log.i(TAG, "${tvViewModel.getTV().title} ${tvViewModel.epg.value}")
|
||||
val epg = tvViewModel.epg.value?.filter { it.beginTime < Utils.getDateTimestamp() }
|
||||
if (!epg.isNullOrEmpty()) {
|
||||
binding.infoDesc.text = epg.last().title
|
||||
binding.desc.text = epg.last().title
|
||||
} else {
|
||||
binding.infoDesc.text = ""
|
||||
binding.desc.text = ""
|
||||
}
|
||||
|
||||
handler.removeCallbacks(removeRunnable)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class ItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
|
||||
|
||||
private var application: MyTVApplication
|
||||
|
||||
init {
|
||||
application = context.applicationContext as MyTVApplication
|
||||
}
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
val space = application.dp2Px(5)
|
||||
outRect.top = space
|
||||
outRect.bottom = space
|
||||
outRect.left = space
|
||||
outRect.right = space
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.lizongying.mytv.databinding.LoadingBinding
|
||||
|
||||
class LoadingFragment : Fragment() {
|
||||
private var _binding: LoadingBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = LoadingBinding.inflate(inflater, container, false)
|
||||
|
||||
val application = requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.bar.layoutParams.width = application.px2Px(binding.bar.layoutParams.width)
|
||||
binding.bar.layoutParams.height = application.px2Px(binding.bar.layoutParams.height)
|
||||
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "LoadingFragment"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.Network
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
@@ -12,25 +9,34 @@ import android.view.GestureDetector
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
import android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
import com.lizongying.mytv.requests.Request
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPreferenceChangeListener {
|
||||
|
||||
private var ready = 0
|
||||
private val playerFragment = PlayerFragment()
|
||||
private val errorFragment = ErrorFragment()
|
||||
|
||||
private val loadingFragment = LoadingFragment()
|
||||
private val mainFragment = MainFragment()
|
||||
private val infoFragment = InfoFragment()
|
||||
private val channelFragment = ChannelFragment()
|
||||
private var timeFragment = TimeFragment()
|
||||
private val settingFragment = SettingFragment()
|
||||
|
||||
private var doubleBackToExitPressedOnce = false
|
||||
@@ -39,61 +45,98 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
|
||||
private val handler = Handler()
|
||||
private val delayHideMain: Long = 10000
|
||||
private val delayHideSetting: Long = 10000
|
||||
private val delayHideSetting: Long = 15000
|
||||
|
||||
init {
|
||||
Utils.setRequestListener(this)
|
||||
}
|
||||
|
||||
fun syncTime() {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val utilsJob = async(start = CoroutineStart.LAZY) { Utils.init() }
|
||||
|
||||
utilsJob.start()
|
||||
|
||||
// utilsJob.await()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Log.i(TAG, "onCreate")
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContentView(R.layout.activity_main)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
val lp = window.attributes
|
||||
lp.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
window.setAttributes(lp)
|
||||
}
|
||||
|
||||
Request.onCreate()
|
||||
Request.setRequestListener(this)
|
||||
|
||||
window.decorView.apply {
|
||||
systemUiVisibility =
|
||||
SYSTEM_UI_FLAG_FULLSCREEN or
|
||||
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
SYSTEM_UI_FLAG_HIDE_NAVIGATION or
|
||||
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||
}
|
||||
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
window.decorView.systemUiVisibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
window.decorView.systemUiVisibility =
|
||||
SYSTEM_UI_FLAG_FULLSCREEN or
|
||||
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or SYSTEM_UI_FLAG_HIDE_NAVIGATION or
|
||||
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
// window.statusBarColor = Color.TRANSPARENT
|
||||
// window.navigationBarColor = Color.TRANSPARENT
|
||||
// }
|
||||
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
Request.setRequestListener(this)
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
supportFragmentManager.beginTransaction()
|
||||
val transaction = supportFragmentManager.beginTransaction()
|
||||
.add(R.id.main_browse_fragment, playerFragment)
|
||||
.add(R.id.main_browse_fragment, errorFragment)
|
||||
// .add(R.id.main_browse_fragment, loadingFragment)
|
||||
.add(R.id.main_browse_fragment, timeFragment)
|
||||
.add(R.id.main_browse_fragment, infoFragment)
|
||||
.add(R.id.main_browse_fragment, channelFragment)
|
||||
.add(R.id.main_browse_fragment, mainFragment)
|
||||
.hide(mainFragment)
|
||||
.commit()
|
||||
.hide(errorFragment)
|
||||
|
||||
if (!SP.time) {
|
||||
transaction.hide(timeFragment)
|
||||
} else {
|
||||
transaction.show(timeFragment)
|
||||
}
|
||||
|
||||
transaction.commitNow()
|
||||
}
|
||||
gestureDetector = GestureDetector(this, GestureListener())
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val connectivityManager =
|
||||
getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
connectivityManager.registerDefaultNetworkCallback(object :
|
||||
ConnectivityManager.NetworkCallback() {
|
||||
override fun onAvailable(network: Network) {
|
||||
super.onAvailable(network)
|
||||
Log.i(TAG, "net ${Build.VERSION.SDK_INT}")
|
||||
if (this@MainActivity.isNetworkConnected) {
|
||||
Log.i(TAG, "net isNetworkConnected")
|
||||
ready++
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Log.i(TAG, "net ${Build.VERSION.SDK_INT}")
|
||||
ready++
|
||||
}
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// val connectivityManager =
|
||||
// getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
// connectivityManager.registerDefaultNetworkCallback(object :
|
||||
// ConnectivityManager.NetworkCallback() {
|
||||
// override fun onAvailable(network: Network) {
|
||||
// super.onAvailable(network)
|
||||
// Log.i(TAG, "net ${Build.VERSION.SDK_INT}")
|
||||
// if (this@MainActivity.isNetworkConnected) {
|
||||
// Log.i(TAG, "net isNetworkConnected")
|
||||
// ready++
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// Log.i(TAG, "net ${Build.VERSION.SDK_INT}")
|
||||
// ready++
|
||||
// }
|
||||
|
||||
SP.setOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
fun showInfoFragment(tvViewModel: TVViewModel) {
|
||||
@@ -103,6 +146,52 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
}
|
||||
|
||||
fun showErrorFragment(msg: String) {
|
||||
errorFragment.show(msg)
|
||||
if (errorFragment.isVisible) {
|
||||
return
|
||||
}
|
||||
supportFragmentManager.beginTransaction()
|
||||
.show(errorFragment)
|
||||
.commit()
|
||||
}
|
||||
|
||||
fun hideErrorFragment() {
|
||||
errorFragment.show("")
|
||||
if (!errorFragment.isVisible) {
|
||||
return
|
||||
}
|
||||
supportFragmentManager.beginTransaction()
|
||||
.hide(errorFragment)
|
||||
.commit()
|
||||
}
|
||||
|
||||
fun showLoadingFragment() {
|
||||
showFragment(loadingFragment)
|
||||
}
|
||||
|
||||
fun hideLoadingFragment() {
|
||||
hideFragment(loadingFragment)
|
||||
}
|
||||
|
||||
fun showPlayerFragment() {
|
||||
if (playerFragment.isVisible) {
|
||||
return
|
||||
}
|
||||
supportFragmentManager.beginTransaction()
|
||||
.show(playerFragment)
|
||||
.commit()
|
||||
}
|
||||
|
||||
fun hidePlayerFragment() {
|
||||
if (!playerFragment.isVisible) {
|
||||
return
|
||||
}
|
||||
supportFragmentManager.beginTransaction()
|
||||
.hide(playerFragment)
|
||||
.commit()
|
||||
}
|
||||
|
||||
private fun showChannel(channel: String) {
|
||||
if (!mainFragment.isHidden) {
|
||||
return
|
||||
@@ -119,7 +208,6 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
|
||||
fun play(tvViewModel: TVViewModel) {
|
||||
playerFragment.play(tvViewModel)
|
||||
mainFragment.view?.requestFocus()
|
||||
}
|
||||
|
||||
fun play(itemPosition: Int) {
|
||||
@@ -134,14 +222,6 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
mainFragment.next()
|
||||
}
|
||||
|
||||
private fun prevSource() {
|
||||
// mainFragment.prevSource()
|
||||
}
|
||||
|
||||
private fun nextSource() {
|
||||
// mainFragment.nextSource()
|
||||
}
|
||||
|
||||
fun switchMainFragment() {
|
||||
val transaction = supportFragmentManager.beginTransaction()
|
||||
|
||||
@@ -188,14 +268,42 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
}
|
||||
|
||||
fun fragmentReady() {
|
||||
fun fragmentReady(tag: String) {
|
||||
ready++
|
||||
Log.i(TAG, "ready $ready")
|
||||
if (ready == 6) {
|
||||
Log.i(TAG, "ready $tag $ready ")
|
||||
if (ready == 7) {
|
||||
mainFragment.fragmentReady()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showTime() {
|
||||
if (SP.time) {
|
||||
showFragment(timeFragment)
|
||||
} else {
|
||||
hideFragment(timeFragment)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showFragment(fragment: Fragment) {
|
||||
if (!fragment.isHidden) {
|
||||
return
|
||||
}
|
||||
|
||||
supportFragmentManager.beginTransaction()
|
||||
.show(fragment)
|
||||
.commitNow()
|
||||
}
|
||||
|
||||
private fun hideFragment(fragment: Fragment) {
|
||||
if (fragment.isHidden) {
|
||||
return
|
||||
}
|
||||
|
||||
supportFragmentManager.beginTransaction()
|
||||
.hide(fragment)
|
||||
.commitNow()
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
||||
if (event != null) {
|
||||
gestureDetector.onTouchEvent(event)
|
||||
@@ -254,14 +362,12 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
return
|
||||
}
|
||||
|
||||
Log.i(TAG, "settingFragment ${settingFragment.isVisible}")
|
||||
if (!settingFragment.isVisible) {
|
||||
settingFragment.show(supportFragmentManager, "setting")
|
||||
settingDelayHide()
|
||||
} else {
|
||||
handler.removeCallbacks(hideSetting)
|
||||
settingFragment.dismiss()
|
||||
if (settingFragment.isVisible) {
|
||||
return
|
||||
}
|
||||
|
||||
settingFragment.show(supportFragmentManager, TAG)
|
||||
settingDelayHide()
|
||||
}
|
||||
|
||||
private val hideSetting = Runnable {
|
||||
@@ -270,6 +376,10 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideSettingFragment() {
|
||||
handler.postDelayed(hideSetting, 0)
|
||||
}
|
||||
|
||||
private fun channelUp() {
|
||||
if (mainFragment.isHidden) {
|
||||
if (SP.channelReversal) {
|
||||
@@ -309,6 +419,11 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
return
|
||||
}
|
||||
|
||||
if (settingFragment.isVisible) {
|
||||
hideSettingFragment()
|
||||
return
|
||||
}
|
||||
|
||||
if (doubleBackToExitPressedOnce) {
|
||||
super.onBackPressed()
|
||||
return
|
||||
@@ -322,6 +437,11 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
private fun active() {
|
||||
if (settingFragment.isVisible) {
|
||||
settingDelayHide()
|
||||
}
|
||||
}
|
||||
|
||||
fun onKey(keyCode: Int): Boolean {
|
||||
Log.i(TAG, "keyCode $keyCode")
|
||||
@@ -392,7 +512,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_UNKNOWN -> {
|
||||
showSetting()
|
||||
// showSetting()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -412,6 +532,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_ENTER -> {
|
||||
active()
|
||||
switchMainFragment()
|
||||
}
|
||||
|
||||
@@ -420,6 +541,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_DPAD_UP -> {
|
||||
active()
|
||||
channelUp()
|
||||
}
|
||||
|
||||
@@ -428,6 +550,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_DPAD_DOWN -> {
|
||||
active()
|
||||
channelDown()
|
||||
}
|
||||
|
||||
@@ -436,30 +559,19 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
||||
channelUp()
|
||||
// if (mainFragment.isHidden) {
|
||||
// prevSource()
|
||||
// } else {
|
||||
//// if (mainFragment.tvListViewModel.getTVViewModelCurrent()
|
||||
//// ?.getItemPosition() == 0
|
||||
//// ) {
|
||||
////// mainFragment.toLastPosition()
|
||||
//// hideMainFragment()
|
||||
//// }
|
||||
// }
|
||||
active()
|
||||
if (mainFragment.isHidden && !settingFragment.isVisible) {
|
||||
switchMainFragment()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||
channelDown()
|
||||
// if (mainFragment.isHidden) {
|
||||
// nextSource()
|
||||
// } else {
|
||||
//// if (mainFragment.tvListViewModel.getTVViewModelCurrent()
|
||||
//// ?.getItemPosition() == mainFragment.tvListViewModel.maxNum[mainFragment.selectedPosition] - 1
|
||||
//// ) {
|
||||
//// mainFragment.toFirstPosition()
|
||||
//// }
|
||||
// }
|
||||
active()
|
||||
if (mainFragment.isHidden && !settingFragment.isVisible) {
|
||||
showSetting()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
@@ -476,13 +588,20 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
private fun getAppSignature() = this.appSignature
|
||||
|
||||
override fun onStart() {
|
||||
Log.i(TAG, "onStart")
|
||||
Log.i(TAG, "onStart MainActivity")
|
||||
syncTime()
|
||||
super.onStart()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
Log.i(TAG, "onResume")
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
override fun onResumeFragments() {
|
||||
super.onResumeFragments()
|
||||
mainFragment.changeMenu()
|
||||
|
||||
if (!mainFragment.isHidden) {
|
||||
handler.postDelayed(hideMain, delayHideMain)
|
||||
}
|
||||
@@ -500,10 +619,18 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
override fun onRequestFinished(message: String?) {
|
||||
fragmentReady()
|
||||
fragmentReady("request")
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val TAG = "MainActivity"
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(key: String) {
|
||||
Log.i(TAG, "$key changed")
|
||||
when (key) {
|
||||
SP.KEY_GRID -> mainFragment.changeMenu()
|
||||
SP.KEY_TIME -> showTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,22 +2,29 @@ package com.lizongying.mytv
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.GestureDetector
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.marginBottom
|
||||
import androidx.core.view.marginStart
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lizongying.mytv.Utils.dpToPx
|
||||
import com.lizongying.mytv.api.YSP
|
||||
import com.lizongying.mytv.databinding.MenuBinding
|
||||
import com.lizongying.mytv.databinding.RowBinding
|
||||
import com.lizongying.mytv.databinding.ShowBinding
|
||||
import com.lizongying.mytv.models.ProgramType
|
||||
import com.lizongying.mytv.models.TVList
|
||||
import com.lizongying.mytv.models.TVListViewModel
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
import com.lizongying.mytv.requests.Request
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -28,21 +35,52 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
|
||||
private var rowList: MutableList<View> = mutableListOf()
|
||||
|
||||
private var _binding: ShowBinding? = null
|
||||
private var _binding: MenuBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
var tvListViewModel = TVListViewModel()
|
||||
|
||||
private var lastVideoUrl = ""
|
||||
|
||||
private lateinit var application: MyTVApplication
|
||||
|
||||
private lateinit var gestureDetector: GestureDetector
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = ShowBinding.inflate(inflater, container, false)
|
||||
val context = requireContext()
|
||||
_binding = MenuBinding.inflate(inflater, container, false)
|
||||
|
||||
application = requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.menu.layoutParams.width = application.shouldWidthPx()
|
||||
binding.menu.layoutParams.height = application.shouldHeightPx()
|
||||
|
||||
binding.container.setOnClickListener {
|
||||
hideSelf()
|
||||
}
|
||||
|
||||
gestureDetector = GestureDetector(context, GestureListener())
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||
Log.i(TAG, "onSingleTapConfirmed")
|
||||
hideSelf()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideSelf() {
|
||||
requireActivity().supportFragmentManager.beginTransaction()
|
||||
.hide(this)
|
||||
.commit()
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
|
||||
@@ -65,50 +103,75 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
tvViewModel.setItemPosition(idx2)
|
||||
tvListViewModelCurrent.addTVViewModel(tvViewModel)
|
||||
tvListViewModel.addTVViewModel(tvViewModel)
|
||||
|
||||
updateEPG(tvViewModel)
|
||||
}
|
||||
tvListViewModel.maxNum.add(v.size)
|
||||
|
||||
val adapter =
|
||||
CardAdapter(
|
||||
itemBinding.rowItems,
|
||||
itemBinding.items,
|
||||
this,
|
||||
tvListViewModelCurrent,
|
||||
)
|
||||
rowList.add(itemBinding.rowItems)
|
||||
rowList.add(itemBinding.items)
|
||||
|
||||
adapter.setItemListener(this)
|
||||
|
||||
itemBinding.rowHeader.text = k
|
||||
itemBinding.rowItems.tag = idx.toInt()
|
||||
itemBinding.rowItems.adapter = adapter
|
||||
itemBinding.header.text = k
|
||||
itemBinding.items.tag = idx.toInt()
|
||||
itemBinding.items.adapter = adapter
|
||||
|
||||
itemBinding.rowItems.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
itemBinding.items.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
(activity as MainActivity).mainActive()
|
||||
}
|
||||
})
|
||||
|
||||
val itemDecoration = context?.let { GrayOverlayItemDecoration(it) }
|
||||
val itemDecoration = context?.let { ItemDecoration(it) }
|
||||
if (itemDecoration != null) {
|
||||
itemBinding.rowItems.addItemDecoration(itemDecoration)
|
||||
itemBinding.items.addItemDecoration(itemDecoration)
|
||||
}
|
||||
|
||||
if (SP.grid) {
|
||||
itemBinding.rowItems.layoutManager =
|
||||
itemBinding.items.layoutManager =
|
||||
GridLayoutManager(context, 6)
|
||||
itemBinding.rowItems.layoutParams.height =
|
||||
dpToPx(92 * ((tvListViewModelCurrent.size() + 6 - 1) / 6))
|
||||
itemBinding.items.layoutParams.height =
|
||||
application.dp2Px(110 * ((tvListViewModelCurrent.size() + 6 - 1) / 6) + 5)
|
||||
} else {
|
||||
itemBinding.rowItems.layoutManager =
|
||||
itemBinding.items.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
val layoutParams = itemBinding.row.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.topMargin = dpToPx(11F)
|
||||
layoutParams.topMargin = application.dp2Px(11)
|
||||
itemBinding.row.layoutParams = layoutParams
|
||||
itemBinding.row.setOnClickListener {
|
||||
hideSelf()
|
||||
}
|
||||
|
||||
itemBinding.items.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener {
|
||||
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
|
||||
gestureDetector.onTouchEvent(e)
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
|
||||
val layoutParamsHeader =
|
||||
itemBinding.header.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsHeader.topMargin = application.px2Px(itemBinding.header.marginTop)
|
||||
layoutParamsHeader.bottomMargin = application.px2Px(itemBinding.header.marginBottom)
|
||||
layoutParamsHeader.marginStart = application.px2Px(itemBinding.header.marginStart)
|
||||
itemBinding.header.layoutParams = layoutParamsHeader
|
||||
itemBinding.header.textSize = application.px2PxFont(itemBinding.header.textSize)
|
||||
|
||||
content.addView(itemBinding.row)
|
||||
|
||||
idx++
|
||||
@@ -124,8 +187,15 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
if (tvViewModel.errInfo.value != null
|
||||
&& tvViewModel.getTV().id == itemPosition
|
||||
) {
|
||||
Toast.makeText(context, tvViewModel.errInfo.value, Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
if (tvViewModel.errInfo.value == "") {
|
||||
(activity as? MainActivity)?.showPlayerFragment()
|
||||
(activity as? MainActivity)?.hideErrorFragment()
|
||||
(activity as? MainActivity)?.hideLoadingFragment()
|
||||
} else {
|
||||
(activity as? MainActivity)?.hidePlayerFragment()
|
||||
(activity as? MainActivity)?.hideLoadingFragment()
|
||||
(activity as? MainActivity)?.showErrorFragment(tvViewModel.errInfo.value.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
tvViewModel.ready.observe(viewLifecycleOwner) { _ ->
|
||||
@@ -165,12 +235,28 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
(activity as MainActivity).fragmentReady()
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
fun changeMenu() {
|
||||
if (SP.grid) {
|
||||
for (i in rowList) {
|
||||
if (i is RecyclerView) {
|
||||
i.layoutManager = GridLayoutManager(context, 6)
|
||||
i.layoutParams.height =
|
||||
application.dp2Px(110 * (((i.adapter as CardAdapter).getItemCount() + 6 - 1) / 6) + 5)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i in rowList) {
|
||||
if (i is RecyclerView) {
|
||||
i.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
|
||||
i.layoutParams.height = application.dp2Px(110 + 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onKey(keyCode: Int): Boolean {
|
||||
@@ -191,13 +277,14 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
}
|
||||
|
||||
override fun onItemHasFocus(tvViewModel: TVViewModel) {
|
||||
tvListViewModel.setItemPositionCurrent(tvViewModel.getTV().id)
|
||||
|
||||
val row = tvViewModel.getRowPosition()
|
||||
|
||||
for (i in rowList) {
|
||||
if (i.tag as Int != row) {
|
||||
((i as RecyclerView).adapter as CardAdapter).clear()
|
||||
((i as RecyclerView).adapter as CardAdapter).focusable = false
|
||||
(i.adapter as CardAdapter).clear()
|
||||
} else {
|
||||
((i as RecyclerView).adapter as CardAdapter).focusable = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +292,6 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
}
|
||||
|
||||
override fun onItemClicked(tvViewModel: TVViewModel) {
|
||||
Log.i(TAG, "onItemClicked")
|
||||
if (this.isHidden) {
|
||||
(activity as? MainActivity)?.switchMainFragment()
|
||||
return
|
||||
@@ -214,14 +300,15 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
if (itemPosition != tvViewModel.getTV().id) {
|
||||
itemPosition = tvViewModel.getTV().id
|
||||
tvListViewModel.setItemPosition(itemPosition)
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed()
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed("menu")
|
||||
Log.i(TAG, "onItemClicked ${tvViewModel.getTV().id}")
|
||||
}
|
||||
(activity as? MainActivity)?.switchMainFragment()
|
||||
}
|
||||
|
||||
fun setPosition() {
|
||||
val tvViewModel = tvListViewModel.getTVViewModel(itemPosition)
|
||||
val rowPosition = tvViewModel!!.getRowPosition()
|
||||
val tvViewModel = tvListViewModel.getTVViewModel(itemPosition) ?: return
|
||||
val rowPosition = tvViewModel.getRowPosition()
|
||||
val itemPosition = tvViewModel.getItemPosition()
|
||||
setPosition(rowPosition, itemPosition)
|
||||
}
|
||||
@@ -261,8 +348,11 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
}
|
||||
|
||||
fun fragmentReady() {
|
||||
// request.fetchPage()
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed()
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed("init")
|
||||
|
||||
tvListViewModel.tvListViewModel.value?.forEach { tvViewModel ->
|
||||
updateEPG(tvViewModel)
|
||||
}
|
||||
}
|
||||
|
||||
fun play(itemPosition: Int) {
|
||||
@@ -270,7 +360,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
if (itemPosition > -1 && itemPosition < tvListViewModel.size()) {
|
||||
this.itemPosition = itemPosition
|
||||
tvListViewModel.setItemPosition(itemPosition)
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed()
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed("num")
|
||||
} else {
|
||||
Toast.makeText(context, "频道不存在", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
@@ -284,7 +374,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
itemPosition = tvListViewModel.size() - 1
|
||||
}
|
||||
tvListViewModel.setItemPosition(itemPosition)
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed()
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed("prev")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,15 +385,23 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
itemPosition = 0
|
||||
}
|
||||
tvListViewModel.setItemPosition(itemPosition)
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed()
|
||||
tvListViewModel.getTVViewModel(itemPosition)?.changed("next")
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateEPG(tvViewModel: TVViewModel) {
|
||||
if (tvViewModel.getTV().channel == "港澳台") {
|
||||
Request.fetchFEPG(tvViewModel)
|
||||
} else {
|
||||
Request.fetchYEPG(tvViewModel)
|
||||
when (tvViewModel.getTV().programType) {
|
||||
ProgramType.Y_PROTO -> {
|
||||
Request.fetchYProtoEPG(tvViewModel)
|
||||
}
|
||||
|
||||
ProgramType.Y_JCE -> {
|
||||
Request.fetchYJceEPG(tvViewModel)
|
||||
}
|
||||
|
||||
ProgramType.F -> {
|
||||
Request.fetchFEPG(tvViewModel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +410,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
Log.i(TAG, "onHiddenChanged $hidden")
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
val tvModel = tvListViewModel.getTVViewModel(itemPosition)
|
||||
@@ -320,15 +419,17 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
Log.i(TAG, "toPosition $rowPosition $itemPosition")
|
||||
for (i in rowList) {
|
||||
if (i.tag as Int == rowPosition) {
|
||||
((i as RecyclerView).adapter as CardAdapter).toPosition(itemPosition!!)
|
||||
((i as RecyclerView).adapter as CardAdapter).updateEPG()
|
||||
(i.adapter as CardAdapter).focusable = true
|
||||
(i.adapter as CardAdapter).toPosition(itemPosition!!)
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
view?.post {
|
||||
// for (i in rowList) {
|
||||
// ((i as RecyclerView).adapter as CardAdapter).visiable = false
|
||||
// }
|
||||
for (i in rowList) {
|
||||
((i as RecyclerView).adapter as CardAdapter).focusable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -338,13 +439,6 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
Log.i(TAG, "onStop")
|
||||
super.onStop()
|
||||
SP.itemPosition = itemPosition
|
||||
Log.i(TAG, "$POSITION $itemPosition saved")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
Log.i(TAG, "onDestroy")
|
||||
super.onDestroy()
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.WindowManager
|
||||
import androidx.multidex.MultiDex
|
||||
|
||||
|
||||
class MyTVApplication : Application() {
|
||||
private lateinit var displayMetrics: DisplayMetrics
|
||||
private lateinit var realDisplayMetrics: DisplayMetrics
|
||||
|
||||
private lateinit var windowManager: WindowManager
|
||||
|
||||
private var width = 0
|
||||
private var height = 0
|
||||
private var shouldWidth = 0
|
||||
private var shouldHeight = 0
|
||||
private var deviation = 0
|
||||
private var ratio = 1.0
|
||||
private var density = 2.0f
|
||||
private var scale = 1.0f
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
displayMetrics = DisplayMetrics()
|
||||
realDisplayMetrics = DisplayMetrics()
|
||||
windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||
windowManager.defaultDisplay.getRealMetrics(realDisplayMetrics)
|
||||
|
||||
if (realDisplayMetrics.heightPixels > realDisplayMetrics.widthPixels) {
|
||||
width = realDisplayMetrics.heightPixels
|
||||
height = realDisplayMetrics.widthPixels
|
||||
} else {
|
||||
width = realDisplayMetrics.widthPixels
|
||||
height = realDisplayMetrics.heightPixels
|
||||
}
|
||||
|
||||
density = displayMetrics.density
|
||||
|
||||
ratio = if ((width.toDouble() / height) < (16.0 / 9)) {
|
||||
width * 2 / 1920.0 / density
|
||||
} else {
|
||||
height * 2 / 1080.0 / density
|
||||
}
|
||||
|
||||
if ((width.toDouble() / height) < (16.0 / 9.0)) {
|
||||
ratio = width * 2 / 1920.0 / density
|
||||
shouldWidth = width
|
||||
shouldHeight = (width * 9.0 / 16.0).toInt()
|
||||
} else {
|
||||
ratio = height * 2 / 1080.0 / density
|
||||
shouldHeight = height
|
||||
shouldWidth = (height * 16.0 / 9.0).toInt()
|
||||
}
|
||||
|
||||
deviation = width - Resources.getSystem().displayMetrics.widthPixels
|
||||
scale = Resources.getSystem().displayMetrics.scaledDensity
|
||||
}
|
||||
|
||||
fun getDisplayMetrics(): DisplayMetrics {
|
||||
return displayMetrics
|
||||
}
|
||||
|
||||
fun getRealDisplayMetrics(): DisplayMetrics {
|
||||
return realDisplayMetrics
|
||||
}
|
||||
|
||||
fun shouldWidthPx(): Int {
|
||||
return shouldWidth
|
||||
}
|
||||
|
||||
fun shouldHeightPx(): Int {
|
||||
return shouldHeight
|
||||
}
|
||||
|
||||
fun getWidth(): Int {
|
||||
return width
|
||||
}
|
||||
|
||||
fun getHeight(): Int {
|
||||
return height
|
||||
}
|
||||
|
||||
fun getDeviation(): Int {
|
||||
return deviation
|
||||
}
|
||||
|
||||
fun getRatio(): Double {
|
||||
return ratio
|
||||
}
|
||||
|
||||
fun dp2Px(dp: Int): Int {
|
||||
return (dp * ratio * density + 0.5f).toInt()
|
||||
}
|
||||
|
||||
fun px2Px(px: Int): Int {
|
||||
return (px * ratio + 0.5f).toInt()
|
||||
}
|
||||
|
||||
fun px2PxFont(px: Float): Float {
|
||||
return (px * ratio / scale).toFloat()
|
||||
}
|
||||
|
||||
fun sp2Px(sp: Float): Float {
|
||||
return (sp * ratio * scale).toFloat()
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context?) {
|
||||
super.attachBaseContext(base)
|
||||
MultiDex.install(base)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
|
||||
interface OnSharedPreferenceChangeListener {
|
||||
fun onSharedPreferenceChanged(key: String)
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package com.lizongying.mytv
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.SurfaceHolder
|
||||
import android.view.SurfaceView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
@@ -17,45 +15,37 @@ import androidx.media3.common.VideoSize
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.ui.PlayerView
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer
|
||||
import com.lizongying.mytv.databinding.PlayerBinding
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
|
||||
|
||||
class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
class PlayerFragment : Fragment() {
|
||||
|
||||
private var _binding: PlayerBinding? = null
|
||||
private var playerView: PlayerView? = null
|
||||
private var tvViewModel: TVViewModel? = null
|
||||
private val aspectRatio = 16f / 9f
|
||||
|
||||
|
||||
private lateinit var surfaceView: SurfaceView
|
||||
private lateinit var surfaceHolder: SurfaceHolder
|
||||
private var exoPlayer: SimpleExoPlayer? = null
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = PlayerBinding.inflate(inflater, container, false)
|
||||
|
||||
if (Utils.isTmallDevice()) {
|
||||
_binding!!.playerView.visibility = View.GONE
|
||||
surfaceView = _binding!!.surfaceView
|
||||
surfaceHolder = surfaceView.holder
|
||||
surfaceHolder.addCallback(this)
|
||||
} else {
|
||||
_binding!!.surfaceView.visibility = View.GONE
|
||||
playerView = _binding!!.playerView
|
||||
}
|
||||
playerView = _binding!!.playerView
|
||||
|
||||
playerView?.viewTreeObserver?.addOnGlobalLayoutListener(object :
|
||||
ViewTreeObserver.OnGlobalLayoutListener {
|
||||
@OptIn(UnstableApi::class)
|
||||
override fun onGlobalLayout() {
|
||||
playerView!!.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
|
||||
// val renderersFactory = context?.let { DefaultRenderersFactory(it) }
|
||||
// renderersFactory?.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON)
|
||||
|
||||
playerView!!.player = activity?.let {
|
||||
ExoPlayer.Builder(it)
|
||||
// .setRenderersFactory(renderersFactory!!)
|
||||
.build()
|
||||
}
|
||||
playerView!!.player?.playWhenReady = true
|
||||
@@ -78,14 +68,22 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
|
||||
override fun onPlayerError(error: PlaybackException) {
|
||||
super.onPlayerError(error)
|
||||
|
||||
Log.e(TAG, "PlaybackException $error")
|
||||
tvViewModel?.changed()
|
||||
val err = "播放错误"
|
||||
tvViewModel?.setErrInfo(err)
|
||||
tvViewModel?.changed("retry")
|
||||
}
|
||||
|
||||
override fun onIsPlayingChanged(isPlaying: Boolean) {
|
||||
super.onIsPlayingChanged(isPlaying)
|
||||
if (isPlaying) {
|
||||
tvViewModel?.setErrInfo("")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
(activity as MainActivity).fragmentReady()
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
return _binding!!.root
|
||||
}
|
||||
|
||||
@@ -96,10 +94,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
setMediaItem(MediaItem.fromUri(tvViewModel.getVideoUrlCurrent()))
|
||||
prepare()
|
||||
}
|
||||
exoPlayer?.run {
|
||||
setMediaItem(com.google.android.exoplayer2.MediaItem.fromUri(tvViewModel.getVideoUrlCurrent()))
|
||||
prepare()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
@@ -110,11 +104,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
playerView!!.player?.prepare()
|
||||
playerView!!.player?.play()
|
||||
}
|
||||
if (exoPlayer?.isPlaying == false) {
|
||||
Log.i(TAG, "replay")
|
||||
exoPlayer?.prepare()
|
||||
exoPlayer?.play()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@@ -127,9 +116,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
if (playerView != null && playerView!!.player?.isPlaying == true) {
|
||||
playerView!!.player?.stop()
|
||||
}
|
||||
if (exoPlayer?.isPlaying == true) {
|
||||
exoPlayer?.stop()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
@@ -137,7 +123,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
if (playerView != null) {
|
||||
playerView!!.player?.release()
|
||||
}
|
||||
exoPlayer?.release()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
@@ -146,18 +131,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "PlaybackVideoFragment"
|
||||
}
|
||||
|
||||
override fun surfaceCreated(holder: SurfaceHolder) {
|
||||
exoPlayer = SimpleExoPlayer.Builder(requireContext()).build()
|
||||
exoPlayer?.setVideoSurfaceHolder(surfaceHolder)
|
||||
exoPlayer?.playWhenReady = true
|
||||
}
|
||||
|
||||
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
|
||||
}
|
||||
|
||||
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
||||
private const val TAG = "PlayerFragment"
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,12 @@ object SP {
|
||||
// If use channel num to select channel or not
|
||||
private const val KEY_CHANNEL_NUM = "channel_num"
|
||||
|
||||
const val KEY_TIME = "time"
|
||||
|
||||
// If start app on device boot or not
|
||||
private const val KEY_BOOT_STARTUP = "boot_startup"
|
||||
|
||||
private const val KEY_GRID = "grid"
|
||||
const val KEY_GRID = "grid"
|
||||
|
||||
// Position in list of the selected channel item
|
||||
private const val KEY_POSITION = "position"
|
||||
@@ -26,6 +28,8 @@ object SP {
|
||||
|
||||
private lateinit var sp: SharedPreferences
|
||||
|
||||
private var listener: OnSharedPreferenceChangeListener? = null
|
||||
|
||||
/**
|
||||
* The method must be invoked as early as possible(At least before using the keys)
|
||||
*/
|
||||
@@ -33,6 +37,10 @@ object SP {
|
||||
sp = context.getSharedPreferences(SP_FILE_NAME, Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
fun setOnSharedPreferenceChangeListener(listener: OnSharedPreferenceChangeListener) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
var channelReversal: Boolean
|
||||
get() = sp.getBoolean(KEY_CHANNEL_REVERSAL, false)
|
||||
set(value) = sp.edit().putBoolean(KEY_CHANNEL_REVERSAL, value).apply()
|
||||
@@ -41,13 +49,27 @@ object SP {
|
||||
get() = sp.getBoolean(KEY_CHANNEL_NUM, true)
|
||||
set(value) = sp.edit().putBoolean(KEY_CHANNEL_NUM, value).apply()
|
||||
|
||||
var time: Boolean
|
||||
get() = sp.getBoolean(KEY_TIME, true)
|
||||
set(value) {
|
||||
if (value != this.time) {
|
||||
sp.edit().putBoolean(KEY_TIME, value).apply()
|
||||
listener?.onSharedPreferenceChanged(KEY_TIME)
|
||||
}
|
||||
}
|
||||
|
||||
var bootStartup: Boolean
|
||||
get() = sp.getBoolean(KEY_BOOT_STARTUP, false)
|
||||
set(value) = sp.edit().putBoolean(KEY_BOOT_STARTUP, value).apply()
|
||||
|
||||
var grid: Boolean
|
||||
get() = sp.getBoolean(KEY_GRID, false)
|
||||
set(value) = sp.edit().putBoolean(KEY_GRID, value).apply()
|
||||
set(value) {
|
||||
if (value != this.grid) {
|
||||
sp.edit().putBoolean(KEY_GRID, value).apply()
|
||||
listener?.onSharedPreferenceChanged(KEY_GRID)
|
||||
}
|
||||
}
|
||||
|
||||
var itemPosition: Int
|
||||
get() = sp.getInt(KEY_POSITION, 0)
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.marginEnd
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.lizongying.mytv.api.YSP
|
||||
import com.lizongying.mytv.databinding.SettingBinding
|
||||
|
||||
|
||||
@@ -15,6 +25,19 @@ class SettingFragment : DialogFragment() {
|
||||
|
||||
private lateinit var updateManager: UpdateManager
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
dialog?.window?.apply {
|
||||
addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||
setAttributes(attributes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setStyle(STYLE_NO_TITLE, 0)
|
||||
@@ -46,6 +69,14 @@ class SettingFragment : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
binding.switchTime.run {
|
||||
isChecked = SP.time
|
||||
setOnCheckedChangeListener { _, isChecked ->
|
||||
SP.time = isChecked
|
||||
(activity as MainActivity).settingDelayHide()
|
||||
}
|
||||
}
|
||||
|
||||
binding.switchBootStartup.run {
|
||||
isChecked = SP.bootStartup
|
||||
setOnCheckedChangeListener { _, isChecked ->
|
||||
@@ -62,31 +93,133 @@ class SettingFragment : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
updateManager = UpdateManager(context, this, context.appVersionCode)
|
||||
binding.checkVersion.setOnClickListener(
|
||||
OnClickListenerCheckVersion(
|
||||
activity as MainActivity,
|
||||
updateManager
|
||||
)
|
||||
binding.checkVersion.setOnClickListener {
|
||||
(activity as MainActivity).settingDelayHide()
|
||||
requestInstallPermissions()
|
||||
}
|
||||
|
||||
binding.clear.setOnClickListener {
|
||||
(requireActivity() as MainActivity).syncTime()
|
||||
SP.guid = ""
|
||||
YSP.getGuid()
|
||||
}
|
||||
|
||||
val application = requireActivity().applicationContext as MyTVApplication
|
||||
val textSize = application.px2PxFont(binding.switchChannelReversal.textSize)
|
||||
|
||||
binding.content.layoutParams.width =
|
||||
application.px2Px(binding.content.layoutParams.width)
|
||||
binding.content.setPadding(
|
||||
application.px2Px(binding.content.paddingLeft),
|
||||
application.px2Px(binding.content.paddingTop),
|
||||
application.px2Px(binding.content.paddingRight),
|
||||
application.px2Px(binding.content.paddingBottom)
|
||||
)
|
||||
binding.name.textSize = application.px2PxFont(binding.name.textSize)
|
||||
binding.version.textSize = textSize
|
||||
val layoutParamsVersion = binding.version.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsVersion.topMargin = application.px2Px(binding.version.marginTop)
|
||||
binding.version.layoutParams = layoutParamsVersion
|
||||
|
||||
binding.checkVersion.textSize = textSize
|
||||
val layoutParamsCheckVersion =
|
||||
binding.checkVersion.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsCheckVersion.marginEnd = application.px2Px(binding.checkVersion.marginEnd)
|
||||
binding.checkVersion.layoutParams = layoutParamsCheckVersion
|
||||
|
||||
binding.versionName.textSize = textSize
|
||||
|
||||
binding.clear.textSize = textSize
|
||||
binding.exit.textSize = textSize
|
||||
|
||||
val layoutParamsChannelSwitch =
|
||||
binding.switchChannelReversal.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsChannelSwitch.topMargin =
|
||||
application.px2Px(binding.switchChannelReversal.marginTop)
|
||||
|
||||
binding.switchChannelReversal.textSize = textSize
|
||||
binding.switchChannelReversal.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchChannelNum.textSize = textSize
|
||||
binding.switchChannelNum.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchTime.textSize = textSize
|
||||
binding.switchTime.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchBootStartup.textSize = textSize
|
||||
binding.switchBootStartup.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchGrid.textSize = textSize
|
||||
binding.switchGrid.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.appreciate.layoutParams.width =
|
||||
application.px2Px(binding.appreciate.layoutParams.width)
|
||||
|
||||
binding.exit.setOnClickListener {
|
||||
requireActivity().finishAffinity()
|
||||
}
|
||||
|
||||
updateManager = UpdateManager(context, context.appVersionCode)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
fun setVersionName(versionName: String) {
|
||||
if (_binding != null) {
|
||||
binding.versionName.text = versionName
|
||||
private fun requestInstallPermissions() {
|
||||
val context = requireContext()
|
||||
val permissionsList: MutableList<String> = ArrayList()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !context.packageManager.canRequestPackageInstalls()) {
|
||||
permissionsList.add(Manifest.permission.REQUEST_INSTALL_PACKAGES)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
ContextCompat.checkSelfPermission(
|
||||
context,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
permissionsList.add(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
ContextCompat.checkSelfPermission(
|
||||
context,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
permissionsList.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
|
||||
if (permissionsList.isNotEmpty()) {
|
||||
ActivityCompat.requestPermissions(
|
||||
requireActivity(),
|
||||
permissionsList.toTypedArray<String>(),
|
||||
PERMISSIONS_REQUEST_CODE
|
||||
)
|
||||
} else {
|
||||
updateManager.checkAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
internal class OnClickListenerCheckVersion(
|
||||
private val mainActivity: MainActivity,
|
||||
private val updateManager: UpdateManager
|
||||
) :
|
||||
View.OnClickListener {
|
||||
override fun onClick(view: View?) {
|
||||
mainActivity.settingDelayHide()
|
||||
updateManager.checkAndUpdate()
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == PERMISSIONS_REQUEST_CODE) {
|
||||
var allPermissionsGranted = true
|
||||
for (result in grantResults) {
|
||||
if (result != PackageManager.PERMISSION_GRANTED) {
|
||||
allPermissionsGranted = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (allPermissionsGranted) {
|
||||
updateManager.checkAndUpdate()
|
||||
} else {
|
||||
Toast.makeText(context, "权限授权失败", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +230,7 @@ class SettingFragment : DialogFragment() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "SettingFragment"
|
||||
const val PERMISSIONS_REQUEST_CODE = 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.marginEnd
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.lizongying.mytv.Utils.getDateFormat
|
||||
import com.lizongying.mytv.databinding.TimeBinding
|
||||
|
||||
class TimeFragment : Fragment() {
|
||||
private var _binding: TimeBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val handler = Handler()
|
||||
private val delay: Long = 1000
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = TimeBinding.inflate(inflater, container, false)
|
||||
|
||||
val application = requireActivity().applicationContext as MyTVApplication
|
||||
|
||||
binding.time.layoutParams.width = application.px2Px(binding.time.layoutParams.width)
|
||||
binding.time.layoutParams.height = application.px2Px(binding.time.layoutParams.height)
|
||||
|
||||
val layoutParams = binding.time.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParams.topMargin = application.px2Px(binding.time.marginTop)
|
||||
layoutParams.marginEnd = application.px2Px(binding.time.marginEnd)
|
||||
binding.time.layoutParams = layoutParams
|
||||
|
||||
binding.content.textSize = application.px2PxFont(binding.content.textSize)
|
||||
binding.channel.textSize = application.px2PxFont(binding.channel.textSize)
|
||||
|
||||
binding.main.layoutParams.width = application.shouldWidthPx()
|
||||
binding.main.layoutParams.height = application.shouldHeightPx()
|
||||
|
||||
if (SP.time) {
|
||||
handler.removeCallbacks(showRunnable)
|
||||
handler.postDelayed(showRunnable, 0)
|
||||
} else {
|
||||
handler.removeCallbacks(showRunnable)
|
||||
}
|
||||
|
||||
(activity as MainActivity).fragmentReady(TAG)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
handler.removeCallbacks(showRunnable)
|
||||
handler.postDelayed(showRunnable, 0)
|
||||
} else {
|
||||
handler.removeCallbacks(showRunnable)
|
||||
}
|
||||
}
|
||||
|
||||
private val showRunnable: Runnable = Runnable {
|
||||
run {
|
||||
if (_binding == null) {
|
||||
return@Runnable
|
||||
}
|
||||
binding.content.text = getDateFormat("HH:mm")
|
||||
handler.postDelayed(showRunnable, delay)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
handler.removeCallbacks(showRunnable)
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TimeFragment"
|
||||
}
|
||||
}
|
||||
@@ -1,206 +1,73 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.DownloadManager
|
||||
import android.app.DownloadManager.Request
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.PermissionChecker
|
||||
import androidx.core.content.PermissionChecker.checkSelfPermission
|
||||
import com.lizongying.mytv.api.ReleaseV2
|
||||
import com.lizongying.mytv.requests.MyRequest
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.work.OneTimeWorkRequestBuilder
|
||||
import androidx.work.WorkManager
|
||||
import androidx.work.workDataOf
|
||||
import com.lizongying.mytv.api.ApiClient
|
||||
import com.lizongying.mytv.requests.ReleaseRequest
|
||||
import com.lizongying.mytv.requests.ReleaseResponse
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
|
||||
|
||||
class UpdateManager(
|
||||
private var context: Context,
|
||||
private var settingFragment: SettingFragment,
|
||||
private var versionCode: Long
|
||||
) :
|
||||
ConfirmationFragment.ConfirmationListener {
|
||||
|
||||
private var myRequest = MyRequest()
|
||||
private var release: ReleaseV2? = null
|
||||
|
||||
private var downloadReceiver: DownloadReceiver? = null
|
||||
private var releaseRequest = ReleaseRequest()
|
||||
private var release: ReleaseResponse? = null
|
||||
|
||||
fun checkAndUpdate() {
|
||||
if (!haveStoragePermission()) {
|
||||
return
|
||||
}
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
var text = "版本获取失败"
|
||||
var update = false
|
||||
try {
|
||||
release = myRequest.getRelease()
|
||||
Log.i(TAG, "versionCode $versionCode ${release?.c}")
|
||||
if (release?.c != null) {
|
||||
text = if (release?.c!! > versionCode) {
|
||||
"最新版本:${release?.n}\n${release?.d ?: ""}"
|
||||
release = releaseRequest.getRelease()
|
||||
val code = release?.version_code
|
||||
if (code != null) {
|
||||
if (code.toLong() > versionCode) {
|
||||
text = "最新版本:${release?.version_name}"
|
||||
update = true
|
||||
} else {
|
||||
"已是最新版本,不需要更新"
|
||||
text = "已是最新版本,不需要更新"
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error occurred: ${e.message}", e)
|
||||
}
|
||||
updateUI(text)
|
||||
updateUI(text, update)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUI(text: String) {
|
||||
val dialog = ConfirmationFragment(this@UpdateManager, text)
|
||||
dialog.show(settingFragment.fragmentManager, TAG)
|
||||
private fun updateUI(text: String, update: Boolean) {
|
||||
val dialog = ConfirmationFragment(this@UpdateManager, text, update)
|
||||
dialog.show((context as FragmentActivity).supportFragmentManager, TAG)
|
||||
}
|
||||
|
||||
private fun haveStoragePermission(): Boolean {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
if (checkSelfPermission(context, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
=== PermissionChecker.PERMISSION_GRANTED
|
||||
) {
|
||||
Log.e("Permission error", "You have permission")
|
||||
return true
|
||||
} else {
|
||||
Log.e("Permission error", "You have asked for permission")
|
||||
ActivityCompat.requestPermissions(
|
||||
context as Activity, arrayOf(
|
||||
android.Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
), 1
|
||||
)
|
||||
return false
|
||||
}
|
||||
} else { //you don't need to worry about these stuff below api level 23
|
||||
Log.e("Permission error", "You already have the permission")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun startDownload(release: ReleaseV2) {
|
||||
val apkFileName = "my-tv-${release.n}.apk"
|
||||
Log.i(TAG, "apkFileName $apkFileName")
|
||||
val downloadManager =
|
||||
context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val request = Request(Uri.parse(release.u))
|
||||
Log.i(TAG, "url ${Uri.parse(release.u)}")
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.mkdirs()
|
||||
request.setDestinationInExternalFilesDir(
|
||||
context,
|
||||
Environment.DIRECTORY_DOWNLOADS,
|
||||
apkFileName
|
||||
)
|
||||
request.setTitle("${settingFragment.resources.getString(R.string.app_name)} ${release.n}")
|
||||
request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
||||
request.setAllowedOverRoaming(false)
|
||||
request.setMimeType("application/vnd.android.package-archive")
|
||||
|
||||
// 获取下载任务的引用
|
||||
val downloadReference = downloadManager.enqueue(request)
|
||||
|
||||
downloadReceiver = DownloadReceiver(context, apkFileName, downloadReference)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.registerReceiver(
|
||||
downloadReceiver,
|
||||
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE),
|
||||
Context.RECEIVER_NOT_EXPORTED,
|
||||
)
|
||||
} else {
|
||||
context.registerReceiver(
|
||||
downloadReceiver,
|
||||
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
|
||||
)
|
||||
}
|
||||
|
||||
getDownloadProgress(context, downloadReference) { progress ->
|
||||
println("Download progress: $progress%")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDownloadProgress(
|
||||
context: Context,
|
||||
downloadId: Long,
|
||||
progressListener: (Int) -> Unit
|
||||
) {
|
||||
val downloadManager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
val intervalMillis: Long = 1000
|
||||
|
||||
handler.post(object : Runnable {
|
||||
override fun run() {
|
||||
Log.i(TAG, "search")
|
||||
val query = DownloadManager.Query().setFilterById(downloadId)
|
||||
val cursor: Cursor = downloadManager.query(query)
|
||||
cursor.use {
|
||||
if (it.moveToFirst()) {
|
||||
val bytesDownloadedIndex =
|
||||
it.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)
|
||||
val bytesTotalIndex =
|
||||
it.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)
|
||||
|
||||
// 检查列名是否存在
|
||||
if (bytesDownloadedIndex != -1 && bytesTotalIndex != -1) {
|
||||
val bytesDownloaded = it.getInt(bytesDownloadedIndex)
|
||||
val bytesTotal = it.getInt(bytesTotalIndex)
|
||||
|
||||
if (bytesTotal != -1) {
|
||||
val progress = (bytesDownloaded * 100L / bytesTotal).toInt()
|
||||
progressListener(progress)
|
||||
if (progress == 100) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handler.postDelayed(this, intervalMillis)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private class DownloadReceiver(
|
||||
private val context: Context,
|
||||
private val apkFileName: String,
|
||||
private val downloadReference: Long
|
||||
) : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val reference = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
|
||||
Log.i(TAG, "reference $reference")
|
||||
val progress = intent.getIntExtra("progress", 0)
|
||||
Log.i(TAG, "progress $progress")
|
||||
|
||||
// 检查是否是我们发起的下载
|
||||
if (reference == downloadReference) {
|
||||
// 下载完成,触发安装
|
||||
installNewVersion()
|
||||
}
|
||||
}
|
||||
|
||||
private fun installNewVersion() {
|
||||
val installIntent = Intent(Intent.ACTION_VIEW)
|
||||
val apkUri = Uri.fromFile(
|
||||
File(
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
|
||||
apkFileName
|
||||
private fun startDownload(context: Context, release: ReleaseResponse) {
|
||||
val versionName = release.version_name
|
||||
val apkName = "my-tv"
|
||||
val apkFileName = "$apkName-${release.version_name}.apk"
|
||||
val downloadUrl =
|
||||
"${ApiClient.DOWNLOAD_HOST}${release.version_name}/$apkName-${release.version_name}.apk"
|
||||
Log.i(TAG, "downloadUrl: $downloadUrl")
|
||||
val downloadRequest = OneTimeWorkRequestBuilder<UpdateWorker>()
|
||||
.setInputData(
|
||||
workDataOf(
|
||||
"VERSION_NAME" to versionName,
|
||||
"APK_FILENAME" to apkFileName,
|
||||
"DOWNLOAD_URL" to downloadUrl
|
||||
)
|
||||
)
|
||||
installIntent.setDataAndType(apkUri, "application/vnd.android.package-archive")
|
||||
installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(installIntent)
|
||||
}
|
||||
.build()
|
||||
|
||||
WorkManager.getInstance(context).enqueue(downloadRequest)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -209,16 +76,9 @@ class UpdateManager(
|
||||
|
||||
override fun onConfirm() {
|
||||
Log.i(TAG, "onConfirm $release")
|
||||
release?.let { startDownload(it) }
|
||||
release?.let { startDownload(context, it) }
|
||||
}
|
||||
|
||||
override fun onCancel() {
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
if (downloadReceiver != null) {
|
||||
context.unregisterReceiver(downloadReceiver)
|
||||
Log.i(TAG, "destroy downloadReceiver")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.app.DownloadManager
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.work.CoroutineWorker
|
||||
import androidx.work.WorkerParameters
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
|
||||
class UpdateWorker(context: Context, params: WorkerParameters) : CoroutineWorker(context, params) {
|
||||
|
||||
private lateinit var notificationManager: NotificationManager
|
||||
private lateinit var notificationBuilder: NotificationCompat.Builder
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
val downloadUrl = inputData.getString("DOWNLOAD_URL") ?: return Result.failure()
|
||||
val apkFileName = inputData.getString("APK_FILENAME") ?: return Result.failure()
|
||||
val versionName = inputData.getString("VERSION_NAME") ?: return Result.failure()
|
||||
|
||||
showNotification(applicationContext)
|
||||
|
||||
return withContext(Dispatchers.IO) {
|
||||
try {
|
||||
downloadAndInstall(applicationContext, downloadUrl, apkFileName, versionName)
|
||||
Result.success()
|
||||
} catch (e: Exception) {
|
||||
Result.failure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showNotification(context: Context) {
|
||||
notificationManager =
|
||||
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationBuilder = NotificationCompat.Builder(context, "download_channel").apply {
|
||||
setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
setContentTitle("Downloading Update")
|
||||
setContentText("Download in progress")
|
||||
priority = NotificationCompat.PRIORITY_LOW
|
||||
setOngoing(true)
|
||||
setProgress(100, 0, false)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val channel = NotificationChannel(
|
||||
"download_channel",
|
||||
"Download Updates",
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
notificationManager.createNotificationChannel(channel)
|
||||
}
|
||||
|
||||
notificationManager.notify(1, notificationBuilder.build())
|
||||
}
|
||||
|
||||
private fun downloadAndInstall(
|
||||
context: Context,
|
||||
downloadUrl: String,
|
||||
apkFileName: String,
|
||||
versionName: String
|
||||
) {
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.mkdirs()
|
||||
Log.i(TAG, "save dir ${Environment.DIRECTORY_DOWNLOADS}")
|
||||
val request = DownloadManager.Request(Uri.parse(downloadUrl)).apply {
|
||||
setTitle("${context.resources.getString(R.string.app_name)} $versionName Downloading")
|
||||
setDescription("Downloading the latest version of the app")
|
||||
setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, apkFileName)
|
||||
|
||||
setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
||||
// setAllowedOverRoaming(false)
|
||||
setMimeType("application/vnd.android.package-archive")
|
||||
}
|
||||
|
||||
val manager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val downloadId = manager.enqueue(request)
|
||||
|
||||
var downloading = true
|
||||
while (downloading) {
|
||||
val query = DownloadManager.Query().setFilterById(downloadId)
|
||||
val cursor = manager.query(query)
|
||||
if (cursor.moveToFirst()) {
|
||||
val bytesDownloaded =
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR))
|
||||
val bytesTotal =
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES))
|
||||
|
||||
if (bytesTotal > 0) {
|
||||
val progress = (bytesDownloaded * 100L / bytesTotal).toInt()
|
||||
notificationBuilder.setProgress(100, progress, false)
|
||||
notificationManager.notify(1, notificationBuilder.build())
|
||||
}
|
||||
|
||||
when (cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS))) {
|
||||
DownloadManager.STATUS_SUCCESSFUL -> downloading = false
|
||||
DownloadManager.STATUS_FAILED -> {
|
||||
downloading = false
|
||||
throw Exception("Download failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor.close()
|
||||
}
|
||||
|
||||
notificationBuilder.setContentText("Download complete")
|
||||
.setProgress(0, 0, false)
|
||||
.setOngoing(false)
|
||||
notificationManager.notify(1, notificationBuilder.build())
|
||||
|
||||
val apkFile = File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
apkFileName
|
||||
)
|
||||
|
||||
if (apkFile.exists()) {
|
||||
val apkUri: Uri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
FileProvider.getUriForFile(context, context.packageName + ".fileprovider", apkFile)
|
||||
.apply {
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||
}
|
||||
} else {
|
||||
Uri.parse("file://${apkFile.absolutePath}")
|
||||
// Uri.fromFile(apkFile)
|
||||
}
|
||||
// val apkUri = Uri.parse("file://$apkFile")
|
||||
Log.i(TAG, "apkUri $apkUri")
|
||||
val installIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(apkUri, "application/vnd.android.package-archive")
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
||||
context.startActivity(installIntent)
|
||||
} else {
|
||||
Log.e(TAG, "APK file does not exist!")
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "UpdateWorker"
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,11 @@ import android.os.Build
|
||||
import android.util.TypedValue
|
||||
import com.google.gson.Gson
|
||||
import com.lizongying.mytv.api.TimeResponse
|
||||
import com.lizongying.mytv.requests.Request
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import java.io.IOException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
@@ -15,6 +18,8 @@ import java.util.Locale
|
||||
object Utils {
|
||||
private var between: Long = 0
|
||||
|
||||
private var listener: Request.RequestListener? = null
|
||||
|
||||
fun getDateFormat(format: String): String {
|
||||
return SimpleDateFormat(
|
||||
format,
|
||||
@@ -31,13 +36,32 @@ object Utils {
|
||||
}
|
||||
|
||||
suspend fun init() {
|
||||
var currentTimeMillis: Long = 0
|
||||
try {
|
||||
currentTimeMillis = getTimestampFromServer()
|
||||
val currentTimeMillis = getTimestampFromServer()
|
||||
if (currentTimeMillis > 0) {
|
||||
between = System.currentTimeMillis() - currentTimeMillis
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
println("Failed to retrieve timestamp from server: ${e.message}")
|
||||
}
|
||||
between = System.currentTimeMillis() - currentTimeMillis
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
listener?.onRequestFinished(null)
|
||||
}
|
||||
}
|
||||
|
||||
class RetryInterceptor(private val maxRetry: Int) : Interceptor {
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request = chain.request()
|
||||
var response = chain.proceed(request)
|
||||
var tryCount = 0
|
||||
while (!response.isSuccessful && tryCount < maxRetry) {
|
||||
tryCount++
|
||||
response = chain.proceed(request)
|
||||
}
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,8 +71,8 @@ object Utils {
|
||||
private suspend fun getTimestampFromServer(): Long {
|
||||
return withContext(Dispatchers.IO) {
|
||||
val client = okhttp3.OkHttpClient.Builder()
|
||||
.connectTimeout(500, java.util.concurrent.TimeUnit.MILLISECONDS)
|
||||
.readTimeout(1, java.util.concurrent.TimeUnit.SECONDS).build()
|
||||
.addInterceptor(RetryInterceptor(3))
|
||||
.build()
|
||||
val request = okhttp3.Request.Builder()
|
||||
.url("https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp")
|
||||
.build()
|
||||
@@ -59,7 +83,6 @@ object Utils {
|
||||
Gson().fromJson(string, TimeResponse::class.java).data.t.toLong()
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
// Handle network errors
|
||||
throw IOException("Error during network request", e)
|
||||
}
|
||||
}
|
||||
@@ -72,10 +95,26 @@ object Utils {
|
||||
}
|
||||
|
||||
fun dpToPx(dp: Int): Int {
|
||||
// val density = Resources.getSystem().displayMetrics.density
|
||||
// return (dp * density + 0.5f).toInt()
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, dp.toFloat(), Resources.getSystem().displayMetrics
|
||||
).toInt()
|
||||
}
|
||||
|
||||
fun pxToDp(px: Float): Int {
|
||||
val scale = Resources.getSystem().displayMetrics.density
|
||||
return (px / scale).toInt()
|
||||
}
|
||||
|
||||
fun pxToDp(px: Int): Int {
|
||||
val scale = Resources.getSystem().displayMetrics.density
|
||||
return (px / scale).toInt()
|
||||
}
|
||||
|
||||
fun isTmallDevice() = Build.MANUFACTURER.equals("Tmall", ignoreCase = true)
|
||||
|
||||
fun setRequestListener(listener: Request.RequestListener) {
|
||||
this.listener = listener
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package com.lizongying.mytv.api
|
||||
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.google.gson.Gson
|
||||
import com.lizongying.mytv.jce.JceConverterFactory
|
||||
import com.lizongying.mytv.requests.ReleaseService
|
||||
import okhttp3.ConnectionSpec
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.TlsVersion
|
||||
@@ -19,15 +22,20 @@ class ApiClient {
|
||||
private val myUrl = "https://lyrics.run/"
|
||||
private val protoUrl = "https://capi.yangshipin.cn/"
|
||||
private val traceUrl = "https://btrace.yangshipin.cn/"
|
||||
private val trace2Url = "https://aatc-api.yangshipin.cn/"
|
||||
private val tokenUrl = "https://h5access.yangshipin.cn/"
|
||||
private val trace3Url = "https://dtrace.ysp.cctv.cn/"
|
||||
private val jceUrl = "https://jacc.ysp.cctv.cn/"
|
||||
private val fUrl = "https://m.fengshows.com/"
|
||||
|
||||
private var okHttpClient = getUnsafeOkHttpClient()
|
||||
private var gson = Gson()
|
||||
|
||||
val yspApiService: YSPApiService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(yspUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPApiService::class.java)
|
||||
}
|
||||
|
||||
@@ -35,15 +43,15 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(myUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPTokenService::class.java)
|
||||
}
|
||||
|
||||
val releaseService: ReleaseService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(myUrl)
|
||||
.baseUrl(HOST)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(ReleaseService::class.java)
|
||||
}
|
||||
|
||||
@@ -59,15 +67,47 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(traceUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPBtraceService::class.java)
|
||||
}
|
||||
|
||||
val yspBtraceService2: YSPBtraceService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(trace2Url)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPBtraceService::class.java)
|
||||
}
|
||||
|
||||
val yspToken2Service: YSPApiService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(tokenUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPApiService::class.java)
|
||||
}
|
||||
|
||||
val yspBtraceService3: YSPBtraceService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(trace3Url)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPBtraceService::class.java)
|
||||
}
|
||||
|
||||
val yspJceService: YSPJceService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(jceUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(JceConverterFactory.create())
|
||||
.build().create(YSPJceService::class.java)
|
||||
}
|
||||
|
||||
val fAuthService: FAuthService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(fUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(FAuthService::class.java)
|
||||
}
|
||||
|
||||
@@ -126,9 +166,12 @@ class ApiClient {
|
||||
val sslContext = SSLContext.getInstance("SSL")
|
||||
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
|
||||
|
||||
// val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("10.0.2.2", 8888))
|
||||
|
||||
val builder = OkHttpClient.Builder()
|
||||
.sslSocketFactory(sslContext.socketFactory, trustAllCerts[0] as X509TrustManager)
|
||||
.hostnameVerifier { _, _ -> true }
|
||||
// .proxy(proxy)
|
||||
.dns(DnsCache())
|
||||
|
||||
return enableTls12OnPreLollipop(builder).build()
|
||||
@@ -137,4 +180,9 @@ class ApiClient {
|
||||
throw RuntimeException(e)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val HOST = "https://gitee.com/lizongying/my-tv/raw/"
|
||||
const val DOWNLOAD_HOST = "https://gitee.com/lizongying/my-tv/releases/download/"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.lizongying.mytv
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
import android.content.Context
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
data class KvcollectRequest(
|
||||
val BossId: Int = 99150,
|
||||
val Pwd: Int = 1999332929,
|
||||
val cdn: String = "waibao",
|
||||
val cmd: Int = 263,
|
||||
val defn: String = "fhd",
|
||||
val downspeed: Int = 10,
|
||||
val durl: String = "", //
|
||||
val errcode: String = "",
|
||||
val fact1: String = "ysp_pc_live_b",
|
||||
val firstreport: Int = 0,
|
||||
val fplayerver: String = "180",
|
||||
val ftime: String = "", //
|
||||
val geturltime: Int = 0,
|
||||
val guid: String = "", //
|
||||
val hc_openid: String = "",
|
||||
val hh_ua: String = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
val live_type: String = "",
|
||||
val livepid: String = "", //
|
||||
val login_type: String = "",
|
||||
val open_id: String = "",
|
||||
val openid: String = "",
|
||||
val platform: String = "5910204",
|
||||
val playno: String = "", //
|
||||
val prd: Int = 60000,
|
||||
val prog: String = "", //
|
||||
val rand_str: String = "", //
|
||||
val sRef: String = "",
|
||||
val sUrl: String = "", //
|
||||
val sdtfrom: String = "ysp_pc_01",
|
||||
val seq: Int = 9, //
|
||||
var signature: String = "",
|
||||
val url: String = "", //
|
||||
val viewid: String = "", //
|
||||
val _dc: Double = 0.0,
|
||||
)
|
||||
|
||||
|
||||
data class KvcollectRequest2(
|
||||
val BossId: Int = 99150,
|
||||
val Pwd: Int = 1999332929,
|
||||
val cdn: String = "waibao",
|
||||
val cmd: Int = 263,
|
||||
val defn: String = "fhd",
|
||||
val downspeed: Int = 10,
|
||||
val durl: String = "", //
|
||||
val errcode: String = "",
|
||||
val fact1: String = "ysp_pc_live_b",
|
||||
val firstreport: Int = 0,
|
||||
val fplayerver: String = "180",
|
||||
val ftime: String = "", //
|
||||
val geturltime: Int = 0,
|
||||
val guid: String = "", //
|
||||
val hc_openid: String = "",
|
||||
val hh_ua: String = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
val live_type: String = "",
|
||||
val livepid: String = "", //
|
||||
val login_type: String = "",
|
||||
val open_id: String = "",
|
||||
val openid: String = "",
|
||||
val platform: String = "5910204",
|
||||
val playno: String = "", //
|
||||
val prd: Int = 60000,
|
||||
val prog: String = "", //
|
||||
val rand_str: String = "", //
|
||||
val sRef: String = "",
|
||||
val sUrl: String = "", //
|
||||
val sdtfrom: String = "ysp_pc_01",
|
||||
val seq: Int = 0, //
|
||||
var signature: String = "",
|
||||
val url: String = "", //
|
||||
val viewid: String = "", //
|
||||
val _dc: String = "",
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Path
|
||||
|
||||
interface ReleaseService {
|
||||
@GET("my-tv/v2/release/{name}")
|
||||
fun getRelease(
|
||||
@Path("name") date: String = "2",
|
||||
): Call<ReleaseV2>
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
data class Token2(
|
||||
val ret: Int?,
|
||||
val msg: String?,
|
||||
val data: Data,
|
||||
) {
|
||||
data class Data(
|
||||
val token: String,
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
import android.content.Context
|
||||
import com.lizongying.mytv.Encryptor
|
||||
import com.lizongying.mytv.MainActivity
|
||||
import com.lizongying.mytv.SP
|
||||
import com.lizongying.mytv.Utils.getDateTimestamp
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
import java.security.MessageDigest
|
||||
import kotlin.math.floor
|
||||
import kotlin.random.Random
|
||||
|
||||
@@ -54,6 +53,13 @@ object YSP {
|
||||
|
||||
private var appid = "ysp_pc"
|
||||
var token = ""
|
||||
var token2 = ""
|
||||
|
||||
var yspsdkinput = ""
|
||||
var openapi_signature = ""
|
||||
|
||||
var nseqId = 1
|
||||
var nrequest_id = ""
|
||||
|
||||
private var encryptor = Encryptor()
|
||||
|
||||
@@ -77,10 +83,43 @@ object YSP {
|
||||
|
||||
cKey =
|
||||
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
|
||||
randStr = getRand()
|
||||
signature = getSignature()
|
||||
return """{"cnlid":"$cnlid","livepid":"$livepid","stream":"$stream","guid":"$guid","cKey":"$cKey","adjust":$adjust,"sphttps":"$sphttps","platform":"$platform","cmd":"$cmd","encryptVer":"$encryptVer","dtype":"$dtype","devid":"$devid","otype":"$otype","appVer":"$appVer","app_version":"$appVersion","rand_str":"$randStr","channel":"$channel","defn":"$defn","signature":"$signature"}"""
|
||||
}
|
||||
|
||||
fun getTokenData(tvModel: TVViewModel) {
|
||||
livepid = tvModel.getTV().pid
|
||||
cnlid = tvModel.getTV().sid
|
||||
defn = "fhd"
|
||||
|
||||
randStr = getRand()
|
||||
|
||||
if (tvModel.retryTimes > 0) {
|
||||
guid = newGuid()
|
||||
}
|
||||
|
||||
cKey =
|
||||
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
|
||||
|
||||
yspsdkinput =
|
||||
md("adjust=$adjust&app_version=$appVersion&appVer=$appVer&channel=$channel&cKey=$cKey&cmd=$cmd&cnlid=$cnlid&defn=$defn&devid=$devid&dtype=$dtype&encryptVer=$encryptVer&guid=$guid&livepid=$livepid&otype=$otype&platform=$platform&sphttps=$sphttps&stream=$stream")
|
||||
|
||||
nseqId++
|
||||
|
||||
nrequest_id = "999999" + getRand() + getTimeStr()
|
||||
|
||||
openapi_signature =
|
||||
md("yspappid:519748109;host:www.yangshipin.cn;protocol:https:;token:$token2;input:$yspsdkinput-$guid-$nseqId-$nrequest_id;")
|
||||
}
|
||||
|
||||
fun md(str: String): String {
|
||||
val md = MessageDigest.getInstance("MD5")
|
||||
md.update(str.toByteArray())
|
||||
val digest = md.digest()
|
||||
return digest.let { it -> it.joinToString("") { "%02x".format(it) } }
|
||||
}
|
||||
|
||||
fun getAuthData(tvModel: TVViewModel): String {
|
||||
livepid = tvModel.getTV().pid
|
||||
|
||||
@@ -94,7 +133,7 @@ object YSP {
|
||||
return """pid=$livepid&guid=$guid&appid=$appid&rand_str=$randStr&signature=$signature"""
|
||||
}
|
||||
|
||||
private fun getTimeStr(): String {
|
||||
fun getTimeStr(): String {
|
||||
return getDateTimestamp().toString()
|
||||
}
|
||||
|
||||
@@ -108,6 +147,7 @@ object YSP {
|
||||
var guid = SP.guid
|
||||
if (guid.length < 18) {
|
||||
guid = generateGuid()
|
||||
this.guid = guid
|
||||
SP.guid = guid
|
||||
}
|
||||
return guid
|
||||
@@ -142,4 +182,9 @@ object YSP {
|
||||
val hashedData = encryptor.hash2(e) ?: return ""
|
||||
return hashedData.let { it -> it.joinToString("") { "%02x".format(it) } }
|
||||
}
|
||||
|
||||
fun getAuthSignature(e: String): String {
|
||||
val hashedData = encryptor.hash2(e.toByteArray()) ?: return ""
|
||||
return hashedData.let { it -> it.joinToString("") { "%02x".format(it) } }
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package com.lizongying.mytv.api
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
|
||||
interface YSPApiService {
|
||||
@@ -18,6 +20,11 @@ interface YSPApiService {
|
||||
fun getLiveInfo(
|
||||
@Header("cookie") cookie: String,
|
||||
@Header("Yspplayertoken") token: String,
|
||||
@Header("Yspsdkinput") Yspsdkinput: String,
|
||||
@Header("yspsdksign") yspsdksign: String,
|
||||
@Header("Seqid") Seqid: String,
|
||||
@Header("Request-Id") RequestId: String,
|
||||
@Header("Yspappid") Yspappid: String="519748109",
|
||||
@Body request: LiveInfoRequest,
|
||||
): Call<LiveInfo>
|
||||
|
||||
@@ -32,4 +39,20 @@ interface YSPApiService {
|
||||
@Header("cookie") cookie: String,
|
||||
@Body request: AuthRequest,
|
||||
): Call<Auth>
|
||||
|
||||
@GET("web/open/token")
|
||||
@Headers(
|
||||
"content-type: application/json",
|
||||
"referer: https://www.yangshipin.cn/",
|
||||
"user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||
)
|
||||
fun getToken(
|
||||
@Header("cookie") cookie: String,
|
||||
@Query("yspappid") yspappid: String = "519748109",
|
||||
@Query("guid") guid: String = "",
|
||||
@Query("vappid") vappid: String = "59306155",
|
||||
@Query("vsecret") vsecret: String = "b42702bf7309a179d102f3d51b1add2fda0bc7ada64cb801",
|
||||
@Query("raw") raw: String = "1",
|
||||
@Query("ts") ts: String = "",
|
||||
): Call<Token2>
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.Field
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
import retrofit2.http.Query
|
||||
|
||||
|
||||
@@ -68,4 +68,58 @@ interface YSPBtraceService {
|
||||
@Field("c_guid") c_guid: String = "",
|
||||
@Field("c_vuid") c_vuid: String = "-",
|
||||
): Call<Void>
|
||||
|
||||
@POST("kvcollect")
|
||||
@Headers(
|
||||
"content-type: application/json",
|
||||
"referer: https://www.yangshipin.cn/",
|
||||
"Cookie: guid=1; versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=123",
|
||||
"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
)
|
||||
fun kvcollect2(
|
||||
@Body request: KvcollectRequest,
|
||||
): Call<Void>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("kvcollect")
|
||||
@Headers(
|
||||
"content-type: application/x-www-form-urlencoded",
|
||||
"referer: https://www.yangshipin.cn/",
|
||||
)
|
||||
fun kvcollect3(
|
||||
@Field("BossId") BossId: String = "9150",
|
||||
@Field("Pwd") Pwd: String = "1999332929",
|
||||
@Field("prog") prog: String = "", //
|
||||
@Field("playno") playno: String = "", //
|
||||
@Field("guid") guid: String = "", //
|
||||
@Field("hh_ua") hh_ua: String = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
@Field("cdn") cdn: String = "waibao",
|
||||
@Field("sdtfrom") sdtfrom: String = "ysp_pc_01",
|
||||
@Field("prd") prd: String = "60000",
|
||||
@Field("platform") platform: String = "5910204",
|
||||
@Field("errcode") errcode: String = "-",
|
||||
@Field("durl") durl: String = "", //
|
||||
@Field("firstreport") firstreport: String = "-",
|
||||
@Field("sUrl") sUrl: String = "", //
|
||||
@Field("sRef") sRef: String = "-",
|
||||
@Field("fplayerver") fplayerver: String = "180",
|
||||
@Field("livepid") livepid: String = "",
|
||||
@Field("viewid") viewid: String = "",
|
||||
@Field("seq") seq: String = "",
|
||||
@Field("cmd") cmd: String = "263",
|
||||
@Field("login_type") login_type: String = "-",
|
||||
@Field("geturltime") geturltime: String = "-",
|
||||
@Field("downspeed") downspeed: String = "10",
|
||||
@Field("hc_openid") hc_openid: String = "-",
|
||||
@Field("open_id") open_id: String = "-",
|
||||
@Field("defn") defn: String = "fhd",
|
||||
@Field("fact1") fact1: String = "ysp_pc_live_b",
|
||||
@Field("openid") openid: String = "-",
|
||||
@Field("_dc") _dc: String = "",
|
||||
@Field("live_type") live_type: String = "-",
|
||||
@Field("ftime") ftime: String = "",
|
||||
// @Field("url") url: String = "",
|
||||
// @Field("rand_str") rand_str: String = "", //
|
||||
// @Field("signature") signature: String = "",
|
||||
): Call<Void>
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.TVTimeShiftProgramRequest
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.TVTimeShiftProgramResponse
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface YSPJceService {
|
||||
@POST("/")
|
||||
@Headers(
|
||||
"content-type: application/octet-stream",
|
||||
"user-agent: CCTVVideo/2.9.0 (iPad; iOS 17.2; Scale/2.00)",
|
||||
)
|
||||
fun getProgram(
|
||||
@Body body: TVTimeShiftProgramRequest
|
||||
): Call<TVTimeShiftProgramResponse>
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.lizongying.mytv.jce;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class CompressUtils {
|
||||
private static final String TAG = "CompressUtils";
|
||||
|
||||
public static byte[] compressGZIP(byte[] bArr) {
|
||||
GZIPOutputStream gZIPOutputStream;
|
||||
Throwable th;
|
||||
if (bArr != null && bArr.length != 0) {
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
|
||||
} catch (IOException unused) {
|
||||
gZIPOutputStream = null;
|
||||
} catch (Throwable th2) {
|
||||
gZIPOutputStream = null;
|
||||
th = th2;
|
||||
}
|
||||
try {
|
||||
byte[] bArr2 = new byte[4096];
|
||||
while (true) {
|
||||
int read = byteArrayInputStream.read(bArr2);
|
||||
if (read <= 0) {
|
||||
break;
|
||||
}
|
||||
gZIPOutputStream.write(bArr2, 0, read);
|
||||
}
|
||||
gZIPOutputStream.finish();
|
||||
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
||||
try {
|
||||
byteArrayInputStream.close();
|
||||
byteArrayOutputStream.close();
|
||||
gZIPOutputStream.close();
|
||||
} catch (IOException e2) {
|
||||
System.out.println(e2);
|
||||
}
|
||||
return byteArray;
|
||||
} catch (IOException unused2) {
|
||||
try {
|
||||
byteArrayInputStream.close();
|
||||
byteArrayOutputStream.close();
|
||||
if (gZIPOutputStream != null) {
|
||||
gZIPOutputStream.close();
|
||||
}
|
||||
} catch (IOException e3) {
|
||||
System.out.println(e3);
|
||||
}
|
||||
return null;
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
try {
|
||||
byteArrayInputStream.close();
|
||||
byteArrayOutputStream.close();
|
||||
if (gZIPOutputStream != null) {
|
||||
gZIPOutputStream.close();
|
||||
}
|
||||
} catch (IOException e4) {
|
||||
System.out.println(e4);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static byte[] decompressGZIP(byte[] bArr) {
|
||||
GZIPInputStream gZIPInputStream;
|
||||
Throwable th;
|
||||
if (bArr != null && bArr.length != 0) {
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
|
||||
} catch (IOException unused) {
|
||||
gZIPInputStream = null;
|
||||
} catch (Throwable th2) {
|
||||
gZIPInputStream = null;
|
||||
th = th2;
|
||||
}
|
||||
|
||||
try {
|
||||
byte[] bArr2 = new byte[4096];
|
||||
while (true) {
|
||||
int read = gZIPInputStream.read(bArr2);
|
||||
if (read <= 0) {
|
||||
break;
|
||||
}
|
||||
byteArrayOutputStream.write(bArr2, 0, read);
|
||||
}
|
||||
byteArrayOutputStream.flush();
|
||||
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
||||
|
||||
try {
|
||||
byteArrayInputStream.close();
|
||||
byteArrayOutputStream.close();
|
||||
gZIPInputStream.close();
|
||||
} catch (IOException e2) {
|
||||
System.out.println(e2);
|
||||
}
|
||||
return byteArray;
|
||||
} catch (IOException unused2) {
|
||||
try {
|
||||
byteArrayInputStream.close();
|
||||
byteArrayOutputStream.close();
|
||||
if (gZIPInputStream != null) {
|
||||
gZIPInputStream.close();
|
||||
}
|
||||
} catch (IOException e3) {
|
||||
System.out.println(e3);
|
||||
}
|
||||
return null;
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
try {
|
||||
byteArrayInputStream.close();
|
||||
byteArrayOutputStream.close();
|
||||
if (gZIPInputStream != null) {
|
||||
gZIPInputStream.close();
|
||||
}
|
||||
} catch (IOException e4) {
|
||||
System.out.println(e4);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.lizongying.mytv.jce;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class JceConverterFactory extends Converter.Factory {
|
||||
public static JceConverterFactory create() {
|
||||
return new JceConverterFactory();
|
||||
}
|
||||
|
||||
private JceConverterFactory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Converter<ResponseBody, ?> responseBodyConverter(
|
||||
@NonNull Type type,
|
||||
@NonNull Annotation[] annotations,
|
||||
@NonNull Retrofit retrofit) {
|
||||
if (!(type instanceof Class<?>)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new JceResponseBodyConverter<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Converter<?, RequestBody> requestBodyConverter(
|
||||
@NonNull Type type,
|
||||
@NonNull Annotation[] parameterAnnotations,
|
||||
@NonNull Annotation[] methodAnnotations,
|
||||
@NonNull Retrofit retrofit) {
|
||||
if (!(type instanceof Class<?>)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new JceRequestBodyConverter<>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.lizongying.mytv.jce;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.BusinessExtent;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.BusinessHead;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.QUA;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.RequestCommand;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.RequestHead;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Converter;
|
||||
|
||||
public class JceRequestBodyConverter<T extends JceStruct> implements Converter<T, RequestBody> {
|
||||
private static final MediaType MEDIA_TYPE = MediaType.get("application/octet-stream");
|
||||
|
||||
@Override
|
||||
public RequestBody convert(@NonNull T value) {
|
||||
BusinessHead businessHead = new BusinessHead();
|
||||
RequestHead requestHead = new RequestHead();
|
||||
requestHead.appId = "1200013";
|
||||
requestHead.busiExtent = new BusinessExtent(1);
|
||||
requestHead.cmdId = 24897;
|
||||
requestHead.contentType = 0;
|
||||
requestHead.guid = "093e7e5989684fd986c44f07542d8dc8";
|
||||
requestHead.isSupportDolby = 0;
|
||||
requestHead.oemPlatform = 0;
|
||||
QUA qua = new QUA();
|
||||
qua.appSubVersion = "";
|
||||
qua.areaMode = 1;
|
||||
qua.channelId = "50001";
|
||||
qua.clientKey = "A41CD6B6-6A56-46DC-9AE0-4ECF2E9118DF";
|
||||
qua.countryCode = 0;
|
||||
qua.densityDpi = 0;
|
||||
qua.deviceId = "5EE46760-11B1-5FE7-949A-FF232DAE1823";
|
||||
qua.deviceModel = "iPad Pro (12.9 inch) 3G";
|
||||
qua.deviceType = 1;
|
||||
qua.extent = "";
|
||||
qua.idfa = "";
|
||||
qua.imei = "";
|
||||
qua.langCode = 0;
|
||||
qua.mac = "";
|
||||
qua.markerId = 1;
|
||||
qua.mobileISP = 0;
|
||||
qua.networkMode = 0;
|
||||
qua.omgId = "78d6ac7572afb5461e9a590f089f893d2abc0010119007";
|
||||
qua.platform = 5;
|
||||
qua.platformVersion = "sysver=ios17.2&device=iPad&modify_time=&lang=zh_CN";
|
||||
qua.qimei = "1c0fc6ed8a53584ae722b915200014317601";
|
||||
qua.screenHeight = 2360;
|
||||
qua.screenWidth = 1640;
|
||||
qua.serverid = "";
|
||||
qua.v4ip = "";
|
||||
qua.versionCode = "23399";
|
||||
qua.versionName = "2.9.0.23399";
|
||||
requestHead.qua = qua;
|
||||
requestHead.requestId = 1;
|
||||
|
||||
JceOutputStream jceOutputStream = new JceOutputStream();
|
||||
jceOutputStream.setServerEncoding("utf-8");
|
||||
value.writeTo(jceOutputStream);
|
||||
byte[] bytes = jceOutputStream.toByteArray();
|
||||
RequestCommand requestCommand = new RequestCommand(requestHead, bytes, businessHead);
|
||||
bytes = b.b(requestCommand, requestHead.requestId);
|
||||
return RequestBody.create(MEDIA_TYPE, bytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.lizongying.mytv.jce;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.QQVideoJCECmd;
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.ResponseCommand;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
|
||||
public class JceResponseBodyConverter<T extends JceStruct> implements Converter<ResponseBody, T> {
|
||||
|
||||
JceResponseBodyConverter() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(@NonNull ResponseBody value) throws IOException {
|
||||
return parseFrom(value.bytes());
|
||||
}
|
||||
|
||||
public T parseFrom(byte[] aa) {
|
||||
byte[] bArr;
|
||||
|
||||
int[] iArr = new int[1];
|
||||
try {
|
||||
bArr = b.a(aa, iArr);
|
||||
} catch (Throwable unused) {
|
||||
bArr = null;
|
||||
}
|
||||
|
||||
ResponseCommand responseCommand = a.g(bArr, ResponseCommand.class);
|
||||
if (responseCommand == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QQVideoJCECmd convert = QQVideoJCECmd.convert(responseCommand.head.cmdId);
|
||||
assert convert != null;
|
||||
|
||||
JceInputStream jceInputStream = new JceInputStream(responseCommand.body);
|
||||
jceInputStream.setServerEncoding("UTF-8");
|
||||
|
||||
JceStruct instance = null;
|
||||
try {
|
||||
instance = (JceStruct) Class.forName("com.tencent.videolite.android.datamodel.cctvjce." + convert + "Response").newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (instance != null) {
|
||||
instance.readFrom(jceInputStream);
|
||||
return (T) instance;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.lizongying.mytv.jce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class a {
|
||||
|
||||
/* renamed from: a reason: collision with root package name */
|
||||
private static final String f33240a = "Net_Protocol";
|
||||
|
||||
private a() {
|
||||
}
|
||||
|
||||
private static JceStruct a(JceStruct jceStruct, ClassLoader classLoader) {
|
||||
Class<?> cls;
|
||||
if (jceStruct == null) {
|
||||
return null;
|
||||
}
|
||||
String name = jceStruct.getClass().getName();
|
||||
String str = name.substring(0, name.length() - 7) + "Response";
|
||||
try {
|
||||
if (classLoader == null) {
|
||||
cls = Class.forName(str);
|
||||
} else {
|
||||
cls = Class.forName(str, true, classLoader);
|
||||
}
|
||||
return (JceStruct) cls.newInstance();
|
||||
} catch (ClassNotFoundException unused) {
|
||||
return null;
|
||||
} catch (IllegalAccessException unused) {
|
||||
return null;
|
||||
} catch (InstantiationException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static JceStruct b(String str, ClassLoader classLoader) {
|
||||
Class<?> cls;
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
String str2 = str + "Response";
|
||||
try {
|
||||
if (classLoader == null) {
|
||||
cls = Class.forName(str2);
|
||||
} else {
|
||||
cls = Class.forName(str2, true, classLoader);
|
||||
}
|
||||
return (JceStruct) cls.newInstance();
|
||||
} catch (ClassNotFoundException unused) {
|
||||
return null;
|
||||
} catch (IllegalAccessException unused) {
|
||||
return null;
|
||||
} catch (InstantiationException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int c(Object obj) {
|
||||
Field[] declaredFields;
|
||||
int i2 = 0;
|
||||
if (obj == null) {
|
||||
return 0;
|
||||
}
|
||||
for (Field field : obj.getClass().getDeclaredFields()) {
|
||||
if (field != null) {
|
||||
field.setAccessible(true);
|
||||
if (!field.getName().equals("errCode")) {
|
||||
continue;
|
||||
} else if (!field.getType().getName().equals(Integer.class.getName()) && !field.getType().getName().equals("int")) {
|
||||
if (field.getType().getName().equals(Long.class.getName()) || field.getType().getName().equals("long")) {
|
||||
try {
|
||||
return (int) field.getLong(obj);
|
||||
} catch (IllegalAccessException e2) {
|
||||
e2.printStackTrace();
|
||||
} catch (IllegalArgumentException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return field.getInt(obj);
|
||||
} catch (IllegalAccessException e4) {
|
||||
e4.printStackTrace();
|
||||
} catch (IllegalArgumentException e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
|
||||
public static byte[] d(JceStruct jceStruct) {
|
||||
if (jceStruct == null) {
|
||||
return null;
|
||||
}
|
||||
JceOutputStream jceOutputStream = new JceOutputStream();
|
||||
jceOutputStream.setServerEncoding("utf-8");
|
||||
jceStruct.writeTo(jceOutputStream);
|
||||
return jceOutputStream.toByteArray();
|
||||
}
|
||||
|
||||
public static JceStruct e(JceStruct jceStruct, byte[] bArr, ClassLoader classLoader) {
|
||||
JceStruct a2;
|
||||
if (jceStruct != null && bArr != null && (a2 = a(jceStruct, classLoader)) != null) {
|
||||
try {
|
||||
JceInputStream jceInputStream = new JceInputStream(bArr);
|
||||
jceInputStream.setServerEncoding("utf-8");
|
||||
a2.readFrom(jceInputStream);
|
||||
return a2;
|
||||
} catch (Exception unused) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JceStruct f(String str, byte[] bArr, ClassLoader classLoader) {
|
||||
if (str != null && bArr != null) {
|
||||
JceStruct b2 = b(str, classLoader);
|
||||
if (b2 != null) {
|
||||
try {
|
||||
JceInputStream jceInputStream = new JceInputStream(bArr);
|
||||
jceInputStream.setServerEncoding("utf-8");
|
||||
b2.readFrom(jceInputStream);
|
||||
return b2;
|
||||
} catch (Exception e2) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T extends JceStruct> T g(byte[] bArr, Class<T> cls) {
|
||||
T t;
|
||||
if (bArr != null && bArr.length >= 4) {
|
||||
try {
|
||||
t = cls.newInstance();
|
||||
} catch (IllegalAccessException unused) {
|
||||
t = null;
|
||||
} catch (InstantiationException unused) {
|
||||
t = null;
|
||||
}
|
||||
try {
|
||||
JceInputStream jceInputStream = new JceInputStream(bArr);
|
||||
jceInputStream.setServerEncoding("utf-8");
|
||||
if (t != null) {
|
||||
t.readFrom(jceInputStream);
|
||||
}
|
||||
return t;
|
||||
} catch (Exception unused2) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package com.lizongying.mytv.jce;
|
||||
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.RequestCommand;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class b {
|
||||
|
||||
/* renamed from: a reason: collision with root package name */
|
||||
private static final String f33241a = "Net_UnifiedProtocol";
|
||||
|
||||
b() {
|
||||
}
|
||||
|
||||
public static byte[] a(byte[] bArr, int[] iArr) {
|
||||
boolean z;
|
||||
if (bArr == null || bArr.length == 0) {
|
||||
return null;
|
||||
}
|
||||
ByteBuffer wrap = ByteBuffer.wrap(bArr);
|
||||
if (wrap.get() == 19 && wrap.getInt() == bArr.length) {
|
||||
wrap.getShort();
|
||||
if ((wrap.getShort() & 65535) != 65281) {
|
||||
|
||||
return null;
|
||||
}
|
||||
wrap.getShort();
|
||||
int i2 = wrap.getShort() & 65535;
|
||||
if (i2 != 0) {
|
||||
iArr[0] = i2;
|
||||
|
||||
return null;
|
||||
}
|
||||
wrap.getLong();
|
||||
int i3 = wrap.getInt();
|
||||
if ((i3 & 2) <= 0) {
|
||||
z = false;
|
||||
} else if ((i3 & 16) <= 0) {
|
||||
iArr[0] = -867;
|
||||
return null;
|
||||
} else {
|
||||
z = true;
|
||||
}
|
||||
wrap.getInt();
|
||||
wrap.getLong();
|
||||
wrap.position(wrap.position() + 32);
|
||||
wrap.get();
|
||||
wrap.position(wrap.position() + 10);
|
||||
wrap.get();
|
||||
wrap.position(wrap.position() + (wrap.getShort() & 65535));
|
||||
int i4 = 65535 & wrap.getShort();
|
||||
wrap.position(wrap.position() + i4);
|
||||
int i5 = 83 + i4 + 2;
|
||||
int i6 = wrap.getInt();
|
||||
int i7 = i5 + 4;
|
||||
if (wrap.get(bArr.length - 1) != 3) {
|
||||
iArr[0] = -869;
|
||||
return null;
|
||||
}
|
||||
int length = (bArr.length - i7) - 1;
|
||||
if (length <= 0) {
|
||||
iArr[0] = -868;
|
||||
return null;
|
||||
}
|
||||
byte[] bArr2 = new byte[length];
|
||||
System.arraycopy(bArr, i7, bArr2, 0, length);
|
||||
return c(bArr2, z, i6, iArr);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static byte[] b(RequestCommand requestCommand, long j) {
|
||||
byte[] d2 = a.d(requestCommand);
|
||||
if (d2 == null) {
|
||||
return null;
|
||||
}
|
||||
byte[] d3 = d(d2);
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(d3.length + 50);
|
||||
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||
try {
|
||||
dataOutputStream.writeByte(19);
|
||||
dataOutputStream.writeInt(0);
|
||||
dataOutputStream.writeShort(2);
|
||||
dataOutputStream.writeShort(65281);
|
||||
dataOutputStream.writeShort(requestCommand.head.cmdId);
|
||||
dataOutputStream.writeShort(0);
|
||||
dataOutputStream.writeLong(j);
|
||||
dataOutputStream.writeInt(531);
|
||||
dataOutputStream.writeInt(0);
|
||||
dataOutputStream.writeLong(0);
|
||||
e(dataOutputStream, requestCommand.head.guid, 32);
|
||||
dataOutputStream.writeByte(0);
|
||||
// VersionCode
|
||||
dataOutputStream.writeInt(0);
|
||||
e(dataOutputStream, null, 6);
|
||||
dataOutputStream.writeByte(0);
|
||||
dataOutputStream.writeShort(0);
|
||||
dataOutputStream.writeShort(0);
|
||||
dataOutputStream.writeInt(d3.length);
|
||||
byte[] compressGZIP = CompressUtils.compressGZIP(d3);
|
||||
if (compressGZIP == null) {
|
||||
return null;
|
||||
}
|
||||
dataOutputStream.write(compressGZIP);
|
||||
dataOutputStream.writeByte(3);
|
||||
dataOutputStream.close();
|
||||
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
||||
ByteBuffer wrap = ByteBuffer.wrap(byteArray);
|
||||
wrap.putInt(1, byteArray.length);
|
||||
return wrap.array();
|
||||
} catch (IOException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] c(byte[] bArr, boolean z, int i2, int[] iArr) {
|
||||
if (bArr == null) {
|
||||
iArr[0] = -871;
|
||||
return null;
|
||||
// } else if (z && ((bArr = CompressUtils.decompressGZIP(bArr)) == null || bArr.length != i2)) {
|
||||
} else if (z && ((bArr = CompressUtils.decompressGZIP(bArr)) == null)) {
|
||||
iArr[0] = -871;
|
||||
|
||||
return null;
|
||||
} else {
|
||||
ByteBuffer wrap = ByteBuffer.wrap(bArr);
|
||||
int position = wrap.position() + 16;
|
||||
if (wrap.get() != 38) {
|
||||
iArr[0] = -869;
|
||||
return null;
|
||||
} else if (wrap.get(bArr.length - 1) != 40) {
|
||||
iArr[0] = -869;
|
||||
return null;
|
||||
} else {
|
||||
int length = (bArr.length - position) - 1;
|
||||
if (length <= 0) {
|
||||
iArr[0] = -869;
|
||||
return null;
|
||||
}
|
||||
byte[] bArr2 = new byte[length];
|
||||
System.arraycopy(bArr, position, bArr2, 0, length);
|
||||
return bArr2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] d(byte[] bArr) {
|
||||
int length = bArr.length + 17;
|
||||
ByteBuffer allocate = ByteBuffer.allocate(length);
|
||||
allocate.put((byte) 38);
|
||||
allocate.putInt(length);
|
||||
allocate.put((byte) 1);
|
||||
allocate.position(allocate.position() + 10);
|
||||
allocate.put(bArr);
|
||||
allocate.put((byte) 40);
|
||||
return allocate.array();
|
||||
}
|
||||
|
||||
private static void e(OutputStream outputStream, String str, int i2) throws IOException {
|
||||
byte[] bArr;
|
||||
int i3;
|
||||
if (i2 > 0) {
|
||||
if (str != null) {
|
||||
bArr = str.getBytes("UTF-8");
|
||||
i3 = bArr.length;
|
||||
} else {
|
||||
bArr = null;
|
||||
i3 = 0;
|
||||
}
|
||||
if (i3 >= i2) {
|
||||
outputStream.write(bArr, 0, i2);
|
||||
return;
|
||||
}
|
||||
if (i3 > 0) {
|
||||
outputStream.write(bArr, 0, i3);
|
||||
}
|
||||
while (i3 < i2) {
|
||||
outputStream.write(0);
|
||||
i3++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.lizongying.mytv.models
|
||||
|
||||
enum class ProgramType {
|
||||
Y_PROTO,
|
||||
Y_JCE,
|
||||
F,
|
||||
}
|
||||
+9
-5
@@ -1,5 +1,6 @@
|
||||
package com.lizongying.mytv
|
||||
package com.lizongying.mytv.models
|
||||
|
||||
import com.lizongying.mytv.models.ProgramType
|
||||
import java.io.Serializable
|
||||
|
||||
data class TV(
|
||||
@@ -11,21 +12,24 @@ data class TV(
|
||||
var logo: Any = "",
|
||||
var pid: String = "",
|
||||
var sid: String = "",
|
||||
var programId: String = "",
|
||||
var programType: ProgramType,
|
||||
var needToken: Boolean = false,
|
||||
var mustToken: Boolean = false,
|
||||
|
||||
) : Serializable {
|
||||
) : Serializable {
|
||||
|
||||
override fun toString(): String {
|
||||
return "TV{" +
|
||||
"id=" + id +
|
||||
", title='" + title + '\'' +
|
||||
", alias='" + alias + '\'' +
|
||||
", videoUrl='" + videoUrl + '\'' +
|
||||
", channel='" + channel + '\'' +
|
||||
", logo='" + logo + '\'' +
|
||||
", pid='" + pid + '\'' +
|
||||
", sid='" + sid + '\'' +
|
||||
", programId='" + programId + '\'' +
|
||||
", programType='" + programType + '\'' +
|
||||
", needToken='" + needToken + '\'' +
|
||||
", mustToken='" + mustToken + '\'' +
|
||||
'}'
|
||||
}
|
||||
}
|
||||
+211
-263
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ package com.lizongying.mytv.models
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.lizongying.mytv.SP
|
||||
|
||||
class TVListViewModel : ViewModel() {
|
||||
|
||||
@@ -16,10 +17,6 @@ class TVListViewModel : ViewModel() {
|
||||
val itemPosition: LiveData<Int>
|
||||
get() = _itemPosition
|
||||
|
||||
private val _itemPositionCurrent = MutableLiveData<Int>()
|
||||
val itemPositionCurrent: LiveData<Int>
|
||||
get() = _itemPositionCurrent
|
||||
|
||||
fun addTVViewModel(tvViewModel: TVViewModel) {
|
||||
if (_tvListViewModel.value == null) {
|
||||
_tvListViewModel.value = mutableListOf(tvViewModel)
|
||||
@@ -32,23 +29,16 @@ class TVListViewModel : ViewModel() {
|
||||
return _tvListViewModel.value?.get(id)
|
||||
}
|
||||
|
||||
fun getTVViewModelCurrent(): TVViewModel? {
|
||||
return _itemPositionCurrent.value?.let { _tvListViewModel.value?.get(it) }
|
||||
}
|
||||
|
||||
fun setItemPosition(position: Int) {
|
||||
_itemPosition.value = position
|
||||
_itemPositionCurrent.value = position
|
||||
}
|
||||
|
||||
fun setItemPositionCurrent(position: Int) {
|
||||
_itemPositionCurrent.value = position
|
||||
SP.itemPosition = position
|
||||
}
|
||||
|
||||
fun size(): Int {
|
||||
if (_tvListViewModel.value == null) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return _tvListViewModel.value!!.size
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.lizongying.mytv.models
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.lizongying.mytv.TV
|
||||
import com.lizongying.mytv.api.FEPG
|
||||
import com.lizongying.mytv.proto.Ysp.cn.yangshipin.omstv.common.proto.programModel.Program
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.TVProgram
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.TimeZone
|
||||
|
||||
@@ -17,6 +16,8 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||
|
||||
var retryTimes = 0
|
||||
var retryMaxTimes = 8
|
||||
var authYSPRetryTimes = 0
|
||||
var authYSPRetryMaxTimes = 3
|
||||
var tokenYSPRetryTimes = 0
|
||||
var tokenYSPRetryMaxTimes = 0
|
||||
var tokenFHRetryTimes = 0
|
||||
@@ -40,8 +41,8 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||
val videoIndex: LiveData<Int>
|
||||
get() = _videoIndex
|
||||
|
||||
private val _change = MutableLiveData<Boolean>()
|
||||
val change: LiveData<Boolean>
|
||||
private val _change = MutableLiveData<String>()
|
||||
val change: LiveData<String>
|
||||
get() = _change
|
||||
|
||||
private val _ready = MutableLiveData<Boolean>()
|
||||
@@ -55,36 +56,27 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||
if (_videoUrl.value!!.last().contains("cctv.cn")) {
|
||||
tv.videoUrl = tv.videoUrl.subList(0, tv.videoUrl.lastIndex) + listOf(url)
|
||||
} else {
|
||||
tv.videoUrl = tv.videoUrl + listOf(url)
|
||||
tv.videoUrl += listOf(url)
|
||||
}
|
||||
} else {
|
||||
tv.videoUrl = tv.videoUrl + listOf(url)
|
||||
tv.videoUrl += listOf(url)
|
||||
}
|
||||
_videoUrl.value = tv.videoUrl
|
||||
_videoIndex.value = tv.videoUrl.lastIndex
|
||||
}
|
||||
|
||||
fun firstSource() {
|
||||
if (_videoUrl.value!!.isNotEmpty()) {
|
||||
setVideoIndex(0)
|
||||
allReady()
|
||||
} else {
|
||||
Log.e(TAG, "no first")
|
||||
}
|
||||
}
|
||||
|
||||
fun changed() {
|
||||
_change.value = true
|
||||
fun changed(from: String) {
|
||||
retryTimes = 0
|
||||
authYSPRetryTimes = 0
|
||||
tokenYSPRetryTimes = 0
|
||||
tokenFHRetryTimes = 0
|
||||
_change.value = from
|
||||
}
|
||||
|
||||
fun allReady() {
|
||||
_ready.value = true
|
||||
}
|
||||
|
||||
fun setVideoIndex(videoIndex: Int) {
|
||||
_videoIndex.value = videoIndex
|
||||
}
|
||||
|
||||
init {
|
||||
_videoUrl.value = tv.videoUrl
|
||||
_videoIndex.value = tv.videoUrl.lastIndex
|
||||
@@ -114,6 +106,10 @@ class TVViewModel(private var tv: TV) : ViewModel() {
|
||||
return tv
|
||||
}
|
||||
|
||||
fun addYJceEPG(p: MutableList<TVProgram>) {
|
||||
_epg.value = p.map { EPG(it.name, it.start_time_stamp.toInt()) }.toMutableList()
|
||||
}
|
||||
|
||||
fun addYEPG(p: MutableList<Program>) {
|
||||
_epg.value = p.map { EPG(it.name, it.st.toInt()) }.toMutableList()
|
||||
}
|
||||
|
||||
+10
-7
@@ -10,20 +10,23 @@ import retrofit2.Response
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
|
||||
class MyRequest {
|
||||
class ReleaseRequest {
|
||||
private var releaseService = ApiClient().releaseService
|
||||
|
||||
suspend fun getRelease(): ReleaseV2? {
|
||||
suspend fun getRelease(): ReleaseResponse? {
|
||||
return withContext(Dispatchers.IO) {
|
||||
fetchRelease()
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun fetchRelease(): ReleaseV2? {
|
||||
private suspend fun fetchRelease(): ReleaseResponse? {
|
||||
return suspendCoroutine { continuation ->
|
||||
releaseService.getRelease()
|
||||
.enqueue(object : Callback<ReleaseV2> {
|
||||
override fun onResponse(call: Call<ReleaseV2>, response: Response<ReleaseV2>) {
|
||||
.enqueue(object : Callback<ReleaseResponse> {
|
||||
override fun onResponse(
|
||||
call: Call<ReleaseResponse>,
|
||||
response: Response<ReleaseResponse>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
continuation.resume(response.body())
|
||||
} else {
|
||||
@@ -31,7 +34,7 @@ class MyRequest {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<ReleaseV2>, t: Throwable) {
|
||||
override fun onFailure(call: Call<ReleaseResponse>, t: Throwable) {
|
||||
continuation.resume(null)
|
||||
}
|
||||
})
|
||||
@@ -39,6 +42,6 @@ class MyRequest {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MyRequest"
|
||||
private const val TAG = "ReleaseRequest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.lizongying.mytv.requests
|
||||
|
||||
|
||||
data class ReleaseResponse(
|
||||
val version_code: Int?,
|
||||
val version_name: String?,
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.lizongying.mytv.requests
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.GET
|
||||
|
||||
interface ReleaseService {
|
||||
@GET("JELLY_BEAN_MR1/version.json")
|
||||
fun getRelease(
|
||||
): Call<ReleaseResponse>
|
||||
}
|
||||
+534
-172
@@ -1,9 +1,10 @@
|
||||
package com.lizongying.mytv
|
||||
package com.lizongying.mytv.requests
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import com.lizongying.mytv.Utils
|
||||
import com.lizongying.mytv.Utils.getDateFormat
|
||||
import com.lizongying.mytv.api.ApiClient
|
||||
import com.lizongying.mytv.api.Auth
|
||||
@@ -13,42 +14,54 @@ import com.lizongying.mytv.api.FAuthService
|
||||
import com.lizongying.mytv.api.FEPG
|
||||
import com.lizongying.mytv.api.Info
|
||||
import com.lizongying.mytv.api.InfoV2
|
||||
import com.lizongying.mytv.api.KvcollectRequest
|
||||
import com.lizongying.mytv.api.KvcollectRequest2
|
||||
import com.lizongying.mytv.api.LiveInfo
|
||||
import com.lizongying.mytv.api.LiveInfoRequest
|
||||
import com.lizongying.mytv.api.Token
|
||||
import com.lizongying.mytv.api.Token2
|
||||
import com.lizongying.mytv.api.YSP
|
||||
import com.lizongying.mytv.api.YSPApiService
|
||||
import com.lizongying.mytv.api.YSPBtraceService
|
||||
import com.lizongying.mytv.api.YSPJceService
|
||||
import com.lizongying.mytv.api.YSPProtoService
|
||||
import com.lizongying.mytv.api.YSPTokenService
|
||||
import com.lizongying.mytv.models.TVList
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
import com.lizongying.mytv.proto.Ysp.cn.yangshipin.oms.common.proto.pageModel
|
||||
import com.lizongying.mytv.proto.Ysp.cn.yangshipin.omstv.common.proto.epgProgramModel
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.TVTimeShiftProgramRequest
|
||||
import com.tencent.videolite.android.datamodel.cctvjce.TVTimeShiftProgramResponse
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
import kotlin.math.max
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
object Request {
|
||||
private const val TAG = "Request"
|
||||
private var yspTokenService: YSPTokenService = ApiClient().yspTokenService
|
||||
private var yspToken2Service: YSPApiService = ApiClient().yspToken2Service
|
||||
private var yspApiService: YSPApiService = ApiClient().yspApiService
|
||||
private var yspBtraceService: YSPBtraceService = ApiClient().yspBtraceService
|
||||
private var yspBtraceService2: YSPBtraceService = ApiClient().yspBtraceService2
|
||||
private var yspBtraceService3: YSPBtraceService = ApiClient().yspBtraceService3
|
||||
private var yspProtoService: YSPProtoService = ApiClient().yspProtoService
|
||||
private var yspJceService: YSPJceService = ApiClient().yspJceService
|
||||
private var fAuthService: FAuthService = ApiClient().fAuthService
|
||||
|
||||
private var openid = ""
|
||||
private var token = ""
|
||||
private var tokenFH = ""
|
||||
|
||||
private var needAuth = false
|
||||
private var needAuth = true
|
||||
private var needToken = false
|
||||
private var needToken2 = true
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private lateinit var btraceRunnable: BtraceRunnable
|
||||
private var tokenRunnable: TokenRunnable = TokenRunnable()
|
||||
|
||||
private val regex = Regex("""des_key = "([^"]+).+var des_iv = "([^"]+)""")
|
||||
private val input =
|
||||
@@ -59,32 +72,133 @@ object Request {
|
||||
private var initRetryTimes = 0
|
||||
private var initRetryMaxTimes = 0
|
||||
|
||||
private var openid = "vu0-8lgGV2LW9QjDeucB9H12d_6HQWmTFgqCWg5o-VBQN4"
|
||||
|
||||
fun onCreate() {
|
||||
Log.i(TAG, "onCreate")
|
||||
fetchInfoV2()
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
Log.i(TAG, "onDestroy")
|
||||
handler.removeCallbacks(tokenRunnable)
|
||||
}
|
||||
|
||||
private var call: Call<LiveInfo>? = null
|
||||
private var callToken: Call<Token2>? = null
|
||||
private var callAuth: Call<Auth>? = null
|
||||
private var callInfo: Call<Info>? = null
|
||||
private var callFAuth: Call<FAuth>? = null
|
||||
private var callPage: Call<pageModel.Response>? = null
|
||||
|
||||
private var callBtracePage: Call<Void>? = null
|
||||
|
||||
private fun cancelCall() {
|
||||
call?.cancel()
|
||||
callAuth?.cancel()
|
||||
callToken?.cancel()
|
||||
callInfo?.cancel()
|
||||
callFAuth?.cancel()
|
||||
callPage?.cancel()
|
||||
}
|
||||
|
||||
|
||||
private fun fetchToken(tvModel: TVViewModel, cookie: String) {
|
||||
cancelCall()
|
||||
|
||||
val title = tvModel.getTV().title
|
||||
|
||||
callToken = yspToken2Service.getToken("guid=${YSP.getGuid()}; $cookie", "519748109", YSP.getGuid(), "59306155", "b42702bf7309a179d102f3d51b1add2fda0bc7ada64cb801" ,"1", YSP.getTimeStr())
|
||||
callToken?.enqueue(object : Callback<Token2> {
|
||||
override fun onResponse(call: Call<Token2>, response: Response<Token2>) {
|
||||
if (response.isSuccessful) {
|
||||
val liveInfo = response.body()
|
||||
|
||||
if (liveInfo?.data?.token != null) {
|
||||
Log.i(TAG, "token ${liveInfo.data.token}")
|
||||
YSP.token2 = liveInfo.data.token
|
||||
|
||||
YSP.getTokenData(tvModel)
|
||||
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
Log.e(TAG, "$title token error")
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchToken(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchToken(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "认证结果错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "$title token status error")
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchToken(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchToken(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "认证状态错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Token2>, t: Throwable) {
|
||||
Log.e(TAG, "$title token request error $t")
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchToken(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchToken(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "认证请求错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun fetchAuth(tvModel: TVViewModel, cookie: String) {
|
||||
cancelCall()
|
||||
|
||||
@@ -99,25 +213,34 @@ object Request {
|
||||
val liveInfo = response.body()
|
||||
|
||||
if (liveInfo?.data?.token != null) {
|
||||
Log.i(TAG, "token ${liveInfo.data.token}")
|
||||
Log.i(TAG, "auth ${liveInfo.data.token}")
|
||||
YSP.token = liveInfo.data.token
|
||||
fetchVideo(tvModel, cookie)
|
||||
} else {
|
||||
Log.e(TAG, "$title token error")
|
||||
Log.e(TAG, "$title auth error")
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "认证结果错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -125,17 +248,26 @@ object Request {
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "认证状态错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,17 +277,26 @@ object Request {
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "认证请求错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -164,7 +305,7 @@ object Request {
|
||||
private fun fetchVideo(tvModel: TVViewModel, cookie: String) {
|
||||
cancelCall()
|
||||
|
||||
if (::btraceRunnable.isInitialized) {
|
||||
if (Request::btraceRunnable.isInitialized) {
|
||||
handler.removeCallbacks(btraceRunnable)
|
||||
}
|
||||
|
||||
@@ -175,8 +316,13 @@ object Request {
|
||||
val request = LiveInfoRequest(data)
|
||||
call = request.let {
|
||||
yspApiService.getLiveInfo(
|
||||
"guid=${YSP.getGuid()}; $cookie",
|
||||
"guid=${YSP.getGuid()}; gr_user_id=261eecf2-0ce4-4316-a6a1-7171e3de7389; $cookie; newLogin=1; nseqId=${YSP.nseqId}; nrequest-id=${YSP.nrequest_id}",
|
||||
YSP.token,
|
||||
YSP.yspsdkinput,
|
||||
YSP.openapi_signature,
|
||||
"${YSP.nseqId}",
|
||||
YSP.nrequest_id,
|
||||
"519748109",
|
||||
it
|
||||
)
|
||||
}
|
||||
@@ -213,45 +359,82 @@ object Request {
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchVideo(tvModel, cookie)
|
||||
// fetchAuth(tvModel, cookie)
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
fetchVideo(tvModel)
|
||||
}
|
||||
} else {
|
||||
tvModel.needGetToken = true
|
||||
fetchVideo(tvModel)
|
||||
// fetchAuth(tvModel)
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
// fetchAuth(tvModel, cookie)
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val err = "结果错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (liveInfo?.data?.errinfo != null && liveInfo.data.errinfo == "应版权方要求,暂停提供直播信号,请点击观看其他精彩节目") {
|
||||
Log.e(TAG, "$title error ${liveInfo.data.errinfo}")
|
||||
tvModel.setErrInfo(liveInfo.data.errinfo)
|
||||
val err = "版权错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
} else {
|
||||
Log.e(TAG, "$title url error $request $liveInfo")
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchVideo(tvModel, cookie)
|
||||
// fetchAuth(tvModel, cookie)
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
fetchVideo(tvModel)
|
||||
}
|
||||
} else {
|
||||
tvModel.needGetToken = true
|
||||
fetchVideo(tvModel)
|
||||
// fetchAuth(tvModel)
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
// fetchAuth(tvModel, cookie)
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val err = "其他错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,20 +443,38 @@ object Request {
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
// fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
tvModel.needGetToken = true
|
||||
fetchVideo(tvModel)
|
||||
// fetchAuth(tvModel)
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
// fetchAuth(tvModel, cookie)
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val err = "状态错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,22 +484,89 @@ object Request {
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (tvModel.tokenYSPRetryTimes == tvModel.tokenYSPRetryMaxTimes) {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
tvModel.needGetToken = true
|
||||
fetchVideo(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
fetchVideo(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
val err = "请求错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun fetchToken(tvModel: TVViewModel) {
|
||||
cancelCall()
|
||||
if (tvModel.needGetToken) {
|
||||
callInfo = yspTokenService.getInfo("")
|
||||
callInfo?.enqueue(object : Callback<Info> {
|
||||
override fun onResponse(call: Call<Info>, response: Response<Info>) {
|
||||
if (response.isSuccessful && response.body()?.data?.token != null) {
|
||||
token = response.body()?.data?.token!!
|
||||
Log.i(TAG, "info success $token")
|
||||
tvModel.needGetToken = false
|
||||
tvModel.tokenYSPRetryTimes = 0
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109;yspopenid=$openid; vusession=$token"
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else if (response.code() == 304) {
|
||||
tvModel.needGetToken = false
|
||||
tvModel.tokenYSPRetryTimes = 0
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109; yspopenid=$openid; vusession=$token"
|
||||
fetchVideo(tvModel, cookie)
|
||||
} else {
|
||||
Log.e(TAG, "info status error")
|
||||
if (tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
fetchToken(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109"
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Info>, t: Throwable) {
|
||||
Log.e(TAG, "info request error $t")
|
||||
if (tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||
tvModel.tokenYSPRetryTimes++
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
if (!tvModel.getTV().mustToken) {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109"
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109;yspopenid=$openid; vusession=$token"
|
||||
fetchToken(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchAuth(tvModel: TVViewModel) {
|
||||
cancelCall()
|
||||
if (tvModel.needGetToken) {
|
||||
@@ -329,6 +597,8 @@ object Request {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; appid=1400421205; yspappid=519748109"
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,13 +614,15 @@ object Request {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; appid=1400421205; yspappid=519748109"
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; appid=1400421205; yspappid=519748109;yspopenid=$openid; vusession=$token"
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; yspopenid=$openid; vusession=$token"
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
@@ -386,6 +658,8 @@ object Request {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; appid=1400421205; yspappid=519748109"
|
||||
fetchVideo(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,6 +675,8 @@ object Request {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; appid=1400421205; yspappid=519748109"
|
||||
fetchVideo(tvModel, cookie)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,6 +712,10 @@ object Request {
|
||||
if (tvModel.tokenFHRetryTimes < tvModel.tokenFHRetryMaxTimes) {
|
||||
tvModel.tokenFHRetryTimes++
|
||||
fetchFAuth(tvModel)
|
||||
} else {
|
||||
val err = "状态错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,6 +725,10 @@ object Request {
|
||||
if (tvModel.tokenFHRetryTimes < tvModel.tokenFHRetryMaxTimes) {
|
||||
tvModel.tokenFHRetryTimes++
|
||||
fetchFAuth(tvModel)
|
||||
} else {
|
||||
val err = "请求错误"
|
||||
Log.e(TAG, "$title $err")
|
||||
tvModel.setErrInfo(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -456,29 +740,46 @@ object Request {
|
||||
return
|
||||
}
|
||||
|
||||
if (tvModel.getTV().needToken) {
|
||||
if (needToken && tvModel.getTV().needToken) {
|
||||
if (token == "") {
|
||||
tvModel.needGetToken = true
|
||||
}
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel)
|
||||
if (needToken2) {
|
||||
if (needAuth) {
|
||||
fetchToken(tvModel)
|
||||
} else {
|
||||
fetchAuth(tvModel)
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel)
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
fetchVideo(tvModel)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; updateProtocol=1; deviceModel=120"
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
}
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124"
|
||||
|
||||
class TokenRunnable : Runnable {
|
||||
override fun run() {
|
||||
// fetchToken()
|
||||
if (needToken2) {
|
||||
if (needAuth) {
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
//
|
||||
// if (needAuth) {
|
||||
// fetchAuth(tvModel, cookie)
|
||||
// } else {
|
||||
// fetchVideo(tvModel, cookie)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,24 +799,6 @@ object Request {
|
||||
if (!t.isNullOrEmpty()) {
|
||||
token = t
|
||||
Log.i(TAG, "token success $token")
|
||||
if (e != null) {
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
max(30 * 60 * 1000, (e - 1500) * 1000).toLong()
|
||||
)
|
||||
} else {
|
||||
Log.e(TAG, "e empty")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "token empty")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
}
|
||||
if (!f.isNullOrEmpty()) {
|
||||
tokenFH = f
|
||||
@@ -528,10 +811,6 @@ object Request {
|
||||
listener?.onRequestFinished(null)
|
||||
} else {
|
||||
Log.e(TAG, "token status error")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
if (initRetryTimes < initRetryMaxTimes) {
|
||||
initRetryTimes++
|
||||
fetchInfoV2()
|
||||
@@ -543,11 +822,6 @@ object Request {
|
||||
|
||||
override fun onFailure(call: Call<InfoV2>, t: Throwable) {
|
||||
Log.e(TAG, "token request error $t")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
|
||||
if (initRetryTimes < initRetryMaxTimes) {
|
||||
initRetryTimes++
|
||||
fetchInfoV2()
|
||||
@@ -558,68 +832,20 @@ object Request {
|
||||
})
|
||||
}
|
||||
|
||||
fun fetchToken() {
|
||||
yspTokenService.getToken(token)
|
||||
.enqueue(object : Callback<Token> {
|
||||
override fun onResponse(call: Call<Token>, response: Response<Token>) {
|
||||
if (response.isSuccessful) {
|
||||
val t = response.body()?.t
|
||||
val e = response.body()?.e
|
||||
if (!t.isNullOrEmpty()) {
|
||||
token = t
|
||||
Log.e(TAG, "token success $token")
|
||||
if (e != null) {
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
max(30 * 60 * 1000, (e - 1500) * 1000).toLong()
|
||||
)
|
||||
} else {
|
||||
Log.e(TAG, "e empty")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "token empty")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "token status error")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Token>, t: Throwable) {
|
||||
Log.e(TAG, "token request error $t")
|
||||
handler.postDelayed(
|
||||
tokenRunnable,
|
||||
30 * 60 * 1000
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class BtraceRunnable(private val tvModel: TVViewModel) : Runnable {
|
||||
override fun run() {
|
||||
fetchBtrace(tvModel)
|
||||
handler.postDelayed(this, 60000)
|
||||
fetchBtrace3(tvModel)
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchBtrace(tvModel: TVViewModel) {
|
||||
callBtracePage?.cancel()
|
||||
val title = tvModel.getTV().title
|
||||
|
||||
val guid = YSP.getGuid()
|
||||
val pid = tvModel.getTV().pid
|
||||
val sid = tvModel.getTV().sid
|
||||
yspBtraceService.kvcollect(
|
||||
callBtracePage = yspBtraceService.kvcollect(
|
||||
c_timestamp = YSP.generateGuid(),
|
||||
guid = guid,
|
||||
c_guid = guid,
|
||||
@@ -632,19 +858,130 @@ object Request {
|
||||
ftime = getDateFormat("yyyy-MM-dd HH:mm:ss"),
|
||||
seq = tvModel.seq.toString(),
|
||||
)
|
||||
.enqueue(object : Callback<Void> {
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
if (response.isSuccessful) {
|
||||
// Log.d(TAG, "$title kvcollect success")
|
||||
} else {
|
||||
Log.e(TAG, "$title kvcollect status error")
|
||||
}
|
||||
callBtracePage?.enqueue(object : Callback<Void> {
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
if (response.isSuccessful) {
|
||||
Log.d(TAG, "$title kvcollect success")
|
||||
} else {
|
||||
Log.e(TAG, "$title kvcollect status error")
|
||||
}
|
||||
handler.postDelayed(btraceRunnable, 60 * 1000)
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
Log.e(TAG, "$title kvcollect request error")
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
Log.e(TAG, "$title kvcollect request error")
|
||||
handler.postDelayed(btraceRunnable, 60 * 1000)
|
||||
}
|
||||
})
|
||||
tvModel.seq++
|
||||
}
|
||||
|
||||
fun fetchBtrace2(tvModel: TVViewModel) {
|
||||
callBtracePage?.cancel()
|
||||
val title = tvModel.getTV().title
|
||||
|
||||
val guid = YSP.getGuid()
|
||||
val pid = tvModel.getTV().pid
|
||||
val sid = tvModel.getTV().sid
|
||||
val randomNumber = Random.nextDouble()
|
||||
val url = tvModel.getTV().videoUrl.first()
|
||||
|
||||
val r = KvcollectRequest(
|
||||
guid = guid,
|
||||
prog = sid,
|
||||
viewid = sid,
|
||||
livepid = pid,
|
||||
sUrl = "https://www.yangshipin.cn/#/tv/home?pid=$pid",
|
||||
playno = YSP.getRand(),
|
||||
rand_str = YSP.getRand(),
|
||||
ftime = getDateFormat("yyyy-MM-dd HH:mm:ss"),
|
||||
seq = tvModel.seq,
|
||||
durl = url,
|
||||
url = url,
|
||||
// _dc = "",
|
||||
)
|
||||
|
||||
val e =
|
||||
"BossId=${r.BossId}&Pwd=${r.Pwd}&_dc=${r._dc}&cdn=${r.cdn}&cmd=${r.cmd}&defn=${r.defn}&downspeed=${r.downspeed}&durl=${r.durl}&errcode=${r.errcode}&fact1=${r.fact1}&firstreport=${r.firstreport}&fplayerver=${r.fplayerver}&ftime=${r.ftime}&geturltime=6&guid=${r.guid}&hc_openid=${r.hc_openid}&hh_ua=${r.hh_ua}&live_type=${r.live_type}&livepid=${r.livepid}&login_type=${r.login_type}&open_id=&openid=${r.openid}&platform=${r.platform}&playno=${r.playno}&prd=${r.prd}&prog=${r.prog}&rand_str=${r.rand_str}&sRef=${r.sRef}&sUrl=${r.sUrl}&sdtfrom=${r.sdtfrom}&seq=${r.seq}&url=${r.url}&viewid=${r.viewid}"
|
||||
r.signature = YSP.getAuthSignature(e)
|
||||
callBtracePage = yspBtraceService2.kvcollect2(r)
|
||||
callBtracePage?.enqueue(object : Callback<Void> {
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
if (response.isSuccessful) {
|
||||
Log.d(TAG, "$title kvcollect success")
|
||||
} else {
|
||||
Log.e(TAG, "$title kvcollect status error")
|
||||
}
|
||||
})
|
||||
handler.postDelayed(btraceRunnable, 60 * 1000)
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
Log.e(TAG, "$title kvcollect request error")
|
||||
handler.postDelayed(btraceRunnable, 60 * 1000)
|
||||
}
|
||||
})
|
||||
tvModel.seq++
|
||||
}
|
||||
|
||||
fun fetchBtrace3(tvModel: TVViewModel) {
|
||||
callBtracePage?.cancel()
|
||||
val title = tvModel.getTV().title
|
||||
|
||||
val guid = YSP.getGuid()
|
||||
val pid = tvModel.getTV().pid
|
||||
val sid = tvModel.getTV().sid
|
||||
// val randomNumber = Random.nextDouble()
|
||||
val url = tvModel.getTV().videoUrl.first()
|
||||
|
||||
val r = KvcollectRequest2(
|
||||
guid = guid,
|
||||
prog = sid,
|
||||
viewid = sid,
|
||||
livepid = pid,
|
||||
sUrl = "https://www.yangshipin.cn/#/tv/home?pid=$pid",
|
||||
playno = YSP.getRand(),
|
||||
rand_str = YSP.getRand(),
|
||||
ftime = getDateFormat("yyyy-MM-dd HH:mm:ss"),
|
||||
seq = tvModel.seq,
|
||||
durl = url,
|
||||
url = url,
|
||||
_dc = "",
|
||||
)
|
||||
|
||||
// val e =
|
||||
// "BossId=${r.BossId}&Pwd=${r.Pwd}&_dc=${r._dc}&cdn=${r.cdn}&cmd=${r.cmd}&defn=${r.defn}&downspeed=${r.downspeed}&durl=${r.durl}&errcode=${r.errcode}&fact1=${r.fact1}&firstreport=${r.firstreport}&fplayerver=${r.fplayerver}&ftime=${r.ftime}&geturltime=${r.geturltime}&guid=${r.guid}&hc_openid=${r.hc_openid}&hh_ua=${r.hh_ua}&live_type=${r.live_type}&livepid=${r.livepid}&login_type=${r.login_type}&open_id=${r.open_id}&openid=${r.openid}&platform=${r.platform}&playno=${r.playno}&prd=${r.prd}&prog=${r.prog}&rand_str=${r.rand_str}&sRef=${r.sRef}&sUrl=${r.sUrl}&sdtfrom=${r.sdtfrom}&seq=${r.seq}&url=${r.url}&viewid=${r.viewid}"
|
||||
// r.signature = YSP.getAuthSignature(e)
|
||||
|
||||
callBtracePage = yspBtraceService3.kvcollect3(
|
||||
guid = r.guid,
|
||||
prog = r.prog,
|
||||
viewid = r.viewid,
|
||||
livepid = r.livepid,
|
||||
sUrl = r.sUrl,
|
||||
playno = r.playno,
|
||||
// rand_str = r.rand_str,
|
||||
ftime = r.ftime,
|
||||
seq = "${r.seq}",
|
||||
durl = r.durl,
|
||||
// url = r.url,
|
||||
_dc = "${r._dc}",
|
||||
// signature = r.signature
|
||||
)
|
||||
callBtracePage?.enqueue(object : Callback<Void> {
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
if (response.isSuccessful) {
|
||||
Log.i(TAG, "$title kvcollect success")
|
||||
} else {
|
||||
Log.e(TAG, "$title kvcollect status error")
|
||||
}
|
||||
handler.postDelayed(btraceRunnable, 60 * 1000)
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
Log.e(TAG, "$title kvcollect request error")
|
||||
handler.postDelayed(btraceRunnable, 60 * 1000)
|
||||
}
|
||||
})
|
||||
tvModel.seq++
|
||||
}
|
||||
|
||||
@@ -683,9 +1020,34 @@ object Request {
|
||||
})
|
||||
}
|
||||
|
||||
fun fetchYEPG(tvViewModel: TVViewModel) {
|
||||
fun fetchYJceEPG(tvViewModel: TVViewModel) {
|
||||
val title = tvViewModel.getTV().title
|
||||
yspProtoService.getProgram(tvViewModel.getTV().programId, getDateFormat("yyyyMMdd"))
|
||||
yspJceService.getProgram(TVTimeShiftProgramRequest(tvViewModel.getTV().pid))
|
||||
.enqueue(object : Callback<TVTimeShiftProgramResponse> {
|
||||
override fun onResponse(
|
||||
call: Call<TVTimeShiftProgramResponse>,
|
||||
response: Response<TVTimeShiftProgramResponse>
|
||||
) {
|
||||
if (response.isSuccessful) {
|
||||
val program = response.body()
|
||||
if (program != null) {
|
||||
tvViewModel.addYJceEPG(program.programs)
|
||||
Log.d(TAG, "$title program ${program.programs.size}")
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "$title program error")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<TVTimeShiftProgramResponse>, t: Throwable) {
|
||||
Log.e(TAG, "$title program request failed $t")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun fetchYProtoEPG(tvViewModel: TVViewModel) {
|
||||
val title = tvViewModel.getTV().title
|
||||
yspProtoService.getProgram(tvViewModel.getTV().pid, getDateFormat("yyyyMMdd"))
|
||||
.enqueue(object : Callback<epgProgramModel.Response> {
|
||||
override fun onResponse(
|
||||
call: Call<epgProgramModel.Response>,
|
||||
@@ -751,6 +1113,6 @@ object Request {
|
||||
}
|
||||
|
||||
fun setRequestListener(listener: RequestListener) {
|
||||
this.listener = listener
|
||||
Request.listener = listener
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
public class HexUtil {
|
||||
private static final char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
public static final byte[] emptybytes = new byte[0];
|
||||
|
||||
public static String byte2HexStr(byte b2) {
|
||||
char[] cArr = digits;
|
||||
return new String(new char[]{cArr[((byte) (b2 >>> 4)) & 15], cArr[b2 & 15]});
|
||||
}
|
||||
|
||||
public static String bytes2HexStr(ByteBuffer byteBuffer) {
|
||||
ByteBuffer duplicate = byteBuffer.duplicate();
|
||||
duplicate.flip();
|
||||
byte[] bArr = new byte[duplicate.limit()];
|
||||
duplicate.get(bArr);
|
||||
return bytes2HexStr(bArr);
|
||||
}
|
||||
|
||||
public static byte char2Byte(char c2) {
|
||||
int i2;
|
||||
if (c2 < '0' || c2 > '9') {
|
||||
char c3 = 'a';
|
||||
if (c2 < 'a' || c2 > 'f') {
|
||||
c3 = 'A';
|
||||
if (c2 < 'A' || c2 > 'F') {
|
||||
return (byte) 0;
|
||||
}
|
||||
}
|
||||
i2 = (c2 - c3) + 10;
|
||||
} else {
|
||||
i2 = c2 - '0';
|
||||
}
|
||||
return (byte) i2;
|
||||
}
|
||||
|
||||
public static byte hexStr2Byte(String str) {
|
||||
if (str == null || str.length() != 1) {
|
||||
return (byte) 0;
|
||||
}
|
||||
return char2Byte(str.charAt(0));
|
||||
}
|
||||
|
||||
public static byte[] hexStr2Bytes(String str) {
|
||||
if (str != null && !str.equals("")) {
|
||||
int length = str.length() / 2;
|
||||
byte[] bArr = new byte[length];
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
int i3 = i2 * 2;
|
||||
bArr[i2] = (byte) ((char2Byte(str.charAt(i3)) * 16) + char2Byte(str.charAt(i3 + 1)));
|
||||
}
|
||||
return bArr;
|
||||
}
|
||||
return emptybytes;
|
||||
}
|
||||
|
||||
public static String bytes2HexStr(byte[] bArr) {
|
||||
if (bArr == null || bArr.length == 0) {
|
||||
return null;
|
||||
}
|
||||
char[] cArr = new char[bArr.length * 2];
|
||||
for (int i2 = 0; i2 < bArr.length; i2++) {
|
||||
byte b2 = bArr[i2];
|
||||
int i3 = i2 * 2;
|
||||
char[] cArr2 = digits;
|
||||
cArr[i3 + 1] = cArr2[b2 & 15];
|
||||
cArr[i3 + 0] = cArr2[((byte) (b2 >>> 4)) & 15];
|
||||
}
|
||||
return new String(cArr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
public class JceDecodeException extends RuntimeException {
|
||||
public JceDecodeException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
public class JceEncodeException extends RuntimeException {
|
||||
public JceEncodeException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,896 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.nio.BufferUnderflowException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class JceInputStream {
|
||||
private ByteBuffer bs;
|
||||
protected String sServerEncoding = "GBK";
|
||||
|
||||
|
||||
public static class HeadData {
|
||||
public int tag;
|
||||
public byte type;
|
||||
|
||||
public void clear() {
|
||||
this.type = (byte) 0;
|
||||
this.tag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public JceInputStream() {
|
||||
}
|
||||
|
||||
private int peakHead(HeadData headData) {
|
||||
return readHead(headData, this.bs.duplicate());
|
||||
}
|
||||
|
||||
private <T> T[] readArrayImpl(T t, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
T[] tArr = (T[]) ((Object[]) Array.newInstance(t.getClass(), read));
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
tArr[i3] = (T) read( t, 0, true);
|
||||
}
|
||||
return tArr;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public static int readHead(HeadData headData, ByteBuffer byteBuffer) {
|
||||
byte b2 = byteBuffer.get();
|
||||
headData.type = (byte) (b2 & 15);
|
||||
int i2 = (b2 & 240) >> 4;
|
||||
headData.tag = i2;
|
||||
if (i2 == 15) {
|
||||
headData.tag = byteBuffer.get() & 255;
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void skip(int i2) {
|
||||
ByteBuffer byteBuffer = this.bs;
|
||||
byteBuffer.position(byteBuffer.position() + i2);
|
||||
}
|
||||
|
||||
private void skipField() {
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
skipField(headData.type);
|
||||
}
|
||||
|
||||
public JceStruct directRead(JceStruct jceStruct, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JceStruct newInit = jceStruct.newInit();
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 10) {
|
||||
newInit.readFrom(this);
|
||||
skipToStructEnd();
|
||||
return newInit;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
} catch (Exception e2) {
|
||||
throw new JceDecodeException(e2.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer getBs() {
|
||||
return this.bs;
|
||||
}
|
||||
|
||||
public boolean read(boolean z, int i2, boolean z2) {
|
||||
return read((byte) 0, i2, z2) != 0;
|
||||
}
|
||||
|
||||
public <T> T[] readArray(T[] tArr, int i2, boolean z) {
|
||||
if (tArr != null && tArr.length != 0) {
|
||||
return (T[]) readArrayImpl(tArr[0], i2, z);
|
||||
}
|
||||
throw new JceDecodeException("unable to get type of key and value.");
|
||||
}
|
||||
|
||||
public String readByteString(String str, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 == 6) {
|
||||
int i3 = this.bs.get();
|
||||
if (i3 < 0) {
|
||||
i3 += 256;
|
||||
}
|
||||
byte[] bArr = new byte[i3];
|
||||
this.bs.get(bArr);
|
||||
return HexUtil.bytes2HexStr(bArr);
|
||||
} else if (b2 == 7) {
|
||||
int i4 = this.bs.getInt();
|
||||
if (i4 <= 104857600 && i4 >= 0 && i4 <= this.bs.capacity()) {
|
||||
byte[] bArr2 = new byte[i4];
|
||||
this.bs.get(bArr2);
|
||||
return HexUtil.bytes2HexStr(bArr2);
|
||||
}
|
||||
throw new JceDecodeException("String too long: " + i4);
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
}
|
||||
|
||||
public List readList(int i2, boolean z) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (skipToTag(i2)) {
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read < 0) {
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
HeadData headData2 = new HeadData();
|
||||
readHead(headData2);
|
||||
switch (headData2.type) {
|
||||
case 0:
|
||||
skip(1);
|
||||
break;
|
||||
case 1:
|
||||
skip(2);
|
||||
break;
|
||||
case 2:
|
||||
skip(4);
|
||||
break;
|
||||
case 3:
|
||||
skip(8);
|
||||
break;
|
||||
case 4:
|
||||
skip(4);
|
||||
break;
|
||||
case 5:
|
||||
skip(8);
|
||||
break;
|
||||
case 6:
|
||||
int i4 = this.bs.get();
|
||||
if (i4 < 0) {
|
||||
i4 += 256;
|
||||
}
|
||||
skip(i4);
|
||||
break;
|
||||
case 7:
|
||||
skip(this.bs.getInt());
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
try {
|
||||
JceStruct jceStruct = (JceStruct) Class.forName(JceStruct.class.getName()).getConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
jceStruct.readFrom(this);
|
||||
skipToStructEnd();
|
||||
arrayList.add(jceStruct);
|
||||
break;
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
throw new JceDecodeException("type mismatch." + e2);
|
||||
}
|
||||
case 11:
|
||||
default:
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
case 12:
|
||||
arrayList.add(Integer.valueOf(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
} else if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public <K, V> HashMap<K, V> readMap(Map<K, V> map, int i2, boolean z) {
|
||||
return (HashMap) readMap(new HashMap(), map, i2, z);
|
||||
}
|
||||
|
||||
public String readString(int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 == 6) {
|
||||
int i3 = this.bs.get();
|
||||
if (i3 < 0) {
|
||||
i3 += 256;
|
||||
}
|
||||
byte[] bArr = new byte[i3];
|
||||
this.bs.get(bArr);
|
||||
try {
|
||||
return new String(bArr, this.sServerEncoding);
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
return new String(bArr);
|
||||
}
|
||||
} else if (b2 == 7) {
|
||||
int i4 = this.bs.getInt();
|
||||
if (i4 <= 104857600 && i4 >= 0 && i4 <= this.bs.capacity()) {
|
||||
byte[] bArr2 = new byte[i4];
|
||||
this.bs.get(bArr2);
|
||||
try {
|
||||
return new String(bArr2, this.sServerEncoding);
|
||||
} catch (UnsupportedEncodingException unused2) {
|
||||
return new String(bArr2);
|
||||
}
|
||||
}
|
||||
throw new JceDecodeException("String too long: " + i4);
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> readStringMap(int i2, boolean z) {
|
||||
HashMap hashMap = new HashMap();
|
||||
if (skipToTag(i2)) {
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 8) {
|
||||
int read = read(0, 0, true);
|
||||
if (read < 0) {
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
hashMap.put(readString(0, true), readString(1, true));
|
||||
}
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
} else if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public int setServerEncoding(String str) {
|
||||
this.sServerEncoding = str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void skipToStructEnd() {
|
||||
HeadData headData = new HeadData();
|
||||
do {
|
||||
readHead(headData);
|
||||
skipField(headData.type);
|
||||
} while (headData.type != 11);
|
||||
}
|
||||
|
||||
public boolean skipToTag(int i2) {
|
||||
try {
|
||||
HeadData headData = new HeadData();
|
||||
while (true) {
|
||||
int peakHead = peakHead(headData);
|
||||
if (i2 <= headData.tag || headData.type == 11) {
|
||||
break;
|
||||
}
|
||||
skip(peakHead);
|
||||
skipField(headData.type);
|
||||
}
|
||||
if (headData.type == 11) {
|
||||
return false;
|
||||
}
|
||||
return i2 == headData.tag;
|
||||
} catch (JceDecodeException | BufferUnderflowException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void warp(byte[] bArr) {
|
||||
wrap(bArr);
|
||||
}
|
||||
|
||||
public void wrap(byte[] bArr) {
|
||||
this.bs = ByteBuffer.wrap(bArr);
|
||||
}
|
||||
|
||||
|
||||
private <K, V> Map<K, V> readMap(Map<K, V> map, Map<K, V> map2, int i2, boolean z) {
|
||||
if (map2 != null && !map2.isEmpty()) {
|
||||
Map.Entry<K, V> next = map2.entrySet().iterator().next();
|
||||
K key = next.getKey();
|
||||
V value = next.getValue();
|
||||
if (skipToTag(i2)) {
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 8) {
|
||||
int read = read(0, 0, true);
|
||||
if (read < 0) {
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
map.put((K)read( key, 0, true), (V)read(value, 1, true));
|
||||
}
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
} else if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
return new HashMap();
|
||||
}
|
||||
|
||||
public byte read(byte b2, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return b2;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b3 = headData.type;
|
||||
if (b3 != 0) {
|
||||
if (b3 == 12) {
|
||||
return (byte) 0;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return this.bs.get();
|
||||
}
|
||||
|
||||
public JceInputStream(ByteBuffer byteBuffer) {
|
||||
this.bs = byteBuffer;
|
||||
}
|
||||
|
||||
private void skipField(byte b2) {
|
||||
int i2 = 0;
|
||||
switch (b2) {
|
||||
case 0:
|
||||
skip(1);
|
||||
return;
|
||||
case 1:
|
||||
skip(2);
|
||||
return;
|
||||
case 2:
|
||||
skip(4);
|
||||
return;
|
||||
case 3:
|
||||
skip(8);
|
||||
return;
|
||||
case 4:
|
||||
skip(4);
|
||||
return;
|
||||
case 5:
|
||||
skip(8);
|
||||
return;
|
||||
case 6:
|
||||
int i3 = this.bs.get();
|
||||
if (i3 < 0) {
|
||||
i3 += 256;
|
||||
}
|
||||
skip(i3);
|
||||
return;
|
||||
case 7:
|
||||
skip(this.bs.getInt());
|
||||
return;
|
||||
case 8:
|
||||
int read = read(0, 0, true);
|
||||
while (i2 < read * 2) {
|
||||
skipField();
|
||||
i2++;
|
||||
}
|
||||
return;
|
||||
case 9:
|
||||
int read2 = read(0, 0, true);
|
||||
while (i2 < read2) {
|
||||
skipField();
|
||||
i2++;
|
||||
}
|
||||
return;
|
||||
case 10:
|
||||
skipToStructEnd();
|
||||
return;
|
||||
case 11:
|
||||
case 12:
|
||||
return;
|
||||
case 13:
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 0) {
|
||||
skip(read(0, 0, true));
|
||||
return;
|
||||
}
|
||||
throw new JceDecodeException("skipField with invalid type, type value: " + ((int) b2) + ", " + ((int) headData.type));
|
||||
default:
|
||||
throw new JceDecodeException("invalid type.");
|
||||
}
|
||||
}
|
||||
|
||||
public <T> List<T> readArray(List<T> list, int i2, boolean z) {
|
||||
if (list != null && !list.isEmpty()) {
|
||||
Object[] readArrayImpl = readArrayImpl(list.get(0), i2, z);
|
||||
if (readArrayImpl == null) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (Object obj : readArrayImpl) {
|
||||
arrayList.add(obj);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
public void readHead(HeadData headData) {
|
||||
readHead(headData, this.bs);
|
||||
}
|
||||
|
||||
public JceInputStream(byte[] bArr) {
|
||||
this.bs = ByteBuffer.wrap(bArr);
|
||||
}
|
||||
|
||||
public JceInputStream(byte[] bArr, int i2) {
|
||||
ByteBuffer wrap = ByteBuffer.wrap(bArr);
|
||||
this.bs = wrap;
|
||||
wrap.position(i2);
|
||||
}
|
||||
|
||||
public short read(short s, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 != 0) {
|
||||
if (b2 != 1) {
|
||||
if (b2 == 12) {
|
||||
return (short) 0;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return this.bs.getShort();
|
||||
}
|
||||
return this.bs.get();
|
||||
}
|
||||
|
||||
public int read(int i2, int i3, boolean z) {
|
||||
if (!skipToTag(i3)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 != 0) {
|
||||
if (b2 != 1) {
|
||||
if (b2 != 2) {
|
||||
if (b2 == 12) {
|
||||
return 0;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return this.bs.getInt();
|
||||
}
|
||||
return this.bs.getShort();
|
||||
}
|
||||
return this.bs.get();
|
||||
}
|
||||
|
||||
public long read(long j, int i2, boolean z) {
|
||||
int i3;
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 == 0) {
|
||||
i3 = this.bs.get();
|
||||
} else if (b2 == 1) {
|
||||
i3 = this.bs.getShort();
|
||||
} else if (b2 != 2) {
|
||||
if (b2 != 3) {
|
||||
if (b2 == 12) {
|
||||
return 0L;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return this.bs.getLong();
|
||||
} else {
|
||||
i3 = this.bs.getInt();
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
public float read(float f2, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return f2;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 != 4) {
|
||||
if (b2 == 12) {
|
||||
return 0.0f;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return this.bs.getFloat();
|
||||
}
|
||||
|
||||
public double read(double d2, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return d2;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 != 4) {
|
||||
if (b2 != 5) {
|
||||
if (b2 == 12) {
|
||||
return 0.0d;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return this.bs.getDouble();
|
||||
}
|
||||
return this.bs.getFloat();
|
||||
}
|
||||
|
||||
public String read(String str, int i2, boolean z) {
|
||||
String str2;
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 == 6) {
|
||||
int i3 = this.bs.get();
|
||||
if (i3 < 0) {
|
||||
i3 += 256;
|
||||
}
|
||||
byte[] bArr = new byte[i3];
|
||||
this.bs.get(bArr);
|
||||
try {
|
||||
str2 = new String(bArr, this.sServerEncoding);
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
str2 = new String(bArr);
|
||||
}
|
||||
} else if (b2 == 7) {
|
||||
int i4 = this.bs.getInt();
|
||||
if (i4 <= 104857600 && i4 >= 0 && i4 <= this.bs.capacity()) {
|
||||
byte[] bArr2 = new byte[i4];
|
||||
this.bs.get(bArr2);
|
||||
try {
|
||||
str2 = new String(bArr2, this.sServerEncoding);
|
||||
} catch (UnsupportedEncodingException unused2) {
|
||||
str2 = new String(bArr2);
|
||||
}
|
||||
} else {
|
||||
throw new JceDecodeException("String too long: " + i4);
|
||||
}
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
return str2;
|
||||
}
|
||||
|
||||
public String[] read(String[] strArr, int i2, boolean z) {
|
||||
return (String[]) readArray(strArr, i2, z);
|
||||
}
|
||||
|
||||
public boolean[] read(boolean[] zArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
boolean[] zArr2 = new boolean[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
zArr2[i3] = read(zArr2[0], 0, true);
|
||||
}
|
||||
return zArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public byte[] read(byte[] bArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
byte b2 = headData.type;
|
||||
if (b2 == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0 && read <= this.bs.capacity()) {
|
||||
byte[] bArr2 = new byte[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
bArr2[i3] = read(bArr2[0], 0, true);
|
||||
}
|
||||
return bArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
} else if (b2 == 13) {
|
||||
HeadData headData2 = new HeadData();
|
||||
readHead(headData2);
|
||||
if (headData2.type == 0) {
|
||||
int read2 = read(0, 0, true);
|
||||
if (read2 >= 0 && read2 <= this.bs.capacity()) {
|
||||
byte[] bArr3 = new byte[read2];
|
||||
this.bs.get(bArr3);
|
||||
return bArr3;
|
||||
}
|
||||
throw new JceDecodeException("invalid size, tag: " + i2 + ", type: " + ((int) headData.type) + ", " + ((int) headData2.type) + ", size: " + read2);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch, tag: " + i2 + ", type: " + ((int) headData.type) + ", " + ((int) headData2.type));
|
||||
} else {
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
}
|
||||
|
||||
public short[] read(short[] sArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
short[] sArr2 = new short[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
sArr2[i3] = read(sArr2[0], 0, true);
|
||||
}
|
||||
return sArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public int[] read(int[] iArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
int[] iArr2 = new int[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
iArr2[i3] = read(iArr2[0], 0, true);
|
||||
}
|
||||
return iArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public long[] read(long[] jArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
long[] jArr2 = new long[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
jArr2[i3] = read(jArr2[0], 0, true);
|
||||
}
|
||||
return jArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public float[] read(float[] fArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
float[] fArr2 = new float[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
fArr2[i3] = read(fArr2[0], 0, true);
|
||||
}
|
||||
return fArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public double[] read(double[] dArr, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 9) {
|
||||
int read = read(0, 0, true);
|
||||
if (read >= 0) {
|
||||
double[] dArr2 = new double[read];
|
||||
for (int i3 = 0; i3 < read; i3++) {
|
||||
dArr2[i3] = read(dArr2[0], 0, true);
|
||||
}
|
||||
return dArr2;
|
||||
}
|
||||
throw new JceDecodeException("size invalid: " + read);
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
}
|
||||
|
||||
public JceStruct read(JceStruct jceStruct, int i2, boolean z) {
|
||||
if (!skipToTag(i2)) {
|
||||
if (z) {
|
||||
throw new JceDecodeException("require field not exist.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JceStruct jceStruct2 = (JceStruct) jceStruct.getClass().newInstance();
|
||||
HeadData headData = new HeadData();
|
||||
readHead(headData);
|
||||
if (headData.type == 10) {
|
||||
jceStruct2.readFrom(this);
|
||||
skipToStructEnd();
|
||||
return jceStruct2;
|
||||
}
|
||||
throw new JceDecodeException("type mismatch.");
|
||||
} catch (Exception e2) {
|
||||
throw new JceDecodeException(e2.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public JceStruct[] read(JceStruct[] jceStructArr, int i2, boolean z) {
|
||||
return (JceStruct[]) readArray(jceStructArr, i2, z);
|
||||
}
|
||||
|
||||
public <T> Object read(T t, int i2, boolean z) {
|
||||
if (t instanceof Byte) {
|
||||
return Byte.valueOf(read((byte) 0, i2, z));
|
||||
}
|
||||
if (t instanceof Boolean) {
|
||||
return Boolean.valueOf(read(false, i2, z));
|
||||
}
|
||||
if (t instanceof Short) {
|
||||
return Short.valueOf(read((short) 0, i2, z));
|
||||
}
|
||||
if (t instanceof Integer) {
|
||||
return Integer.valueOf(read(0, i2, z));
|
||||
}
|
||||
if (t instanceof Long) {
|
||||
return Long.valueOf(read(0L, i2, z));
|
||||
}
|
||||
if (t instanceof Float) {
|
||||
return Float.valueOf(read(0.0f, i2, z));
|
||||
}
|
||||
if (t instanceof Double) {
|
||||
return Double.valueOf(read(0.0d, i2, z));
|
||||
}
|
||||
if (t instanceof String) {
|
||||
return readString(i2, z);
|
||||
}
|
||||
if (t instanceof Map) {
|
||||
return readMap((Map) t, i2, z);
|
||||
}
|
||||
if (t instanceof List) {
|
||||
return readArray((List) t, i2, z);
|
||||
}
|
||||
if (t instanceof JceStruct) {
|
||||
return read((JceStruct) t, i2, z);
|
||||
}
|
||||
if (t.getClass().isArray()) {
|
||||
if (!(t instanceof byte[]) && !(t instanceof Byte[])) {
|
||||
if (t instanceof boolean[]) {
|
||||
return read((boolean[]) null, i2, z);
|
||||
}
|
||||
if (t instanceof short[]) {
|
||||
return read((short[]) null, i2, z);
|
||||
}
|
||||
if (t instanceof int[]) {
|
||||
return read((int[]) null, i2, z);
|
||||
}
|
||||
if (t instanceof long[]) {
|
||||
return read((long[]) null, i2, z);
|
||||
}
|
||||
if (t instanceof float[]) {
|
||||
return read((float[]) null, i2, z);
|
||||
}
|
||||
if (t instanceof double[]) {
|
||||
return read((double[]) null, i2, z);
|
||||
}
|
||||
return readArray((Object[]) t, i2, z);
|
||||
}
|
||||
return read((byte[]) null, i2, z);
|
||||
}
|
||||
throw new JceDecodeException("read object error: unsupport type.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,361 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JceOutputStream {
|
||||
private ByteBuffer bs;
|
||||
private OnIllegalArgumentException exceptionHandler;
|
||||
protected String sServerEncoding;
|
||||
|
||||
public JceOutputStream(ByteBuffer byteBuffer) {
|
||||
this.sServerEncoding = "GBK";
|
||||
this.bs = byteBuffer;
|
||||
}
|
||||
|
||||
private void writeArray(Object[] objArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(objArr.length, 0);
|
||||
for (Object obj : objArr) {
|
||||
write(obj, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer getByteBuffer() {
|
||||
return this.bs;
|
||||
}
|
||||
|
||||
public OnIllegalArgumentException getExceptionHandler() {
|
||||
return this.exceptionHandler;
|
||||
}
|
||||
|
||||
public void reserve(int i2) {
|
||||
if (this.bs.remaining() < i2) {
|
||||
int capacity = (this.bs.capacity() + i2) * 2;
|
||||
try {
|
||||
ByteBuffer allocate = ByteBuffer.allocate(capacity);
|
||||
allocate.put(this.bs.array(), 0, this.bs.position());
|
||||
this.bs = allocate;
|
||||
} catch (IllegalArgumentException e2) {
|
||||
OnIllegalArgumentException onIllegalArgumentException = this.exceptionHandler;
|
||||
if (onIllegalArgumentException != null) {
|
||||
onIllegalArgumentException.onException(e2, this.bs, i2, capacity);
|
||||
}
|
||||
throw e2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setExceptionHandler(OnIllegalArgumentException onIllegalArgumentException) {
|
||||
this.exceptionHandler = onIllegalArgumentException;
|
||||
}
|
||||
|
||||
public int setServerEncoding(String str) {
|
||||
this.sServerEncoding = str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public byte[] toByteArray() {
|
||||
byte[] bArr = new byte[this.bs.position()];
|
||||
System.arraycopy(this.bs.array(), 0, bArr, 0, this.bs.position());
|
||||
return bArr;
|
||||
}
|
||||
|
||||
public void write(boolean z, int i2) {
|
||||
write(z ? (byte) 1 : (byte) 0, i2);
|
||||
}
|
||||
|
||||
public void writeByteString(String str, int i2) {
|
||||
reserve(str.length() + 10);
|
||||
byte[] hexStr2Bytes = HexUtil.hexStr2Bytes(str);
|
||||
if (hexStr2Bytes.length > 255) {
|
||||
writeHead((byte) 7, i2);
|
||||
this.bs.putInt(hexStr2Bytes.length);
|
||||
this.bs.put(hexStr2Bytes);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 6, i2);
|
||||
this.bs.put((byte) hexStr2Bytes.length);
|
||||
this.bs.put(hexStr2Bytes);
|
||||
}
|
||||
|
||||
public void writeHead(byte b2, int i2) {
|
||||
if (i2 < 15) {
|
||||
this.bs.put((byte) (b2 | (i2 << 4)));
|
||||
} else if (i2 < 256) {
|
||||
this.bs.put((byte) (b2 | 240));
|
||||
this.bs.put((byte) i2);
|
||||
} else {
|
||||
throw new JceEncodeException("tag is too large: " + i2);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeStringByte(String str, int i2) {
|
||||
byte[] hexStr2Bytes = HexUtil.hexStr2Bytes(str);
|
||||
reserve(hexStr2Bytes.length + 10);
|
||||
if (hexStr2Bytes.length > 255) {
|
||||
writeHead((byte) 7, i2);
|
||||
this.bs.putInt(hexStr2Bytes.length);
|
||||
this.bs.put(hexStr2Bytes);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 6, i2);
|
||||
this.bs.put((byte) hexStr2Bytes.length);
|
||||
this.bs.put(hexStr2Bytes);
|
||||
}
|
||||
|
||||
public void write(byte b2, int i2) {
|
||||
reserve(3);
|
||||
if (b2 == 0) {
|
||||
writeHead((byte) 12, i2);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 0, i2);
|
||||
this.bs.put(b2);
|
||||
}
|
||||
|
||||
public JceOutputStream(int i2) {
|
||||
this.sServerEncoding = "GBK";
|
||||
this.bs = ByteBuffer.allocate(i2);
|
||||
}
|
||||
|
||||
public void write(short s, int i2) {
|
||||
reserve(4);
|
||||
if (s >= -128 && s <= 127) {
|
||||
write((byte) s, i2);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 1, i2);
|
||||
this.bs.putShort(s);
|
||||
}
|
||||
|
||||
public JceOutputStream() {
|
||||
this(128);
|
||||
}
|
||||
|
||||
public void write(int i2, int i3) {
|
||||
reserve(6);
|
||||
if (i2 >= -32768 && i2 <= 32767) {
|
||||
write((short) i2, i3);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 2, i3);
|
||||
this.bs.putInt(i2);
|
||||
}
|
||||
|
||||
public void write(long j, int i2) {
|
||||
reserve(10);
|
||||
if (j >= -2147483648L && j <= 2147483647L) {
|
||||
write((int) j, i2);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 3, i2);
|
||||
this.bs.putLong(j);
|
||||
}
|
||||
|
||||
public void write(float f2, int i2) {
|
||||
reserve(6);
|
||||
writeHead((byte) 4, i2);
|
||||
this.bs.putFloat(f2);
|
||||
}
|
||||
|
||||
public void write(double d2, int i2) {
|
||||
reserve(10);
|
||||
writeHead((byte) 5, i2);
|
||||
this.bs.putDouble(d2);
|
||||
}
|
||||
|
||||
public void write(String str, int i2) {
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = str.getBytes(this.sServerEncoding);
|
||||
} catch (UnsupportedEncodingException unused) {
|
||||
bytes = str.getBytes();
|
||||
}
|
||||
reserve(bytes.length + 10);
|
||||
if (bytes.length > 255) {
|
||||
writeHead((byte) 7, i2);
|
||||
this.bs.putInt(bytes.length);
|
||||
this.bs.put(bytes);
|
||||
return;
|
||||
}
|
||||
writeHead((byte) 6, i2);
|
||||
this.bs.put((byte) bytes.length);
|
||||
this.bs.put(bytes);
|
||||
}
|
||||
|
||||
public <K, V> void write(Map<K, V> map, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 8, i2);
|
||||
write(map == null ? 0 : map.size(), 0);
|
||||
if (map != null) {
|
||||
for (Map.Entry<K, V> entry : map.entrySet()) {
|
||||
write(entry.getKey(), 0);
|
||||
write(entry.getValue(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void write(boolean[] zArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(zArr.length, 0);
|
||||
for (boolean z : zArr) {
|
||||
write(z, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(byte[] bArr, int i2) {
|
||||
reserve(bArr.length + 8);
|
||||
writeHead((byte) 13, i2);
|
||||
writeHead((byte) 0, 0);
|
||||
write(bArr.length, 0);
|
||||
this.bs.put(bArr);
|
||||
}
|
||||
|
||||
public void write(short[] sArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(sArr.length, 0);
|
||||
for (short s : sArr) {
|
||||
write(s, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(int[] iArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(iArr.length, 0);
|
||||
for (int i3 : iArr) {
|
||||
write(i3, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(long[] jArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(jArr.length, 0);
|
||||
for (long j : jArr) {
|
||||
write(j, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(float[] fArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(fArr.length, 0);
|
||||
for (float f2 : fArr) {
|
||||
write(f2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(double[] dArr, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(dArr.length, 0);
|
||||
for (double d2 : dArr) {
|
||||
write(d2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void write(T[] tArr, int i2) {
|
||||
writeArray(tArr, i2);
|
||||
}
|
||||
|
||||
public <T> void write(Collection<T> collection, int i2) {
|
||||
reserve(8);
|
||||
writeHead((byte) 9, i2);
|
||||
write(collection == null ? 0 : collection.size(), 0);
|
||||
if (collection != null) {
|
||||
for (T t : collection) {
|
||||
write(t, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void write(JceStruct jceStruct, int i2) {
|
||||
reserve(2);
|
||||
writeHead((byte) 10, i2);
|
||||
jceStruct.writeTo(this);
|
||||
reserve(2);
|
||||
writeHead((byte) 11, 0);
|
||||
}
|
||||
|
||||
public void write(Byte b2, int i2) {
|
||||
write(b2.byteValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Boolean bool, int i2) {
|
||||
write(bool.booleanValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Short sh, int i2) {
|
||||
write(sh.shortValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Integer num, int i2) {
|
||||
write(num.intValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Long l, int i2) {
|
||||
write(l.longValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Float f2, int i2) {
|
||||
write(f2.floatValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Double d2, int i2) {
|
||||
write(d2.doubleValue(), i2);
|
||||
}
|
||||
|
||||
public void write(Object obj, int i2) {
|
||||
if (obj instanceof Byte) {
|
||||
write(((Byte) obj).byteValue(), i2);
|
||||
} else if (obj instanceof Boolean) {
|
||||
write(((Boolean) obj).booleanValue(), i2);
|
||||
} else if (obj instanceof Short) {
|
||||
write(((Short) obj).shortValue(), i2);
|
||||
} else if (obj instanceof Integer) {
|
||||
write(((Integer) obj).intValue(), i2);
|
||||
} else if (obj instanceof Long) {
|
||||
write(((Long) obj).longValue(), i2);
|
||||
} else if (obj instanceof Float) {
|
||||
write(((Float) obj).floatValue(), i2);
|
||||
} else if (obj instanceof Double) {
|
||||
write(((Double) obj).doubleValue(), i2);
|
||||
} else if (obj instanceof String) {
|
||||
write((String) obj, i2);
|
||||
} else if (obj instanceof Map) {
|
||||
write((Map) obj, i2);
|
||||
} else if (obj instanceof List) {
|
||||
write((Collection) ((List) obj), i2);
|
||||
} else if (obj instanceof JceStruct) {
|
||||
write((JceStruct) obj, i2);
|
||||
} else if (obj instanceof byte[]) {
|
||||
write((byte[]) obj, i2);
|
||||
} else if (obj instanceof boolean[]) {
|
||||
write((boolean[]) obj, i2);
|
||||
} else if (obj instanceof short[]) {
|
||||
write((short[]) obj, i2);
|
||||
} else if (obj instanceof int[]) {
|
||||
write((int[]) obj, i2);
|
||||
} else if (obj instanceof long[]) {
|
||||
write((long[]) obj, i2);
|
||||
} else if (obj instanceof float[]) {
|
||||
write((float[]) obj, i2);
|
||||
} else if (obj instanceof double[]) {
|
||||
write((double[]) obj, i2);
|
||||
} else if (obj.getClass().isArray()) {
|
||||
writeArray((Object[]) obj, i2);
|
||||
} else if (obj instanceof Collection) {
|
||||
write((Collection) obj, i2);
|
||||
} else {
|
||||
throw new JceEncodeException("write object error: unsupport type. " + obj.getClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class JceStruct implements Serializable {
|
||||
public static final byte BYTE = 0;
|
||||
public static final byte DOUBLE = 5;
|
||||
public static final byte FLOAT = 4;
|
||||
public static final byte INT = 2;
|
||||
public static final int JCE_MAX_STRING_LENGTH = 104857600;
|
||||
public static final byte LIST = 9;
|
||||
public static final byte LONG = 3;
|
||||
public static final byte MAP = 8;
|
||||
public static final byte SHORT = 1;
|
||||
public static final byte SIMPLE_LIST = 13;
|
||||
public static final byte STRING1 = 6;
|
||||
public static final byte STRING4 = 7;
|
||||
public static final byte STRUCT_BEGIN = 10;
|
||||
public static final byte STRUCT_END = 11;
|
||||
public static final byte ZERO_TAG = 12;
|
||||
private Object tag;
|
||||
|
||||
public static String toDisplaySimpleString(JceStruct jceStruct) {
|
||||
if (jceStruct == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
jceStruct.displaySimple(sb, 0);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean containField(String str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void display(StringBuilder sb, int i2) {
|
||||
}
|
||||
|
||||
public void displaySimple(StringBuilder sb, int i2) {
|
||||
}
|
||||
|
||||
public Object getFieldByName(String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getTag() {
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
public JceStruct newInit() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void readFrom(JceInputStream jceInputStream);
|
||||
|
||||
public void recyle() {
|
||||
}
|
||||
|
||||
public void setFieldByName(String str, Object obj) {
|
||||
}
|
||||
|
||||
public void setTag(Object obj) {
|
||||
this.tag = obj;
|
||||
}
|
||||
|
||||
public byte[] toByteArray() {
|
||||
JceOutputStream jceOutputStream = new JceOutputStream();
|
||||
writeTo(jceOutputStream);
|
||||
return jceOutputStream.toByteArray();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
display(sb, 0);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public abstract void writeTo(JceOutputStream jceOutputStream);
|
||||
|
||||
public byte[] toByteArray(String str) {
|
||||
JceOutputStream jceOutputStream = new JceOutputStream();
|
||||
jceOutputStream.setServerEncoding(str);
|
||||
writeTo(jceOutputStream);
|
||||
return jceOutputStream.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.qq.taf.jce;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public interface OnIllegalArgumentException {
|
||||
void onException(IllegalArgumentException illegalArgumentException, ByteBuffer byteBuffer, int i2, int i3);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class Action extends JceStruct {
|
||||
public String reportEventId;
|
||||
public String reportKey;
|
||||
public String reportParams;
|
||||
public String url;
|
||||
|
||||
public Action() {
|
||||
this.url = "";
|
||||
this.reportEventId = "";
|
||||
this.reportKey = "";
|
||||
this.reportParams = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.url = jceInputStream.readString(0, true);
|
||||
this.reportEventId = jceInputStream.readString(1, false);
|
||||
this.reportKey = jceInputStream.readString(2, false);
|
||||
this.reportParams = jceInputStream.readString(3, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.url, 0);
|
||||
String str = this.reportEventId;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 1);
|
||||
}
|
||||
String str2 = this.reportKey;
|
||||
if (str2 != null) {
|
||||
jceOutputStream.write(str2, 2);
|
||||
}
|
||||
String str3 = this.reportParams;
|
||||
if (str3 != null) {
|
||||
jceOutputStream.write(str3, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public Action(String str, String str2, String str3, String str4) {
|
||||
this.url = "";
|
||||
this.reportEventId = "";
|
||||
this.reportKey = "";
|
||||
this.reportParams = "";
|
||||
this.url = str;
|
||||
this.reportEventId = str2;
|
||||
this.reportKey = str3;
|
||||
this.reportParams = str4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class BucketConfig extends JceStruct {
|
||||
public int bucketId;
|
||||
public String extra;
|
||||
|
||||
public BucketConfig() {
|
||||
this.bucketId = 0;
|
||||
this.extra = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.bucketId = jceInputStream.read(this.bucketId, 0, true);
|
||||
this.extra = jceInputStream.readString(1, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.bucketId, 0);
|
||||
String str = this.extra;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public BucketConfig(int i2, String str) {
|
||||
this.bucketId = 0;
|
||||
this.extra = "";
|
||||
this.bucketId = i2;
|
||||
this.extra = str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class BusinessExtent extends JceStruct {
|
||||
public int launchType;
|
||||
|
||||
public BusinessExtent() {
|
||||
this.launchType = 0;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.launchType = jceInputStream.read(this.launchType, 0, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.launchType, 0);
|
||||
}
|
||||
|
||||
public BusinessExtent(int i2) {
|
||||
this.launchType = 0;
|
||||
this.launchType = i2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class BusinessHead extends JceStruct {
|
||||
static byte[] cache_head;
|
||||
public byte[] head;
|
||||
public int type;
|
||||
|
||||
static {
|
||||
cache_head = new byte[0];
|
||||
byte[] bArr = {0};
|
||||
}
|
||||
|
||||
public BusinessHead() {
|
||||
this.type = 0;
|
||||
this.head = null;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.type = jceInputStream.read(this.type, 0, true);
|
||||
this.head = jceInputStream.read(cache_head, 1, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.type, 0);
|
||||
byte[] bArr = this.head;
|
||||
if (bArr != null) {
|
||||
jceOutputStream.write(bArr, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public BusinessHead(int i2, byte[] bArr) {
|
||||
this.type = 0;
|
||||
this.head = null;
|
||||
this.type = i2;
|
||||
this.head = bArr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class Coordinates extends JceStruct {
|
||||
public double accuracy;
|
||||
public float latitude;
|
||||
public float longitude;
|
||||
public int type;
|
||||
|
||||
public Coordinates() {
|
||||
this.type = 0;
|
||||
this.latitude = 0.0f;
|
||||
this.longitude = 0.0f;
|
||||
this.accuracy = 0.0d;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.type = jceInputStream.read(this.type, 0, false);
|
||||
this.latitude = jceInputStream.read(this.latitude, 1, false);
|
||||
this.longitude = jceInputStream.read(this.longitude, 2, false);
|
||||
this.accuracy = jceInputStream.read(this.accuracy, 3, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.type, 0);
|
||||
jceOutputStream.write(this.latitude, 1);
|
||||
jceOutputStream.write(this.longitude, 2);
|
||||
jceOutputStream.write(this.accuracy, 3);
|
||||
}
|
||||
|
||||
public Coordinates(int i2, float f2, float f3, double d2) {
|
||||
this.type = 0;
|
||||
this.latitude = 0.0f;
|
||||
this.longitude = 0.0f;
|
||||
this.accuracy = 0.0d;
|
||||
this.type = i2;
|
||||
this.latitude = f2;
|
||||
this.longitude = f3;
|
||||
this.accuracy = d2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class ExtentAccount extends JceStruct {
|
||||
public String accountId;
|
||||
public int type;
|
||||
|
||||
public ExtentAccount() {
|
||||
this.type = 0;
|
||||
this.accountId = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.type = jceInputStream.read(this.type, 0, true);
|
||||
this.accountId = jceInputStream.readString(1, true);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.type, 0);
|
||||
jceOutputStream.write(this.accountId, 1);
|
||||
}
|
||||
|
||||
public ExtentAccount(int i2, String str) {
|
||||
this.type = 0;
|
||||
this.accountId = "";
|
||||
this.type = i2;
|
||||
this.accountId = str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class ExtentData extends JceStruct {
|
||||
static BucketConfig cache_bucketInfo = new BucketConfig();
|
||||
public BucketConfig bucketInfo;
|
||||
public int checkFlag;
|
||||
public String extra;
|
||||
public byte flagByte;
|
||||
|
||||
public ExtentData() {
|
||||
this.checkFlag = 0;
|
||||
this.flagByte = (byte) 0;
|
||||
this.extra = "";
|
||||
this.bucketInfo = null;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.checkFlag = jceInputStream.read(this.checkFlag, 0, false);
|
||||
this.flagByte = jceInputStream.read(this.flagByte, 1, false);
|
||||
this.extra = jceInputStream.readString(2, false);
|
||||
this.bucketInfo = (BucketConfig) jceInputStream.read((JceStruct) cache_bucketInfo, 3, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.checkFlag, 0);
|
||||
jceOutputStream.write(this.flagByte, 1);
|
||||
String str = this.extra;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 2);
|
||||
}
|
||||
BucketConfig bucketConfig = this.bucketInfo;
|
||||
if (bucketConfig != null) {
|
||||
jceOutputStream.write((JceStruct) bucketConfig, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public ExtentData(int i2, byte b2, String str, BucketConfig bucketConfig) {
|
||||
this.checkFlag = 0;
|
||||
this.flagByte = (byte) 0;
|
||||
this.extra = "";
|
||||
this.bucketInfo = null;
|
||||
this.checkFlag = i2;
|
||||
this.flagByte = b2;
|
||||
this.extra = str;
|
||||
this.bucketInfo = bucketConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class LogReport extends JceStruct {
|
||||
public String callType;
|
||||
public String channelId;
|
||||
public String extent;
|
||||
public String from;
|
||||
public int isAuto;
|
||||
public String mid;
|
||||
public String pageId;
|
||||
public int pageStep;
|
||||
public String pid;
|
||||
public String refPageId;
|
||||
public String vid;
|
||||
|
||||
public LogReport() {
|
||||
this.pageId = "";
|
||||
this.refPageId = "";
|
||||
this.pageStep = 0;
|
||||
this.callType = "";
|
||||
this.isAuto = 0;
|
||||
this.vid = "";
|
||||
this.pid = "";
|
||||
this.from = "";
|
||||
this.channelId = "";
|
||||
this.mid = "";
|
||||
this.extent = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.pageId = jceInputStream.readString(0, false);
|
||||
this.refPageId = jceInputStream.readString(1, false);
|
||||
this.pageStep = jceInputStream.read(this.pageStep, 2, false);
|
||||
this.callType = jceInputStream.readString(3, false);
|
||||
this.isAuto = jceInputStream.read(this.isAuto, 4, false);
|
||||
this.vid = jceInputStream.readString(5, false);
|
||||
this.pid = jceInputStream.readString(6, false);
|
||||
this.from = jceInputStream.readString(7, false);
|
||||
this.channelId = jceInputStream.readString(8, false);
|
||||
this.mid = jceInputStream.readString(9, false);
|
||||
this.extent = jceInputStream.readString(10, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
String str = this.pageId;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 0);
|
||||
}
|
||||
String str2 = this.refPageId;
|
||||
if (str2 != null) {
|
||||
jceOutputStream.write(str2, 1);
|
||||
}
|
||||
jceOutputStream.write(this.pageStep, 2);
|
||||
String str3 = this.callType;
|
||||
if (str3 != null) {
|
||||
jceOutputStream.write(str3, 3);
|
||||
}
|
||||
jceOutputStream.write(this.isAuto, 4);
|
||||
String str4 = this.vid;
|
||||
if (str4 != null) {
|
||||
jceOutputStream.write(str4, 5);
|
||||
}
|
||||
String str5 = this.pid;
|
||||
if (str5 != null) {
|
||||
jceOutputStream.write(str5, 6);
|
||||
}
|
||||
String str6 = this.from;
|
||||
if (str6 != null) {
|
||||
jceOutputStream.write(str6, 7);
|
||||
}
|
||||
String str7 = this.channelId;
|
||||
if (str7 != null) {
|
||||
jceOutputStream.write(str7, 8);
|
||||
}
|
||||
String str8 = this.mid;
|
||||
if (str8 != null) {
|
||||
jceOutputStream.write(str8, 9);
|
||||
}
|
||||
String str9 = this.extent;
|
||||
if (str9 != null) {
|
||||
jceOutputStream.write(str9, 10);
|
||||
}
|
||||
}
|
||||
|
||||
public LogReport(String str, String str2, int i2, String str3, int i3, String str4, String str5, String str6, String str7, String str8, String str9) {
|
||||
this.pageId = "";
|
||||
this.refPageId = "";
|
||||
this.pageStep = 0;
|
||||
this.callType = "";
|
||||
this.isAuto = 0;
|
||||
this.vid = "";
|
||||
this.pid = "";
|
||||
this.from = "";
|
||||
this.channelId = "";
|
||||
this.mid = "";
|
||||
this.extent = "";
|
||||
this.pageId = str;
|
||||
this.refPageId = str2;
|
||||
this.pageStep = i2;
|
||||
this.callType = str3;
|
||||
this.isAuto = i3;
|
||||
this.vid = str4;
|
||||
this.pid = str5;
|
||||
this.from = str6;
|
||||
this.channelId = str7;
|
||||
this.mid = str8;
|
||||
this.extent = str9;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class LoginToken extends JceStruct {
|
||||
static byte[] cache_TokenValue;
|
||||
public boolean IsMainLogin;
|
||||
public String TokenAppID;
|
||||
public byte TokenKeyType;
|
||||
public String TokenUin;
|
||||
public byte[] TokenValue;
|
||||
|
||||
static {
|
||||
cache_TokenValue = new byte[0];
|
||||
byte[] bArr = {0};
|
||||
}
|
||||
|
||||
public LoginToken() {
|
||||
this.TokenAppID = "";
|
||||
this.TokenKeyType = (byte) 0;
|
||||
this.TokenValue = null;
|
||||
this.TokenUin = "";
|
||||
this.IsMainLogin = true;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.TokenAppID = jceInputStream.readString(0, true);
|
||||
this.TokenKeyType = jceInputStream.read(this.TokenKeyType, 1, true);
|
||||
this.TokenValue = jceInputStream.read(cache_TokenValue, 2, true);
|
||||
this.TokenUin = jceInputStream.readString(3, false);
|
||||
this.IsMainLogin = jceInputStream.read(this.IsMainLogin, 4, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.TokenAppID, 0);
|
||||
jceOutputStream.write(this.TokenKeyType, 1);
|
||||
jceOutputStream.write(this.TokenValue, 2);
|
||||
String str = this.TokenUin;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 3);
|
||||
}
|
||||
jceOutputStream.write(this.IsMainLogin, 4);
|
||||
}
|
||||
|
||||
public LoginToken(String str, byte b2, byte[] bArr, String str2, boolean z) {
|
||||
this.TokenAppID = "";
|
||||
this.TokenKeyType = (byte) 0;
|
||||
this.TokenValue = null;
|
||||
this.TokenUin = "";
|
||||
this.IsMainLogin = true;
|
||||
this.TokenAppID = str;
|
||||
this.TokenKeyType = b2;
|
||||
this.TokenValue = bArr;
|
||||
this.TokenUin = str2;
|
||||
this.IsMainLogin = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class QQVideoJCECmd implements Serializable {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
public static final int _BindCellphone = 24736;
|
||||
public static final int _CheckBindReadForward = 24869;
|
||||
public static final int _CheckBindReadReverse = 24870;
|
||||
public static final int _CheckCode = 24681;
|
||||
public static final int _GetCode = 24680;
|
||||
public static final int _NewGetTicket = 60788;
|
||||
public static final int _NewLogin = 59986;
|
||||
public static final int _NewLogout = 59988;
|
||||
public static final int _NewRefreshToken = 59987;
|
||||
private String __T;
|
||||
private int __value;
|
||||
private static QQVideoJCECmd[] __values = new QQVideoJCECmd[195];
|
||||
public static final int _StGuidGet = 24865;
|
||||
public static final QQVideoJCECmd StGuidGet = new QQVideoJCECmd(0, _StGuidGet, "StGuidGet");
|
||||
public static final int _ChannelList = 24593;
|
||||
public static final QQVideoJCECmd ChannelList = new QQVideoJCECmd(1, _ChannelList, "ChannelList");
|
||||
public static final int _FeedList = 24608;
|
||||
public static final QQVideoJCECmd FeedList = new QQVideoJCECmd(2, _FeedList, "FeedList");
|
||||
public static final int _FeedListiPad = 25316;
|
||||
public static final QQVideoJCECmd FeedListiPad = new QQVideoJCECmd(3, _FeedListiPad, "FeedListiPad");
|
||||
public static final int _SearchSmart = 24733;
|
||||
public static final QQVideoJCECmd SearchSmart = new QQVideoJCECmd(4, _SearchSmart, "SearchSmart");
|
||||
public static final int _VideoDetails = 24805;
|
||||
public static final QQVideoJCECmd VideoDetails = new QQVideoJCECmd(5, _VideoDetails, "VideoDetails");
|
||||
public static final int _DetailVideoList = 24806;
|
||||
public static final QQVideoJCECmd DetailVideoList = new QQVideoJCECmd(6, _DetailVideoList, "DetailVideoList");
|
||||
public static final int _DetailCoverList = 24807;
|
||||
public static final QQVideoJCECmd DetailCoverList = new QQVideoJCECmd(7, _DetailCoverList, "DetailCoverList");
|
||||
public static final int _SecondaryFeedList = 65231;
|
||||
public static final QQVideoJCECmd SecondaryFeedList = new QQVideoJCECmd(8, _SecondaryFeedList, "SecondaryFeedList");
|
||||
public static final int _GetCloudBucketConfig = 24842;
|
||||
public static final QQVideoJCECmd GetCloudBucketConfig = new QQVideoJCECmd(9, _GetCloudBucketConfig, "GetCloudBucketConfig");
|
||||
public static final QQVideoJCECmd NewRefreshToken = new QQVideoJCECmd(10, 59987, "NewRefreshToken");
|
||||
public static final QQVideoJCECmd NewLogin = new QQVideoJCECmd(11, 59986, "NewLogin");
|
||||
public static final QQVideoJCECmd NewLogout = new QQVideoJCECmd(12, 59988, "NewLogout");
|
||||
public static final QQVideoJCECmd NewGetTicket = new QQVideoJCECmd(13, 60788, "NewGetTicket");
|
||||
public static final int _AppUpdate = 24841;
|
||||
public static final QQVideoJCECmd AppUpdate = new QQVideoJCECmd(14, _AppUpdate, "AppUpdate");
|
||||
public static final int _WatchRecordListV1 = 24811;
|
||||
public static final QQVideoJCECmd WatchRecordListV1 = new QQVideoJCECmd(15, _WatchRecordListV1, "WatchRecordListV1");
|
||||
public static final int _WatchRecordUploadV1 = 24810;
|
||||
public static final QQVideoJCECmd WatchRecordUploadV1 = new QQVideoJCECmd(16, _WatchRecordUploadV1, "WatchRecordUploadV1");
|
||||
public static final int _WatchRecordPostersV1 = 24813;
|
||||
public static final QQVideoJCECmd WatchRecordPostersV1 = new QQVideoJCECmd(17, _WatchRecordPostersV1, "WatchRecordPostersV1");
|
||||
public static final int _WatchRecordDelV1 = 24812;
|
||||
public static final QQVideoJCECmd WatchRecordDelV1 = new QQVideoJCECmd(18, _WatchRecordDelV1, "WatchRecordDelV1");
|
||||
public static final int _TicketTrade = 59572;
|
||||
public static final QQVideoJCECmd TicketTrade = new QQVideoJCECmd(19, _TicketTrade, "TicketTrade");
|
||||
public static final int _AiSeeRsaEncrypt = 23875;
|
||||
public static final QQVideoJCECmd AiSeeRsaEncrypt = new QQVideoJCECmd(20, _AiSeeRsaEncrypt, "AiSeeRsaEncrypt");
|
||||
public static final int _PriceCloud = 59569;
|
||||
public static final QQVideoJCECmd PriceCloud = new QQVideoJCECmd(21, _PriceCloud, "PriceCloud");
|
||||
public static final int _SearchRank = 24732;
|
||||
public static final QQVideoJCECmd SearchRank = new QQVideoJCECmd(22, _SearchRank, "SearchRank");
|
||||
public static final int _SearchHotWords = 24797;
|
||||
public static final QQVideoJCECmd SearchHotWords = new QQVideoJCECmd(23, _SearchHotWords, "SearchHotWords");
|
||||
public static final int _VideoList = 24902;
|
||||
public static final QQVideoJCECmd VideoList = new QQVideoJCECmd(24, _VideoList, "VideoList");
|
||||
public static final int _Search = 24731;
|
||||
public static final QQVideoJCECmd Search = new QQVideoJCECmd(25, _Search, "Search");
|
||||
public static final int _CheckDownloadCopyright = 59985;
|
||||
public static final QQVideoJCECmd CheckDownloadCopyright = new QQVideoJCECmd(26, _CheckDownloadCopyright, "CheckDownloadCopyright");
|
||||
public static final int _GetCacheList = 24002;
|
||||
public static final QQVideoJCECmd GetCacheList = new QQVideoJCECmd(27, _GetCacheList, "GetCacheList");
|
||||
public static final int _AccountPlayPermission = 24194;
|
||||
public static final QQVideoJCECmd AccountPlayPermission = new QQVideoJCECmd(28, _AccountPlayPermission, "AccountPlayPermission");
|
||||
public static final int _OneWeekSignUp = 24369;
|
||||
public static final QQVideoJCECmd OneWeekSignUp = new QQVideoJCECmd(29, _OneWeekSignUp, "OneWeekSignUp");
|
||||
public static final int _FollowAction = 24824;
|
||||
public static final QQVideoJCECmd FollowAction = new QQVideoJCECmd(30, _FollowAction, "FollowAction");
|
||||
public static final int _MyFollow = 24827;
|
||||
public static final QQVideoJCECmd MyFollow = new QQVideoJCECmd(31, _MyFollow, "MyFollow");
|
||||
public static final int _MyAllFollow = 24828;
|
||||
public static final QQVideoJCECmd MyAllFollow = new QQVideoJCECmd(32, _MyAllFollow, "MyAllFollow");
|
||||
public static final int _OperatePageNav = 24666;
|
||||
public static final QQVideoJCECmd OperatePageNav = new QQVideoJCECmd(33, _OperatePageNav, "OperatePageNav");
|
||||
public static final int _OperatePageNavIPad = 25318;
|
||||
public static final QQVideoJCECmd OperatePageNavIPad = new QQVideoJCECmd(34, _OperatePageNavIPad, "OperatePageNavIPad");
|
||||
public static final int _OperationPageList = 24648;
|
||||
public static final QQVideoJCECmd OperationPageList = new QQVideoJCECmd(35, _OperationPageList, "OperationPageList");
|
||||
public static final int _OperationPageListIPad = 25338;
|
||||
public static final QQVideoJCECmd OperationPageListIPad = new QQVideoJCECmd(36, _OperationPageListIPad, "OperationPageListIPad");
|
||||
public static final int _LiveDetail = 24873;
|
||||
public static final QQVideoJCECmd LiveDetail = new QQVideoJCECmd(37, _LiveDetail, "LiveDetail");
|
||||
public static final int _LiveDetailIPad = 25356;
|
||||
public static final QQVideoJCECmd LiveDetailIPad = new QQVideoJCECmd(38, _LiveDetailIPad, "LiveDetailIPad");
|
||||
public static final int _LivePoll = 24874;
|
||||
public static final QQVideoJCECmd LivePoll = new QQVideoJCECmd(39, _LivePoll, "LivePoll");
|
||||
public static final int _LivePollIPad = 25355;
|
||||
public static final QQVideoJCECmd LivePollIPad = new QQVideoJCECmd(40, _LivePollIPad, "LivePollIPad");
|
||||
public static final int _LiveMultiCameraInfo = 24875;
|
||||
public static final QQVideoJCECmd LiveMultiCameraInfo = new QQVideoJCECmd(41, _LiveMultiCameraInfo, "LiveMultiCameraInfo");
|
||||
public static final int _LiveMultiCameraInfoIPad = 25354;
|
||||
public static final QQVideoJCECmd LiveMultiCameraInfoIPad = new QQVideoJCECmd(42, _LiveMultiCameraInfoIPad, "LiveMultiCameraInfoIPad");
|
||||
public static final int _FollowActorPage = 24761;
|
||||
public static final QQVideoJCECmd FollowActorPage = new QQVideoJCECmd(43, _FollowActorPage, "FollowActorPage");
|
||||
public static final int _BookAction = 24788;
|
||||
public static final QQVideoJCECmd BookAction = new QQVideoJCECmd(44, _BookAction, "BookAction");
|
||||
public static final int _ReportPlayStart = 24702;
|
||||
public static final QQVideoJCECmd ReportPlayStart = new QQVideoJCECmd(45, _ReportPlayStart, "ReportPlayStart");
|
||||
public static final int _ReportPlayStop = 24703;
|
||||
public static final QQVideoJCECmd ReportPlayStop = new QQVideoJCECmd(46, _ReportPlayStop, "ReportPlayStop");
|
||||
public static final int _AccountUserInfo = 24802;
|
||||
public static final QQVideoJCECmd AccountUserInfo = new QQVideoJCECmd(47, _AccountUserInfo, "AccountUserInfo");
|
||||
public static final int _SearchVideoList = 24764;
|
||||
public static final QQVideoJCECmd SearchVideoList = new QQVideoJCECmd(48, _SearchVideoList, "SearchVideoList");
|
||||
public static final int _LikeAction = 24803;
|
||||
public static final QQVideoJCECmd LikeAction = new QQVideoJCECmd(49, _LikeAction, "LikeAction");
|
||||
public static final QQVideoJCECmd BindCellphone = new QQVideoJCECmd(50, 24736, "BindCellphone");
|
||||
public static final QQVideoJCECmd CheckBindReadForward = new QQVideoJCECmd(51, 24869, "CheckBindReadForward");
|
||||
public static final QQVideoJCECmd CheckBindReadReverse = new QQVideoJCECmd(52, 24870, "CheckBindReadReverse");
|
||||
public static final QQVideoJCECmd CheckCode = new QQVideoJCECmd(53, 24681, "CheckCode");
|
||||
public static final QQVideoJCECmd GetCode = new QQVideoJCECmd(54, 24680, "GetCode");
|
||||
public static final int _LikeGlobalSwitch = 24830;
|
||||
public static final QQVideoJCECmd LikeGlobalSwitch = new QQVideoJCECmd(55, _LikeGlobalSwitch, "LikeGlobalSwitch");
|
||||
public static final int _CommentGlobalSwitch = 24852;
|
||||
public static final QQVideoJCECmd CommentGlobalSwitch = new QQVideoJCECmd(56, _CommentGlobalSwitch, "CommentGlobalSwitch");
|
||||
public static final int _ShareGlobalSwitch = 24851;
|
||||
public static final QQVideoJCECmd ShareGlobalSwitch = new QQVideoJCECmd(57, _ShareGlobalSwitch, "ShareGlobalSwitch");
|
||||
public static final int _PublishLiveComment = 24814;
|
||||
public static final QQVideoJCECmd PublishLiveComment = new QQVideoJCECmd(58, _PublishLiveComment, "PublishLiveComment");
|
||||
public static final int _PublishVideoComment = 24815;
|
||||
public static final QQVideoJCECmd PublishVideoComment = new QQVideoJCECmd(59, _PublishVideoComment, "PublishVideoComment");
|
||||
public static final int _LiveCommentList = 24816;
|
||||
public static final QQVideoJCECmd LiveCommentList = new QQVideoJCECmd(60, _LiveCommentList, "LiveCommentList");
|
||||
public static final int _VideoCommentList = 24817;
|
||||
public static final QQVideoJCECmd VideoCommentList = new QQVideoJCECmd(61, _VideoCommentList, "VideoCommentList");
|
||||
public static final int _MyCommentList = 24818;
|
||||
public static final QQVideoJCECmd MyCommentList = new QQVideoJCECmd(62, _MyCommentList, "MyCommentList");
|
||||
public static final int _CommentDelete = 24821;
|
||||
public static final QQVideoJCECmd CommentDelete = new QQVideoJCECmd(63, _CommentDelete, "CommentDelete");
|
||||
public static final int _CommentCount = 24819;
|
||||
public static final QQVideoJCECmd CommentCount = new QQVideoJCECmd(64, _CommentCount, "CommentCount");
|
||||
public static final int _FavoriteAction = 24796;
|
||||
public static final QQVideoJCECmd FavoriteAction = new QQVideoJCECmd(65, _FavoriteAction, "FavoriteAction");
|
||||
public static final int _FavoriteIDList = 24845;
|
||||
public static final QQVideoJCECmd FavoriteIDList = new QQVideoJCECmd(66, _FavoriteIDList, "FavoriteIDList");
|
||||
public static final int _ShareAction = 24853;
|
||||
public static final QQVideoJCECmd ShareAction = new QQVideoJCECmd(67, _ShareAction, "ShareAction");
|
||||
public static final int _DynamicInsertFeed = 24883;
|
||||
public static final QQVideoJCECmd DynamicInsertFeed = new QQVideoJCECmd(68, _DynamicInsertFeed, "DynamicInsertFeed");
|
||||
public static final int _GetAppStartUpPictureConfig = 24896;
|
||||
public static final QQVideoJCECmd GetAppStartUpPictureConfig = new QQVideoJCECmd(69, _GetAppStartUpPictureConfig, "GetAppStartUpPictureConfig");
|
||||
public static final int _TVTimeShiftProgram = 24897;
|
||||
public static final QQVideoJCECmd TVTimeShiftProgram = new QQVideoJCECmd(70, _TVTimeShiftProgram, "TVTimeShiftProgram");
|
||||
public static final int _DevReport = 24901;
|
||||
public static final QQVideoJCECmd DevReport = new QQVideoJCECmd(71, _DevReport, "DevReport");
|
||||
public static final int _CPRec = 24838;
|
||||
public static final QQVideoJCECmd CPRec = new QQVideoJCECmd(72, _CPRec, "CPRec");
|
||||
public static final int _WebGetCode = 24960;
|
||||
public static final QQVideoJCECmd WebGetCode = new QQVideoJCECmd(73, _WebGetCode, "WebGetCode");
|
||||
public static final int _HoverBallConfig = 24961;
|
||||
public static final QQVideoJCECmd HoverBallConfig = new QQVideoJCECmd(74, _HoverBallConfig, "HoverBallConfig");
|
||||
public static final int _SignInConfig = 24963;
|
||||
public static final QQVideoJCECmd SignInConfig = new QQVideoJCECmd(75, _SignInConfig, "SignInConfig");
|
||||
public static final int _GetTmpCredentials = 24854;
|
||||
public static final QQVideoJCECmd GetTmpCredentials = new QQVideoJCECmd(76, _GetTmpCredentials, "GetTmpCredentials");
|
||||
public static final int _VideoReplyCommentList = 24965;
|
||||
public static final QQVideoJCECmd VideoReplyCommentList = new QQVideoJCECmd(77, _VideoReplyCommentList, "VideoReplyCommentList");
|
||||
public static final int _JumpVideoCommentList = 24966;
|
||||
public static final QQVideoJCECmd JumpVideoCommentList = new QQVideoJCECmd(78, _JumpVideoCommentList, "JumpVideoCommentList");
|
||||
public static final int _VideoCommentLike = 24967;
|
||||
public static final QQVideoJCECmd VideoCommentLike = new QQVideoJCECmd(79, _VideoCommentLike, "VideoCommentLike");
|
||||
public static final int _PublishVideoReplyComment = 24968;
|
||||
public static final QQVideoJCECmd PublishVideoReplyComment = new QQVideoJCECmd(80, _PublishVideoReplyComment, "PublishVideoReplyComment");
|
||||
public static final int _MyReplyCommentList = 24969;
|
||||
public static final QQVideoJCECmd MyReplyCommentList = new QQVideoJCECmd(81, _MyReplyCommentList, "MyReplyCommentList");
|
||||
public static final int _ReplyCommentCount = 24970;
|
||||
public static final QQVideoJCECmd ReplyCommentCount = new QQVideoJCECmd(82, _ReplyCommentCount, "ReplyCommentCount");
|
||||
public static final int _ModifyUser = 24964;
|
||||
public static final QQVideoJCECmd ModifyUser = new QQVideoJCECmd(83, _ModifyUser, "ModifyUser");
|
||||
public static final int _DetailPagePlayBasic = 24976;
|
||||
public static final QQVideoJCECmd DetailPagePlayBasic = new QQVideoJCECmd(84, _DetailPagePlayBasic, "DetailPagePlayBasic");
|
||||
public static final int _GetVodUploadSignature = 24979;
|
||||
public static final QQVideoJCECmd GetVodUploadSignature = new QQVideoJCECmd(85, _GetVodUploadSignature, "GetVodUploadSignature");
|
||||
public static final int _VodUploadComplete = 25033;
|
||||
public static final QQVideoJCECmd VodUploadComplete = new QQVideoJCECmd(86, _VodUploadComplete, "VodUploadComplete");
|
||||
public static final int _GetGShootTopics = 24980;
|
||||
public static final QQVideoJCECmd GetGShootTopics = new QQVideoJCECmd(87, _GetGShootTopics, "GetGShootTopics");
|
||||
public static final int _GetActivityEntranceConfigList = 24981;
|
||||
public static final QQVideoJCECmd GetActivityEntranceConfigList = new QQVideoJCECmd(88, _GetActivityEntranceConfigList, "GetActivityEntranceConfigList");
|
||||
public static final int _GetHomeTabWelfareEntryAction = 24984;
|
||||
public static final QQVideoJCECmd GetHomeTabWelfareEntryAction = new QQVideoJCECmd(89, _GetHomeTabWelfareEntryAction, "GetHomeTabWelfareEntryAction");
|
||||
public static final int _AppStartupConfig = 24990;
|
||||
public static final QQVideoJCECmd AppStartupConfig = new QQVideoJCECmd(90, _AppStartupConfig, "AppStartupConfig");
|
||||
public static final int _TVShowList = 24997;
|
||||
public static final QQVideoJCECmd TVShowList = new QQVideoJCECmd(91, _TVShowList, "TVShowList");
|
||||
public static final int _TabHoverBallConfig = 25006;
|
||||
public static final QQVideoJCECmd TabHoverBallConfig = new QQVideoJCECmd(92, _TabHoverBallConfig, "TabHoverBallConfig");
|
||||
public static final int _CPClassificationList = 25007;
|
||||
public static final QQVideoJCECmd CPClassificationList = new QQVideoJCECmd(93, _CPClassificationList, "CPClassificationList");
|
||||
public static final int _FollowActorTabPage = 25008;
|
||||
public static final QQVideoJCECmd FollowActorTabPage = new QQVideoJCECmd(94, _FollowActorTabPage, "FollowActorTabPage");
|
||||
public static final int _CPVideoList = 25018;
|
||||
public static final QQVideoJCECmd CPVideoList = new QQVideoJCECmd(95, _CPVideoList, "CPVideoList");
|
||||
public static final int _RedDotConfig = 25019;
|
||||
public static final QQVideoJCECmd RedDotConfig = new QQVideoJCECmd(96, _RedDotConfig, "RedDotConfig");
|
||||
public static final int _LiveExt = 25025;
|
||||
public static final QQVideoJCECmd LiveExt = new QQVideoJCECmd(97, _LiveExt, "LiveExt");
|
||||
public static final int _LiveExtIPad = 25353;
|
||||
public static final QQVideoJCECmd LiveExtIPad = new QQVideoJCECmd(98, _LiveExtIPad, "LiveExtIPad");
|
||||
public static final int _TopicList = 25030;
|
||||
public static final QQVideoJCECmd TopicList = new QQVideoJCECmd(99, _TopicList, "TopicList");
|
||||
public static final int _UserVideoList = 25031;
|
||||
public static final QQVideoJCECmd UserVideoList = new QQVideoJCECmd(100, _UserVideoList, "UserVideoList");
|
||||
public static final int _UcenterCfg = 25049;
|
||||
public static final QQVideoJCECmd UcenterCfg = new QQVideoJCECmd(101, _UcenterCfg, "UcenterCfg");
|
||||
public static final int _TaskComplete = 25042;
|
||||
public static final QQVideoJCECmd TaskComplete = new QQVideoJCECmd(102, _TaskComplete, "TaskComplete");
|
||||
public static final int _TaskList = 25043;
|
||||
public static final QQVideoJCECmd TaskList = new QQVideoJCECmd(103, _TaskList, "TaskList");
|
||||
public static final int _H5SkipConfig = 25047;
|
||||
public static final QQVideoJCECmd H5SkipConfig = new QQVideoJCECmd(104, _H5SkipConfig, "H5SkipConfig");
|
||||
public static final int _TaskListWithAuth = 25048;
|
||||
public static final QQVideoJCECmd TaskListWithAuth = new QQVideoJCECmd(105, _TaskListWithAuth, "TaskListWithAuth");
|
||||
public static final int _GetCpInfo = 25060;
|
||||
public static final QQVideoJCECmd GetCpInfo = new QQVideoJCECmd(106, _GetCpInfo, "GetCpInfo");
|
||||
public static final int _PortraitVideoList = 25065;
|
||||
public static final QQVideoJCECmd PortraitVideoList = new QQVideoJCECmd(107, _PortraitVideoList, "PortraitVideoList");
|
||||
public static final int _PortraitVideoListIPad = 25359;
|
||||
public static final QQVideoJCECmd PortraitVideoListIPad = new QQVideoJCECmd(108, _PortraitVideoListIPad, "PortraitVideoListIPad");
|
||||
public static final int _HomeRedDotConfig = 25063;
|
||||
public static final QQVideoJCECmd HomeRedDotConfig = new QQVideoJCECmd(109, _HomeRedDotConfig, "HomeRedDotConfig");
|
||||
public static final int _EraseHomeRedDot = 25068;
|
||||
public static final QQVideoJCECmd EraseHomeRedDot = new QQVideoJCECmd(110, _EraseHomeRedDot, "EraseHomeRedDot");
|
||||
public static final int _LiveHistoryCommentList = 25062;
|
||||
public static final QQVideoJCECmd LiveHistoryCommentList = new QQVideoJCECmd(111, _LiveHistoryCommentList, "LiveHistoryCommentList");
|
||||
public static final int _MsgList = 25072;
|
||||
public static final QQVideoJCECmd MsgList = new QQVideoJCECmd(112, _MsgList, "MsgList");
|
||||
public static final int _MsgPoll = 25073;
|
||||
public static final QQVideoJCECmd MsgPoll = new QQVideoJCECmd(113, _MsgPoll, "MsgPoll");
|
||||
public static final int _LikeList = 25093;
|
||||
public static final QQVideoJCECmd LikeList = new QQVideoJCECmd(114, _LikeList, "LikeList");
|
||||
public static final int _InteractiveMsgList = 25098;
|
||||
public static final QQVideoJCECmd InteractiveMsgList = new QQVideoJCECmd(115, _InteractiveMsgList, "InteractiveMsgList");
|
||||
public static final int _CommunityFeedList = 25107;
|
||||
public static final QQVideoJCECmd CommunityFeedList = new QQVideoJCECmd(116, _CommunityFeedList, "CommunityFeedList");
|
||||
public static final int _CircleAction = 25110;
|
||||
public static final QQVideoJCECmd CircleAction = new QQVideoJCECmd(117, _CircleAction, "CircleAction");
|
||||
public static final int _CircleHomePage = 25111;
|
||||
public static final QQVideoJCECmd CircleHomePage = new QQVideoJCECmd(118, _CircleHomePage, "CircleHomePage");
|
||||
public static final int _DeletePost = 25115;
|
||||
public static final QQVideoJCECmd DeletePost = new QQVideoJCECmd(119, _DeletePost, "DeletePost");
|
||||
public static final int _MyCircleList = 25113;
|
||||
public static final QQVideoJCECmd MyCircleList = new QQVideoJCECmd(120, _MyCircleList, "MyCircleList");
|
||||
public static final int _AllMyCircleList = 25116;
|
||||
public static final QQVideoJCECmd AllMyCircleList = new QQVideoJCECmd(121, _AllMyCircleList, "AllMyCircleList");
|
||||
public static final int _CommunityPersonHomePage = 25106;
|
||||
public static final QQVideoJCECmd CommunityPersonHomePage = new QQVideoJCECmd(122, _CommunityPersonHomePage, "CommunityPersonHomePage");
|
||||
public static final int _CreatePost = 25112;
|
||||
public static final QQVideoJCECmd CreatePost = new QQVideoJCECmd(123, _CreatePost, "CreatePost");
|
||||
public static final int _ForwardPost = 25119;
|
||||
public static final QQVideoJCECmd ForwardPost = new QQVideoJCECmd(124, _ForwardPost, "ForwardPost");
|
||||
public static final int _ReportPost = 25121;
|
||||
public static final QQVideoJCECmd ReportPost = new QQVideoJCECmd(125, _ReportPost, "ReportPost");
|
||||
public static final int _AllCircleList = 25123;
|
||||
public static final QQVideoJCECmd AllCircleList = new QQVideoJCECmd(126, _AllCircleList, "AllCircleList");
|
||||
public static final int _ModifyUserInfo = 25127;
|
||||
public static final QQVideoJCECmd ModifyUserInfo = new QQVideoJCECmd(127, _ModifyUserInfo, "ModifyUserInfo");
|
||||
public static final int _CommunityFollowingList = 25102;
|
||||
public static final QQVideoJCECmd CommunityFollowingList = new QQVideoJCECmd(128, _CommunityFollowingList, "CommunityFollowingList");
|
||||
public static final int _GetPostInfo = 25122;
|
||||
public static final QQVideoJCECmd GetPostInfo = new QQVideoJCECmd(129, _GetPostInfo, "GetPostInfo");
|
||||
public static final int _CommunityMuteInfo = 25130;
|
||||
public static final QQVideoJCECmd CommunityMuteInfo = new QQVideoJCECmd(130, _CommunityMuteInfo, "CommunityMuteInfo");
|
||||
public static final int _PostDetail = 25143;
|
||||
public static final QQVideoJCECmd PostDetail = new QQVideoJCECmd(131, _PostDetail, "PostDetail");
|
||||
public static final int _PostDetailIPad = 25360;
|
||||
public static final QQVideoJCECmd PostDetailIPad = new QQVideoJCECmd(132, _PostDetailIPad, "PostDetailIPad");
|
||||
public static final int _MomentCommentList = 25153;
|
||||
public static final QQVideoJCECmd MomentCommentList = new QQVideoJCECmd(133, _MomentCommentList, "MomentCommentList");
|
||||
public static final int _AppBottomTabBubble = 25159;
|
||||
public static final QQVideoJCECmd AppBottomTabBubble = new QQVideoJCECmd(134, _AppBottomTabBubble, "AppBottomTabBubble");
|
||||
public static final int _PayOrder = 25164;
|
||||
public static final QQVideoJCECmd PayOrder = new QQVideoJCECmd(135, _PayOrder, "PayOrder");
|
||||
public static final int _GuidVipRequest = 25200;
|
||||
public static final QQVideoJCECmd GuidVipRequest = new QQVideoJCECmd(136, _GuidVipRequest, "GuidVipRequest");
|
||||
public static final int _CircleUserList = 25239;
|
||||
public static final QQVideoJCECmd CircleUserList = new QQVideoJCECmd(137, _CircleUserList, "CircleUserList");
|
||||
public static final int _CacheVideoList = 25240;
|
||||
public static final QQVideoJCECmd CacheVideoList = new QQVideoJCECmd(138, _CacheVideoList, "CacheVideoList");
|
||||
public static final int _CachedVideoInfo = 25241;
|
||||
public static final QQVideoJCECmd CachedVideoInfo = new QQVideoJCECmd(139, _CachedVideoInfo, "CachedVideoInfo");
|
||||
public static final int _PersonalConf = 25265;
|
||||
public static final QQVideoJCECmd PersonalConf = new QQVideoJCECmd(140, _PersonalConf, "PersonalConf");
|
||||
public static final int _PersonalConfFix = 25263;
|
||||
public static final QQVideoJCECmd PersonalConfFix = new QQVideoJCECmd(141, _PersonalConfFix, "PersonalConfFix");
|
||||
public static final int _PhoneBind = 25267;
|
||||
public static final QQVideoJCECmd PhoneBind = new QQVideoJCECmd(142, _PhoneBind, "PhoneBind");
|
||||
public static final int _ScreenLiveList = 25282;
|
||||
public static final QQVideoJCECmd ScreenLiveList = new QQVideoJCECmd(143, _ScreenLiveList, "ScreenLiveList");
|
||||
public static final int _ScreenLiveListIPad = 25352;
|
||||
public static final QQVideoJCECmd ScreenLiveListIPad = new QQVideoJCECmd(144, _ScreenLiveListIPad, "ScreenLiveListIPad");
|
||||
public static final int _IsScreenHasLiveList = 25285;
|
||||
public static final QQVideoJCECmd IsScreenHasLiveList = new QQVideoJCECmd(145, _IsScreenHasLiveList, "IsScreenHasLiveList");
|
||||
public static final int _IsScreenHasLiveListIPad = 25351;
|
||||
public static final QQVideoJCECmd IsScreenHasLiveListIPad = new QQVideoJCECmd(146, _IsScreenHasLiveListIPad, "IsScreenHasLiveListIPad");
|
||||
public static final int _MatchFilter = 25311;
|
||||
public static final QQVideoJCECmd MatchFilter = new QQVideoJCECmd(147, _MatchFilter, "MatchFilter");
|
||||
public static final int _PidTimeShift = 25312;
|
||||
public static final QQVideoJCECmd PidTimeShift = new QQVideoJCECmd(148, _PidTimeShift, "PidTimeShift");
|
||||
public static final int _PidEditTask = 25313;
|
||||
public static final QQVideoJCECmd PidEditTask = new QQVideoJCECmd(149, _PidEditTask, "PidEditTask");
|
||||
public static final int _PidQueryTask = 25314;
|
||||
public static final QQVideoJCECmd PidQueryTask = new QQVideoJCECmd(150, _PidQueryTask, "PidQueryTask");
|
||||
public static final int _CheckUserVipBind = 25272;
|
||||
public static final QQVideoJCECmd CheckUserVipBind = new QQVideoJCECmd(151, _CheckUserVipBind, "CheckUserVipBind");
|
||||
public static final int _UninterestedReport = 25324;
|
||||
public static final QQVideoJCECmd UninterestedReport = new QQVideoJCECmd(152, _UninterestedReport, "UninterestedReport");
|
||||
public static final int _UninterestedReportDup = 25317;
|
||||
public static final QQVideoJCECmd UninterestedReportDup = new QQVideoJCECmd(153, _UninterestedReportDup, "UninterestedReportDup");
|
||||
public static final int _GameList = 25309;
|
||||
public static final QQVideoJCECmd GameList = new QQVideoJCECmd(154, _GameList, "GameList");
|
||||
public static final int _GameNum = 25310;
|
||||
public static final QQVideoJCECmd GameNum = new QQVideoJCECmd(155, _GameNum, "GameNum");
|
||||
public static final int _GameCenterTab = 25315;
|
||||
public static final QQVideoJCECmd GameCenterTab = new QQVideoJCECmd(156, _GameCenterTab, "GameCenterTab");
|
||||
public static final int _GameMatchTab = 25369;
|
||||
public static final QQVideoJCECmd GameMatchTab = new QQVideoJCECmd(157, _GameMatchTab, "GameMatchTab");
|
||||
public static final int _SubscribeGameList = 25319;
|
||||
public static final QQVideoJCECmd SubscribeGameList = new QQVideoJCECmd(158, _SubscribeGameList, "SubscribeGameList");
|
||||
public static final int _GameIDsToSubscribe = 25323;
|
||||
public static final QQVideoJCECmd GameIDsToSubscribe = new QQVideoJCECmd(159, _GameIDsToSubscribe, "GameIDsToSubscribe");
|
||||
public static final int _BatchSubscribeAPP = 25325;
|
||||
public static final QQVideoJCECmd BatchSubscribeAPP = new QQVideoJCECmd(160, _BatchSubscribeAPP, "BatchSubscribeAPP");
|
||||
public static final int _ChannelsWithPrograms = 25328;
|
||||
public static final QQVideoJCECmd ChannelsWithPrograms = new QQVideoJCECmd(161, _ChannelsWithPrograms, "ChannelsWithPrograms");
|
||||
public static final int _SubscribedPids = 24809;
|
||||
public static final QQVideoJCECmd SubscribedPids = new QQVideoJCECmd(162, _SubscribedPids, "SubscribedPids");
|
||||
public static final int _CheckVideoEpisodes = 25331;
|
||||
public static final QQVideoJCECmd CheckVideoEpisodes = new QQVideoJCECmd(163, _CheckVideoEpisodes, "CheckVideoEpisodes");
|
||||
public static final int _ProgramsList = 25333;
|
||||
public static final QQVideoJCECmd ProgramsList = new QQVideoJCECmd(164, _ProgramsList, "ProgramsList");
|
||||
public static final int _GetCircleInfo = 25337;
|
||||
public static final QQVideoJCECmd GetCircleInfo = new QQVideoJCECmd(165, _GetCircleInfo, "GetCircleInfo");
|
||||
public static final int _FeedsLiveComment = 25332;
|
||||
public static final QQVideoJCECmd FeedsLiveComment = new QQVideoJCECmd(166, _FeedsLiveComment, "FeedsLiveComment");
|
||||
public static final int _IPadCPClassificationList = 25349;
|
||||
public static final QQVideoJCECmd IPadCPClassificationList = new QQVideoJCECmd(167, _IPadCPClassificationList, "IPadCPClassificationList");
|
||||
public static final int _IPadFollowActorTabPage = 25348;
|
||||
public static final QQVideoJCECmd IPadFollowActorTabPage = new QQVideoJCECmd(168, _IPadFollowActorTabPage, "IPadFollowActorTabPage");
|
||||
public static final int _VideoDetailsIPad = 25346;
|
||||
public static final QQVideoJCECmd VideoDetailsIPad = new QQVideoJCECmd(169, _VideoDetailsIPad, "VideoDetailsIPad");
|
||||
public static final int _GetTicketSignature = 25306;
|
||||
public static final QQVideoJCECmd GetTicketSignature = new QQVideoJCECmd(170, _GetTicketSignature, "GetTicketSignature");
|
||||
public static final int _LoginNotice = 25367;
|
||||
public static final QQVideoJCECmd LoginNotice = new QQVideoJCECmd(171, _LoginNotice, "LoginNotice");
|
||||
public static final int _VidEditTask = 25374;
|
||||
public static final QQVideoJCECmd VidEditTask = new QQVideoJCECmd(172, _VidEditTask, "VidEditTask");
|
||||
public static final int _TVCircleCardList = 25382;
|
||||
public static final QQVideoJCECmd TVCircleCardList = new QQVideoJCECmd(173, _TVCircleCardList, "TVCircleCardList");
|
||||
public static final int _LiveMsgRead = 25404;
|
||||
public static final QQVideoJCECmd LiveMsgRead = new QQVideoJCECmd(174, _LiveMsgRead, "LiveMsgRead");
|
||||
public static final int _FifaVideoList = 25413;
|
||||
public static final QQVideoJCECmd FifaVideoList = new QQVideoJCECmd(175, _FifaVideoList, "FifaVideoList");
|
||||
public static final int _Topic = 25419;
|
||||
public static final QQVideoJCECmd Topic = new QQVideoJCECmd(176, _Topic, "Topic");
|
||||
public static final int _SubscribeConf = 25427;
|
||||
public static final QQVideoJCECmd SubscribeConf = new QQVideoJCECmd(177, _SubscribeConf, "SubscribeConf");
|
||||
public static final int _PortraitLiveList = 25454;
|
||||
public static final QQVideoJCECmd PortraitLiveList = new QQVideoJCECmd(178, _PortraitLiveList, "PortraitLiveList");
|
||||
public static final int _FoldingScreenHoverCard = 25456;
|
||||
public static final QQVideoJCECmd FoldingScreenHoverCard = new QQVideoJCECmd(179, _FoldingScreenHoverCard, "FoldingScreenHoverCard");
|
||||
public static final int _TVTimeShiftProgramAuthority = 25457;
|
||||
public static final QQVideoJCECmd TVTimeShiftProgramAuthority = new QQVideoJCECmd(180, _TVTimeShiftProgramAuthority, "TVTimeShiftProgramAuthority");
|
||||
public static final int _SnapshotCreate = 25471;
|
||||
public static final QQVideoJCECmd SnapshotCreate = new QQVideoJCECmd(181, _SnapshotCreate, "SnapshotCreate");
|
||||
public static final int _SnapshotDel = 25473;
|
||||
public static final QQVideoJCECmd SnapshotDel = new QQVideoJCECmd(182, _SnapshotDel, "SnapshotDel");
|
||||
public static final int _SnapshotActList = 25477;
|
||||
public static final QQVideoJCECmd SnapshotActList = new QQVideoJCECmd(183, _SnapshotActList, "SnapshotActList");
|
||||
public static final int _ModulePage = 25481;
|
||||
public static final QQVideoJCECmd ModulePage = new QQVideoJCECmd(184, _ModulePage, "ModulePage");
|
||||
public static final int _GetSnapshotDetail = 25479;
|
||||
public static final QQVideoJCECmd GetSnapshotDetail = new QQVideoJCECmd(185, _GetSnapshotDetail, "GetSnapshotDetail");
|
||||
public static final int _SnapshotPostInfo = 25482;
|
||||
public static final QQVideoJCECmd SnapshotPostInfo = new QQVideoJCECmd(186, _SnapshotPostInfo, "SnapshotPostInfo");
|
||||
public static final int _ActivityHomePage = 25483;
|
||||
public static final QQVideoJCECmd ActivityHomePage = new QQVideoJCECmd(187, _ActivityHomePage, "ActivityHomePage");
|
||||
public static final int _GetWSAuthCode = 25464;
|
||||
public static final QQVideoJCECmd GetWSAuthCode = new QQVideoJCECmd(188, _GetWSAuthCode, "GetWSAuthCode");
|
||||
public static final int _WsPollingMsg = 25493;
|
||||
public static final QQVideoJCECmd WsPollingMsg = new QQVideoJCECmd(189, _WsPollingMsg, "WsPollingMsg");
|
||||
public static final int _MedalStatistics = 25495;
|
||||
public static final QQVideoJCECmd MedalStatistics = new QQVideoJCECmd(190, _MedalStatistics, "MedalStatistics");
|
||||
public static final int _MedalChangeSubscription = 25496;
|
||||
public static final QQVideoJCECmd MedalChangeSubscription = new QQVideoJCECmd(191, _MedalChangeSubscription, "MedalChangeSubscription");
|
||||
public static final int _MedalDetails = 25498;
|
||||
public static final QQVideoJCECmd MedalDetails = new QQVideoJCECmd(192, _MedalDetails, "MedalDetails");
|
||||
public static final int _GetScheme = 25504;
|
||||
public static final QQVideoJCECmd GetScheme = new QQVideoJCECmd(193, _GetScheme, "GetScheme");
|
||||
public static final int _SubGameList = 25502;
|
||||
public static final QQVideoJCECmd SubGameList = new QQVideoJCECmd(194, _SubGameList, "SubGameList");
|
||||
|
||||
private QQVideoJCECmd(int i2, int i3, String str) {
|
||||
this.__T = new String();
|
||||
this.__T = str;
|
||||
this.__value = i3;
|
||||
__values[i2] = this;
|
||||
}
|
||||
|
||||
public static QQVideoJCECmd convert(int i2) {
|
||||
int i3 = 0;
|
||||
while (true) {
|
||||
QQVideoJCECmd[] qQVideoJCECmdArr = __values;
|
||||
if (i3 >= qQVideoJCECmdArr.length) {
|
||||
return null;
|
||||
}
|
||||
if (qQVideoJCECmdArr[i3].value() == i2) {
|
||||
return __values[i3];
|
||||
}
|
||||
i3++;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.__T;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this.__value;
|
||||
}
|
||||
|
||||
public static QQVideoJCECmd convert(String str) {
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
QQVideoJCECmd[] qQVideoJCECmdArr = __values;
|
||||
if (i2 >= qQVideoJCECmdArr.length) {
|
||||
return null;
|
||||
}
|
||||
if (qQVideoJCECmdArr[i2].toString().equals(str)) {
|
||||
return __values[i2];
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class QUA extends JceStruct {
|
||||
public String appSubVersion;
|
||||
public int areaMode;
|
||||
public String channelId;
|
||||
public String clientKey;
|
||||
public Coordinates coordinates;
|
||||
public int countryCode;
|
||||
public int densityDpi;
|
||||
public String deviceId;
|
||||
public String deviceModel;
|
||||
public int deviceType;
|
||||
public String extent;
|
||||
public ExtentData extentData;
|
||||
public String idfa;
|
||||
public String imei;
|
||||
public String imsi;
|
||||
public int langCode;
|
||||
public String mac;
|
||||
public int markerId;
|
||||
public int mobileISP;
|
||||
public int networkMode;
|
||||
public String omgId;
|
||||
public int platform;
|
||||
public String platformVersion;
|
||||
public String qimei;
|
||||
public int screenHeight;
|
||||
public int screenWidth;
|
||||
public String serverid;
|
||||
public String v4ip;
|
||||
public String versionCode;
|
||||
public String versionName;
|
||||
static ExtentData cache_extentData = new ExtentData();
|
||||
static Coordinates cache_coordinates = new Coordinates();
|
||||
|
||||
public QUA() {
|
||||
this.versionName = "";
|
||||
this.versionCode = "";
|
||||
this.screenWidth = 0;
|
||||
this.screenHeight = 0;
|
||||
this.platform = 0;
|
||||
this.platformVersion = "";
|
||||
this.markerId = 0;
|
||||
this.networkMode = 0;
|
||||
this.densityDpi = 0;
|
||||
this.channelId = "";
|
||||
this.imei = "";
|
||||
this.imsi = "";
|
||||
this.idfa = "";
|
||||
this.omgId = "";
|
||||
this.extent = "";
|
||||
this.extentData = null;
|
||||
this.clientKey = "";
|
||||
this.mac = "";
|
||||
this.serverid = "";
|
||||
this.coordinates = null;
|
||||
this.deviceId = "";
|
||||
this.deviceModel = "";
|
||||
this.deviceType = 0;
|
||||
this.mobileISP = 0;
|
||||
this.areaMode = 0;
|
||||
this.countryCode = 0;
|
||||
this.langCode = 0;
|
||||
this.appSubVersion = "";
|
||||
this.v4ip = "";
|
||||
this.qimei = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.versionName = jceInputStream.readString(0, true);
|
||||
this.versionCode = jceInputStream.readString(1, true);
|
||||
this.screenWidth = jceInputStream.read(this.screenWidth, 2, false);
|
||||
this.screenHeight = jceInputStream.read(this.screenHeight, 3, false);
|
||||
this.platform = jceInputStream.read(this.platform, 4, false);
|
||||
this.platformVersion = jceInputStream.readString(5, false);
|
||||
this.markerId = jceInputStream.read(this.markerId, 6, false);
|
||||
this.networkMode = jceInputStream.read(this.networkMode, 7, false);
|
||||
this.densityDpi = jceInputStream.read(this.densityDpi, 8, false);
|
||||
this.channelId = jceInputStream.readString(9, false);
|
||||
this.imei = jceInputStream.readString(10, false);
|
||||
this.imsi = jceInputStream.readString(11, false);
|
||||
this.idfa = jceInputStream.readString(12, false);
|
||||
this.omgId = jceInputStream.readString(13, false);
|
||||
this.extent = jceInputStream.readString(14, false);
|
||||
this.extentData = (ExtentData) jceInputStream.read((JceStruct) cache_extentData, 15, false);
|
||||
this.clientKey = jceInputStream.readString(16, false);
|
||||
this.mac = jceInputStream.readString(17, false);
|
||||
this.serverid = jceInputStream.readString(18, false);
|
||||
this.coordinates = (Coordinates) jceInputStream.read((JceStruct) cache_coordinates, 19, false);
|
||||
this.deviceId = jceInputStream.readString(20, false);
|
||||
this.deviceModel = jceInputStream.readString(21, false);
|
||||
this.deviceType = jceInputStream.read(this.deviceType, 22, false);
|
||||
this.mobileISP = jceInputStream.read(this.mobileISP, 23, false);
|
||||
this.areaMode = jceInputStream.read(this.areaMode, 24, false);
|
||||
this.countryCode = jceInputStream.read(this.countryCode, 25, false);
|
||||
this.langCode = jceInputStream.read(this.langCode, 26, false);
|
||||
this.appSubVersion = jceInputStream.readString(27, false);
|
||||
this.v4ip = jceInputStream.readString(28, false);
|
||||
this.qimei = jceInputStream.readString(29, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.versionName, 0);
|
||||
jceOutputStream.write(this.versionCode, 1);
|
||||
jceOutputStream.write(this.screenWidth, 2);
|
||||
jceOutputStream.write(this.screenHeight, 3);
|
||||
jceOutputStream.write(this.platform, 4);
|
||||
String str = this.platformVersion;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 5);
|
||||
}
|
||||
jceOutputStream.write(this.markerId, 6);
|
||||
jceOutputStream.write(this.networkMode, 7);
|
||||
jceOutputStream.write(this.densityDpi, 8);
|
||||
String str2 = this.channelId;
|
||||
if (str2 != null) {
|
||||
jceOutputStream.write(str2, 9);
|
||||
}
|
||||
String str3 = this.imei;
|
||||
if (str3 != null) {
|
||||
jceOutputStream.write(str3, 10);
|
||||
}
|
||||
String str4 = this.imsi;
|
||||
if (str4 != null) {
|
||||
jceOutputStream.write(str4, 11);
|
||||
}
|
||||
String str5 = this.idfa;
|
||||
if (str5 != null) {
|
||||
jceOutputStream.write(str5, 12);
|
||||
}
|
||||
String str6 = this.omgId;
|
||||
if (str6 != null) {
|
||||
jceOutputStream.write(str6, 13);
|
||||
}
|
||||
String str7 = this.extent;
|
||||
if (str7 != null) {
|
||||
jceOutputStream.write(str7, 14);
|
||||
}
|
||||
ExtentData extentData = this.extentData;
|
||||
if (extentData != null) {
|
||||
jceOutputStream.write((JceStruct) extentData, 15);
|
||||
}
|
||||
String str8 = this.clientKey;
|
||||
if (str8 != null) {
|
||||
jceOutputStream.write(str8, 16);
|
||||
}
|
||||
String str9 = this.mac;
|
||||
if (str9 != null) {
|
||||
jceOutputStream.write(str9, 17);
|
||||
}
|
||||
String str10 = this.serverid;
|
||||
if (str10 != null) {
|
||||
jceOutputStream.write(str10, 18);
|
||||
}
|
||||
Coordinates coordinates = this.coordinates;
|
||||
if (coordinates != null) {
|
||||
jceOutputStream.write((JceStruct) coordinates, 19);
|
||||
}
|
||||
String str11 = this.deviceId;
|
||||
if (str11 != null) {
|
||||
jceOutputStream.write(str11, 20);
|
||||
}
|
||||
String str12 = this.deviceModel;
|
||||
if (str12 != null) {
|
||||
jceOutputStream.write(str12, 21);
|
||||
}
|
||||
jceOutputStream.write(this.deviceType, 22);
|
||||
jceOutputStream.write(this.mobileISP, 23);
|
||||
jceOutputStream.write(this.areaMode, 24);
|
||||
jceOutputStream.write(this.countryCode, 25);
|
||||
jceOutputStream.write(this.langCode, 26);
|
||||
String str13 = this.appSubVersion;
|
||||
if (str13 != null) {
|
||||
jceOutputStream.write(str13, 27);
|
||||
}
|
||||
String str14 = this.v4ip;
|
||||
if (str14 != null) {
|
||||
jceOutputStream.write(str14, 28);
|
||||
}
|
||||
String str15 = this.qimei;
|
||||
if (str15 != null) {
|
||||
jceOutputStream.write(str15, 29);
|
||||
}
|
||||
}
|
||||
|
||||
public QUA(String str, String str2, int i2, int i3, int i4, String str3, int i5, int i6, int i7, String str4, String str5, String str6, String str7, String str8, String str9, ExtentData extentData, String str10, String str11, String str12, Coordinates coordinates, String str13, String str14, int i8, int i9, int i10, int i11, int i12, String str15, String str16, String str17) {
|
||||
this.versionName = "";
|
||||
this.versionCode = "";
|
||||
this.screenWidth = 0;
|
||||
this.screenHeight = 0;
|
||||
this.platform = 0;
|
||||
this.platformVersion = "";
|
||||
this.markerId = 0;
|
||||
this.networkMode = 0;
|
||||
this.densityDpi = 0;
|
||||
this.channelId = "";
|
||||
this.imei = "";
|
||||
this.imsi = "";
|
||||
this.idfa = "";
|
||||
this.omgId = "";
|
||||
this.extent = "";
|
||||
this.extentData = null;
|
||||
this.clientKey = "";
|
||||
this.mac = "";
|
||||
this.serverid = "";
|
||||
this.coordinates = null;
|
||||
this.deviceId = "";
|
||||
this.deviceModel = "";
|
||||
this.deviceType = 0;
|
||||
this.mobileISP = 0;
|
||||
this.areaMode = 0;
|
||||
this.countryCode = 0;
|
||||
this.langCode = 0;
|
||||
this.appSubVersion = "";
|
||||
this.v4ip = "";
|
||||
this.qimei = "";
|
||||
this.versionName = str;
|
||||
this.versionCode = str2;
|
||||
this.screenWidth = i2;
|
||||
this.screenHeight = i3;
|
||||
this.platform = i4;
|
||||
this.platformVersion = str3;
|
||||
this.markerId = i5;
|
||||
this.networkMode = i6;
|
||||
this.densityDpi = i7;
|
||||
this.channelId = str4;
|
||||
this.imei = str5;
|
||||
this.imsi = str6;
|
||||
this.idfa = str7;
|
||||
this.omgId = str8;
|
||||
this.extent = str9;
|
||||
this.extentData = extentData;
|
||||
this.clientKey = str10;
|
||||
this.mac = str11;
|
||||
this.serverid = str12;
|
||||
this.coordinates = coordinates;
|
||||
this.deviceId = str13;
|
||||
this.deviceModel = str14;
|
||||
this.deviceType = i8;
|
||||
this.mobileISP = i9;
|
||||
this.areaMode = i10;
|
||||
this.countryCode = i11;
|
||||
this.langCode = i12;
|
||||
this.appSubVersion = str15;
|
||||
this.v4ip = str16;
|
||||
this.qimei = str17;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class RequestCommand extends JceStruct {
|
||||
static byte[] cache_body;
|
||||
public byte[] body;
|
||||
public BusinessHead businessHead;
|
||||
public RequestHead head;
|
||||
static RequestHead cache_head = new RequestHead();
|
||||
static BusinessHead cache_businessHead = new BusinessHead();
|
||||
|
||||
static {
|
||||
cache_body = new byte[0];
|
||||
byte[] bArr = {0};
|
||||
}
|
||||
|
||||
public RequestCommand() {
|
||||
this.head = null;
|
||||
this.body = null;
|
||||
this.businessHead = null;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.head = (RequestHead) jceInputStream.read((JceStruct) cache_head, 0, true);
|
||||
this.body = jceInputStream.read(cache_body, 1, false);
|
||||
this.businessHead = (BusinessHead) jceInputStream.read((JceStruct) cache_businessHead, 2, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write((JceStruct) this.head, 0);
|
||||
byte[] bArr = this.body;
|
||||
if (bArr != null) {
|
||||
jceOutputStream.write(bArr, 1);
|
||||
}
|
||||
BusinessHead businessHead = this.businessHead;
|
||||
if (businessHead != null) {
|
||||
jceOutputStream.write((JceStruct) businessHead, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public RequestCommand(RequestHead requestHead, byte[] bArr, BusinessHead businessHead) {
|
||||
this.head = null;
|
||||
this.body = null;
|
||||
this.businessHead = null;
|
||||
this.head = requestHead;
|
||||
this.body = bArr;
|
||||
this.businessHead = businessHead;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public final class RequestHead extends JceStruct {
|
||||
static BusinessExtent cache_busiExtent;
|
||||
static ArrayList<ExtentAccount> cache_extentAccountList;
|
||||
static LogReport cache_logReport;
|
||||
static SafeInfo cache_safeInfo;
|
||||
public String appId;
|
||||
public BusinessExtent busiExtent;
|
||||
public int cmdId;
|
||||
public int contentType;
|
||||
public ArrayList<ExtentAccount> extentAccountList;
|
||||
public String guid;
|
||||
public int isSupportDolby;
|
||||
public LogReport logReport;
|
||||
public int oemPlatform;
|
||||
public QUA qua;
|
||||
public int requestId;
|
||||
public SafeInfo safeInfo;
|
||||
public ArrayList<LoginToken> token;
|
||||
static QUA cache_qua = new QUA();
|
||||
static ArrayList<LoginToken> cache_token = new ArrayList<>();
|
||||
|
||||
static {
|
||||
cache_token.add(new LoginToken());
|
||||
cache_logReport = new LogReport();
|
||||
cache_extentAccountList = new ArrayList<>();
|
||||
cache_extentAccountList.add(new ExtentAccount());
|
||||
cache_safeInfo = new SafeInfo();
|
||||
cache_busiExtent = new BusinessExtent();
|
||||
}
|
||||
|
||||
public RequestHead() {
|
||||
this.requestId = 0;
|
||||
this.cmdId = 0;
|
||||
this.qua = null;
|
||||
this.appId = "";
|
||||
this.guid = "";
|
||||
this.token = null;
|
||||
this.logReport = null;
|
||||
this.extentAccountList = null;
|
||||
this.oemPlatform = 0;
|
||||
this.isSupportDolby = 0;
|
||||
this.contentType = 0;
|
||||
this.safeInfo = null;
|
||||
this.busiExtent = null;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.requestId = jceInputStream.read(this.requestId, 0, true);
|
||||
this.cmdId = jceInputStream.read(this.cmdId, 1, true);
|
||||
this.qua = (QUA) jceInputStream.read((JceStruct) cache_qua, 2, false);
|
||||
this.appId = jceInputStream.readString(3, false);
|
||||
this.guid = jceInputStream.readString(4, false);
|
||||
this.token = (ArrayList) jceInputStream.read(cache_token, 5, false);
|
||||
this.logReport = (LogReport) jceInputStream.read((JceStruct) cache_logReport, 6, false);
|
||||
this.extentAccountList = (ArrayList) jceInputStream.read( cache_extentAccountList, 7, false);
|
||||
this.oemPlatform = jceInputStream.read(this.oemPlatform, 8, false);
|
||||
this.isSupportDolby = jceInputStream.read(this.isSupportDolby, 9, false);
|
||||
this.contentType = jceInputStream.read(this.contentType, 10, false);
|
||||
this.safeInfo = (SafeInfo) jceInputStream.read((JceStruct) cache_safeInfo, 11, false);
|
||||
this.busiExtent = (BusinessExtent) jceInputStream.read((JceStruct) cache_busiExtent, 12, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.requestId, 0);
|
||||
jceOutputStream.write(this.cmdId, 1);
|
||||
QUA qua = this.qua;
|
||||
if (qua != null) {
|
||||
jceOutputStream.write((JceStruct) qua, 2);
|
||||
}
|
||||
String str = this.appId;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 3);
|
||||
}
|
||||
String str2 = this.guid;
|
||||
if (str2 != null) {
|
||||
jceOutputStream.write(str2, 4);
|
||||
}
|
||||
ArrayList<LoginToken> arrayList = this.token;
|
||||
if (arrayList != null) {
|
||||
jceOutputStream.write((Collection) arrayList, 5);
|
||||
}
|
||||
LogReport logReport = this.logReport;
|
||||
if (logReport != null) {
|
||||
jceOutputStream.write((JceStruct) logReport, 6);
|
||||
}
|
||||
ArrayList<ExtentAccount> arrayList2 = this.extentAccountList;
|
||||
if (arrayList2 != null) {
|
||||
jceOutputStream.write((Collection) arrayList2, 7);
|
||||
}
|
||||
jceOutputStream.write(this.oemPlatform, 8);
|
||||
jceOutputStream.write(this.isSupportDolby, 9);
|
||||
jceOutputStream.write(this.contentType, 10);
|
||||
SafeInfo safeInfo = this.safeInfo;
|
||||
if (safeInfo != null) {
|
||||
jceOutputStream.write((JceStruct) safeInfo, 11);
|
||||
}
|
||||
BusinessExtent businessExtent = this.busiExtent;
|
||||
if (businessExtent != null) {
|
||||
jceOutputStream.write((JceStruct) businessExtent, 12);
|
||||
}
|
||||
}
|
||||
|
||||
public RequestHead(int i2, int i3, QUA qua, String str, String str2, ArrayList<LoginToken> arrayList, LogReport logReport, ArrayList<ExtentAccount> arrayList2, int i4, int i5, int i6, SafeInfo safeInfo, BusinessExtent businessExtent) {
|
||||
this.requestId = 0;
|
||||
this.cmdId = 0;
|
||||
this.qua = null;
|
||||
this.appId = "";
|
||||
this.guid = "";
|
||||
this.token = null;
|
||||
this.logReport = null;
|
||||
this.extentAccountList = null;
|
||||
this.oemPlatform = 0;
|
||||
this.isSupportDolby = 0;
|
||||
this.contentType = 0;
|
||||
this.safeInfo = null;
|
||||
this.busiExtent = null;
|
||||
this.requestId = i2;
|
||||
this.cmdId = i3;
|
||||
this.qua = qua;
|
||||
this.appId = str;
|
||||
this.guid = str2;
|
||||
this.token = arrayList;
|
||||
this.logReport = logReport;
|
||||
this.extentAccountList = arrayList2;
|
||||
this.oemPlatform = i4;
|
||||
this.isSupportDolby = i5;
|
||||
this.contentType = i6;
|
||||
this.safeInfo = safeInfo;
|
||||
this.busiExtent = businessExtent;
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class ResponseCommand extends JceStruct {
|
||||
static byte[] cache_body;
|
||||
public byte[] body;
|
||||
public BusinessHead businessHead;
|
||||
public ResponseHead head;
|
||||
static ResponseHead cache_head = new ResponseHead();
|
||||
static BusinessHead cache_businessHead = new BusinessHead();
|
||||
|
||||
static {
|
||||
cache_body = new byte[0];
|
||||
byte[] bArr = {0};
|
||||
}
|
||||
|
||||
public ResponseCommand() {
|
||||
this.head = null;
|
||||
this.body = null;
|
||||
this.businessHead = null;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.head = (ResponseHead) jceInputStream.read((JceStruct) cache_head, 0, true);
|
||||
this.body = jceInputStream.read(cache_body, 1, false);
|
||||
this.businessHead = (BusinessHead) jceInputStream.read((JceStruct) cache_businessHead, 2, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write((JceStruct) this.head, 0);
|
||||
byte[] bArr = this.body;
|
||||
if (bArr != null) {
|
||||
jceOutputStream.write(bArr, 1);
|
||||
}
|
||||
BusinessHead businessHead = this.businessHead;
|
||||
if (businessHead != null) {
|
||||
jceOutputStream.write((JceStruct) businessHead, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public ResponseCommand(ResponseHead responseHead, byte[] bArr, BusinessHead businessHead) {
|
||||
this.head = null;
|
||||
this.body = null;
|
||||
this.businessHead = null;
|
||||
this.head = responseHead;
|
||||
this.body = bArr;
|
||||
this.businessHead = businessHead;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class ResponseHead extends JceStruct {
|
||||
public int cmdId;
|
||||
public int errCode;
|
||||
public int requestId;
|
||||
public String sUserid;
|
||||
|
||||
public ResponseHead() {
|
||||
this.requestId = 0;
|
||||
this.cmdId = 0;
|
||||
this.errCode = 0;
|
||||
this.sUserid = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.requestId = jceInputStream.read(this.requestId, 0, true);
|
||||
this.cmdId = jceInputStream.read(this.cmdId, 1, true);
|
||||
this.errCode = jceInputStream.read(this.errCode, 2, true);
|
||||
this.sUserid = jceInputStream.readString(3, true);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.requestId, 0);
|
||||
jceOutputStream.write(this.cmdId, 1);
|
||||
jceOutputStream.write(this.errCode, 2);
|
||||
jceOutputStream.write(this.sUserid, 3);
|
||||
}
|
||||
|
||||
public ResponseHead(int i2, int i3, int i4, String str) {
|
||||
this.requestId = 0;
|
||||
this.cmdId = 0;
|
||||
this.errCode = 0;
|
||||
this.sUserid = "";
|
||||
this.requestId = i2;
|
||||
this.cmdId = i3;
|
||||
this.errCode = i4;
|
||||
this.sUserid = str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class SafeInfo extends JceStruct {
|
||||
static byte[] cache_SafeResult;
|
||||
public String SafeKey;
|
||||
public byte[] SafeResult;
|
||||
public int type;
|
||||
|
||||
static {
|
||||
cache_SafeResult = new byte[0];
|
||||
byte[] bArr = {0};
|
||||
}
|
||||
|
||||
public SafeInfo() {
|
||||
this.type = 0;
|
||||
this.SafeKey = "";
|
||||
this.SafeResult = null;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.type = jceInputStream.read(this.type, 0, false);
|
||||
this.SafeKey = jceInputStream.readString(1, false);
|
||||
this.SafeResult = jceInputStream.read(cache_SafeResult, 2, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.type, 0);
|
||||
String str = this.SafeKey;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 1);
|
||||
}
|
||||
byte[] bArr = this.SafeResult;
|
||||
if (bArr != null) {
|
||||
jceOutputStream.write(bArr, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public SafeInfo(int i2, String str, byte[] bArr) {
|
||||
this.type = 0;
|
||||
this.SafeKey = "";
|
||||
this.SafeResult = null;
|
||||
this.type = i2;
|
||||
this.SafeKey = str;
|
||||
this.SafeResult = bArr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
|
||||
public final class TVProgram extends JceStruct {
|
||||
public int copyRight;
|
||||
public int duration;
|
||||
public String epg_time;
|
||||
public String id;
|
||||
public String name;
|
||||
public int picScreenFlag;
|
||||
public long start_time_stamp;
|
||||
public int timeShiftFlag;
|
||||
public int videoScreenFlag;
|
||||
|
||||
public TVProgram() {
|
||||
this.id = "";
|
||||
this.start_time_stamp = 0L;
|
||||
this.epg_time = "";
|
||||
this.name = "";
|
||||
this.copyRight = 0;
|
||||
this.timeShiftFlag = 0;
|
||||
this.duration = 0;
|
||||
this.picScreenFlag = 0;
|
||||
this.videoScreenFlag = 0;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.id = jceInputStream.readString(0, false);
|
||||
this.start_time_stamp = jceInputStream.read(this.start_time_stamp, 1, false);
|
||||
this.epg_time = jceInputStream.readString(2, false);
|
||||
this.name = jceInputStream.readString(3, false);
|
||||
this.copyRight = jceInputStream.read(this.copyRight, 4, false);
|
||||
this.timeShiftFlag = jceInputStream.read(this.timeShiftFlag, 5, false);
|
||||
this.duration = jceInputStream.read(this.duration, 6, false);
|
||||
this.picScreenFlag = jceInputStream.read(this.picScreenFlag, 7, false);
|
||||
this.videoScreenFlag = jceInputStream.read(this.videoScreenFlag, 8, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
String str = this.id;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 0);
|
||||
}
|
||||
jceOutputStream.write(this.start_time_stamp, 1);
|
||||
String str2 = this.epg_time;
|
||||
if (str2 != null) {
|
||||
jceOutputStream.write(str2, 2);
|
||||
}
|
||||
String str3 = this.name;
|
||||
if (str3 != null) {
|
||||
jceOutputStream.write(str3, 3);
|
||||
}
|
||||
jceOutputStream.write(this.copyRight, 4);
|
||||
jceOutputStream.write(this.timeShiftFlag, 5);
|
||||
jceOutputStream.write(this.duration, 6);
|
||||
jceOutputStream.write(this.picScreenFlag, 7);
|
||||
jceOutputStream.write(this.videoScreenFlag, 8);
|
||||
}
|
||||
|
||||
public TVProgram(String str, long j, String str2, String str3, int i2, int i3, int i4, int i5, int i6) {
|
||||
this.id = "";
|
||||
this.start_time_stamp = 0L;
|
||||
this.epg_time = "";
|
||||
this.name = "";
|
||||
this.copyRight = 0;
|
||||
this.timeShiftFlag = 0;
|
||||
this.duration = 0;
|
||||
this.picScreenFlag = 0;
|
||||
this.videoScreenFlag = 0;
|
||||
this.id = str;
|
||||
this.start_time_stamp = j;
|
||||
this.epg_time = str2;
|
||||
this.name = str3;
|
||||
this.copyRight = i2;
|
||||
this.timeShiftFlag = i3;
|
||||
this.duration = i4;
|
||||
this.picScreenFlag = i5;
|
||||
this.videoScreenFlag = i6;
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class TVTimeShiftProgramRequest extends JceStruct {
|
||||
public String pid;
|
||||
|
||||
public TVTimeShiftProgramRequest() {
|
||||
this.pid = "";
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.pid = jceInputStream.readString(0, true);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.pid, 0);
|
||||
}
|
||||
|
||||
public TVTimeShiftProgramRequest(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
public final class TVTimeShiftProgramResponse extends JceStruct {
|
||||
static ArrayList<TVProgram> cache_programs = new ArrayList<>();
|
||||
public int errcode;
|
||||
public String errmsg;
|
||||
public ArrayList<TVProgram> programs;
|
||||
public int timeShiftFlag;
|
||||
|
||||
static {
|
||||
cache_programs.add(new TVProgram());
|
||||
}
|
||||
|
||||
public TVTimeShiftProgramResponse() {
|
||||
this.errcode = 0;
|
||||
this.errmsg = "";
|
||||
this.programs = null;
|
||||
this.timeShiftFlag = 0;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.errcode = jceInputStream.read(this.errcode, 0, true);
|
||||
this.errmsg = jceInputStream.readString(1, false);
|
||||
this.programs = (ArrayList) jceInputStream.read(cache_programs, 2, false);
|
||||
this.timeShiftFlag = jceInputStream.read(this.timeShiftFlag, 3, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.errcode, 0);
|
||||
String str = this.errmsg;
|
||||
if (str != null) {
|
||||
jceOutputStream.write(str, 1);
|
||||
}
|
||||
ArrayList<TVProgram> arrayList = this.programs;
|
||||
if (arrayList != null) {
|
||||
jceOutputStream.write((Collection) arrayList, 2);
|
||||
}
|
||||
jceOutputStream.write(this.timeShiftFlag, 3);
|
||||
}
|
||||
|
||||
public TVTimeShiftProgramResponse(int i2, String str, ArrayList<TVProgram> arrayList, int i3) {
|
||||
this.errcode = 0;
|
||||
this.errmsg = "";
|
||||
this.programs = null;
|
||||
this.timeShiftFlag = 0;
|
||||
this.errcode = i2;
|
||||
this.errmsg = str;
|
||||
this.programs = arrayList;
|
||||
this.timeShiftFlag = i3;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.tencent.videolite.android.datamodel.cctvjce;
|
||||
|
||||
import com.qq.taf.jce.JceInputStream;
|
||||
import com.qq.taf.jce.JceOutputStream;
|
||||
import com.qq.taf.jce.JceStruct;
|
||||
public final class TextInnerLayoutInfo extends JceStruct {
|
||||
public int bottomPending;
|
||||
public int leftPending;
|
||||
public int rightPending;
|
||||
public int topPending;
|
||||
|
||||
public TextInnerLayoutInfo() {
|
||||
this.leftPending = 0;
|
||||
this.topPending = 0;
|
||||
this.rightPending = 0;
|
||||
this.bottomPending = 0;
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void readFrom(JceInputStream jceInputStream) {
|
||||
this.leftPending = jceInputStream.read(this.leftPending, 0, false);
|
||||
this.topPending = jceInputStream.read(this.topPending, 1, false);
|
||||
this.rightPending = jceInputStream.read(this.rightPending, 2, false);
|
||||
this.bottomPending = jceInputStream.read(this.bottomPending, 3, false);
|
||||
}
|
||||
|
||||
@Override // com.qq.taf.jce.JceStruct
|
||||
public void writeTo(JceOutputStream jceOutputStream) {
|
||||
jceOutputStream.write(this.leftPending, 0);
|
||||
jceOutputStream.write(this.topPending, 1);
|
||||
jceOutputStream.write(this.rightPending, 2);
|
||||
jceOutputStream.write(this.bottomPending, 3);
|
||||
}
|
||||
|
||||
public TextInnerLayoutInfo(int i2, int i3, int i4, int i5) {
|
||||
this.leftPending = 0;
|
||||
this.topPending = 0;
|
||||
this.rightPending = 0;
|
||||
this.bottomPending = 0;
|
||||
this.leftPending = i2;
|
||||
this.topPending = i3;
|
||||
this.rightPending = i4;
|
||||
this.bottomPending = i5;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FF263238" />
|
||||
<corners android:radius="4dp" /> <!-- Adjust the radius as needed -->
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/blur" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:bottomRightRadius="4dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/blur" />
|
||||
<corners
|
||||
android:topLeftRadius="4dp"
|
||||
android:bottomLeftRadius="4dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/blur" />
|
||||
<corners
|
||||
android:topRightRadius="4dp"
|
||||
android:bottomRightRadius="4dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/focus" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:bottomRightRadius="4dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<corners
|
||||
android:topLeftRadius="4dp"
|
||||
android:bottomLeftRadius="4dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<corners
|
||||
android:topRightRadius="4dp"
|
||||
android:bottomRightRadius="4dp" />
|
||||
</shape>
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="4dp" /> <!-- Adjust the radius as needed -->
|
||||
<corners
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="4dp" />
|
||||
</shape>
|
||||
@@ -0,0 +1,23 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:viewportWidth="50"
|
||||
android:viewportHeight="50"
|
||||
android:width="62.5dp"
|
||||
android:height="62.5dp">
|
||||
<group
|
||||
android:scaleX="0.1"
|
||||
android:scaleY="-0.1"
|
||||
android:translateY="50">
|
||||
<path
|
||||
android:pathData="M205 377c-27 -27 -40 -33 -65 -29 -30 4 -70 -19 -70 -40 0 -5 -16 -24 -35 -42 -38 -36 -44 -66 -23 -111 22 -49 51 -55 248 -55l182 0 29 29c46 46 37 106 -20 136 -20 10 -31 25 -35 49 -4 22 -20 46 -42 65 -29 26 -43 31 -85 31 -44 0 -55 -4 -84 -33zm138 2c29 -13 57 -58 57 -93 0 -17 5 -26 15 -26 24 0 65 -46 65 -71 0 -13 -10 -33 -22 -46 -21 -22 -26 -23 -205 -23 -182 0 -184 0 -208 25 -33 32 -32 70 3 105 16 15 36 40 45 54 18 27 54 35 74 15 8 -8 16 -2 29 19 9 17 27 35 38 41 28 13 80 13 109 0z"
|
||||
android:fillColor="#FFEEEEEE" />
|
||||
<path
|
||||
android:pathData="M174 269c-10 -17 13 -36 27 -22 12 12 4 33 -11 33 -5 0 -12 -5 -16 -11z"
|
||||
android:fillColor="#FFEEEEEE" />
|
||||
<path
|
||||
android:pathData="M294 269c-10 -17 13 -36 27 -22 12 12 4 33 -11 33 -5 0 -12 -5 -16 -11z"
|
||||
android:fillColor="#FFEEEEEE" />
|
||||
<path
|
||||
android:pathData="M194 196c-32 -14 -50 -33 -41 -42 3 -3 20 4 38 15 43 26 75 26 118 0 34 -20 49 -20 36 1 -10 16 -69 40 -97 40 -13 -1 -37 -7 -54 -14z"
|
||||
android:fillColor="#FFEEEEEE" />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/card"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="100dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/rounded_white_top"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:padding="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/icon"
|
||||
android:background="@drawable/rounded_dark_bottom"
|
||||
android:orientation="vertical"
|
||||
android:padding="7dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="start"
|
||||
android:text="Title"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textColor="#FFEEEEEE"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="start"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:text="Description"
|
||||
android:textColor="#B3EEEEEE"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,19 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/channel_fragment"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="end|top"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="50dp">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
>
|
||||
<FrameLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/channel_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="0dp"
|
||||
android:textColor="#FFEEEEEE"
|
||||
android:textStyle="bold"
|
||||
android:textSize="50sp" />
|
||||
</FrameLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="end|top"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="170dp"
|
||||
android:gravity="end|bottom" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:textSize="40sp"
|
||||
tools:text="99"
|
||||
android:layout_alignBaseline="@+id/time"/>
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:textSize="32sp"
|
||||
tools:text="12:34" />
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:src="@drawable/sad_cloud"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="#FFEEEEEE"
|
||||
android:text="Message"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -1,53 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/info_fragment"
|
||||
android:layout_width="320dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/rounded_background">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/info_logo"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:padding="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="216dp"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
>
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="100dp"
|
||||
android:background="#FF263238"
|
||||
android:gravity="start|center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:padding="7dp">
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="0dp"
|
||||
android:gravity="start"
|
||||
android:textColor="#FFEEEEEE"
|
||||
android:textSize="22sp" />
|
||||
<LinearLayout
|
||||
android:id="@+id/info"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="start"
|
||||
android:singleLine="true"
|
||||
android:textColor="#B3EEEEEE"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/rounded_white_left"
|
||||
android:padding="10dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:background="@drawable/rounded_background2" />
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="@drawable/rounded_dark_right"
|
||||
android:gravity="start|center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:padding="7dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:textColor="#FFEEEEEE"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="start"
|
||||
android:singleLine="true"
|
||||
android:textColor="#B3EEEEEE"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user