多语言机翻

This commit is contained in:
coldmint 2022-07-09 19:26:28 +08:00
parent 15ace14a26
commit 0d153622cb
21 changed files with 2762 additions and 787 deletions

Binary file not shown.

View File

@ -20,6 +20,7 @@ import com.afollestad.materialdialogs.WhichButton
import com.afollestad.materialdialogs.actions.setActionButtonEnabled
import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.coldmint.dialog.InputDialog
import com.coldmint.rust.core.dataBean.ApiResponse
import com.coldmint.rust.core.dataBean.LoginRequestData
import com.coldmint.rust.core.dataBean.user.UserData
@ -132,7 +133,7 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
val expirationTime = userData.data.expirationTime
val time = ServerConfiguration.toLongTime(expirationTime)
appSettings.forceSetValue(AppSettings.Setting.ExpirationTime, time)
appSettings.forceSetValue(AppSettings.Setting.LoginStatus,true)
appSettings.forceSetValue(AppSettings.Setting.LoginStatus, true)
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
finish()
} else {
@ -371,30 +372,16 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
)
}
viewBinding.changeServerView.setOnClickListener {
MaterialDialog(this@LoginActivity).show {
title(R.string.changing_the_server).message(R.string.changing_the_server_tip)
.cancelable(false)
input(
maxLength = 255,
waitForPositiveButton = false,
prefill = appSettings.getValue(
InputDialog(this).setTitle(R.string.changing_the_server)
.setMessage(R.string.changing_the_server_tip).setMaxNumber(255).setText(
appSettings.getValue(
AppSettings.Setting.ServerAddress,
ServerConfiguration.website
)
) { dialog, text ->
if (text.startsWith("http://") || text.startsWith("https://")) {
dialog.setActionButtonEnabled(
WhichButton.POSITIVE,
true
)
} else {
dialog.setActionButtonEnabled(
WhichButton.POSITIVE,
false
)
}
}.positiveButton(R.string.dialog_ok, null) { dialog ->
val input = dialog.getInputField().text.toString()
).setHint(R.string.server_address_configuration).setErrorTip { s, textInputLayout ->
textInputLayout.isErrorEnabled =
!(s.startsWith("http://") || s.startsWith("https://"))
}.setPositiveButton(R.string.dialog_ok) { input ->
if (input.isNotBlank()) {
appSettings.setValue(AppSettings.Setting.ServerAddress, input)
ServerConfiguration.website = input
@ -403,9 +390,12 @@ class LoginActivity : BaseActivity<ActivityLoginBinding>() {
R.string.change_server_complete,
Snackbar.LENGTH_SHORT
).show()
return@setPositiveButton true
} else {
return@setPositiveButton false
}
}.negativeButton(R.string.dialog_close)
}
}.setNegativeButton(R.string.dialog_close) {
}.show()
}
}

View File

@ -684,17 +684,17 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
startViewModel.needLoginLiveData.observe(this) {
if (it) {
MaterialAlertDialogBuilder(this).setTitle(R.string.login)
.setMessage(R.string.login_tip).setPositiveButton(R.string.login) { i, i2 ->
CoreDialog(this).setTitle(R.string.login).setMessage(R.string.login_tip)
.setPositiveButton(R.string.login) {
startActivity(
Intent(
this,
LoginActivity::class.java
)
)
}.setNegativeButton(R.string.dialog_close) { i, i2 ->
}.setNegativeButton(R.string.dialog_close) {
finish()
}.show()
}.setCancelable(false).show()
} else {
showGameConfiguredDialog()
}
@ -742,16 +742,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
fun inputName() {
InputDialog(this).setInputCanBeEmpty(false).setTitle("姓名")
.setPositiveButton("确定") {
}.setNegativeButton("取消") {
}.setCancelable(false).show()
}
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
@ -760,7 +750,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
initNav()
observeStartViewModel()
checkAppUpdate()
inputName()
} else {
startViewModel.initAllData()
}

View File

@ -217,7 +217,7 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
viewBinding.toolbar.setTitle(R.string.set_up)
title = getString(R.string.set_up)
setReturnButton()
val settingsFragment = SettingsFragment()
supportFragmentManager

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
<!-- 语言条目 -->
<string-array name="language_entries">
<item>简体中文</item>
<item>繁體中文</item>
<!-- <item>繁體中文</item>-->
<item>English</item>
<item>日本語</item>
<item>Россия</item>
@ -10,7 +10,7 @@
<string-array name="language_values">
<item>zh</item>
<item>zh_TW</item>
<!-- <item>zh_TW</item>-->
<item>en</item>
<item>ja</item>
<item>ru</item>

