wrap warning in cardview and add warning icon for extra visual

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-05 15:43:15 +02:00
parent c368af6bab
commit 202d98d478
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
4 changed files with 57 additions and 16 deletions

View File

@ -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)

View File

@ -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 -> {

View File

@ -22,6 +22,7 @@
<com.yarolegovich.mp.MaterialPreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:apc="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_screen"
android:layout_width="match_parent"
@ -73,15 +74,44 @@
android:textColor="@color/medium_emphasis_text"
tools:text="nextcloud.com" />
<TextView
android:id="@+id/server_age_warning_text"
android:layout_width="wrap_content"
<com.google.android.material.card.MaterialCardView
android:id="@+id/server_age_warning_text_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/base_url_text"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/standard_margin"
android:textColor="@color/nc_darkRed"
tools:text="@string/nc_settings_server_almost_eol" />
app:cardCornerRadius="8dp"
app:cardElevation="2dp"
app:strokeWidth="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding">
<ImageView
android:id="@+id/server_age_warning_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_warning_white"
android:layout_centerVertical="true"
app:tint="@color/nc_darkRed"
android:contentDescription="@string/nc_settings_warning" />
<TextView
android:id="@+id/server_age_warning_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/server_age_warning_icon"
android:paddingStart="@dimen/standard_padding"
android:paddingEnd="0dp"
android:layout_centerHorizontal="true"
android:textColor="@color/nc_darkRed"
tools:text="@string/nc_settings_server_almost_eol" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/avatar_image"
@ -92,12 +122,11 @@
apc:roundAsCircle="true"
tools:src="@tools:sample/avatars[0]" />
<com.yarolegovich.mp.MaterialStandardPreference
android:id="@+id/settings_switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/server_age_warning_text"
android:layout_below="@id/server_age_warning_text_card"
android:tag="switchAccountButton"
apc:mp_title="@string/nc_settings_switch_account" />

View File

@ -86,10 +86,9 @@
<string name="nc_settings_remove_account">Remove account</string>
<string name="nc_settings_add_account">Add a new account</string>
<string name="nc_settings_server_eol_title">Unsupported server</string>
<string name="nc_settings_server_eol">The server version is too old and not supported by this version of the
Android app</string>
<string name="nc_settings_server_almost_eol">The server version is very old and will not be supported in the next
release!</string>
<string name="nc_settings_server_eol">The server version is too old and not supported by this version of the Android app</string>
<string name="nc_settings_server_almost_eol">The server version is very old and will not be supported in the next release!</string>
<string name="nc_settings_warning">Warning</string>
<string name="nc_add">Add</string>
<string name="nc_settings_wrong_account">Only current account can be reauthorized</string>
<string name="nc_settings_no_talk_installed">Talk app is not installed on the server you tried to authenticate against</string>