Browse Source

Replace ThemeTextInputUtils with common lib utils

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Álvaro Brey 2 năm trước cách đây
mục cha
commit
413df44a3c

+ 1 - 1
app/build.gradle

@@ -355,7 +355,7 @@ dependencies {
     gplayImplementation "com.google.firebase:firebase-messaging:23.0.7"
 
     // TODO change back to tag before merging
-    implementation 'com.github.nextcloud.android-common:ui:db33e5a'
+    implementation 'com.github.nextcloud.android-common:ui:cbcc747'
 }
 
 configurations.all {

+ 3 - 9
app/src/main/java/com/nextcloud/client/di/ThemeModule.kt

@@ -27,12 +27,12 @@ import com.owncloud.android.utils.theme.ThemeColorUtils
 import com.owncloud.android.utils.theme.ThemeDrawableUtils
 import com.owncloud.android.utils.theme.ThemeMenuUtils
 import com.owncloud.android.utils.theme.ThemeSnackbarUtils
-import com.owncloud.android.utils.theme.ThemeTextInputUtils
 import com.owncloud.android.utils.theme.ThemeTextUtils
 import com.owncloud.android.utils.theme.ThemeToolbarUtils
 import com.owncloud.android.utils.theme.ThemeUtils
 import com.owncloud.android.utils.theme.newm3.MaterialSchemesProvider
 import com.owncloud.android.utils.theme.newm3.MaterialSchemesProviderImpl
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
 import dagger.Binds
 import dagger.Module
 import dagger.Provides
@@ -57,9 +57,9 @@ internal abstract class ThemeModule {
         fun themeToolbarUtils(
             themeColorUtils: ThemeColorUtils?,
             themeDrawableUtils: ThemeDrawableUtils?,
-            themeTextInputUtils: ThemeTextInputUtils?
+            viewThemeUtils: ViewThemeUtils
         ): ThemeToolbarUtils {
-            return ThemeToolbarUtils(themeColorUtils, themeDrawableUtils, themeTextInputUtils)
+            return ThemeToolbarUtils(themeColorUtils, themeDrawableUtils, viewThemeUtils)
         }
 
         @Provides
@@ -92,12 +92,6 @@ internal abstract class ThemeModule {
             return ThemeTextUtils()
         }
 
-        @Provides
-        @Singleton
-        fun themeTextInputUtils(): ThemeTextInputUtils {
-            return ThemeTextInputUtils()
-        }
-
         @Provides
         @Singleton
         fun themeAvatarUtils(): ThemeAvatarUtils {

+ 1 - 10
app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt

@@ -54,7 +54,6 @@ import com.owncloud.android.ui.adapter.PredefinedStatusClickListener
 import com.owncloud.android.ui.adapter.PredefinedStatusListAdapter
 import com.owncloud.android.utils.DisplayUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
-import com.owncloud.android.utils.theme.ThemeTextInputUtils
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
 import com.vanniktech.emoji.EmojiManager
 import com.vanniktech.emoji.EmojiPopup
@@ -112,9 +111,6 @@ class SetStatusDialogFragment :
     @Inject
     lateinit var themeColorUtils: ThemeColorUtils
 
-    @Inject
-    lateinit var themeTextInputUtils: ThemeTextInputUtils
-
     @Inject
     lateinit var viewThemeUtils: ViewThemeUtils
 
@@ -206,12 +202,7 @@ class SetStatusDialogFragment :
 
         binding.clearStatus.setTextColor(themeColorUtils.primaryColor(context, true))
         viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.setStatus)
-        themeTextInputUtils.colorTextInput(
-            binding.customStatusInputContainer,
-            binding.customStatusInput,
-            themeColorUtils.primaryColor(activity),
-            themeColorUtils.primaryAccentColor(activity)
-        )
+        viewThemeUtils.material.colorTextInputLayout(binding.customStatusInputContainer)
     }
 
     private fun updateCurrentStatusViews(it: Status) {

+ 7 - 17
app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java

@@ -42,8 +42,6 @@ import com.owncloud.android.R;
 import com.owncloud.android.authentication.PassCodeManager;
 import com.owncloud.android.databinding.PasscodelockBinding;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.util.Arrays;
@@ -74,8 +72,6 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
 
     @Inject AppPreferences preferences;
     @Inject PassCodeManager passCodeManager;
-    @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject ViewThemeUtils viewThemeUtils;
     private PasscodelockBinding binding;
     private final EditText[] passCodeEditTexts = new EditText[4];
@@ -95,26 +91,20 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
         binding = PasscodelockBinding.inflate(getLayoutInflater());
         setContentView(binding.getRoot());
 
-        int elementColor = themeColorUtils.primaryColor(this, true);
 
         viewThemeUtils.platform.colorTextButtons(binding.cancel);
 
         passCodeEditTexts[0] = binding.txt0;
-        themeTextInputUtils.colorEditText(passCodeEditTexts[0], elementColor);
-        themeTextInputUtils.themeEditText(this, passCodeEditTexts[0], false, themeColorUtils);
-        passCodeEditTexts[0].requestFocus();
-
         passCodeEditTexts[1] = binding.txt1;
-        themeTextInputUtils.colorEditText(passCodeEditTexts[1], elementColor);
-        themeTextInputUtils.themeEditText(this, passCodeEditTexts[1], false, themeColorUtils);
-
         passCodeEditTexts[2] = binding.txt2;
-        themeTextInputUtils.colorEditText(passCodeEditTexts[2], elementColor);
-        themeTextInputUtils.themeEditText(this, passCodeEditTexts[2], false, themeColorUtils);
-
         passCodeEditTexts[3] = binding.txt3;
-        themeTextInputUtils.colorEditText(passCodeEditTexts[3], elementColor);
-        themeTextInputUtils.themeEditText(this, passCodeEditTexts[3], false, themeColorUtils);
+
+        for (EditText passCodeEditText : passCodeEditTexts) {
+            viewThemeUtils.platform.colorEditText(passCodeEditText);
+        }
+
+        passCodeEditTexts[0].requestFocus();
+
 
         Window window = getWindow();
         if (window != null) {

+ 3 - 6
app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -94,7 +94,7 @@ import com.owncloud.android.utils.ErrorMessageAdapter;
 import com.owncloud.android.utils.FileSortOrder;
 import com.owncloud.android.utils.MimeType;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -332,7 +332,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
         private Spinner mSpinner;
         @Inject AppPreferences preferences;
         @Inject ThemeColorUtils themeColorUtils;
-        @Inject ThemeTextInputUtils themeTextInputUtils;
+        @Inject ViewThemeUtils viewThemeUtils;
 
         public static DialogInputUploadFilename newInstance(String subjectText, String extraText) {
             DialogInputUploadFilename dialog = new DialogInputUploadFilename();
@@ -427,10 +427,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
             final TextInputLayout userInputContainer = view.findViewById(R.id.user_input_container);
             setFilename(userInput, selectPos);
             userInput.requestFocus();
-            themeTextInputUtils.colorTextInput(userInputContainer,
-                                               userInput,
-                                               themeColorUtils.primaryColor(getContext()),
-                                               themeColorUtils.primaryAccentColor(getContext()));
+            viewThemeUtils.material.colorTextInputLayout(userInputContainer);
 
             final Spinner spinner = view.findViewById(R.id.file_type);
             setupSpinner(adapter, selectPos, userInput, spinner);

+ 1 - 6
app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java

@@ -60,7 +60,6 @@ import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.NextcloudServer;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.lang.ref.WeakReference;
@@ -91,7 +90,6 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
     @Inject ClientFactory clientFactory;
     @Inject ThemeColorUtils themeColorUtils;
     @Inject ViewThemeUtils viewThemeUtils;
-    @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject FileDataStorageManager fileDataStorageManager;
     private RichDocumentsTemplateAdapter adapter;
     private OCFile parentFolder;
@@ -164,10 +162,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
         View view = binding.getRoot();
 
         binding.filename.requestFocus();
-        themeTextInputUtils.colorTextInput(binding.filenameContainer,
-                                           binding.filename,
-                                           themeColorUtils.primaryColor(getContext()),
-                                           themeColorUtils.primaryAccentColor(getContext()));
+        viewThemeUtils.material.colorTextInputLayout(binding.filenameContainer);
 
         Type type = Type.valueOf(arguments.getString(ARG_TYPE));
         new FetchTemplateTask(this, client).execute(type);

+ 2 - 9
app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt

@@ -60,7 +60,6 @@ import com.owncloud.android.utils.DisplayUtils
 import com.owncloud.android.utils.FileStorageUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
 import com.owncloud.android.utils.theme.ThemeDrawableUtils
-import com.owncloud.android.utils.theme.ThemeTextInputUtils
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
 import java.lang.ref.WeakReference
 import javax.inject.Inject
@@ -84,9 +83,6 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
     @Inject
     lateinit var themeDrawableUtils: ThemeDrawableUtils
 
-    @Inject
-    lateinit var themeTextInputUtils: ThemeTextInputUtils
-
     @Inject
     lateinit var fileDataStorageManager: FileDataStorageManager
 
@@ -143,11 +139,8 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
         val view: View = binding.root
 
         binding.filename.requestFocus()
-        themeTextInputUtils.colorTextInput(
-            binding.filenameContainer,
-            binding.filename,
-            themeColorUtils.primaryColor(context),
-            themeColorUtils.primaryAccentColor(context)
+        viewThemeUtils.material.colorTextInputLayout(
+            binding.filenameContainer
         )
 
         binding.filename.addTextChangedListener(object : TextWatcher {

+ 1 - 6
app/src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java

@@ -43,7 +43,6 @@ import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.util.List;
@@ -68,7 +67,6 @@ public class CreateFolderDialogFragment
     public static final String CREATE_FOLDER_FRAGMENT = "CREATE_FOLDER_FRAGMENT";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject FileDataStorageManager fileDataStorageManager;
     @Inject ViewThemeUtils viewThemeUtils;
 
@@ -118,10 +116,7 @@ public class CreateFolderDialogFragment
         // Setup layout
         binding.userInput.setText("");
         binding.userInput.requestFocus();
-        themeTextInputUtils.colorTextInput(binding.userInputContainer,
-                                           binding.userInput,
-                                           themeColorUtils.primaryColor(getActivity()),
-                                           themeColorUtils.primaryAccentColor(getActivity()));
+        viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer);
 
         OCFile parentFolder = requireArguments().getParcelable(ARG_PARENT_FOLDER);
         List<OCFile> folderContent = fileDataStorageManager.getFolderContent(parentFolder, false);

+ 1 - 6
app/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java

@@ -36,7 +36,6 @@ import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import javax.inject.Inject;
@@ -55,7 +54,6 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
 
     @Inject ThemeColorUtils themeColorUtils;
     @Inject ViewThemeUtils viewThemeUtils;
-    @Inject ThemeTextInputUtils themeTextInputUtils;
 
     private OCShare share;
     private NoteDialogBinding binding;
@@ -101,10 +99,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
         // Setup layout
         binding.noteText.setText(share.getNote());
         binding.noteText.requestFocus();
-        themeTextInputUtils.colorTextInput(binding.noteContainer,
-                                           binding.noteText,
-                                           themeColorUtils.primaryColor(getContext()),
-                                           themeColorUtils.primaryAccentColor(getContext()));
+        viewThemeUtils.material.colorTextInputLayout(binding.noteContainer);
 
         // Build the dialog
         AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());

+ 3 - 6
app/src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java

@@ -48,7 +48,7 @@ import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.util.List;
 import java.util.Set;
@@ -72,7 +72,7 @@ public class RenameFileDialogFragment
     private static final String ARG_PARENT_FOLDER = "PARENT_FOLDER";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeTextInputUtils themeTextInputUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
     @Inject FileDataStorageManager fileDataStorageManager;
 
     private EditBoxDialogBinding binding;
@@ -123,10 +123,7 @@ public class RenameFileDialogFragment
         // Setup layout
         String currentName = mTargetFile.getFileName();
         binding.userInput.setText(currentName);
-        themeTextInputUtils.colorTextInput(binding.userInputContainer,
-                                           binding.userInput,
-                                           themeColorUtils.primaryColor(getActivity()),
-                                           themeColorUtils.primaryAccentColor(getActivity()));
+        viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer);
         int extensionStart = mTargetFile.isFolder() ? -1 : currentName.lastIndexOf('.');
         int selectionEnd = extensionStart >= 0 ? extensionStart : currentName.length();
         binding.userInput.setSelection(0, selectionEnd);

+ 1 - 6
app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java

@@ -37,7 +37,6 @@ import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import javax.inject.Inject;
@@ -61,7 +60,6 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
 
     @Inject ThemeColorUtils themeColorUtils;
 
-    @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject ViewThemeUtils viewThemeUtils;
 
     private PasswordDialogBinding binding;
@@ -162,10 +160,7 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
 
         // Setup layout
         binding.sharePassword.setText("");
-        themeTextInputUtils.colorTextInput(binding.sharePasswordContainer,
-                                           binding.sharePassword,
-                                           themeColorUtils.primaryColor(getActivity()),
-                                           themeColorUtils.primaryAccentColor(getActivity()));
+        viewThemeUtils.material.colorTextInputLayout(binding.sharePasswordContainer);
         binding.sharePassword.requestFocus();
 
         int negativeButtonCaption;

+ 1 - 6
app/src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java

@@ -61,7 +61,6 @@ import com.owncloud.android.ui.interfaces.VersionListInterface;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.theme.ThemeDrawableUtils;
-import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
@@ -117,7 +116,6 @@ public class FileDetailActivitiesFragment extends Fragment implements
     @Inject ThemeColorUtils themeColorUtils;
     @Inject ThemeToolbarUtils themeToolbarUtils;
     @Inject ThemeDrawableUtils themeDrawableUtils;
-    @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject ViewThemeUtils viewThemeUtils;
 
     public static FileDetailActivitiesFragment newInstance(OCFile file, User user) {
@@ -183,10 +181,7 @@ public class FileDetailActivitiesFragment extends Fragment implements
 
         binding.submitComment.setOnClickListener(v -> submitComment());
 
-        themeTextInputUtils.colorTextInput(binding.commentInputFieldContainer,
-                                           binding.commentInputField,
-                                           themeColorUtils.primaryColor(getContext()),
-                                           themeColorUtils.primaryAccentColor(getContext()));
+        viewThemeUtils.material.colorTextInputLayout(binding.commentInputFieldContainer);
 
         DisplayUtils.setAvatar(user,
                                this,

+ 0 - 139
app/src/main/java/com/owncloud/android/utils/theme/ThemeTextInputUtils.java

@@ -1,139 +0,0 @@
-/*
- * Nextcloud Android client application
- *
- * @author Tobias Kaminsky
- * @author Andy Scherzinger
- * Copyright (C) 2017 Tobias Kaminsky
- * Copyright (C) 2017 Nextcloud GmbH
- * Copyright (C) 2018 Andy Scherzinger
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.owncloud.android.utils.theme;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.Color;
-import android.graphics.PorterDuff;
-import android.widget.EditText;
-
-import com.google.android.material.textfield.TextInputEditText;
-import com.google.android.material.textfield.TextInputLayout;
-import com.owncloud.android.R;
-
-import androidx.core.content.ContextCompat;
-
-/**
- * Utility class with methods for client side text input theming.
- */
-public final class ThemeTextInputUtils {
-    /**
-     * Sets the color of the (containerized) text input TextInputLayout to {@code color} for hint text, box stroke and
-     * highlight color.
-     *
-     * @param textInputLayout   the TextInputLayout instance
-     * @param textInputEditText the TextInputEditText child element
-     * @param color             the color to be used for the hint text and box stroke
-     */
-    public void colorTextInput(TextInputLayout textInputLayout,
-                               TextInputEditText textInputEditText,
-                               int color,
-                               int errorColor) {
-        textInputEditText.setHighlightColor(color);
-        colorTextInputLayout(textInputLayout, color, errorColor);
-    }
-
-    /**
-     * Sets the color of the  TextInputLayout to {@code color} for hint text and box stroke.
-     *
-     * @param textInputLayout the TextInputLayout instance
-     * @param color           the color to be used for the hint text and box stroke
-     */
-    private void colorTextInputLayout(TextInputLayout textInputLayout, int color, int errorColor) {
-        textInputLayout.setBoxStrokeColor(color);
-        textInputLayout.setErrorIconTintList(new ColorStateList(
-            new int[][]{
-                new int[]{-android.R.attr.state_focused},
-                new int[]{android.R.attr.state_focused},
-            },
-            new int[]{
-                errorColor,
-                errorColor
-            }
-        ));
-        textInputLayout.setErrorTextColor(new ColorStateList(
-            new int[][]{
-                new int[]{-android.R.attr.state_focused},
-                new int[]{android.R.attr.state_focused},
-            },
-            new int[]{
-                errorColor,
-                errorColor
-            }
-        ));
-        textInputLayout.setBoxStrokeErrorColor(new ColorStateList(
-            new int[][]{
-                new int[]{-android.R.attr.state_focused},
-                new int[]{android.R.attr.state_focused},
-            },
-            new int[]{
-                errorColor,
-                errorColor
-            }
-        ));
-        textInputLayout.setDefaultHintTextColor(new ColorStateList(
-            new int[][]{
-                new int[]{-android.R.attr.state_focused},
-                new int[]{android.R.attr.state_focused},
-            },
-            new int[]{
-                Color.GRAY,
-                color
-            }
-        ));
-    }
-
-    public void themeEditText(Context context,
-                              EditText editText,
-                              boolean themedBackground,
-                              ThemeColorUtils themeColorUtils) {
-        if (editText == null) {
-            return;
-        }
-
-        int color = ContextCompat.getColor(context, R.color.text_color);
-
-        if (themedBackground) {
-            if (themeColorUtils.darkTheme(context)) {
-                color = ContextCompat.getColor(context, R.color.themed_fg);
-            } else {
-                color = ContextCompat.getColor(context, R.color.themed_fg_inverse);
-            }
-        }
-
-        setEditTextColor(context, editText, color);
-    }
-
-    public void setEditTextColor(Context context, EditText editText, int color) {
-        editText.setTextColor(color);
-        editText.setHighlightColor(context.getResources().getColor(R.color.fg_contrast));
-    }
-
-    public void colorEditText(EditText editText, int color) {
-        if (editText != null) {
-            editText.setTextColor(color);
-            editText.getBackground().setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
-        }
-    }
-}

+ 5 - 4
app/src/main/java/com/owncloud/android/utils/theme/ThemeToolbarUtils.java

@@ -34,6 +34,7 @@ import android.view.Window;
 import android.widget.ImageView;
 
 import com.owncloud.android.R;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import androidx.annotation.ColorInt;
 import androidx.annotation.Nullable;
@@ -47,14 +48,14 @@ import androidx.core.content.res.ResourcesCompat;
 public class ThemeToolbarUtils {
     private final ThemeColorUtils themeColorUtils;
     private final ThemeDrawableUtils themeDrawableUtils;
-    private final ThemeTextInputUtils themeTextInputUtils;
+    private final ViewThemeUtils viewThemeUtils;
 
     public ThemeToolbarUtils(ThemeColorUtils themeColorUtils,
                              ThemeDrawableUtils themeDrawableUtils,
-                             ThemeTextInputUtils themeTextInputUtils) {
+                             ViewThemeUtils viewThemeUtils) {
         this.themeColorUtils = themeColorUtils;
         this.themeDrawableUtils = themeDrawableUtils;
-        this.themeTextInputUtils = themeTextInputUtils;
+        this.viewThemeUtils = viewThemeUtils;
     }
 
     /**
@@ -125,7 +126,7 @@ public class ThemeToolbarUtils {
         int fontColor = themeColorUtils.appBarPrimaryFontColor(context);
         SearchView.SearchAutoComplete editText = searchView.findViewById(R.id.search_src_text);
         editText.setTextSize(16);
-        themeTextInputUtils.setEditTextColor(context, editText, fontColor);
+        viewThemeUtils.platform.colorEditText(editText);
         editText.setHintTextColor(themeColorUtils.appBarSecondaryFontColor(context));
 
         ImageView closeButton = searchView.findViewById(androidx.appcompat.R.id.search_close_btn);