View File

@ -18,6 +18,7 @@ interface AppDialog {
fun setTitle(string: String): AppDialog
fun setTitle(stringRes: Int): AppDialog
fun dismiss()
/**
* 设置消息
@ -101,4 +102,10 @@ interface AppDialog {
*/
fun setView(view: View): AppDialog
/**
* 设置是否可以自动关闭
* @param enable Boolean
* @return AppDialog
*/
fun setAutoDismiss(enable: Boolean): AppDialog
}

View File

@ -9,7 +9,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
/**
* 基础App对话框
*/
abstract class BaseAppDialog(context: Context) : AppDialog {
abstract class BaseAppDialog<DialogType : AppDialog>(context: Context) :
AppDialog {
protected val materialAlertDialogBuilder: MaterialAlertDialogBuilder by lazy {
MaterialAlertDialogBuilder(context)
@ -18,97 +19,101 @@ abstract class BaseAppDialog(context: Context) : AppDialog {
protected lateinit var dialog: AlertDialog
override fun setTitle(string: String): AppDialog {
override fun dismiss() {
dialog.dismiss()
}
override fun setTitle(string: String): DialogType {
materialAlertDialogBuilder.setTitle(string)
return this
return this as DialogType
}
override fun setTitle(stringRes: Int): AppDialog {
override fun setTitle(stringRes: Int): DialogType {
materialAlertDialogBuilder.setTitle(stringRes)
return this
return this as DialogType
}
override fun setMessage(stringRes: Int): AppDialog {
override fun setMessage(stringRes: Int): DialogType {
materialAlertDialogBuilder.setMessage(stringRes)
return this
return this as DialogType
}
override fun setMessage(string: String): AppDialog {
override fun setMessage(string: String): DialogType {
materialAlertDialogBuilder.setMessage(string)
return this
return this as DialogType
}
override fun show(): AppDialog {
override fun show(): DialogType {
dialog = materialAlertDialogBuilder.show()
return this
return this as DialogType
}
override fun setPositiveButton(text: String, func: () -> Unit): AppDialog {
override fun setPositiveButton(text: String, func: () -> Unit): DialogType {
materialAlertDialogBuilder.setPositiveButton(text) { i, i2 ->
func.invoke()
}
return this
return this as DialogType
}
override fun setPositiveButton(textRes: Int, func: () -> Unit): AppDialog {
override fun setPositiveButton(textRes: Int, func: () -> Unit): DialogType {
materialAlertDialogBuilder.setPositiveButton(textRes) { i, i2 ->
func.invoke()
}
return this
return this as DialogType
}
override fun setNegativeButton(text: String, func: () -> Unit): AppDialog {
override fun setNegativeButton(text: String, func: () -> Unit): DialogType {
materialAlertDialogBuilder.setNegativeButton(text) { i, i2 ->
func.invoke()
}
return this
return this as DialogType
}
override fun setNegativeButton(textRes: Int, func: () -> Unit): AppDialog {
override fun setNegativeButton(textRes: Int, func: () -> Unit): DialogType {
materialAlertDialogBuilder.setNegativeButton(textRes) { i, i2 ->
func.invoke()
}
return this
return this as DialogType
}
override fun setNeutralButton(text: String, func: () -> Unit): AppDialog {
override fun setNeutralButton(text: String, func: () -> Unit): DialogType {
materialAlertDialogBuilder.setNeutralButton(text) { i, i2 ->
func.invoke()
}
return this
return this as DialogType
}
override fun setNeutralButton(textRes: Int, func: () -> Unit): AppDialog {
override fun setNeutralButton(textRes: Int, func: () -> Unit): DialogType {
materialAlertDialogBuilder.setNeutralButton(textRes) { i, i2 ->
func.invoke()
}
return this
return this as DialogType
}
override fun setCancelable(cancelable: Boolean): AppDialog {
override fun setCancelable(cancelable: Boolean): DialogType {
materialAlertDialogBuilder.setCancelable(cancelable)
return this
return this as DialogType
}
override fun setIcon(iconRes: Int): AppDialog {
override fun setIcon(iconRes: Int): DialogType {
materialAlertDialogBuilder.setIcon(iconRes)
return this
return this as DialogType
}
override fun setSingleChoiceItems(
singleItems: Array<CharSequence>,
func: (Int, CharSequence) -> Unit,
checkedItem: Int
): AppDialog {
): DialogType {
materialAlertDialogBuilder.setSingleChoiceItems(singleItems, checkedItem) { dialog, which ->
func.invoke(which, singleItems[which])
}
return this
return this as DialogType
}
override fun setView(view: View): AppDialog {
override fun setView(view: View): DialogType {
materialAlertDialogBuilder.setView(view)
return this
return this as DialogType
}
}

View File

@ -1,11 +1,131 @@
package com.coldmint.dialog
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import androidx.core.view.isVisible
import com.coldmint.dialog.BaseAppDialog
import com.coldmint.dialog.databinding.DialogCoreBinding
/**
* 核心对话框
* @constructor
*/
class CoreDialog(context: Context) : BaseAppDialog(context) {
class CoreDialog(context: Context) : BaseAppDialog<CoreDialog>(context) {
val dialogCoreBinding by lazy {
DialogCoreBinding.inflate(LayoutInflater.from(context))
}
private var autoDismiss: Boolean = true
init {
setView(dialogCoreBinding.root)
}
/**
* 设置是否自动关闭
* @param enable Boolean
*/
override fun setAutoDismiss(enable: Boolean): CoreDialog {
autoDismiss = enable
return this
}
override fun setTitle(string: String): CoreDialog {
dialogCoreBinding.titleView.isVisible = true
dialogCoreBinding.titleView.text = string
return this
}
override fun setTitle(stringRes: Int): CoreDialog {
dialogCoreBinding.titleView.isVisible = true
dialogCoreBinding.titleView.setText(stringRes)
return this
}
override fun setMessage(stringRes: Int): CoreDialog {
dialogCoreBinding.messageView.isVisible = true
dialogCoreBinding.messageView.setText(stringRes)
return this
}
override fun setMessage(string: String): CoreDialog {
dialogCoreBinding.messageView.isVisible = true
dialogCoreBinding.messageView.text = string
return this
}
override fun setPositiveButton(text: String, func: () -> Unit): CoreDialog {
dialogCoreBinding.buttonContainer.isVisible = true
dialogCoreBinding.positiveButton.isVisible = true
dialogCoreBinding.positiveButton.text = text
dialogCoreBinding.positiveButton.setOnClickListener {
func.invoke()
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
override fun setPositiveButton(textRes: Int, func: () -> Unit): CoreDialog {
dialogCoreBinding.buttonContainer.isVisible = true
dialogCoreBinding.positiveButton.isVisible = true
dialogCoreBinding.positiveButton.setText(textRes)
dialogCoreBinding.positiveButton.setOnClickListener {
func.invoke()
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
override fun setNegativeButton(text: String, func: () -> Unit): CoreDialog {
dialogCoreBinding.buttonContainer.isVisible = true
dialogCoreBinding.negativeButton.isVisible = true
dialogCoreBinding.negativeButton.text = text
dialogCoreBinding.negativeButton.setOnClickListener {
func.invoke()
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
override fun setNegativeButton(textRes: Int, func: () -> Unit): CoreDialog {
dialogCoreBinding.buttonContainer.isVisible = true
dialogCoreBinding.negativeButton.isVisible = true
dialogCoreBinding.negativeButton.setText(textRes)
dialogCoreBinding.negativeButton.setOnClickListener {
func.invoke()
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
@Deprecated("无法使用。")
override fun setIcon(iconRes: Int): CoreDialog {
return super.setIcon(iconRes)
}
@Deprecated("无法使用。")
override fun setView(view: View): CoreDialog {
return super.setView(view)
}
@Deprecated("无法使用。")
override fun setSingleChoiceItems(
singleItems: Array<CharSequence>,
func: (Int, CharSequence) -> Unit,
checkedItem: Int
): CoreDialog {
return super.setSingleChoiceItems(singleItems, func, checkedItem)
}
}

View File

@ -7,26 +7,63 @@ import android.view.LayoutInflater
import android.view.View
import androidx.core.view.isVisible
import com.coldmint.dialog.databinding.DialogInputBinding
import com.google.android.material.textfield.TextInputLayout
/**
* 输入对话框
* @property dialogInputBinding [@androidx.annotation.NonNull] DialogInputBinding
* @constructor
*/
class InputDialog(context: Context) : BaseAppDialog(context) {
class InputDialog(context: Context) : BaseAppDialog<InputDialog>(context) {
val dialogInputBinding by lazy {
private val dialogInputBinding by lazy {
DialogInputBinding.inflate(LayoutInflater.from(context))
}
private var autoDismiss: Boolean = true
private var inputCanBeEmpty: Boolean = true
private var errorTipFunction: ((String, TextInputLayout) -> Unit)? = null
/**
* 设置错误提示若设置了错误提示按钮空检查将失效
* @param func Function2<String, TextInputLayout, Boolean>?
*/
fun setErrorTip(func: ((String, TextInputLayout) -> Unit)?): InputDialog {
errorTipFunction = func
dialogInputBinding.positiveButton.isEnabled = func == null
return this
}
/**
* 设置编辑框文本
* @param string String
* @return InputDialog
*/
fun setText(string: String):InputDialog{
dialogInputBinding.textInputEditText.setText(string)
return this
}
/**
* 设置最大输入数量
* @param number Int 小于0禁用
* @return InputDialog
*/
fun setMaxNumber(number: Int): InputDialog {
if (number > 0) {
dialogInputBinding.textInputLayout.counterMaxLength = number
dialogInputBinding.textInputLayout.isCounterEnabled = true
} else {
dialogInputBinding.textInputLayout.isCounterEnabled = false
}
return this
}
/**
* 设置是否自动关闭
* @param enable Boolean
*/
fun setAutoDismiss(enable: Boolean): InputDialog {
override fun setAutoDismiss(enable: Boolean): InputDialog {
autoDismiss = enable
return this
}
@ -56,38 +93,61 @@ class InputDialog(context: Context) : BaseAppDialog(context) {
override fun afterTextChanged(p0: Editable?) {
val text = p0.toString()
dialogInputBinding.positiveButton.isEnabled = !(text.isBlank() && !inputCanBeEmpty)
if (errorTipFunction != null) {
errorTipFunction!!.invoke(text, dialogInputBinding.textInputLayout)
} else {
dialogInputBinding.positiveButton.isEnabled =
!(text.isBlank() && !inputCanBeEmpty)
}
//如果启用计数并且,超过最大字数
if (dialogInputBinding.textInputLayout.isCounterEnabled && text.length > dialogInputBinding.textInputLayout.counterMaxLength) {
dialogInputBinding.textInputLayout.isErrorEnabled = true
}
//如果处于错误状态禁用按钮
dialogInputBinding.positiveButton.isEnabled =
!dialogInputBinding.textInputLayout.isErrorEnabled
}
})
}
override fun setTitle(string: String): AppDialog {
fun setHint(string: String): InputDialog {
dialogInputBinding.textInputLayout.hint = string
return this
}
fun setHint(stringRes: Int): InputDialog {
dialogInputBinding.textInputLayout.setHint(stringRes)
return this
}
override fun setTitle(string: String): InputDialog {
dialogInputBinding.titleView.isVisible = true
dialogInputBinding.titleView.text = string
return this
}
override fun setTitle(stringRes: Int): AppDialog {
override fun setTitle(stringRes: Int): InputDialog {
dialogInputBinding.titleView.isVisible = true
dialogInputBinding.titleView.setText(stringRes)
return this
}
override fun setMessage(stringRes: Int): AppDialog {
override fun setMessage(stringRes: Int): InputDialog {
dialogInputBinding.messageView.isVisible = true
dialogInputBinding.messageView.setText(stringRes)
return this
}
override fun setMessage(string: String): AppDialog {
override fun setMessage(string: String): InputDialog {
dialogInputBinding.messageView.isVisible = true
dialogInputBinding.messageView.text = string
return this
}
override fun setPositiveButton(text: String, func: () -> Unit): AppDialog {
@Deprecated("已废弃")
override fun setPositiveButton(text: String, func: () -> Unit): InputDialog {
dialogInputBinding.buttonContainer.isVisible = true
dialogInputBinding.positiveButton.isVisible = true
dialogInputBinding.positiveButton.text = text
@ -100,7 +160,8 @@ class InputDialog(context: Context) : BaseAppDialog(context) {
return this
}
override fun setPositiveButton(textRes: Int, func: () -> Unit): AppDialog {
@Deprecated("已废弃")
override fun setPositiveButton(textRes: Int, func: () -> Unit): InputDialog {
dialogInputBinding.buttonContainer.isVisible = true
dialogInputBinding.positiveButton.isVisible = true
dialogInputBinding.positiveButton.setText(textRes)
@ -113,7 +174,45 @@ class InputDialog(context: Context) : BaseAppDialog(context) {
return this
}
override fun setNegativeButton(text: String, func: () -> Unit): AppDialog {
fun setPositiveButton(text: String, func: (String) -> Boolean): InputDialog {
dialogInputBinding.buttonContainer.isVisible = true
dialogInputBinding.positiveButton.isVisible = true
dialogInputBinding.positiveButton.text = text
dialogInputBinding.positiveButton.setOnClickListener {
val d = func.invoke(
dialogInputBinding.textInputEditText.text.toString()
)
if (d) {
dialog.dismiss()
return@setOnClickListener
}
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
fun setPositiveButton(textRes: Int, func: (String) -> Boolean): InputDialog {
dialogInputBinding.buttonContainer.isVisible = true
dialogInputBinding.positiveButton.isVisible = true
dialogInputBinding.positiveButton.setText(textRes)
dialogInputBinding.positiveButton.setOnClickListener {
val d = func.invoke(
dialogInputBinding.textInputEditText.text.toString()
)
if (d) {
dialog.dismiss()
return@setOnClickListener
}
if (autoDismiss) {
dialog.dismiss()
}
}
return this
}
override fun setNegativeButton(text: String, func: () -> Unit): InputDialog {
dialogInputBinding.buttonContainer.isVisible = true
dialogInputBinding.negativeButton.isVisible = true
dialogInputBinding.negativeButton.text = text
@ -126,7 +225,7 @@ class InputDialog(context: Context) : BaseAppDialog(context) {
return this
}
override fun setNegativeButton(textRes: Int, func: () -> Unit): AppDialog {
override fun setNegativeButton(textRes: Int, func: () -> Unit): InputDialog {
dialogInputBinding.buttonContainer.isVisible = true
dialogInputBinding.negativeButton.isVisible = true
dialogInputBinding.negativeButton.setText(textRes)
@ -140,22 +239,22 @@ class InputDialog(context: Context) : BaseAppDialog(context) {
}
@Deprecated("输入对话框无法使用。")
override fun setIcon(iconRes: Int): AppDialog {
@Deprecated("无法使用。")
override fun setIcon(iconRes: Int): InputDialog {
return super.setIcon(iconRes)
}
@Deprecated("输入对话框无法使用。")
override fun setView(view: View): AppDialog {
@Deprecated("无法使用。")
override fun setView(view: View): InputDialog {
return super.setView(view)
}
@Deprecated("输入对话框无法使用。")
@Deprecated("无法使用。")
override fun setSingleChoiceItems(
singleItems: Array<CharSequence>,
func: (Int, CharSequence) -> Unit,
checkedItem: Int
): AppDialog {
): InputDialog {
return super.setSingleChoiceItems(singleItems, func, checkedItem)
}
}

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:orientation="vertical">
<TextView
android:id="@+id/titleView"
style="@style/MaterialAlertDialog.Material3.Title.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title"
android:visibility="gone" />
<TextView
android:id="@+id/messageView"
style="@style/MaterialAlertDialog.Material3.Body.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/title"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/buttonContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:visibility="gone">
<Button
android:id="@+id/negativeButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/positiveButton"
android:text="@string/title"
android:visibility="gone" />
<Button
android:layout_marginLeft="8dp"
android:id="@+id/positiveButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/title"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>

View File

@ -11,7 +11,7 @@
<TextView
android:id="@+id/titleView"
style="@style/TextAppearance.Material3.HeadlineSmall"
style="@style/MaterialAlertDialog.Material3.Title.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title"
@ -19,7 +19,7 @@
<TextView
android:id="@+id/messageView"
style="@style/TextAppearance.Material3.BodyMedium"
style="@style/MaterialAlertDialog.Material3.Body.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
@ -30,7 +30,7 @@
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginTop="24dp"
android:hint="@string/title">
<com.google.android.material.textfield.TextInputEditText
@ -42,23 +42,24 @@
<RelativeLayout
android:id="@+id/buttonContainer"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp">
android:layout_marginTop="24dp"
android:visibility="gone">
<Button
android:id="@+id/negativeButton"
style="@style/Widget.Material3.Button.TextButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/positiveButton"
android:text="@string/title"
android:visibility="gone" />
<Button
android:layout_marginLeft="8dp"
android:id="@+id/positiveButton"
style="@style/Widget.Material3.Button.TextButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"