diff --git a/app/src/main/java/ru/vtosters/lite/ui/dialogs/OTADialog.java b/app/src/main/java/ru/vtosters/lite/ui/dialogs/OTADialog.java index f84305798..3683a930f 100644 --- a/app/src/main/java/ru/vtosters/lite/ui/dialogs/OTADialog.java +++ b/app/src/main/java/ru/vtosters/lite/ui/dialogs/OTADialog.java @@ -30,7 +30,8 @@ public class OTADialog implements OTAHelper.OTAListener{ mActivity.runOnUiThread(() -> { // Toast.makeText(mActivity, "Обновления найдены", Toast.LENGTH_SHORT).show(); new ModalBottomSheetWrapper(mActivity) - .setUpdateInfoView(mHelper.getNewVersionName(), mHelper.getUpdateDescription()) + .setTitle(getString("newversion") + " " + mHelper.getNewVersionName()) + .setUpdateInfoView(mHelper.getUpdateDescription()) .setPositiveButton(getString("updateanddownload"), () -> { OTADownloader.downloadBuild(mHelper.getDownloadUrl()); }) diff --git a/app/src/main/java/ru/vtosters/lite/ui/vkui/ModalBottomSheetWrapper.java b/app/src/main/java/ru/vtosters/lite/ui/vkui/ModalBottomSheetWrapper.java index 9a2418829..215d0db7f 100644 --- a/app/src/main/java/ru/vtosters/lite/ui/vkui/ModalBottomSheetWrapper.java +++ b/app/src/main/java/ru/vtosters/lite/ui/vkui/ModalBottomSheetWrapper.java @@ -1,8 +1,10 @@ package ru.vtosters.lite.ui.vkui; +import static ru.vtosters.lite.utils.Globals.*; import static ru.vtosters.lite.utils.Globals.getString; import static ru.vtosters.lite.utils.Themes.getTextAttr; +import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.Typeface; import android.view.View; @@ -21,27 +23,19 @@ public class ModalBottomSheetWrapper{ } public ModalBottomSheetWrapper setTitle(String title){ - builder.b(title); + builder.d(title); return this; } - public ModalBottomSheetWrapper setUpdateInfoView(String version, String changelog){ - var context = Globals.getContext(); + @SuppressLint("SetTextI18n") + public ModalBottomSheetWrapper setUpdateInfoView(String changelog){ + var context = getContext(); var container = new LinearLayout(context); - var title = new TextView(context); var changelogView = new TextView(context); container.setOrientation(LinearLayout.VERTICAL); - title.setText(getString("newversion") + " " + version); - title.setTypeface(title.getTypeface(), Typeface.BOLD); - title.setSingleLine(true); - title.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); - title.setTextColor(getTextAttr()); - title.setTextSize(24.0f); - container.addView(title, new LinearLayout.LayoutParams(-1, -2)); - - changelogView.setPadding(0, Globals.convertDpToPixel(8), 0, 0); + changelogView.setPadding(0, convertDpToPixel(8), 0, 0); changelogView.setText(getString("changelog") + ": \n" + changelog); changelogView.setTextColor(getTextAttr()); container.addView(changelogView, new LinearLayout.LayoutParams(-1, -2)); @@ -51,15 +45,6 @@ public class ModalBottomSheetWrapper{ return this; } - // try to call a true function and you will understand my pain - public ModalBottomSheetWrapper setMessage( - String text - ){ - builder.a(text, listener -> { - }); - return this; - } - public ModalBottomSheetWrapper setClickableMessage( String text, Runnable callback @@ -76,11 +61,6 @@ public class ModalBottomSheetWrapper{ return this; } - public ModalBottomSheetWrapper setSubtitle(String text){ - builder.b((CharSequence) text); - return this; - } - public ModalBottomSheetWrapper setView(View view){ builder.a(view); return this; diff --git a/app/src/main/java/ru/vtosters/lite/ui/vkui/VBottomSheetBuilder.java b/app/src/main/java/ru/vtosters/lite/ui/vkui/VBottomSheetBuilder.java index f10c6c6ce..e384a563b 100644 --- a/app/src/main/java/ru/vtosters/lite/ui/vkui/VBottomSheetBuilder.java +++ b/app/src/main/java/ru/vtosters/lite/ui/vkui/VBottomSheetBuilder.java @@ -12,6 +12,8 @@ public class VBottomSheetBuilder{ builder.setView(content.view); + builder.setTitle(content.title); + builder.setPositiveButton(content.button.title, () -> { // Button OnClick new Handler(Looper.getMainLooper()).post(content.button.action); @@ -23,13 +25,11 @@ public class VBottomSheetBuilder{ public static class VBSContent{ public String title; @Nullable - public String subtitle; public View view; public VBSButton button; - public VBSContent(String title, @Nullable String subtitle, View view, VBSButton button){ + public VBSContent(String title, @Nullable View view, VBSButton button){ this.title = title; - this.subtitle = subtitle; this.view = view; this.button = button; }