strings + better dialogbox

This commit is contained in:
Sarang S 2022-08-18 22:04:47 +05:30
parent e2590cbd9b
commit 1b2b93eed7
3 changed files with 13 additions and 7 deletions

View file

@ -214,7 +214,7 @@ class ExtensionsFragment : Fragment() {
RepositoryManager.addRepository(newRepo) RepositoryManager.addRepository(newRepo)
extensionViewModel.loadStats() extensionViewModel.loadStats()
extensionViewModel.loadRepositories() extensionViewModel.loadRepositories()
this@ExtensionsFragment.activity?.downloadAllPluginsDialog(url) this@ExtensionsFragment.activity?.downloadAllPluginsDialog(url, fixedName)
} }
dialog.dismissSafe(activity) dialog.dismissSafe(activity)
} }

View file

@ -259,24 +259,26 @@ object AppUtils {
) )
} }
afterRepositoryLoadedEvent.invoke(true) afterRepositoryLoadedEvent.invoke(true)
downloadAllPluginsDialog(url) downloadAllPluginsDialog(url, repo.name)
} }
} }
fun Activity.downloadAllPluginsDialog(repositoryUrl: String) { fun Activity.downloadAllPluginsDialog(repositoryUrl: String, repositoryName: String) {
runOnUiThread { runOnUiThread {
val context = this val context = this
val builder: AlertDialog.Builder = AlertDialog.Builder(this) val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle( builder.setTitle(
"Download all plugins from this repo?" repositoryName
)
builder.setMessage(
R.string.download_all_plugins_from_repo
) )
builder.apply { builder.apply {
// TODO: R.string Yes No setPositiveButton(R.string.yes) { _, _ ->
setPositiveButton("Yes") { _, _ ->
downloadAll(context, repositoryUrl, null) downloadAll(context, repositoryUrl, null)
} }
setNegativeButton("No") { _, _ -> } setNegativeButton(R.string.no) { _, _ -> }
} }
builder.show() builder.show()
} }

View file

@ -602,4 +602,8 @@
<string name="view_public_repositories_button">View community repositories</string> <string name="view_public_repositories_button">View community repositories</string>
<string name="view_public_repositories_button_short">Public list</string> <string name="view_public_repositories_button_short">Public list</string>
<string name="uppercase_all_subtitles">Uppercase all subtitles</string> <string name="uppercase_all_subtitles">Uppercase all subtitles</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="download_all_plugins_from_repo">Download all plugins from this repo?</string>
</resources> </resources>