Compare commits

..
6 Commits
Author SHA1 Message Date
Li ZongYing bb38cf5033 fix gson crash 2024-05-26 20:20:42 +08:00
Li ZongYing 51d9c4c2a7 fix gson crash 2024-05-26 20:16:10 +08:00
Li ZongYing 70da1d8241 fix the settings options are not displayed 2024-05-26 09:36:24 +08:00
Li ZongYing ef17427f64 add reset 2024-05-21 09:55:15 +08:00
Li ZongYing c1143afb4e fix ysp 2024-05-20 22:23:16 +08:00
Li ZongYing 68f158e556 fix ysp 2024-05-20 22:08:37 +08:00
23 changed files with 129 additions and 69 deletions
+16 -1
View File
@@ -1,8 +1,23 @@
## 更新日志
### v2.0.2
### v2.0.7
* 修复部分设备闪退的问题
* 修复设置页可能显示不全的问题
### v2.0.5
* 设置页增加恢复默认按钮,目前只用于同步系统时间
### v2.0.4
* 修复不能播放的问题
* 包含国际频道
### v2.0.3
* 修复不能播放的问题
* 不包含国际频道
### v2.0.0
+1 -1
View File
@@ -16,4 +16,4 @@ gen-version:
#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)" "\"}"}' > version.json
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
+3 -1
View File
@@ -89,7 +89,7 @@ static def VersionName() {
process.waitFor()
def versionName = process.text.trim() - "v"
if (versionName.isEmpty()) {
versionName = "1.0.0"
versionName = "1.0.0"
}
return versionName
} catch (ignored) {
@@ -114,6 +114,8 @@ dependencies {
def retrofit2_version = "2.6.4"
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
// 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"
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit2_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
+1 -1
View File
@@ -15,7 +15,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:name=".MyTvApplication"
android:name=".MyTVApplication"
android:allowBackup="true"
android:banner="@drawable/banner"
android:icon="@drawable/logo"
Binary file not shown.
Binary file not shown.
@@ -34,7 +34,7 @@ class CardAdapter(
val inflater = LayoutInflater.from(parent.context)
val binding = CardBinding.inflate(inflater, parent, false)
val application = mainFragment.requireActivity().applicationContext as MyTvApplication
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)
@@ -28,7 +28,7 @@ class ChannelFragment : Fragment() {
_binding = ChannelBinding.inflate(inflater, container, false)
_binding!!.root.visibility = View.GONE
val application = requireActivity().applicationContext as MyTvApplication
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)
@@ -19,7 +19,7 @@ class ErrorFragment : Fragment() {
): View {
_binding = ErrorBinding.inflate(inflater, container, false)
val application = requireActivity().applicationContext as MyTvApplication
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)
@@ -29,7 +29,7 @@ class InfoFragment : Fragment() {
): View {
_binding = InfoBinding.inflate(inflater, container, false)
val application = requireActivity().applicationContext as MyTvApplication
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)
@@ -7,10 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
class ItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
private var application: MyTvApplication
private var application: MyTVApplication
init {
application = context.applicationContext as MyTvApplication
application = context.applicationContext as MyTVApplication
}
override fun getItemOffsets(
@@ -17,7 +17,7 @@ class LoadingFragment : Fragment() {
): View {
_binding = LoadingBinding.inflate(inflater, container, false)
val application = requireActivity().applicationContext as MyTvApplication
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)
@@ -8,6 +8,7 @@ import android.util.Log
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
@@ -44,13 +45,13 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
private val handler = Handler()
private val delayHideMain: Long = 10000
private val delayHideSetting: Long = 10000
private val delayHideSetting: Long = 15000
init {
Utils.setRequestListener(this)
}
private fun syncTime() {
fun syncTime() {
lifecycleScope.launch(Dispatchers.IO) {
val utilsJob = async(start = CoroutineStart.LAZY) { Utils.init() }
utilsJob.start()
@@ -59,9 +60,6 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Request.setRequestListener(this)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val lp = window.attributes
@@ -70,6 +68,17 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
window.setAttributes(lp)
}
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 =
@@ -82,6 +91,10 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
// window.navigationBarColor = Color.TRANSPARENT
// }
setContentView(R.layout.activity_main)
Request.setRequestListener(this)
if (savedInstanceState == null) {
val transaction = supportFragmentManager.beginTransaction()
.add(R.id.main_browse_fragment, playerFragment)
@@ -42,7 +42,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
private var lastVideoUrl = ""
private lateinit var application: MyTvApplication
private lateinit var application: MyTVApplication
private lateinit var gestureDetector: GestureDetector
@@ -53,7 +53,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
val context = requireContext()
_binding = MenuBinding.inflate(inflater, container, false)
application = requireActivity().applicationContext as MyTvApplication
application = requireActivity().applicationContext as MyTVApplication
binding.menu.layoutParams.width = application.shouldWidthPx()
binding.menu.layoutParams.height = application.shouldHeightPx()
@@ -8,7 +8,7 @@ import android.view.WindowManager
import androidx.multidex.MultiDex
class MyTvApplication : Application() {
class MyTVApplication : Application() {
private lateinit var displayMetrics: DisplayMetrics
private lateinit var realDisplayMetrics: DisplayMetrics
@@ -14,6 +14,7 @@ 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
@@ -97,7 +98,14 @@ class SettingFragment : DialogFragment() {
requestInstallPermissions()
}
val application = requireActivity().applicationContext as MyTvApplication
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)
@@ -108,51 +116,41 @@ class SettingFragment : DialogFragment() {
application.px2Px(binding.content.paddingBottom)
)
binding.name.textSize = application.px2PxFont(binding.name.textSize)
binding.version.textSize = application.px2PxFont(binding.version.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 = application.px2PxFont(binding.checkVersion.textSize)
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 = application.px2PxFont(binding.versionName.textSize)
binding.versionName.textSize = textSize
binding.exit.textSize = application.px2PxFont(binding.exit.textSize)
binding.clear.textSize = textSize
binding.exit.textSize = textSize
binding.switchChannelReversal.textSize =
application.px2PxFont(binding.switchChannelReversal.textSize)
val layoutParamsChannelReversal =
val layoutParamsChannelSwitch =
binding.switchChannelReversal.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsChannelReversal.topMargin =
layoutParamsChannelSwitch.topMargin =
application.px2Px(binding.switchChannelReversal.marginTop)
binding.switchChannelReversal.layoutParams = layoutParamsChannelReversal
binding.switchChannelNum.textSize = application.px2PxFont(binding.switchChannelNum.textSize)
val layoutParamsChannelNum =
binding.switchChannelNum.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsChannelNum.topMargin = application.px2Px(binding.switchChannelNum.marginTop)
binding.switchChannelNum.layoutParams = layoutParamsChannelNum
binding.switchChannelReversal.textSize = textSize
binding.switchChannelReversal.layoutParams = layoutParamsChannelSwitch
binding.switchTime.textSize = application.px2PxFont(binding.switchTime.textSize)
val layoutParamsTime = binding.switchTime.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsTime.topMargin = application.px2Px(binding.switchTime.marginTop)
binding.switchTime.layoutParams = layoutParamsTime
binding.switchChannelNum.textSize = textSize
binding.switchChannelNum.layoutParams = layoutParamsChannelSwitch
binding.switchBootStartup.textSize =
application.px2PxFont(binding.switchBootStartup.textSize)
val layoutParamsBootStartup =
binding.switchBootStartup.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsBootStartup.topMargin = application.px2Px(binding.switchBootStartup.marginTop)
binding.switchBootStartup.layoutParams = layoutParamsBootStartup
binding.switchTime.textSize = textSize
binding.switchTime.layoutParams = layoutParamsChannelSwitch
binding.switchGrid.textSize = application.px2PxFont(binding.switchGrid.textSize)
val layoutParamsGrid = binding.switchGrid.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsGrid.topMargin = application.px2Px(binding.switchGrid.marginTop)
binding.switchGrid.layoutParams = layoutParamsGrid
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)
@@ -24,7 +24,7 @@ class TimeFragment : Fragment() {
): View {
_binding = TimeBinding.inflate(inflater, container, false)
val application = requireActivity().applicationContext as MyTvApplication
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)
@@ -1,7 +1,6 @@
package com.lizongying.mytv.api
import android.content.Context
import android.util.Log
import com.lizongying.mytv.SP
import com.lizongying.mytv.Utils.getDateTimestamp
import com.lizongying.mytv.models.TVViewModel
@@ -103,18 +102,18 @@ object YSP {
cKey =
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
Log.i(TAG,"yspsdkinput ${"""{"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","channel":"$channel","defn":"$defn"}"""}" )
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")
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()
nrequest_id = "999999" + getRand() + getTimeStr()
openapi_signature = md("yspappid:519748109;host:www.yangshipin.cn;protocol:https:;token:$token2;input:$yspsdkinput-$guid-$nseqId-$nrequest_id;")
openapi_signature =
md("yspappid:519748109;host:www.yangshipin.cn;protocol:https:;token:$token2;input:$yspsdkinput-$guid-$nseqId-$nrequest_id;")
}
fun md(str:String):String {
fun md(str: String): String {
val md = MessageDigest.getInstance("MD5")
md.update(str.toByteArray())
val digest = md.digest()
@@ -148,6 +147,7 @@ object YSP {
var guid = SP.guid
if (guid.length < 18) {
guid = generateGuid()
this.guid = guid
SP.guid = guid
}
return guid
@@ -15,7 +15,7 @@ class TVViewModel(private var tv: TV) : ViewModel() {
private var itemPosition: Int = 0
var retryTimes = 0
var retryMaxTimes = 1
var retryMaxTimes = 8
var authYSPRetryTimes = 0
var authYSPRetryMaxTimes = 3
var tokenYSPRetryTimes = 0
+22 -11
View File
@@ -1,18 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<LinearLayout
<ScrollView
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:id="@+id/content"
android:layout_width="300dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:background="@drawable/rounded_dark_left"
@@ -55,6 +59,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="@string/clear"
/>
<Button
android:id="@+id/exit"
android:layout_width="wrap_content"
@@ -98,11 +109,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:id="@+id/appreciate"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:src="@drawable/appreciate"
android:background="@drawable/rounded_white_right" />
</LinearLayout>
</FrameLayout>
</ScrollView>
<ImageView
android:id="@+id/appreciate"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:src="@drawable/appreciate"
android:background="@drawable/rounded_white_right" />
</LinearLayout>
+1
View File
@@ -6,5 +6,6 @@
<string name="title_boot_startup">开机自启</string>
<string name="title_grid">频道列表采用网格样式</string>
<string name="title_time">显示时间</string>
<string name="clear">恢复默认</string>
<string name="exit">退出应用</string>
</resources>
Executable
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
in_changelog=false
while IFS= read -r line; do
if [[ "$line" == "## "* ]]; then
continue
fi
if [[ $in_changelog == false ]] && [[ "$line" == "### "* ]]; then
in_changelog=true
continue
fi
if [[ $in_changelog == true ]] && [[ "$line" == "### "* ]]; then
break
fi
echo "$line"
done < HISTORY.md
+1 -1
View File
@@ -1 +1 @@
{"version_code": 33554944, "version_name": "v2.0.2"}
{"version_code": 33556224, "version_name": "v2.0.7"}