two buttons

This commit is contained in:
IndusAryan 2024-05-14 19:39:58 +05:30
parent f89aad3e95
commit 18c600faf2
2 changed files with 11 additions and 12 deletions

View File

@ -431,16 +431,15 @@ object AppUtils {
}
fun Activity.addRepositoryDialog(repositoryName: String, isExtensionsFragment: Boolean) {
val message = String.format(resources.getString(
R.string.download_all_plugins_from_repo), repositoryName)
val repos = RepositoryManager.getRepositories()
// navigate to newly added repository on pressing OK
// navigate to newly added repository on pressing Open Repository
fun openAddedRepo() {
// don't redirect if user is adding from add repo button
// don't redirect if user is adding manually from add repository fab button
if (!isExtensionsFragment && repos.isNotEmpty()) {
normalSafeApiCall { navigate(
normalSafeApiCall {
navigate(
R.id.navigation_home_to_navigation_settings_plugins,
PluginsFragment.newInstance(
repositoryName,
@ -451,14 +450,13 @@ object AppUtils {
}
runOnUiThread {
val builder : AlertDialog.Builder = AlertDialog.Builder(this)
builder.apply {
AlertDialog.Builder(this).apply {
setTitle(repositoryName)
setMessage(message)
setPositiveButton(R.string.ok) { _, _ ->
setMessage(R.string.download_all_plugins_from_repo)
setPositiveButton(R.string.open_downloaded_repo) { _, _ ->
openAddedRepo()
}
setCancelable(false)
setNegativeButton(R.string.dismiss, null)
show().setDefaultFocus()
}
}

View File

@ -609,8 +609,7 @@
<string name="view_public_repositories_button">View community repositories</string>
<string name="view_public_repositories_button_short">Public list</string>
<string name="uppercase_all_subtitles">Uppercase all subtitles</string>
<string name="download_all_plugins_from_repo">%1$s has been added. You can install your desired extensions from 𝗦𝗲𝘁𝘁𝗶𝗻𝗴𝘀 > 𝗘𝘅𝘁𝗲𝗻𝘀𝗶𝗼𝗻𝘀 > %1$s.
CloudStream 3 does not takes any responsibility for using third-party extensions neither provides support for them.</string>
<string name="download_all_plugins_from_repo">CloudStream 3 does not takes any responsibility for using 3rd-party extensions neither provides support for them</string>
<string name="single_plugin_disabled" formatted="true">%s (Disabled)</string>
<string name="tracks">Tracks</string>
<string name="audio_tracks">Audio tracks</string>
@ -659,6 +658,8 @@
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="ok">OK</string>
<string name="dismiss">Dismiss</string>
<string name="open_downloaded_repo">Open repository</string>
<string name="battery_dialog_title">Disable Battery optimization</string>
<string name="battery_dialog_message">To ensure uninterrupted downloads and notifications for subscribed
TV shows, CloudStream needs permission to run in background. By pressing "OK", you\'ll be directed to App info.