Skip to content

Commit

Permalink
update toasts and ban Mi TV Player
Browse files Browse the repository at this point in the history
  • Loading branch information
tsynik committed Jun 21, 2024
1 parent a25ef11 commit c590148
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
14 changes: 7 additions & 7 deletions app/src/main/java/top/rootu/lampa/AndroidJS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class AndroidJS(private val mainActivity: MainActivity, private val browser: Bro
try {
mainActivity.startActivity(intent)
} catch (e: Exception) {
Log.d(TAG, e.message, e)
App.toast(R.string.no_activity_found, true)
if (BuildConfig.DEBUG) Log.d(TAG, e.message, e)
App.toast(R.string.no_torrent_activity_found, true)
}
}
// update Recs to filter viewed
Expand All @@ -210,8 +210,8 @@ class AndroidJS(private val mainActivity: MainActivity, private val browser: Bro
try {
mainActivity.startActivity(intent)
} catch (e: Exception) {
Log.d(TAG, e.message, e)
App.toast(R.string.no_activity_found, true)
if (BuildConfig.DEBUG) Log.d(TAG, e.message, e)
App.toast(R.string.no_youtube_activity_found, true)
}
}
}
Expand All @@ -229,7 +229,7 @@ class AndroidJS(private val mainActivity: MainActivity, private val browser: Bro
@JavascriptInterface
@org.xwalk.core.JavascriptInterface
fun httpReq(str: String?, returnI: Int) {
Log.d("JS", str!!)
if (BuildConfig.DEBUG) Log.d("JS", str!!)
val jSONObject: JSONObject?
try {
jSONObject = JSONObject(str)
Expand Down Expand Up @@ -343,7 +343,7 @@ class AndroidJS(private val mainActivity: MainActivity, private val browser: Bro
@JavascriptInterface
@org.xwalk.core.JavascriptInterface
fun openPlayer(link: String, jsonStr: String) {
Log.d(TAG, "openPlayer: $link json:$jsonStr")
if (BuildConfig.DEBUG) Log.d(TAG, "openPlayer: $link json:$jsonStr")
val jsonObject: JSONObject = try {
JSONObject(jsonStr.ifEmpty { "{}" })
} catch (e: Exception) {
Expand Down Expand Up @@ -398,7 +398,7 @@ class AndroidJS(private val mainActivity: MainActivity, private val browser: Bro
fun updateChannel(where: String?) {
// https://github.com/yumata/lampa-source/blob/e5505b0e9cf5f95f8ec49bddbbb04086fccf26c8/src/app.js#L203
if (where != null && isAndroidTV) {
Log.d(TAG, "***** updateChannel [$where]")
if (BuildConfig.DEBUG) Log.d(TAG, "***** updateChannel [$where]")
when (where) {
LampaProvider.HIST,
LampaProvider.BOOK,
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/top/rootu/lampa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ class MainActivity : AppCompatActivity(),
"com.ghisler.android.totalcommander",
"com.instantbits.cast.webvideo",
"com.lonelycatgames.xplore",
"com.mitv.videoplayer",
"com.mixplorer.silver",
"com.opera.browser",
"org.droidtv.contentexplorer",
Expand All @@ -1273,7 +1274,7 @@ class MainActivity : AppCompatActivity(),
filteredList.add(info)
}
if (filteredList.isEmpty()) {
App.toast(R.string.no_activity_found, true)
App.toast(R.string.no_player_activity_found, true)
return
}
var playerPackageExist = false
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<resources>
<string name="no_activity_found">Lampa: Нет приложения для открытия ссылки данного типа</string>
<string name="no_activity_found">Нет приложения, позволяющего открыть ссылку этого типа.</string>
<string name="no_player_activity_found">Подходящего мультимедиа-плеера не найдено. Пожалуйста, установите плеер из Google Play Store или любого другого источника. Мы рекомендуем Just Player, Vimu Media Player, VLC.</string>
<string name="no_torrent_activity_found">Нет приложения для открытия торрент-ссылок. Пожалуйста, установите TorrServe или любое другое приложение, работающее с торрентами.</string>
<string name="no_youtube_activity_found">Нет приложения для открытия ссылок YouTube. Пожалуйста, установите приложение YouTube.</string>
<string name="no_launch_player">Lampa: Выбранный плеер не поддерживает воспроизведение этого видео</string>
<string name="invalid_url">Введите корректный адрес сайта, например:\nhttp://lampa.mx</string>
<string name="cancel">Отмена</string>
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<resources>
<string name="no_activity_found">​​Lampa:没有应用程序可以打开此类链接</string>
<string name="no_launch_player">Lampa:所选播放器不支持该视频</string>
<string name="no_activity_found">​​没有应用程序可以打开此类链接。</string>
<string name="no_player_activity_found">​​未找到匹配的播放器。请从 Google Play 商店或任何其他来源安装播放器。我们推荐 Just Player、Vimu Media Player、VLC。</string>
<string name="no_torrent_activity_found">​​没有应用程序可以打开 torrent 链接。请安装 TorrServe 或任何其他支持 torrent 的应用程序。</string>
<string name="no_youtube_activity_found">​​没有应用程序可以打开 YouTube 链接。请安装 YouTube 应用。</string>
<string name="no_launch_player">所选播放器不支持该视频</string>
<string name="invalid_url">请输入一个有效的网址,例如:\nhttp://lampa.mx</string>
<string name="cancel">取消</string>
<string name="save">保存</string>
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<resources>
<string name="app_name" translatable="false">LAMPA</string>
<string name="provider_auth" translatable="false">top.rootu.lampa</string>
<string name="no_activity_found">Lampa: There is no application to open this type of link</string>
<string name="no_launch_player">Lampa: The selected player does not support playing this video</string>
<string name="no_activity_found">There is no application to open this type of link.</string>
<string name="no_player_activity_found">No matching multimedia player found. Please, install player from Google Play Store or any other source. We recommend Just Player, Vimu Media Player, VLC.</string>
<string name="no_torrent_activity_found">There is no application to open torrent links. Please, install TorrServe or any other App working with torrents.</string>
<string name="no_youtube_activity_found">There is no application to open YouTube links. Please, install YouTube App.</string>
<string name="no_launch_player">The selected player does not support playing this video</string>
<string name="invalid_url">Enter the correct website address, for example:\nhttp://lampa.mx</string>
<string name="cancel">Cancel</string>
<string name="save">Save</string>
Expand Down

0 comments on commit c590148

Please sign in to comment.