From 202d98d47806254c44b8bf8b816acb86c8925c23 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Wed, 5 May 2021 15:43:15 +0200 Subject: [PATCH] wrap warning in cardview and add warning icon for extra visual Signed-off-by: Andy Scherzinger --- .../ConversationsListController.java | 3 +- .../talk/controllers/SettingsController.java | 18 ++++++-- .../main/res/layout/controller_settings.xml | 45 +++++++++++++++---- app/src/main/res/values/strings.xml | 7 ++- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java index 900a6e2cd..2fb61a98e 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationsListController.java @@ -872,7 +872,8 @@ public class ConversationsListController extends BaseController implements Searc new LovelyStandardDialog(getActivity(), LovelyStandardDialog.ButtonLayout.HORIZONTAL) .setTopColorRes(R.color.nc_darkRed) .setIcon(DisplayUtils.getTintedDrawable(context.getResources(), - R.drawable.ic_timer_black_24dp, R.color.bg_default)) + R.drawable.ic_warning_white, + R.color.bg_default)) .setPositiveButtonColor(context.getResources().getColor(R.color.nc_darkRed)) .setCancelable(false) .setTitle(R.string.nc_settings_server_eol_title) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java index b8f44629e..3af9b8cd8 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java @@ -29,6 +29,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.ColorStateList; +import android.graphics.PorterDuff; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -45,6 +46,7 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.Checkable; import android.widget.EditText; +import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -56,6 +58,7 @@ import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler; import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler; import com.bluelinelabs.logansquare.LoganSquare; import com.facebook.drawee.view.SimpleDraweeView; +import com.google.android.material.card.MaterialCardView; import com.google.android.material.textfield.TextInputLayout; import com.nextcloud.talk.BuildConfig; import com.nextcloud.talk.R; @@ -103,6 +106,7 @@ import javax.inject.Inject; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; +import androidx.core.content.ContextCompat; import androidx.core.view.ViewCompat; import androidx.emoji.widget.EmojiTextView; import androidx.work.OneTimeWorkRequest; @@ -144,8 +148,12 @@ public class SettingsController extends BaseController { EmojiTextView displayNameTextView; @BindView(R.id.base_url_text) TextView baseUrlTextView; + @BindView(R.id.server_age_warning_text_card) + MaterialCardView serverAgeCardView; @BindView(R.id.server_age_warning_text) TextView serverAgeTextView; + @BindView(R.id.server_age_warning_icon) + ImageView serverAgeIcon; @BindView(R.id.settings_call_sound) MaterialStandardPreference settingsCallSound; @BindView(R.id.settings_message_sound) @@ -554,13 +562,17 @@ public class SettingsController extends BaseController { baseUrlTextView.setText(Uri.parse(currentUser.getBaseUrl()).getHost()); if (currentUser.isServerEOL()) { - serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkRed)); + serverAgeTextView.setTextColor(ContextCompat.getColor(context, R.color.nc_darkRed)); serverAgeTextView.setText(R.string.nc_settings_server_eol); + serverAgeIcon.setColorFilter(ContextCompat.getColor(context, R.color.nc_darkRed), + PorterDuff.Mode.SRC_IN); } else if (currentUser.isServerAlmostEOL()) { - serverAgeTextView.setTextColor(getResources().getColor(R.color.nc_darkYellow)); + serverAgeTextView.setTextColor(ContextCompat.getColor(context, R.color.nc_darkYellow)); serverAgeTextView.setText(R.string.nc_settings_server_almost_eol); + serverAgeIcon.setColorFilter(ContextCompat.getColor(context, R.color.nc_darkYellow), + PorterDuff.Mode.SRC_IN); } else { - serverAgeTextView.setVisibility(View.GONE); + serverAgeCardView.setVisibility(View.GONE); } reauthorizeButton.addPreferenceClickListener(view14 -> { diff --git a/app/src/main/res/layout/controller_settings.xml b/app/src/main/res/layout/controller_settings.xml index fe23dbf78..d459ef2f0 100644 --- a/app/src/main/res/layout/controller_settings.xml +++ b/app/src/main/res/layout/controller_settings.xml @@ -22,6 +22,7 @@ - + app:cardCornerRadius="8dp" + app:cardElevation="2dp" + app:strokeWidth="0dp"> + + + + + + + + + + - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aa79b6cbf..54aa13108 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -86,10 +86,9 @@ Remove account Add a new account Unsupported server - The server version is too old and not supported by this version of the - Android app - The server version is very old and will not be supported in the next - release! + The server version is too old and not supported by this version of the Android app + The server version is very old and will not be supported in the next release! + Warning Add Only current account can be reauthorized Talk app is not installed on the server you tried to authenticate against