-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4e7792
commit eca2257
Showing
14 changed files
with
189 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
## 更新日誌 | ||
|
||
### v1.3.8.9-kitkat | ||
|
||
* 優化EPG | ||
|
||
### v1.3.8.9 | ||
|
||
* 優化EPG | ||
|
||
### v1.3.8.8-kitkat | ||
|
||
* 通過網絡獲取默認視頻源列表 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.lizongying.mytv0 | ||
|
||
import android.content.Context | ||
import android.graphics.Bitmap | ||
import android.graphics.drawable.BitmapDrawable | ||
import android.graphics.drawable.Drawable | ||
import android.os.Handler | ||
import android.widget.ImageView | ||
import com.bumptech.glide.Glide | ||
import com.bumptech.glide.load.DataSource | ||
import com.bumptech.glide.load.engine.GlideException | ||
import com.bumptech.glide.request.RequestListener | ||
import com.bumptech.glide.request.target.Target | ||
|
||
fun loadNextUrl( | ||
context: Context, | ||
imageView: ImageView, | ||
bitmap: Bitmap, | ||
urlList: List<String>, | ||
index: Int, | ||
handler: Handler, | ||
onSuccess: (Int) -> Unit | ||
) { | ||
if (urlList.isEmpty()) { | ||
return | ||
} | ||
if (index >= urlList.size) { | ||
return | ||
} | ||
val url = urlList[index] | ||
if (url.isEmpty()) { | ||
Glide.with(context) | ||
.load(bitmap) | ||
.fitCenter() | ||
.into(imageView) | ||
} else { | ||
Glide.with(context) | ||
.load(url) | ||
.listener(object : RequestListener<Drawable> { | ||
override fun onResourceReady( | ||
resource: Drawable, | ||
model: Any, | ||
target: Target<Drawable>?, | ||
dataSource: DataSource, | ||
isFirstResource: Boolean | ||
): Boolean { | ||
onSuccess(index) | ||
return false | ||
} | ||
|
||
override fun onLoadFailed( | ||
e: GlideException?, | ||
model: Any?, | ||
target: Target<Drawable>, | ||
isFirstResource: Boolean | ||
): Boolean { | ||
handler.post { | ||
loadNextUrl( | ||
context, | ||
imageView, | ||
bitmap, | ||
urlList, | ||
index + 1, | ||
handler, | ||
onSuccess | ||
) | ||
} | ||
return true | ||
} | ||
}) | ||
.placeholder(BitmapDrawable(context.resources, bitmap)) | ||
.fitCenter() | ||
.into(imageView) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.