Skip to content

Commit

Permalink
add epg cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Jan 21, 2025
1 parent 7738b88 commit d62a1cf
Show file tree
Hide file tree
Showing 45 changed files with 771 additions and 405 deletions.
24 changes: 24 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
## 更新日誌

### v1.3.8.15-kitkat

* 修復頻道記憶失敗的問題
* 打開頻道列表同時顯示組
* 增加EPG緩存

### v1.3.8.15

* 修復頻道記憶失敗的問題
* 打開頻道列表同時顯示組
* 增加EPG緩存

### v1.3.8.14

* 優化重試

### v1.3.8.13

* 支持切換軟解/硬解

### v1.3.8.12

* 在觸屏設備上可以調節聲音和亮度

### v1.3.8.14-kitkat

* 優化樣式
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ adb install my-tv-0.apk

## TODO

* 軟解
* 支持回看
* 詳細EPG
* 淺色菜單
Expand All @@ -92,7 +91,7 @@ adb install my-tv-0.apk

## 讚賞

![image](./screenshots/appreciate.jpeg)
![image](./screenshots/appreciate.png)

## 感謝

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
android:networkSecurityConfig="@xml/network"
android:supportsRtl="true"
android:theme="@style/Theme.MyTV0"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
android:enableOnBackInvokedCallback="false">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/lizongying/mytv0/ErrorFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ErrorFragment : Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
(activity as MainActivity).ready(TAG)
}

fun setMsg(msg: String) {
Expand Down
26 changes: 17 additions & 9 deletions app/src/main/java/com/lizongying/mytv0/GroupAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GroupAdapter(
private var defaultFocused = false
private var defaultFocus: Int = -1

var visiable = false
var visible = false

private var first = true

Expand Down Expand Up @@ -80,16 +80,24 @@ class GroupAdapter(
if (hasFocus) {
viewHolder.focus(true)
focused = view
if (visiable) {

// "position" should not be used here, as the "list" may have been filtered out.
val p = listTVModel.getGroupIndex()
if (p != tvGroupModel.positionValue) {
tvGroupModel.setPosition(p)
}
} else {
visiable = true
val p = listTVModel.getGroupIndex()
if (p != tvGroupModel.positionValue) {
tvGroupModel.setPosition(p)
}

// if (visible) {
//
// // "position" should not be used here, as the "list" may have been filtered out.
// val p = listTVModel.getGroupIndex()
// Log.e(TAG, "group getGroupIndex $p")
// Log.e(TAG, "group positionValue ${tvGroupModel.positionValue}")
// if (p != tvGroupModel.positionValue) {
// tvGroupModel.setPosition(p)
// }
// } else {
// visible = true
// }
} else {
viewHolder.focus(false)
}
Expand Down
28 changes: 24 additions & 4 deletions app/src/main/java/com/lizongying/mytv0/ListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.os.Looper
import android.util.Log
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.FOCUS_BEFORE_DESCENDANTS
Expand All @@ -34,7 +35,7 @@ class ListAdapter(
private var defaultFocused = false
private var defaultFocus: Int = -1

var visiable = false
var visible = false

val application = context.applicationContext as MyTVApplication

Expand Down Expand Up @@ -105,12 +106,12 @@ class ListAdapter(
if (hasFocus) {
viewHolder.focus(true)
focused = view
if (visiable) {
if (visible) {
if (position != it.positionValue) {
it.setPosition(position)
}
} else {
visiable = true
visible = true
}
} else {
viewHolder.focus(false)
Expand All @@ -123,6 +124,25 @@ class ListAdapter(
listener?.onItemClicked(position)
}

view.setOnTouchListener(object : View.OnTouchListener {
override fun onTouch(
v: View?,
event: MotionEvent?
): Boolean {
v ?: return false
event ?: return false

when (event.action) {
MotionEvent.ACTION_UP -> {
v.performClick()
return true
}
}

return false
}
})

view.setOnKeyListener { _, keyCode, event: KeyEvent? ->
if (event?.action == KeyEvent.ACTION_DOWN) {
if (keyCode == KeyEvent.KEYCODE_DPAD_UP && position == 0) {
Expand Down Expand Up @@ -235,7 +255,7 @@ class ListAdapter(
R.drawable.baseline_favorite_24
)
)
binding.heart.setColorFilter(ContextCompat.getColor(context, R.color.heart))
binding.heart.setColorFilter(ContextCompat.getColor(context, R.color.red))
} else {
binding.heart.setImageDrawable(
ContextCompat.getDrawable(
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/lizongying/mytv0/LoadingFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class LoadingFragment : Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
(activity as MainActivity).ready(TAG)
}

override fun onDestroyView() {
Expand Down
Loading

0 comments on commit d62a1cf

Please sign in to comment.