mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Makes dialog strings translatable and move to themed Material dialog
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ac0f8608a7
commit
98690a02d1
@ -2,7 +2,9 @@
|
|||||||
* Nextcloud Talk application
|
* Nextcloud Talk application
|
||||||
*
|
*
|
||||||
* @author Julius Linus
|
* @author Julius Linus
|
||||||
|
* @author Andy Scherzinger
|
||||||
* Copyright (C) 2023 Julius Linus <julius.linus@nextcloud.com>
|
* Copyright (C) 2023 Julius Linus <julius.linus@nextcloud.com>
|
||||||
|
* Copyright (C) 2023 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.translate
|
package com.nextcloud.talk.translate
|
||||||
|
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.method.ScrollingMovementMethod
|
import android.text.method.ScrollingMovementMethod
|
||||||
@ -27,7 +28,9 @@ import android.util.Log
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.activities.BaseActivity
|
import com.nextcloud.talk.activities.BaseActivity
|
||||||
import com.nextcloud.talk.api.NcApi
|
import com.nextcloud.talk.api.NcApi
|
||||||
@ -172,11 +175,26 @@ class TranslateActivity : BaseActivity() {
|
|||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
binding.progressBar.visibility = View.GONE
|
binding.progressBar.visibility = View.GONE
|
||||||
val builder = AlertDialog.Builder(this@TranslateActivity)
|
val dialogBuilder = MaterialAlertDialogBuilder(this@TranslateActivity)
|
||||||
builder.setTitle("Translation Failed")
|
.setIcon(
|
||||||
builder.setMessage("Could not detect language")
|
viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
|
||||||
val dialog = builder.create()
|
context,
|
||||||
dialog.show()
|
R.drawable.ic_warning_white
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.setTitle(R.string.translation_error_title)
|
||||||
|
.setMessage(R.string.translation_error_message)
|
||||||
|
.setPositiveButton(R.string.nc_ok) { dialog, _ ->
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(context, dialogBuilder)
|
||||||
|
|
||||||
|
val dialog = dialogBuilder.show()
|
||||||
|
|
||||||
|
viewThemeUtils.platform.colorTextButtons(
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onComplete() {
|
override fun onComplete() {
|
||||||
|
@ -658,5 +658,7 @@ How to translate with transifex:
|
|||||||
<string name="scroll_to_bottom">Scroll to bottom</string>
|
<string name="scroll_to_bottom">Scroll to bottom</string>
|
||||||
<string name="translate">Translate</string>
|
<string name="translate">Translate</string>
|
||||||
<string name="translation">Translation</string>
|
<string name="translation">Translation</string>
|
||||||
|
<string name="translation_error_title">Translation failed</string>
|
||||||
|
<string name="translation_error_message">Could not detect language</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user