فهرست منبع

Replace ThemeButtonUtils with utils from common lib

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
Álvaro Brey 2 سال پیش
والد
کامیت
2755c78bbd
37فایلهای تغییر یافته به همراه341 افزوده شده و 478 حذف شده
  1. 11 10
      app/build.gradle
  2. 0 7
      app/src/main/java/com/nextcloud/client/di/ThemeModule.kt
  3. 2 5
      app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt
  4. 1 3
      app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt
  5. 3 3
      app/src/main/java/com/nextcloud/client/onboarding/WhatsNewActivity.java
  6. 4 4
      app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt
  7. 0 2
      app/src/main/java/com/owncloud/android/files/BootupBroadcastReceiver.java
  8. 1 1
      app/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java
  9. 1 2
      app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
  10. 2 2
      app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt
  11. 5 5
      app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java
  12. 41 49
      app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java
  13. 69 71
      app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java
  14. 15 17
      app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
  15. 5 6
      app/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.kt
  16. 1 2
      app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java
  17. 1 1
      app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java
  18. 16 16
      app/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java
  19. 4 5
      app/src/main/java/com/owncloud/android/ui/dialog/AccountRemovalConfirmationDialog.java
  20. 5 6
      app/src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java
  21. 5 6
      app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt
  22. 6 6
      app/src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java
  23. 4 5
      app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
  24. 7 7
      app/src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java
  25. 5 6
      app/src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.java
  26. 4 5
      app/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java
  27. 11 12
      app/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java
  28. 10 11
      app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java
  29. 8 7
      app/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java
  30. 6 6
      app/src/main/java/com/owncloud/android/ui/dialog/StoragePermissionDialogFragment.kt
  31. 9 5
      app/src/main/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragment.java
  32. 67 65
      app/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java
  33. 8 8
      app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java
  34. 0 106
      app/src/main/java/com/owncloud/android/utils/theme/ThemeButtonUtils.java
  35. 2 0
      app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java
  36. 1 0
      app/src/main/java/com/owncloud/android/utils/theme/newm3/MaterialSchemesProvider.kt
  37. 1 6
      app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt

+ 11 - 10
app/build.gradle

@@ -112,7 +112,7 @@ android {
 
         buildTypes {
             debug {
-                testCoverageEnabled (project.hasProperty('coverage'))
+                testCoverageEnabled(project.hasProperty('coverage'))
             }
         }
 
@@ -218,11 +218,12 @@ dependencies {
     // dependencies for app building
     implementation 'androidx.multidex:multidex:2.0.1'
 //    implementation project('nextcloud-android-library')
-    implementation ("com.github.nextcloud:android-library:$androidLibraryVersion") {
+    implementation("com.github.nextcloud:android-library:$androidLibraryVersion") {
         exclude group: 'org.ogce', module: 'xpp3' // unused in Android and brings wrong Junit version
     }
 
-    compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' // remove after entire switch to lib v2
+    compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
+    // remove after entire switch to lib v2
     implementation "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
     implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5' // remove after entire switch to lib v2
     implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
@@ -281,7 +282,7 @@ dependencies {
     implementation "com.google.android.exoplayer:extension-okhttp:$exoplayerVersion"
 
     implementation 'me.zhanghai.android.fastscroll:library:1.1.8'
-    
+
     // Shimmer animation
     implementation 'io.github.elye:loaderviewlibrary:3.0.0'
 
@@ -296,8 +297,8 @@ dependencies {
     implementation "io.noties:prism4j:$prismVersion"
     kapt "io.noties:prism4j-bundler:$prismVersion"
 
-    implementation ('org.mnode.ical4j:ical4j:3.0.0') {
-        ['org.apache.commons','commons-logging'].each {
+    implementation('org.mnode.ical4j:ical4j:3.0.0') {
+        ['org.apache.commons', 'commons-logging'].each {
             exclude group: "$it"
         }
     }
@@ -354,11 +355,11 @@ dependencies {
     gplayImplementation "com.google.firebase:firebase-messaging:23.0.7"
 
     // TODO change back to tag before merging
-    implementation 'com.github.nextcloud.android-common:ui:9bad101de67c312731b7f170b23a4e4cf81633a6'
+    implementation 'com.github.nextcloud.android-common:ui:2fa8334415c4289228e650d6a70cb1c70746c28e'
 }
 
 configurations.all {
-    resolutionStrategy{
+    resolutionStrategy {
         cacheChangingModulesFor 0, 'seconds'
         force 'org.objenesis:objenesis:2.6'
         eachDependency { details ->
@@ -403,7 +404,7 @@ shot {
     showOnlyFailingTestsInReports = ciBuild
     // CI environment renders some shadows slightly different from local VMs
     // Add a 0.5% tolerance to account for that
-    tolerance = ciBuild ? 0.5: 0
+    tolerance = ciBuild ? 0.5 : 0
 }
 
 jacoco {
@@ -416,7 +417,7 @@ spotbugs {
     reportLevel = "medium"
 }
 
-tasks.withType(SpotBugsTask){task ->
+tasks.withType(SpotBugsTask) { task ->
     String variantNameCap = task.name.replace("spotbugs", "")
     String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1)
 

+ 0 - 7
app/src/main/java/com/nextcloud/client/di/ThemeModule.kt

@@ -23,7 +23,6 @@ package com.nextcloud.client.di
 import android.content.Context
 import com.nextcloud.android.common.ui.theme.MaterialSchemes
 import com.owncloud.android.utils.theme.ThemeAvatarUtils
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 import com.owncloud.android.utils.theme.ThemeCheckableUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
 import com.owncloud.android.utils.theme.ThemeDrawableUtils
@@ -108,12 +107,6 @@ internal abstract class ThemeModule {
             return ThemeTextUtils()
         }
 
-        @Provides
-        @Singleton
-        fun themeButtonUtils(): ThemeButtonUtils {
-            return ThemeButtonUtils()
-        }
-
         @Provides
         @Singleton
         fun themeTextInputUtils(): ThemeTextInputUtils {

+ 2 - 5
app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt

@@ -40,7 +40,6 @@ import com.nextcloud.client.preferences.AppPreferences
 import com.owncloud.android.datamodel.ArbitraryDataProvider
 import com.owncloud.android.datamodel.SyncedFolderProvider
 import com.owncloud.android.datamodel.UploadsStorageManager
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
 import com.owncloud.android.utils.theme.ThemeSnackbarUtils
 import org.greenrobot.eventbus.EventBus
@@ -68,8 +67,7 @@ class BackgroundJobFactory @Inject constructor(
     private val eventBus: EventBus,
     private val deckApi: DeckApi,
     private val themeColorUtils: ThemeColorUtils,
-    private val themeSnackbarUtils: ThemeSnackbarUtils,
-    private val themeButtonUtils: ThemeButtonUtils
+    private val themeSnackbarUtils: ThemeSnackbarUtils
 ) : WorkerFactory() {
 
     @SuppressLint("NewApi")
@@ -213,8 +211,7 @@ class BackgroundJobFactory @Inject constructor(
             preferences,
             clock,
             themeColorUtils,
-            themeSnackbarUtils,
-            themeButtonUtils
+            themeSnackbarUtils
         )
     }
 

+ 1 - 3
app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt

@@ -55,7 +55,6 @@ import com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FOR_REMOV
 import com.owncloud.android.ui.activity.SyncedFoldersActivity
 import com.owncloud.android.ui.notifications.NotificationUtils
 import com.owncloud.android.utils.SyncedFolderUtils
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
 import com.owncloud.android.utils.theme.ThemeSnackbarUtils
 import java.util.Random
@@ -70,8 +69,7 @@ class MediaFoldersDetectionWork constructor(
     private val preferences: AppPreferences,
     private val clock: Clock,
     private val themeColorUtils: ThemeColorUtils,
-    private val themeSnackbarUtils: ThemeSnackbarUtils,
-    private val themeButtonUtils: ThemeButtonUtils
+    private val themeSnackbarUtils: ThemeSnackbarUtils
 ) : Worker(context, params) {
 
     companion object {

+ 3 - 3
app/src/main/java/com/nextcloud/client/onboarding/WhatsNewActivity.java

@@ -37,7 +37,7 @@ import com.owncloud.android.R;
 import com.owncloud.android.ui.adapter.FeaturesViewAdapter;
 import com.owncloud.android.ui.adapter.FeaturesWebViewAdapter;
 import com.owncloud.android.ui.whatsnew.ProgressIndicator;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import javax.inject.Inject;
 
@@ -56,7 +56,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
     @Inject AppPreferences preferences;
     @Inject AppInfo appInfo;
     @Inject OnboardingService onboarding;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -86,7 +86,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
         mPager.addOnPageChangeListener(this);
 
         mForwardFinishButton = findViewById(R.id.forward);
-        themeButtonUtils.colorImageButton(mForwardFinishButton, fontColor);
+        viewThemeUtils.platform.colorImageButton(mForwardFinishButton, fontColor);
 
         mForwardFinishButton.setOnClickListener(view -> {
             if (mProgress.hasNextStep()) {

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

@@ -53,9 +53,9 @@ import com.owncloud.android.ui.activity.BaseActivity
 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.ThemeButtonUtils
 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
 import com.vanniktech.emoji.google.GoogleEmojiProvider
@@ -113,10 +113,10 @@ class SetStatusDialogFragment :
     lateinit var themeColorUtils: ThemeColorUtils
 
     @Inject
-    lateinit var themeButtonUtils: ThemeButtonUtils
+    lateinit var themeTextInputUtils: ThemeTextInputUtils
 
     @Inject
-    lateinit var themeTextInputUtils: ThemeTextInputUtils
+    lateinit var viewThemeUtils: ViewThemeUtils
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -205,7 +205,7 @@ class SetStatusDialogFragment :
         }
 
         binding.clearStatus.setTextColor(themeColorUtils.primaryColor(context, true))
-        themeButtonUtils.colorPrimaryButton(binding.setStatus, context, themeColorUtils)
+        viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.setStatus)
         themeTextInputUtils.colorTextInput(
             binding.customStatusInputContainer,
             binding.customStatusInput,

+ 0 - 2
app/src/main/java/com/owncloud/android/files/BootupBroadcastReceiver.java

@@ -36,8 +36,6 @@ import com.nextcloud.client.preferences.AppPreferences;
 import com.owncloud.android.MainApp;
 import com.owncloud.android.datamodel.UploadsStorageManager;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
-import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
 
 import javax.inject.Inject;

+ 1 - 1
app/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java

@@ -86,7 +86,7 @@ public class CommunityActivity extends DrawerActivity {
                                 getString(R.string.contributing_link)))));
 
         MaterialButton reportButton = binding.communityTestingReport;
-        themeButtonUtils.colorPrimaryButton(reportButton, this, themeColorUtils);
+        viewThemeUtils.material.colorMaterialButtonPrimaryFilled(reportButton);
         reportButton.setOnClickListener(v -> DisplayUtils.startLinkIntent(this, R.string.report_issue_empty_link));
 
         binding.communityBetaFdroid.setOnClickListener(

+ 1 - 2
app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -314,8 +314,7 @@ public class FileDisplayActivity extends FileActivity
                     .create();
 
                 alertDialog.show();
-                themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                                       alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
+                viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
             } catch (WindowManager.BadTokenException e) {
                 Log_OC.e(TAG, "Error showing wrong storage info, so skipping it: " + e.getMessage());
             }

+ 2 - 2
app/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.kt

@@ -354,12 +354,12 @@ open class FolderPickerActivity :
         mCancelBtn = findViewById(R.id.folder_picker_btn_cancel)
         mChooseBtn = findViewById(R.id.folder_picker_btn_choose)
         if (mChooseBtn != null) {
-            themeButtonUtils.colorPrimaryButton(mChooseBtn, this, themeColorUtils)
+            viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mChooseBtn!!)
             mChooseBtn!!.setOnClickListener(this)
         }
         if (mCancelBtn != null) {
             if (this is FilePickerActivity) {
-                themeButtonUtils.colorPrimaryButton(mCancelBtn, this, themeColorUtils)
+                viewThemeUtils.material.colorMaterialButtonPrimaryFilled(mCancelBtn!!)
             } else {
                 mCancelBtn!!.setTextColor(themeColorUtils.primaryColor(this, true))
             }

+ 5 - 5
app/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java

@@ -85,7 +85,7 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
         // use account from intent (opened via android notification can have a different account than current one)
         if (getIntent() != null && getIntent().getExtras() != null) {
             String accountName = getIntent().getExtras().getString(NotificationWork.KEY_NOTIFICATION_ACCOUNT);
-            if(accountName != null && optionalUser.isPresent()) {
+            if (accountName != null && optionalUser.isPresent()) {
                 User user = optionalUser.get();
                 if (user.getAccountName().equalsIgnoreCase(accountName)) {
                     accountManager.setCurrentOwnCloudAccount(accountName);
@@ -109,8 +109,8 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
         if (!optionalUser.isPresent()) {
             // show error
             runOnUiThread(() -> setEmptyContent(
-                getString(R.string.notifications_no_results_headline),
-                getString(R.string.account_not_found))
+                              getString(R.string.notifications_no_results_headline),
+                              getString(R.string.account_not_found))
                          );
             return;
         }
@@ -149,7 +149,7 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
                 final ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
                 final String accountName = optionalUser.isPresent() ? optionalUser.get().getAccountName() : "";
                 final boolean usesOldLogin = arbitraryDataProvider.getBooleanValue(accountName,
-                                                                     UserAccountManager.ACCOUNT_USES_STANDARD_PASSWORD);
+                                                                                   UserAccountManager.ACCOUNT_USES_STANDARD_PASSWORD);
 
                 if (usesOldLogin) {
                     snackbar = Snackbar.make(binding.emptyList.emptyListView,
@@ -258,7 +258,7 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
     private void initializeAdapter() {
         initializeClient();
         if (adapter == null) {
-            adapter = new NotificationListAdapter(client, this, themeColorUtils, themeButtonUtils);
+            adapter = new NotificationListAdapter(client, this, themeColorUtils, viewThemeUtils);
             binding.list.setAdapter(adapter);
         }
     }

+ 41 - 49
app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java

@@ -42,9 +42,9 @@ 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.ThemeButtonUtils;
 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;
 
@@ -63,7 +63,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     public final static String ACTION_REQUEST_WITH_RESULT = "ACTION_REQUEST_WITH_RESULT";
     public final static String ACTION_CHECK_WITH_RESULT = "ACTION_CHECK_WITH_RESULT";
     public final static String ACTION_CHECK = "ACTION_CHECK";
-    public final static String KEY_PASSCODE  = "KEY_PASSCODE";
+    public final static String KEY_PASSCODE = "KEY_PASSCODE";
     public final static String KEY_CHECK_RESULT = "KEY_CHECK_RESULT";
 
     public final static String PREFERENCE_PASSCODE_D = "PrefPinCode";
@@ -76,7 +76,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     @Inject PassCodeManager passCodeManager;
     @Inject ThemeColorUtils themeColorUtils;
     @Inject ThemeTextInputUtils themeTextInputUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
     private PasscodelockBinding binding;
     private final EditText[] passCodeEditTexts = new EditText[4];
     private String[] passCodeDigits = {"", "", "", ""};
@@ -85,11 +85,10 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
 
     /**
      * Initializes the activity.
+     * <p>
+     * An intent with a valid ACTION is expected; if none is found, an {@link IllegalArgumentException} will be thrown.
      *
-     * An intent with a valid ACTION is expected; if none is found, an
-     * {@link IllegalArgumentException} will be thrown.
-     *
-     * @param savedInstanceState    Previously saved state - irrelevant in this case
+     * @param savedInstanceState Previously saved state - irrelevant in this case
      */
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -98,7 +97,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
 
         int elementColor = themeColorUtils.primaryColor(this, true);
 
-        themeButtonUtils.themeBorderlessButton(themeColorUtils.primaryColor(this, true), binding.cancel);
+        viewThemeUtils.platform.colorTextButtons(binding.cancel);
 
         passCodeEditTexts[0] = binding.txt0;
         themeTextInputUtils.colorEditText(passCodeEditTexts[0], elementColor);
@@ -135,10 +134,10 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
                 confirmingPassCode = savedInstanceState.getBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE);
                 passCodeDigits = savedInstanceState.getStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS);
             }
-            if(confirmingPassCode){
+            if (confirmingPassCode) {
                 // the app was in the passcodeconfirmation
                 requestPassCodeConfirmation();
-            }else{
+            } else {
                 // pass code preference has just been activated in SettingsActivity;
                 // will receive and confirm pass code value
                 binding.header.setText(R.string.pass_code_configure_your_pass_code);
@@ -162,13 +161,12 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     }
 
     /**
-     * Enables or disables the cancel button to allow the user interrupt the ACTION
-     * requested to the activity.
+     * Enables or disables the cancel button to allow the user interrupt the ACTION requested to the activity.
      *
-     * @param enabled       'True' makes the cancel button available, 'false' hides it.
+     * @param enabled 'True' makes the cancel button available, 'false' hides it.
      */
-    protected void setCancelButtonEnabled(boolean enabled){
-        if(enabled){
+    protected void setCancelButtonEnabled(boolean enabled) {
+        if (enabled) {
             binding.cancel.setVisibility(View.VISIBLE);
             binding.cancel.setOnClickListener(new OnClickListener() {
                 @Override
@@ -235,9 +233,9 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
 
     /**
      * Processes the pass code entered by the user just after the last digit was in.
-     *
-     * Takes into account the action requested to the activity, the currently saved pass code and
-     * the previously typed pass code, if any.
+     * <p>
+     * Takes into account the action requested to the activity, the currently saved pass code and the previously typed
+     * pass code, if any.
      */
     private void processFullPassCode() {
         if (ACTION_CHECK.equals(getIntent().getAction())) {
@@ -249,7 +247,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
                 hideSoftKeyboard();
                 finish();
 
-            }  else {
+            } else {
                 preferences.increasePinWrongAttempts();
 
                 showErrorAndRestart(R.string.pass_code_wrong, R.string.pass_code_enter_pass_code, View.INVISIBLE);
@@ -278,8 +276,8 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
 
             } else {
                 showErrorAndRestart(
-                        R.string.pass_code_mismatch, R.string.pass_code_configure_your_pass_code, View.VISIBLE
-                );
+                    R.string.pass_code_mismatch, R.string.pass_code_configure_your_pass_code, View.VISIBLE
+                                   );
             }
         }
     }
@@ -292,7 +290,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
             inputMethodManager.hideSoftInputFromWindow(
                 focusedView.getWindowToken(),
                 0
-            );
+                                                      );
         }
     }
 
@@ -309,10 +307,9 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
 
 
     /**
-     * Ask to the user for retyping the pass code just entered before saving it as the current pass
-     * code.
+     * Ask to the user for retyping the pass code just entered before saving it as the current pass code.
      */
-    protected void requestPassCodeConfirmation(){
+    protected void requestPassCodeConfirmation() {
         clearBoxes();
         binding.header.setText(R.string.pass_code_reenter_your_pass_code);
         binding.explanation.setVisibility(View.INVISIBLE);
@@ -322,7 +319,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     /**
      * Compares pass code entered by the user with the value currently saved in the app.
      *
-     * @return     'True' if entered pass code equals to the saved one.
+     * @return 'True' if entered pass code equals to the saved one.
      */
     protected boolean checkPassCode() {
 
@@ -337,12 +334,11 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     }
 
     /**
-     * Compares pass code retyped by the user in the input fields with the value entered just
-     * before.
+     * Compares pass code retyped by the user in the input fields with the value entered just before.
      *
-     * @return     'True' if retyped pass code equals to the entered before.
+     * @return 'True' if retyped pass code equals to the entered before.
      */
-    protected boolean confirmPassCode(){
+    protected boolean confirmPassCode() {
         confirmingPassCode = false;
 
         boolean result = true;
@@ -355,7 +351,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     /**
      * Sets the input fields to empty strings and puts the focus on the first one.
      */
-    protected void clearBoxes(){
+    protected void clearBoxes() {
         for (EditText mPassCodeEditText : passCodeEditTexts) {
             mPassCodeEditText.setText("");
         }
@@ -363,12 +359,12 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     }
 
     /**
-     * Overrides click on the BACK arrow to correctly cancel ACTION_ENABLE or ACTION_DISABLE, while
-     * preventing than ACTION_CHECK may be worked around.
+     * Overrides click on the BACK arrow to correctly cancel ACTION_ENABLE or ACTION_DISABLE, while preventing than
+     * ACTION_CHECK may be worked around.
      *
-     * @param keyCode       Key code of the key that triggered the down event.
-     * @param event         Event triggered.
-     * @return              'True' when the key event was processed by this method.
+     * @param keyCode Key code of the key that triggered the down event.
+     * @param event   Event triggered.
+     * @return 'True' when the key event was processed by this method.
      */
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
@@ -448,18 +444,16 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
         /**
          * Constructor
          *
-         * @param index         Position in the pass code of the input field that will be bound to
-         *                      this watcher.
-         * @param lastOne       'True' means that watcher corresponds to the last position of the
-         *                      pass code.
+         * @param index   Position in the pass code of the input field that will be bound to this watcher.
+         * @param lastOne 'True' means that watcher corresponds to the last position of the pass code.
          */
         PassCodeDigitTextWatcher(int index, boolean lastOne) {
             mIndex = index;
-            mLastOne  = lastOne;
+            mLastOne = lastOne;
             if (mIndex < 0) {
                 throw new IllegalArgumentException(
-                        "Invalid index in " + PassCodeDigitTextWatcher.class.getSimpleName() +
-                                " constructor"
+                    "Invalid index in " + PassCodeDigitTextWatcher.class.getSimpleName() +
+                        " constructor"
                 );
             }
         }
@@ -469,13 +463,11 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
         }
 
         /**
-         * Performs several actions when the user types a digit in an input field:
-         *  - saves the input digit to the state of the activity; this will allow retyping the
-         *    pass code to confirm it.
-         *  - moves the focus automatically to the next field
-         *  - for the last field, triggers the processing of the full pass code
+         * Performs several actions when the user types a digit in an input field: - saves the input digit to the state
+         * of the activity; this will allow retyping the pass code to confirm it. - moves the focus automatically to the
+         * next field - for the last field, triggers the processing of the full pass code
          *
-         * @param s     Changed text
+         * @param s Changed text
          */
         @Override
         public void afterTextChanged(Editable s) {

+ 69 - 71
app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

@@ -202,11 +202,11 @@ public class ReceiveExternalFilesActivity extends FileActivity
         // Init Fragment without UI to retain AsyncTask across configuration changes
         FragmentManager fm = getSupportFragmentManager();
         TaskRetainerFragment taskRetainerFragment =
-                (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
+            (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
         if (taskRetainerFragment == null) {
             taskRetainerFragment = new TaskRetainerFragment();
             fm.beginTransaction()
-                    .add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
+                .add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
         }   // else, Fragment already created and retained across configuration change
     }
 
@@ -221,9 +221,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
         if (!somethingToUpload()) {
             showErrorDialog(
-                    R.string.uploader_error_message_no_file_to_upload,
-                    R.string.uploader_error_title_no_file_to_upload
-            );
+                R.string.uploader_error_message_no_file_to_upload,
+                R.string.uploader_error_title_no_file_to_upload
+                           );
         }
 
         super.setAccount(account, savedAccount);
@@ -297,7 +297,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
             builder.setIcon(R.drawable.ic_warning);
             builder.setTitle(R.string.uploader_wrn_no_account_title);
             builder.setMessage(String.format(getString(R.string.uploader_wrn_no_account_text),
-                    getString(R.string.app_name)));
+                                             getString(R.string.app_name)));
             builder.setCancelable(false);
             builder.setPositiveButton(R.string.uploader_wrn_no_account_setup_btn_text, (dialog, which) -> {
                 // using string value since in API7 this
@@ -310,7 +310,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 startActivityForResult(intent, REQUEST_CODE__SETUP_ACCOUNT);
             });
             builder.setNeutralButton(R.string.uploader_wrn_no_account_quit_btn_text,
-                                 (dialog, which) -> getActivity().finish());
+                                     (dialog, which) -> getActivity().finish());
             return builder.create();
         }
     }
@@ -370,7 +370,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
             View view = layout.inflate(R.layout.upload_file_dialog, null);
 
             ArrayAdapter<String> adapter
-                    = new ArrayAdapter<>(requireContext(), android.R.layout.simple_spinner_item);
+                = new ArrayAdapter<>(requireContext(), android.R.layout.simple_spinner_item);
             adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 
             int selectPos = 0;
@@ -387,17 +387,17 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 mText.add(internetShortcutUrlText(extraText));
                 mFilenameBase.add(filename);
                 mFilenameSuffix.add(URL_FILE_SUFFIX);
-                adapter.add(String.format(str,URL_FILE_SUFFIX));
+                adapter.add(String.format(str, URL_FILE_SUFFIX));
 
                 mText.add(internetShortcutWeblocText(extraText));
                 mFilenameBase.add(filename);
                 mFilenameSuffix.add(WEBLOC_FILE_SUFFIX);
-                adapter.add(String.format(str,WEBLOC_FILE_SUFFIX));
+                adapter.add(String.format(str, WEBLOC_FILE_SUFFIX));
 
                 mText.add(internetShortcutDesktopText(extraText, filename));
                 mFilenameBase.add(filename);
                 mFilenameSuffix.add(DESKTOP_FILE_SUFFIX);
-                adapter.add(String.format(str,DESKTOP_FILE_SUFFIX));
+                adapter.add(String.format(str, DESKTOP_FILE_SUFFIX));
 
                 selectPos = preferences.getUploadUrlFileExtensionUrlSelectedPos();
                 mFileCategory = CATEGORY_URL;
@@ -407,12 +407,12 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 mText.add(internetShortcutUrlText(texts[2]));
                 mFilenameBase.add(texts[0]);
                 mFilenameSuffix.add(URL_FILE_SUFFIX);
-                adapter.add(String.format(str,URL_FILE_SUFFIX));
+                adapter.add(String.format(str, URL_FILE_SUFFIX));
 
                 mText.add(internetShortcutWeblocText(texts[2]));
                 mFilenameBase.add(texts[0]);
                 mFilenameSuffix.add(WEBLOC_FILE_SUFFIX);
-                adapter.add(String.format(str,WEBLOC_FILE_SUFFIX));
+                adapter.add(String.format(str, WEBLOC_FILE_SUFFIX));
 
                 mText.add(internetShortcutDesktopText(texts[2], texts[0]));
                 mFilenameBase.add(texts[0]);
@@ -525,8 +525,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
             }
         }
 
-        private void setFilename(EditText inputText, int selectPos)
-        {
+        private void setFilename(EditText inputText, int selectPos) {
             String filename = mFilenameBase.get(selectPos) + mFilenameSuffix.get(selectPos);
             inputText.setText(filename);
             int selectionStart = 0;
@@ -534,8 +533,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
             int selectionEnd = extensionStart >= 0 ? extensionStart : filename.length();
             if (selectionEnd >= 0) {
                 inputText.setSelection(
-                        Math.min(selectionStart, selectionEnd),
-                        Math.max(selectionStart, selectionEnd));
+                    Math.min(selectionStart, selectionEnd),
+                    Math.max(selectionStart, selectionEnd));
             }
         }
 
@@ -579,18 +578,18 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
         private String internetShortcutUrlText(String url) {
             return "[InternetShortcut]\r\n" +
-                    "URL=" + url + "\r\n";
+                "URL=" + url + "\r\n";
         }
 
         private String internetShortcutWeblocText(String url) {
             return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                    "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" +
-                    "<plist version=\"1.0\">\n" +
-                    "<dict>\n" +
-                    "<key>URL</key>\n" +
-                    "<string>" + url + "</string>\n" +
-                    "</dict>\n" +
-                    "</plist>\n";
+                "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" +
+                "<plist version=\"1.0\">\n" +
+                "<dict>\n" +
+                "<key>URL</key>\n" +
+                "<string>" + url + "</string>\n" +
+                "</dict>\n" +
+                "</plist>\n";
         }
 
         private String internetShortcutDesktopText(String url, String filename) {
@@ -654,7 +653,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
         if (files.size() < position) {
             throw new IndexOutOfBoundsException("Incorrect item selected");
         }
-        if (files.get(position).isFolder()){
+        if (files.get(position).isFolder()) {
             OCFile folderToEnter = files.get(position);
             startSyncFolderOperation(folderToEnter);
             mParents.push(folderToEnter.getFileName());
@@ -753,7 +752,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
             if (files.isEmpty()) {
                 setMessageForEmptyList(R.string.file_list_empty_headline, R.string.empty,
-                        R.drawable.uploads);
+                                       R.drawable.uploads);
             } else {
                 mEmptyListContainer.setVisibility(View.GONE);
 
@@ -779,12 +778,12 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 binding.list.setAdapter(sa);
             }
             MaterialButton btnChooseFolder = binding.uploaderChooseFolder;
-            themeButtonUtils.colorPrimaryButton(btnChooseFolder, this, themeColorUtils);
+            viewThemeUtils.material.colorMaterialButtonPrimaryFilled(btnChooseFolder);
             btnChooseFolder.setOnClickListener(this);
 
             if (mFile.canWrite()) {
                 btnChooseFolder.setEnabled(true);
-                themeButtonUtils.colorPrimaryButton(btnChooseFolder, this, themeColorUtils);
+                viewThemeUtils.material.colorMaterialButtonPrimaryFilled(btnChooseFolder);
             } else {
                 btnChooseFolder.setEnabled(false);
                 btnChooseFolder.setBackgroundColor(Color.GRAY);
@@ -840,13 +839,13 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
         // perform folder synchronization
         RemoteOperation syncFolderOp = new RefreshFolderOperation(folder,
-                                                                        currentSyncTime,
-                                                                        false,
-                                                                        false,
-                                                                        getStorageManager(),
-                                                                        getUser().orElseThrow(RuntimeException::new),
-                                                                        getApplicationContext()
-                                                                      );
+                                                                  currentSyncTime,
+                                                                  false,
+                                                                  false,
+                                                                  getStorageManager(),
+                                                                  getUser().orElseThrow(RuntimeException::new),
+                                                                  getApplicationContext()
+        );
         syncFolderOp.execute(getAccount(), this, null, null);
     }
 
@@ -898,23 +897,23 @@ public class ReceiveExternalFilesActivity extends FileActivity
 
     private boolean somethingToUpload() {
         return (mStreamsToUpload != null && mStreamsToUpload.size() > 0 && mStreamsToUpload.get(0) != null ||
-                mUploadFromTmpFile);
+            mUploadFromTmpFile);
     }
 
     public void uploadFile(String tmpName, String filename) {
         FileUploader.uploadNewFile(
-                getBaseContext(),
-                getUser().orElseThrow(RuntimeException::new),
-                tmpName,
-                mFile.getRemotePath() + filename,
-                FileUploader.LOCAL_BEHAVIOUR_COPY,
-                null,
-                true,
-                UploadFileOperation.CREATED_BY_USER,
-                false,
-                false,
-                NameCollisionPolicy.ASK_USER
-        );
+            getBaseContext(),
+            getUser().orElseThrow(RuntimeException::new),
+            tmpName,
+            mFile.getRemotePath() + filename,
+            FileUploader.LOCAL_BEHAVIOUR_COPY,
+            null,
+            true,
+            UploadFileOperation.CREATED_BY_USER,
+            false,
+            false,
+            NameCollisionPolicy.ASK_USER
+                                  );
         finish();
     }
 
@@ -952,9 +951,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
             }
 
             showErrorDialog(
-                    messageResId,
-                    messageResTitle
-            );
+                messageResId,
+                messageResTitle
+                           );
         }
     }
 
@@ -970,8 +969,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
     }
 
     /**
-     * Updates the view associated to the activity after the finish of an operation
-     * trying create a new folder
+     * Updates the view associated to the activity after the finish of an operation trying create a new folder
      *
      * @param operation Creation operation performed.
      * @param result    Result of the creation.
@@ -986,8 +984,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
         } else {
             try {
                 DisplayUtils.showSnackMessage(
-                        this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources())
-                );
+                    this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources())
+                                             );
 
             } catch (NotFoundException e) {
                 Log_OC.e(TAG, "Error while trying to show fail message ", e);
@@ -1072,7 +1070,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
         return retval;
     }
 
-    private OCFile getCurrentFolder(){
+    private OCFile getCurrentFolder() {
         OCFile file = mFile;
         if (file != null) {
             if (file.isFolder()) {
@@ -1103,9 +1101,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
                 String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
                 String syncFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
                 RemoteOperationResult syncResult = (RemoteOperationResult)
-                        DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
+                    DataHolderUtil.getInstance().retrieve(intent.getStringExtra(FileSyncAdapter.EXTRA_RESULT));
                 boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name)
-                        && getStorageManager() != null;
+                    && getStorageManager() != null;
 
                 if (sameAccount) {
 
@@ -1121,10 +1119,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
                         if (currentDir == null) {
                             // current folder was removed from the server
                             DisplayUtils.showSnackMessage(
-                                    getActivity(),
-                                    R.string.sync_current_folder_was_removed,
-                                    getCurrentFolder().getFileName()
-                            );
+                                getActivity(),
+                                R.string.sync_current_folder_was_removed,
+                                getCurrentFolder().getFileName()
+                                                         );
                             browseToRoot();
 
                         } else {
@@ -1140,11 +1138,11 @@ public class ReceiveExternalFilesActivity extends FileActivity
                         }
 
                         mSyncInProgress = !FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
-                                !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event);
+                            !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event);
 
                         if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event)
-                                /// TODO refactor and make common
-                                && syncResult != null && !syncResult.isSuccess()) {
+                            /// TODO refactor and make common
+                            && syncResult != null && !syncResult.isSuccess()) {
 
                             if (syncResult.getCode() == ResultCode.UNAUTHORIZED ||
                                 (syncResult.isException() && syncResult.getException()
@@ -1181,9 +1179,9 @@ public class ReceiveExternalFilesActivity extends FileActivity
     /**
      * Show an error dialog, forcing the user to click a single button to exit the activity
      *
-     * @param messageResId      Resource id of the message to show in the dialog.
-     * @param messageResTitle   Resource id of the title to show in the dialog. 0 to show default alert message.
-     *                          -1 to show no title.
+     * @param messageResId    Resource id of the message to show in the dialog.
+     * @param messageResTitle Resource id of the title to show in the dialog. 0 to show default alert message. -1 to
+     *                        show no title.
      */
     private void showErrorDialog(int messageResId, int messageResTitle) {
 
@@ -1194,7 +1192,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
             R.string.common_back,
             -1,
             -1
-        );
+                                                                                       );
         errorDialog.setCancelable(false);
         errorDialog.setOnConfirmationListener(
             new ConfirmationDialogFragment.ConfirmationDialogFragmentListener() {
@@ -1213,7 +1211,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
                     // not used at the moment
                 }
             }
-        );
+                                             );
         errorDialog.show(getSupportFragmentManager(), FTAG_ERROR_FRAGMENT);
     }
 }

+ 15 - 17
app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

@@ -75,11 +75,11 @@ import com.owncloud.android.utils.DeviceCredentialUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.EncryptionUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 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.ViewThemeUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -95,7 +95,7 @@ import androidx.appcompat.app.AppCompatDelegate;
 
 /**
  * An Activity that allows the user to change the application's settings.
- *
+ * <p>
  * It proxies the necessary calls via {@link androidx.appcompat.app.AppCompatDelegate} to be used with AppCompat.
  */
 public class SettingsActivity extends ThemedPreferenceActivity
@@ -104,7 +104,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
 
     private static final String TAG = SettingsActivity.class.getSimpleName();
 
-    public static final String PREFERENCE_LOCK= "lock";
+    public static final String PREFERENCE_LOCK = "lock";
 
     public static final String LOCK_NONE = "none";
     public static final String LOCK_PASSCODE = "passcode";
@@ -144,7 +144,8 @@ public class SettingsActivity extends ThemedPreferenceActivity
     @Inject ThemeToolbarUtils themeToolbarUtils;
     @Inject ThemeUtils themeUtils;
     @Inject ThemeTextUtils themeTextUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
+
 
     @SuppressWarnings("deprecation")
     @Override
@@ -288,7 +289,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
                         } else {
                             intent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
                             intent.putExtra(ExternalSiteWebView.EXTRA_TITLE,
-                                    getResources().getString(R.string.privacy));
+                                            getResources().getString(R.string.privacy));
                             intent.putExtra(ExternalSiteWebView.EXTRA_URL, privacyUrl.toString());
                             intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
                             intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
@@ -386,7 +387,6 @@ public class SettingsActivity extends ThemedPreferenceActivity
     }
 
 
-
     private void setupRecommendPreference(PreferenceCategory preferenceCategoryMore) {
         boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled);
         Preference pRecommend = findPreference("recommend");
@@ -402,11 +402,11 @@ public class SettingsActivity extends ThemedPreferenceActivity
                     String downloadUrlGooglePlayStore = getString(R.string.url_app_download);
                     String downloadUrlFDroid = getString(R.string.fdroid_link);
                     String downloadUrls = String.format(getString(R.string.recommend_urls),
-                            downloadUrlGooglePlayStore, downloadUrlFDroid);
+                                                        downloadUrlGooglePlayStore, downloadUrlFDroid);
 
                     String recommendSubject = String.format(getString(R.string.recommend_subject), appName);
                     String recommendText = String.format(getString(R.string.recommend_text),
-                            appName, downloadUrls);
+                                                         appName, downloadUrls);
 
                     intent.putExtra(Intent.EXTRA_SUBJECT, recommendSubject);
                     intent.putExtra(Intent.EXTRA_TEXT, recommendText);
@@ -501,9 +501,9 @@ public class SettingsActivity extends ThemedPreferenceActivity
                     } catch (Throwable t) {
                         Log_OC.e(TAG, "Base Uri for account could not be resolved to call DAVdroid!", t);
                         DisplayUtils.showSnackMessage(
-                                activity,
-                                R.string.prefs_calendar_contacts_address_resolve_error
-                        );
+                            activity,
+                            R.string.prefs_calendar_contacts_address_resolve_error
+                                                     );
                     }
                     return true;
                 });
@@ -653,7 +653,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
             Intent i = new Intent(getApplicationContext(), PassCodeActivity.class);
             i.setAction(PassCodeActivity.ACTION_REQUEST_WITH_RESULT);
             startActivityForResult(i, ACTION_REQUEST_PASSCODE);
-        } else if (LOCK_DEVICE_CREDENTIALS.equals(lock)){
+        } else if (LOCK_DEVICE_CREDENTIALS.equals(lock)) {
             if (!DeviceCredentialUtils.areCredentialsAvailable(getApplicationContext())) {
                 DisplayUtils.showSnackMessage(this, R.string.prefs_lock_device_credentials_not_setup);
             } else {
@@ -798,7 +798,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
             } else {
                 // no f-droid market app or Play store installed --> launch browser for f-droid url
                 Intent downloadIntent = new Intent(Intent.ACTION_VIEW,
-                        Uri.parse("https://f-droid.org/repository/browse/?fdid=at.bitfire.davdroid"));
+                                                   Uri.parse("https://f-droid.org/repository/browse/?fdid=at.bitfire.davdroid"));
                 DisplayUtils.startIntentIfAppAvailable(downloadIntent, this, R.string.no_browser_available);
 
                 DisplayUtils.showSnackMessage(this, R.string.prefs_calendar_contacts_no_store_error);
@@ -819,7 +819,6 @@ public class SettingsActivity extends ThemedPreferenceActivity
     }
 
 
-
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         super.onCreateOptionsMenu(menu);
@@ -834,7 +833,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
             String passcode = data.getStringExtra(PassCodeActivity.KEY_PASSCODE);
             if (passcode != null && passcode.length() == 4) {
                 SharedPreferences.Editor appPrefs = PreferenceManager
-                        .getDefaultSharedPreferences(getApplicationContext()).edit();
+                    .getDefaultSharedPreferences(getApplicationContext()).edit();
 
                 for (int i = 1; i <= 4; ++i) {
                     appPrefs.putString(PassCodeActivity.PREFERENCE_PASSCODE_D + i, passcode.substring(i - 1, i));
@@ -887,8 +886,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
                     .create();
 
                 alertDialog.show();
-                themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                                       alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
+                viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
             }
         }
     }

+ 5 - 6
app/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.kt

@@ -66,8 +66,8 @@ import com.owncloud.android.ui.dialog.SyncedFolderPreferencesDialogFragment.OnSy
 import com.owncloud.android.ui.dialog.parcel.SyncedFolderParcelable
 import com.owncloud.android.utils.PermissionUtil
 import com.owncloud.android.utils.SyncedFolderUtils
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 import com.owncloud.android.utils.theme.ThemeSnackbarUtils
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
@@ -159,7 +159,7 @@ class SyncedFoldersActivity :
     lateinit var backgroundJobManager: BackgroundJobManager
 
     @Inject
-    lateinit var themeButtonUtils: ThemeButtonUtils
+    lateinit var viewThemeUtils: ViewThemeUtils
 
     @Inject
     lateinit var themeSnackBarUtils: ThemeSnackbarUtils
@@ -243,7 +243,7 @@ class SyncedFoldersActivity :
             .setTitle(R.string.autoupload_disable_power_save_check)
             .setMessage(getString(R.string.power_save_check_dialog_message))
             .show()
-        themeButtonUtils.themeBorderlessButton(themeColorUtils, alertDialog.getButton(AlertDialog.BUTTON_POSITIVE))
+        viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE))
     }
 
     /**
@@ -255,7 +255,7 @@ class SyncedFoldersActivity :
         adapter = SyncedFolderAdapter(this, clock, gridWidth, this, lightVersion, themeColorUtils, themeDrawableUtils)
         syncedFolderProvider = SyncedFolderProvider(contentResolver, preferences, clock)
         binding.emptyList.emptyListIcon.setImageResource(R.drawable.nav_synced_folders)
-        themeButtonUtils.colorPrimaryButton(binding.emptyList.emptyListViewAction, this, themeColorUtils)
+        viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.emptyList.emptyListViewAction)
         val lm = GridLayoutManager(this, gridWidth)
         adapter.setLayoutManager(lm)
         val spacing = resources.getDimensionPixelSize(R.dimen.media_grid_spacing)
@@ -802,8 +802,7 @@ class SyncedFoldersActivity :
                 .setIcon(R.drawable.ic_battery_alert)
             if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
                 val alertDialog = alertDialogBuilder.show()
-                themeButtonUtils.themeBorderlessButton(
-                    themeColorUtils,
+                viewThemeUtils.platform.colorTextButtons(
                     alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
                     alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL)
                 )

+ 1 - 2
app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java

@@ -44,7 +44,7 @@ import com.nextcloud.client.di.Injectable;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
+
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 import com.owncloud.android.utils.theme.ThemeLayoutUtils;
@@ -85,7 +85,6 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
     @Inject public ThemeToolbarUtils themeToolbarUtils;
     @Inject public ThemeUtils themeUtils;
     @Inject public ThemeDrawableUtils themeDrawableUtils;
-    @Inject public ThemeButtonUtils themeButtonUtils;
 
     /**
      * Toolbar setup that must be called in implementer's {@link #onCreate} after {@link #setContentView} if they want

+ 1 - 1
app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -189,7 +189,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
         cancelButton.setOnClickListener(this);
 
         uploadButton = findViewById(R.id.upload_files_btn_upload);
-        themeButtonUtils.colorPrimaryButton(uploadButton, this, themeColorUtils);
+        viewThemeUtils.material.colorMaterialButtonPrimaryFilled(uploadButton);
         uploadButton.setOnClickListener(this);
         uploadButton.setEnabled(mLocalFolderPickerMode);
 

+ 16 - 16
app/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java

@@ -60,8 +60,8 @@ import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.svg.SvgDecoder;
 import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
 import com.owncloud.android.utils.svg.SvgSoftwareLayerSetter;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -84,17 +84,17 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
     private final OwnCloudClient client;
     private final NotificationsActivity notificationsActivity;
     private final ThemeColorUtils themeColorUtils;
-    private final ThemeButtonUtils themeButtonUtils;
+    private final ViewThemeUtils viewThemeUtils;
 
     public NotificationListAdapter(OwnCloudClient client,
                                    NotificationsActivity notificationsActivity,
                                    ThemeColorUtils themeColorUtils,
-                                   ThemeButtonUtils themeButtonUtils) {
+                                   ViewThemeUtils viewThemeUtils) {
         this.notificationsList = new ArrayList<>();
         this.client = client;
         this.notificationsActivity = notificationsActivity;
         this.themeColorUtils = themeColorUtils;
-        this.themeButtonUtils = themeButtonUtils;
+        this.viewThemeUtils = viewThemeUtils;
         foregroundColorSpanBlack = new ForegroundColorSpan(
             notificationsActivity.getResources().getColor(R.color.text_color));
     }
@@ -153,7 +153,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
 
         int nightModeFlag =
             notificationsActivity.getResources().getConfiguration().uiMode
-            & Configuration.UI_MODE_NIGHT_MASK;
+                & Configuration.UI_MODE_NIGHT_MASK;
         if (Configuration.UI_MODE_NIGHT_YES == nightModeFlag) {
             holder.binding.icon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
         } else {
@@ -184,11 +184,11 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
                          );
 
         int primaryColor = themeColorUtils.primaryColor(notificationsActivity);
-        
+
         List<Action> overflowActions = new ArrayList<>();
-        
+
         if (notification.getActions().size() > 2) {
-            for (Action action: notification.getActions()) {
+            for (Action action : notification.getActions()) {
                 if (action.primary) {
                     button = new MaterialButton(notificationsActivity);
                     button.setAllCaps(false);
@@ -216,13 +216,13 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
                         }
                     });
 
-                    themeButtonUtils.colorPrimaryButton(button, notificationsActivity, themeColorUtils);
+                    viewThemeUtils.material.colorMaterialButtonPrimaryFilled(button);
                     holder.binding.buttons.addView(button);
                 } else {
                     overflowActions.add(action);
                 }
             }
-            
+
             // further actions
             button = new MaterialButton(notificationsActivity);
             button.setBackgroundColor(resources.getColor(R.color.grey_200));
@@ -256,11 +256,11 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
                                                               notificationsActivity)
                                 .execute(action);
                         }
-                        
+
                         return true;
                     });
                 }
-                
+
                 popup.show();
             });
 
@@ -270,7 +270,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
                 button = new MaterialButton(notificationsActivity);
 
                 if (action.primary) {
-                    themeButtonUtils.colorPrimaryButton(button, notificationsActivity, themeColorUtils);
+                    viewThemeUtils.material.colorMaterialButtonPrimaryFilled(button);
                 } else {
                     button.setBackgroundColor(resources.getColor(R.color.grey_200));
                     button.setTextColor(primaryColor);
@@ -305,11 +305,11 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
             }
         }
     }
-    
+
     private void handleItemClick() {
-        
+
     }
-    
+
 
     private SpannableStringBuilder makeSpecialPartsBold(Notification notification) {
         String text = notification.getSubjectRich();

+ 4 - 5
app/src/main/java/com/owncloud/android/ui/dialog/AccountRemovalConfirmationDialog.java

@@ -29,8 +29,8 @@ import com.nextcloud.client.account.User;
 import com.nextcloud.client.di.Injectable;
 import com.nextcloud.client.jobs.BackgroundJobManager;
 import com.owncloud.android.R;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import javax.inject.Inject;
 
@@ -44,7 +44,7 @@ public class AccountRemovalConfirmationDialog extends DialogFragment implements
 
     @Inject BackgroundJobManager backgroundJobManager;
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
     private User user;
 
     public static AccountRemovalConfirmationDialog newInstance(User user) {
@@ -69,9 +69,8 @@ public class AccountRemovalConfirmationDialog extends DialogFragment implements
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
-        themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                               alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
-                                               alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+        viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
+                                                 alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
     }
 
     @NonNull

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

@@ -59,9 +59,9 @@ import com.owncloud.android.ui.adapter.RichDocumentsTemplateAdapter;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.NextcloudServer;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 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;
 import java.util.ArrayList;
@@ -90,7 +90,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
     @Inject CurrentAccountProvider currentAccount;
     @Inject ClientFactory clientFactory;
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
     @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject FileDataStorageManager fileDataStorageManager;
     private RichDocumentsTemplateAdapter adapter;
@@ -123,9 +123,8 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
         positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
-        themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                               positiveButton,
-                                               alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+        viewThemeUtils.platform.colorTextButtons(positiveButton,
+                                                 alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
         positiveButton.setOnClickListener(this);
         positiveButton.setEnabled(false);
 
@@ -323,7 +322,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
                                    Template template,
                                    String path,
                                    User user
-        ) {
+                                  ) {
             this.client = client;
             this.chooseTemplateDialogFragmentWeakReference = new WeakReference<>(chooseTemplateDialogFragment);
             this.template = template;

+ 5 - 6
app/src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.kt

@@ -58,10 +58,10 @@ import com.owncloud.android.ui.activity.TextEditorWebView
 import com.owncloud.android.ui.adapter.TemplateAdapter
 import com.owncloud.android.utils.DisplayUtils
 import com.owncloud.android.utils.FileStorageUtils
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 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,15 +84,15 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
     @Inject
     lateinit var themeDrawableUtils: ThemeDrawableUtils
 
-    @Inject
-    lateinit var themeButtonUtils: ThemeButtonUtils
-
     @Inject
     lateinit var themeTextInputUtils: ThemeTextInputUtils
 
     @Inject
     lateinit var fileDataStorageManager: FileDataStorageManager
 
+    @Inject
+    lateinit var viewThemeUtils: ViewThemeUtils
+
     private var adapter: TemplateAdapter? = null
     private var parentFolder: OCFile? = null
     private var title: String? = null
@@ -111,8 +111,7 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
         val alertDialog = dialog as AlertDialog
         val button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
 
-        themeButtonUtils.themeBorderlessButton(
-            themeColorUtils,
+        viewThemeUtils.platform.colorTextButtons(
             button,
             alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL)
         )

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

@@ -22,8 +22,8 @@ import android.os.Bundle;
 
 import com.nextcloud.client.di.Injectable;
 import com.owncloud.android.R;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import javax.inject.Inject;
 
@@ -45,7 +45,8 @@ public class ConfirmationDialogFragment extends DialogFragment implements Inject
     public static final String FTAG_CONFIRMATION = "CONFIRMATION_FRAGMENT";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
+
 
     private ConfirmationDialogFragmentListener mListener;
 
@@ -84,10 +85,9 @@ public class ConfirmationDialogFragment extends DialogFragment implements Inject
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
-        themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                               alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
-                                               alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE),
-                                               alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+        viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
+                                                 alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE),
+                                                 alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
     }
 
     public void setOnConfirmationListener(ConfirmationDialogFragmentListener listener) {

+ 4 - 5
app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java

@@ -39,10 +39,10 @@ import com.owncloud.android.datamodel.ThumbnailsCacheManager;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.adapter.LocalFileListAdapter;
 import com.owncloud.android.utils.DisplayUtils;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeCheckableUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.theme.ThemeDrawableUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -74,7 +74,7 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable
     private Button positiveButton;
     @Inject ThemeColorUtils themeColorUtils;
     @Inject ThemeDrawableUtils themeDrawableUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
     @Inject ThemeCheckableUtils themeCheckableUtils;
 
     private static final String KEY_NEW_FILE = "file";
@@ -123,9 +123,8 @@ public class ConflictsResolveDialog extends DialogFragment implements Injectable
         }
 
         positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
-        themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                               positiveButton,
-                                               alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+        viewThemeUtils.platform.colorTextButtons(positiveButton,
+                                                 alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
         positiveButton.setEnabled(false);
     }
 

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

@@ -42,9 +42,9 @@ import com.owncloud.android.datamodel.OCFile;
 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.ThemeButtonUtils;
 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;
@@ -68,9 +68,10 @@ public class CreateFolderDialogFragment
     public static final String CREATE_FOLDER_FRAGMENT = "CREATE_FOLDER_FRAGMENT";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
     @Inject ThemeTextInputUtils themeTextInputUtils;
     @Inject FileDataStorageManager fileDataStorageManager;
+    @Inject ViewThemeUtils viewThemeUtils;
+
 
     private OCFile mParentFolder;
     private Button positiveButton;
@@ -99,9 +100,8 @@ public class CreateFolderDialogFragment
         if (alertDialog != null) {
             positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
 
-            themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                                   positiveButton,
-                                                   alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+            viewThemeUtils.platform.colorTextButtons(positiveButton,
+                                                     alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
         }
     }
 
@@ -192,8 +192,8 @@ public class CreateFolderDialogFragment
     public void onClick(DialogInterface dialog, int which) {
         if (which == AlertDialog.BUTTON_POSITIVE) {
             String newFolderName =
-                    ((TextView)(getDialog().findViewById(R.id.user_input)))
-                        .getText().toString().trim();
+                ((TextView) (getDialog().findViewById(R.id.user_input)))
+                    .getText().toString().trim();
 
             if (TextUtils.isEmpty(newFolderName)) {
                 DisplayUtils.showSnackMessage(getActivity(), R.string.filename_empty);

+ 5 - 6
app/src/main/java/com/owncloud/android/ui/dialog/LocalStoragePathPickerDialogFragment.java

@@ -33,8 +33,8 @@ import com.owncloud.android.databinding.StoragePathDialogBinding;
 import com.owncloud.android.ui.adapter.StoragePathAdapter;
 import com.owncloud.android.ui.adapter.StoragePathItem;
 import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -61,7 +61,7 @@ public class LocalStoragePathPickerDialogFragment extends DialogFragment
     private static Set<String> internalStoragePaths = new HashSet<>();
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
 
     static {
         internalStoragePaths.add("/storage/emulated/legacy");
@@ -82,8 +82,7 @@ public class LocalStoragePathPickerDialogFragment extends DialogFragment
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
         if (alertDialog != null) {
-            themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                                   alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
+            viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
         }
     }
 
@@ -97,7 +96,7 @@ public class LocalStoragePathPickerDialogFragment extends DialogFragment
     public Dialog onCreateDialog(Bundle savedInstanceState) {
         if (!(getActivity() instanceof StoragePathAdapter.StoragePathAdapterListener)) {
             throw new IllegalArgumentException("Calling activity must implement " +
-                "StoragePathAdapter.StoragePathAdapterListener");
+                                                   "StoragePathAdapter.StoragePathAdapterListener");
         }
 
         // Inflate the layout for the dialog
@@ -137,7 +136,7 @@ public class LocalStoragePathPickerDialogFragment extends DialogFragment
 
         for (FileStorageUtils.StandardDirectory standardDirectory : FileStorageUtils.StandardDirectory.getStandardDirectories()) {
             addIfExists(storagePathItems, standardDirectory.getIcon(), getString(standardDirectory.getDisplayName()),
-                Environment.getExternalStoragePublicDirectory(standardDirectory.getName()).getAbsolutePath());
+                        Environment.getExternalStoragePublicDirectory(standardDirectory.getName()).getAbsolutePath());
         }
 
         String sdCard = getString(R.string.storage_internal_storage);

+ 4 - 5
app/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java

@@ -35,9 +35,9 @@ import com.owncloud.android.databinding.NoteDialogBinding;
 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.ThemeButtonUtils;
 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;
 
@@ -54,7 +54,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
     private static final String ARG_SHARE = "SHARE";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
     @Inject ThemeTextInputUtils themeTextInputUtils;
 
     private OCShare share;
@@ -86,9 +86,8 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
-        themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                               alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
-                                               alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+        viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
+                                                 alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
     }
 
     @NonNull

+ 11 - 12
app/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java

@@ -47,8 +47,8 @@ import com.owncloud.android.lib.resources.users.SendCSROperation;
 import com.owncloud.android.lib.resources.users.StorePrivateKeyOperation;
 import com.owncloud.android.utils.CsrHelper;
 import com.owncloud.android.utils.EncryptionUtils;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.io.IOException;
 import java.security.KeyPair;
@@ -90,7 +90,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
     private static final String KEY_GENERATE = "KEY_GENERATE";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
 
     private User user;
     private TextView textView;
@@ -125,9 +125,8 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
 
         positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
         neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
-        themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                               positiveButton,
-                                               neutralButton);
+        viewThemeUtils.platform.colorTextButtons(positiveButton,
+                                                 neutralButton);
 
         task = new DownloadKeysAsyncTask();
         task.execute();
@@ -162,8 +161,8 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
     private Dialog createDialog(View v) {
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
         builder.setView(v).setPositiveButton(R.string.common_ok, null)
-                .setNeutralButton(R.string.common_cancel, null)
-                .setTitle(R.string.end_to_end_encryption_title);
+            .setNeutralButton(R.string.common_cancel, null)
+            .setTitle(R.string.end_to_end_encryption_title);
 
         Dialog dialog = builder.create();
         dialog.setCanceledOnTouchOutside(false);
@@ -188,7 +187,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
                                 intentCreated.putExtra(SUCCESS, true);
                                 intentCreated.putExtra(ARG_POSITION, getArguments().getInt(ARG_POSITION));
                                 getTargetFragment().onActivityResult(getTargetRequestCode(),
-                                        SETUP_ENCRYPTION_RESULT_CODE, intentCreated);
+                                                                     SETUP_ENCRYPTION_RESULT_CODE, intentCreated);
                                 break;
 
                             case KEY_EXISTING_USED:
@@ -370,7 +369,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
                 String privateKeyString = EncryptionUtils.encodeBytesToBase64String(privateKey.getEncoded());
                 String privatePemKeyString = EncryptionUtils.privateKeyToPEM(privateKey);
                 String encryptedPrivateKey = EncryptionUtils.encryptPrivateKey(privatePemKeyString,
-                        generateMnemonicString(false));
+                                                                               generateMnemonicString(false));
 
                 // upload encryptedPrivateKey
                 StorePrivateKeyOperation storePrivateKeyOperation = new StorePrivateKeyOperation(encryptedPrivateKey);
@@ -380,10 +379,10 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
                     Log_OC.d(TAG, "private key success");
 
                     arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), EncryptionUtils.PRIVATE_KEY,
-                            privateKeyString);
+                                                                privateKeyString);
                     arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), EncryptionUtils.PUBLIC_KEY, publicKey);
                     arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), EncryptionUtils.MNEMONIC,
-                            generateMnemonicString(true));
+                                                                generateMnemonicString(true));
 
                     keyResult = KEY_CREATED;
                     return (String) storePrivateKeyResult.getData().get(0);
@@ -443,7 +442,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment implements Inj
         positiveButton.setVisibility(View.VISIBLE);
 
         neutralButton.setVisibility(View.VISIBLE);
-        themeButtonUtils.themeBorderlessButton(themeColorUtils, positiveButton, neutralButton);
+        viewThemeUtils.platform.colorTextButtons(positiveButton, neutralButton);
 
         keyResult = KEY_GENERATE;
     }

+ 10 - 11
app/src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java

@@ -36,9 +36,9 @@ import com.owncloud.android.datamodel.OCFile;
 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.ThemeButtonUtils;
 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;
 
@@ -60,8 +60,9 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
     public static final String PASSWORD_FRAGMENT = "PASSWORD_FRAGMENT";
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+
     @Inject ThemeTextInputUtils themeTextInputUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
 
     private PasswordDialogBinding binding;
     private OCFile file;
@@ -75,11 +76,10 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
 
         AlertDialog alertDialog = (AlertDialog) getDialog();
         if (alertDialog != null) {
-            themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                                   alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
-                                                   alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
-            themeButtonUtils.themeBorderlessButton(getResources().getColor(R.color.highlight_textColor_Warning),
-                                                   alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
+            viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
+                                                     alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
+            viewThemeUtils.platform.colorTextButtons(getResources().getColor(R.color.highlight_textColor_Warning),
+                                                     alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
 
             alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(v -> {
                 String password = binding.sharePassword.getText().toString();
@@ -104,9 +104,8 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
      * Public factory method to create new SharePasswordDialogFragment instances.
      *
      * @param file        OCFile bound to the public share that which password will be set or updated
-     * @param createShare When 'true', the request for password will be followed by the creation of a new
-     *                    public link; when 'false', a public share is assumed to exist, and the password
-     *                    is bound to it.
+     * @param createShare When 'true', the request for password will be followed by the creation of a new public link;
+     *                    when 'false', a public share is assumed to exist, and the password is bound to it.
      * @return Dialog ready to show.
      */
     public static SharePasswordDialogFragment newInstance(OCFile file, boolean createShare, boolean askForPassword) {
@@ -185,7 +184,7 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
         builder.setView(view)
             .setPositiveButton(R.string.common_ok, null)
             .setNegativeButton(negativeButtonCaption, this)
-                .setNeutralButton(R.string.common_delete, this)
+            .setNeutralButton(R.string.common_delete, this)
             .setTitle(title);
         Dialog d = builder.create();
 

+ 8 - 7
app/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java

@@ -35,8 +35,8 @@ import com.nextcloud.client.di.Injectable;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.utils.FileSortOrder;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import javax.inject.Inject;
 
@@ -59,7 +59,8 @@ public class SortingOrderDialogFragment extends DialogFragment implements Inject
     private String mCurrentSortOrderName;
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+
+    @Inject ViewThemeUtils viewThemeUtils;
 
     public static SortingOrderDialogFragment newInstance(FileSortOrder sortOrder) {
         SortingOrderDialogFragment dialogFragment = new SortingOrderDialogFragment();
@@ -138,16 +139,16 @@ public class SortingOrderDialogFragment extends DialogFragment implements Inject
      */
     private void setupActiveOrderSelection() {
         final int color = themeColorUtils.primaryColor(null, true, true, getContext());
-        for (View view: mTaggedViews) {
+        for (View view : mTaggedViews) {
             if (!((FileSortOrder) view.getTag()).name.equals(mCurrentSortOrderName)) {
                 continue;
             }
             if (view instanceof ImageButton) {
-                themeButtonUtils.colorImageButton((ImageButton) view, color);
+                viewThemeUtils.platform.themeImageButton((ImageButton) view);
             }
             if (view instanceof TextView) {
-                ((TextView)view).setTextColor(color);
-                ((TextView)view).setTypeface(Typeface.DEFAULT_BOLD);
+                ((TextView) view).setTextColor(color);
+                ((TextView) view).setTypeface(Typeface.DEFAULT_BOLD);
             }
         }
     }
@@ -185,7 +186,7 @@ public class SortingOrderDialogFragment extends DialogFragment implements Inject
         public void onClick(View v) {
             dismissAllowingStateLoss();
             ((SortingOrderDialogFragment.OnSortingOrderListener) getActivity())
-                    .onSortingOrderChosen((FileSortOrder) v.getTag());
+                .onSortingOrderChosen((FileSortOrder) v.getTag());
         }
     }
 

+ 6 - 6
app/src/main/java/com/owncloud/android/ui/dialog/StoragePermissionDialogFragment.kt

@@ -32,8 +32,8 @@ import com.nextcloud.client.di.Injectable
 import com.owncloud.android.R
 import com.owncloud.android.databinding.StoragePermissionDialogBinding
 import com.owncloud.android.ui.dialog.StoragePermissionDialogFragment.Listener
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils
 import javax.inject.Inject
 
 /**
@@ -51,16 +51,16 @@ class StoragePermissionDialogFragment(val listener: Listener, val permissionRequ
     private lateinit var binding: StoragePermissionDialogBinding
 
     @Inject
-    lateinit var themeButtonUtils: ThemeButtonUtils
+    lateinit var themeColorUtils: ThemeColorUtils
 
     @Inject
-    lateinit var themeColorUtils: ThemeColorUtils
+    lateinit var viewThemeUtils: ViewThemeUtils
 
     override fun onStart() {
         super.onStart()
         dialog?.let {
             val alertDialog = it as AlertDialog
-            themeButtonUtils.themeBorderlessButton(themeColorUtils, alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE))
+            viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE))
         }
     }
 
@@ -77,12 +77,12 @@ class StoragePermissionDialogFragment(val listener: Listener, val permissionRequ
         binding.storagePermissionExplanation.text = getString(explanationResource, getString(R.string.app_name))
 
         // Setup layout
-        themeButtonUtils.colorPrimaryButton(binding.btnFullAccess, context, themeColorUtils)
+        viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.btnFullAccess)
         binding.btnFullAccess.setOnClickListener {
             listener.onClickFullAccess()
             dismiss()
         }
-        themeButtonUtils.themeBorderlessButton(themeColorUtils, binding.btnReadOnly)
+        viewThemeUtils.platform.colorTextButtons(binding.btnReadOnly)
         binding.btnReadOnly.setOnClickListener {
             listener.onClickMediaReadOnly()
             dismiss()

+ 9 - 5
app/src/main/java/com/owncloud/android/ui/dialog/SyncFileNotEnoughSpaceDialogFragment.java

@@ -31,6 +31,9 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
 import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
+
+import javax.inject.Inject;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.RequiresApi;
@@ -47,6 +50,8 @@ public class SyncFileNotEnoughSpaceDialogFragment extends ConfirmationDialogFrag
 
     private OCFile targetFile;
 
+    @Inject ViewThemeUtils viewThemeUtils;
+
     public static SyncFileNotEnoughSpaceDialogFragment newInstance(OCFile file, long availableDeviceSpace) {
         Bundle args = new Bundle();
         SyncFileNotEnoughSpaceDialogFragment frag = new SyncFileNotEnoughSpaceDialogFragment();
@@ -57,7 +62,7 @@ public class SyncFileNotEnoughSpaceDialogFragment extends ConfirmationDialogFrag
         args.putInt(ARG_TITLE_ID, R.string.sync_not_enough_space_dialog_title);
         args.putInt(ARG_MESSAGE_RESOURCE_ID, R.string.sync_not_enough_space_dialog_placeholder);
         args.putStringArray(ARG_MESSAGE_ARGUMENTS,
-                            new String[] {
+                            new String[]{
                                 file.getFileName(),
                                 properFileSize,
                                 properDiskAvailableSpace});
@@ -83,10 +88,9 @@ public class SyncFileNotEnoughSpaceDialogFragment extends ConfirmationDialogFrag
         AlertDialog alertDialog = (AlertDialog) getDialog();
 
         if (alertDialog != null) {
-            themeButtonUtils.themeBorderlessButton(themeColorUtils,
-                                                   alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
-                                                   alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL),
-                                                   alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
+            viewThemeUtils.platform.colorTextButtons(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
+                                                     alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL),
+                                                     alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
         }
     }
 

+ 67 - 65
app/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java

@@ -47,9 +47,9 @@ import com.owncloud.android.ui.activity.UploadFilesActivity;
 import com.owncloud.android.ui.dialog.parcel.SyncedFolderParcelable;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeCheckableUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.io.File;
 
@@ -82,8 +82,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
     private final static float alphaDisabled = 0.7f;
 
     @Inject ThemeColorUtils themeColorUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
     @Inject ThemeCheckableUtils themeCheckableUtils;
+    @Inject ViewThemeUtils viewThemeUtils;
+
     protected View mView;
     private CharSequence[] mUploadBehaviorItemStrings;
     private CharSequence[] mNameCollisionPolicyItemStrings;
@@ -176,7 +177,7 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
 
             // switch text to create headline
             ((TextView) view.findViewById(R.id.synced_folders_settings_title))
-                    .setText(R.string.autoupload_create_new_custom_folder);
+                .setText(R.string.autoupload_create_new_custom_folder);
 
             // disable save button
             view.findViewById(R.id.save).setEnabled(false);
@@ -200,7 +201,7 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
         mUploadExistingCheckbox = view.findViewById(R.id.setting_instant_upload_existing_checkbox);
 
         mUploadUseSubfoldersCheckbox = view.findViewById(
-                R.id.setting_instant_upload_path_use_subfolders_checkbox);
+            R.id.setting_instant_upload_path_use_subfolders_checkbox);
 
         themeCheckableUtils.tintCheckbox(accentColor,
                                          mUploadOnWifiCheckbox,
@@ -215,19 +216,19 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
         mCancel = view.findViewById(R.id.cancel);
         mSave = view.findViewById(R.id.save);
 
-        themeButtonUtils.themeBorderlessButton(themeColorUtils, mCancel, mSave);
+        viewThemeUtils.platform.colorTextButtons(mCancel, mSave);
 
         // Set values
         setEnabled(mSyncedFolder.isEnabled());
 
         if (!TextUtils.isEmpty(mSyncedFolder.getLocalPath())) {
             mLocalFolderPath.setText(
-                    DisplayUtils.createTextWithSpan(
-                            String.format(
-                                    getString(R.string.synced_folders_preferences_folder_path),
-                                    mSyncedFolder.getLocalPath()),
-                            mSyncedFolder.getFolderName(),
-                            new StyleSpan(Typeface.BOLD)));
+                DisplayUtils.createTextWithSpan(
+                    String.format(
+                        getString(R.string.synced_folders_preferences_folder_path),
+                        mSyncedFolder.getLocalPath()),
+                    mSyncedFolder.getFolderName(),
+                    new StyleSpan(Typeface.BOLD)));
             mLocalFolderSummary.setText(FileStorageUtils.pathToUserFriendlyDisplay(
                 mSyncedFolder.getLocalPath(),
                 getActivity(),
@@ -268,9 +269,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
     }
 
     /**
-     * set (new) remote path on activity result of the folder picker activity. The result gets originally propagated
-     * to the underlying activity since the picker is an activity and the result can't get passed to the dialog
-     * fragment directly.
+     * set (new) remote path on activity result of the folder picker activity. The result gets originally propagated to
+     * the underlying activity since the picker is an activity and the result can't get passed to the dialog fragment
+     * directly.
      *
      * @param path the remote path to be set
      */
@@ -281,9 +282,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
     }
 
     /**
-     * set (new) local path on activity result of the folder picker activity. The result gets originally propagated
-     * to the underlying activity since the picker is an activity and the result can't get passed to the dialog
-     * fragment directly.
+     * set (new) local path on activity result of the folder picker activity. The result gets originally propagated to
+     * the underlying activity since the picker is an activity and the result can't get passed to the dialog fragment
+     * directly.
      *
      * @param path the local path to be set
      */
@@ -291,12 +292,12 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
         mSyncedFolder.setLocalPath(path);
         mLocalFolderSummary.setText(FileStorageUtils.pathToUserFriendlyDisplay(path, getActivity(), getResources()));
         mLocalFolderPath.setText(
-                DisplayUtils.createTextWithSpan(
-                        String.format(
-                                getString(R.string.synced_folders_preferences_folder_path),
-                                mSyncedFolder.getLocalPath()),
-                        new File(mSyncedFolder.getLocalPath()).getName(),
-                        new StyleSpan(Typeface.BOLD)));
+            DisplayUtils.createTextWithSpan(
+                String.format(
+                    getString(R.string.synced_folders_preferences_folder_path),
+                    mSyncedFolder.getLocalPath()),
+                new File(mSyncedFolder.getLocalPath()).getName(),
+                new StyleSpan(Typeface.BOLD)));
         checkAndUpdateSaveButtonState();
     }
 
@@ -406,22 +407,22 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
             });
 
         view.findViewById(R.id.setting_instant_upload_existing_container).setOnClickListener(
-              new OnClickListener() {
-                  @Override
-                  public void onClick(View v) {
-                      mSyncedFolder.setExisting(!mSyncedFolder.isExisting());
-                      mUploadExistingCheckbox.toggle();
-                  }
-              });
+            new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mSyncedFolder.setExisting(!mSyncedFolder.isExisting());
+                    mUploadExistingCheckbox.toggle();
+                }
+            });
 
         view.findViewById(R.id.setting_instant_upload_path_use_subfolders_container).setOnClickListener(
-                new OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        mSyncedFolder.setSubfolderByDate(!mSyncedFolder.isSubfolderByDate());
-                        mUploadUseSubfoldersCheckbox.toggle();
-                    }
-                });
+            new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mSyncedFolder.setSubfolderByDate(!mSyncedFolder.isSubfolderByDate());
+                    mUploadUseSubfoldersCheckbox.toggle();
+                }
+            });
 
         view.findViewById(R.id.remote_folder_container).setOnClickListener(v -> {
             Intent action = new Intent(getActivity(), FolderPickerActivity.class);
@@ -443,12 +444,12 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
         });
 
         view.findViewById(R.id.setting_instant_behaviour_container).setOnClickListener(
-                new OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        showBehaviourDialog();
-                    }
-                });
+            new OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    showBehaviourDialog();
+                }
+            });
 
         view.findViewById(R.id.setting_instant_name_collision_policy_container).setOnClickListener(
             new OnClickListener() {
@@ -462,26 +463,26 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
     private void showBehaviourDialog() {
         AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
         builder.setTitle(R.string.prefs_instant_behaviour_dialogTitle)
-                .setSingleChoiceItems(getResources().getTextArray(R.array.pref_behaviour_entries),
-                        mSyncedFolder.getUploadActionInteger(),
-                        new
-                                DialogInterface.OnClickListener() {
-                                    public void onClick(DialogInterface dialog, int which) {
-                                        mSyncedFolder.setUploadAction(
-                                                getResources().getTextArray(
-                                                        R.array.pref_behaviour_entryValues)[which].toString());
-                                        mUploadBehaviorSummary.setText(SyncedFolderPreferencesDialogFragment
-                                                .this.mUploadBehaviorItemStrings[which]);
-                                        behaviourDialogShown = false;
-                                        dialog.dismiss();
-                                    }
-                                })
-                .setOnCancelListener(new DialogInterface.OnCancelListener() {
-                    @Override
-                    public void onCancel(DialogInterface dialog) {
-                        behaviourDialogShown = false;
-                    }
-                });
+            .setSingleChoiceItems(getResources().getTextArray(R.array.pref_behaviour_entries),
+                                  mSyncedFolder.getUploadActionInteger(),
+                                  new
+                                      DialogInterface.OnClickListener() {
+                                          public void onClick(DialogInterface dialog, int which) {
+                                              mSyncedFolder.setUploadAction(
+                                                  getResources().getTextArray(
+                                                      R.array.pref_behaviour_entryValues)[which].toString());
+                                              mUploadBehaviorSummary.setText(SyncedFolderPreferencesDialogFragment
+                                                                                 .this.mUploadBehaviorItemStrings[which]);
+                                              behaviourDialogShown = false;
+                                              dialog.dismiss();
+                                          }
+                                      })
+            .setOnCancelListener(new DialogInterface.OnCancelListener() {
+                @Override
+                public void onCancel(DialogInterface dialog) {
+                    behaviourDialogShown = false;
+                }
+            });
         behaviourDialogShown = true;
         behaviourDialog = builder.create();
         behaviourDialog.show();
@@ -534,14 +535,14 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
     @Override
     public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
         behaviourDialogShown = savedInstanceState != null &&
-                savedInstanceState.getBoolean(BEHAVIOUR_DIALOG_STATE, false);
+            savedInstanceState.getBoolean(BEHAVIOUR_DIALOG_STATE, false);
         nameCollisionPolicyDialogShown = savedInstanceState != null &&
             savedInstanceState.getBoolean(NAME_COLLISION_POLICY_DIALOG_STATE, false);
 
         if (behaviourDialogShown) {
             showBehaviourDialog();
         }
-        if (nameCollisionPolicyDialogShown){
+        if (nameCollisionPolicyDialogShown) {
             showNameCollisionPolicyDialog();
         }
 
@@ -594,6 +595,7 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment implem
 
     /**
      * Get index for name collision selection dialog.
+     *
      * @return 0 if ASK_USER, 1 if OVERWRITE, 2 if RENAME, 3 if SKIP, Otherwise: 0
      */
     static private Integer getSelectionIndexForNameCollisionPolicy(NameCollisionPolicy nameCollisionPolicy) {

+ 8 - 8
app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java

@@ -37,7 +37,6 @@ import android.widget.Toast;
 import com.nextcloud.client.account.User;
 import com.nextcloud.client.di.Injectable;
 import com.nextcloud.client.jobs.BackgroundJobManager;
-import com.nextcloud.client.preferences.AppPreferences;
 import com.nextcloud.java.util.Optional;
 import com.owncloud.android.R;
 import com.owncloud.android.databinding.BackupFragmentBinding;
@@ -53,11 +52,11 @@ import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 import com.owncloud.android.utils.PermissionUtil;
-import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeCheckableUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 import com.owncloud.android.utils.theme.ThemeUtils;
+import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -95,8 +94,9 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
     @Inject ThemeToolbarUtils themeToolbarUtils;
     @Inject ThemeUtils themeUtils;
     @Inject ThemeCheckableUtils themeCheckableUtils;
-    @Inject ThemeButtonUtils themeButtonUtils;
+
     @Inject ArbitraryDataProvider arbitraryDataProvider;
+    @Inject ViewThemeUtils viewThemeUtils;
 
     private Date selectedDate;
     private boolean calendarPickerOpen;
@@ -202,8 +202,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
             calendarPickerOpen = true;
         }
 
-        themeButtonUtils.colorPrimaryButton(binding.backupNow, getContext(), themeColorUtils);
-        themeButtonUtils.themeBorderlessButton(themeColorUtils, binding.contactsDatepicker);
+        viewThemeUtils.material.colorMaterialButtonPrimaryFilled(binding.backupNow);
+        viewThemeUtils.platform.colorTextButtons(binding.contactsDatepicker);
 
         int primaryAccentColor = themeColorUtils.primaryAccentColor(getContext());
         binding.dataToBackUpTitle.setTextColor(primaryAccentColor);
@@ -292,7 +292,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
 
                 if (folder != null) {
                     RefreshFolderOperation operation = new RefreshFolderOperation(folder, System.currentTimeMillis(),
-                            false, false, storageManager, user, context);
+                                                                                  false, false, storageManager, user, context);
 
                     RemoteOperationResult result = operation.execute(user, context);
                     return result.isSuccess();
@@ -464,7 +464,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
             backgroundJobManager.cancelPeriodicCalendarBackup(user);
         }
 
-        arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), 
+        arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(),
                                                     PREFERENCE_CONTACTS_AUTOMATIC_BACKUP,
                                                     String.valueOf(enabled));
     }
@@ -570,7 +570,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
             datePickerDialog.getButton(DatePickerDialog.BUTTON_POSITIVE).setBackgroundColor(0x00000000);
         } else {
             DisplayUtils.showSnackMessage(getView().findViewById(R.id.contacts_linear_layout),
-                    R.string.contacts_preferences_something_strange_happened);
+                                          R.string.contacts_preferences_something_strange_happened);
         }
     }
 

+ 0 - 106
app/src/main/java/com/owncloud/android/utils/theme/ThemeButtonUtils.java

@@ -1,106 +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.Button;
-import android.widget.ImageButton;
-
-import com.owncloud.android.R;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.Nullable;
-import androidx.core.content.ContextCompat;
-
-/**
- * Utility class with methods for client side button theming.
- */
-public final class ThemeButtonUtils {
-    /**
-     * sets the tinting of the given ImageButton's icon to color_accent.
-     *
-     * @param imageButton the image button who's icon should be colored
-     */
-    public void colorImageButton(ImageButton imageButton, @ColorInt int color) {
-        if (imageButton != null) {
-            imageButton.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
-        }
-    }
-
-    public void colorPrimaryButton(Button button, Context context, ThemeColorUtils themeColorUtils) {
-        int primaryColor = themeColorUtils.primaryColor(null, true, false, context);
-        int fontColor = themeColorUtils.fontColor(context, false);
-
-        button.setBackgroundColor(primaryColor);
-
-        if (Color.BLACK == primaryColor) {
-            button.setTextColor(Color.WHITE);
-        } else if (Color.WHITE == primaryColor) {
-            button.setTextColor(Color.BLACK);
-        } else {
-            button.setTextColor(fontColor);
-        }
-    }
-
-    /**
-     * theme buttons based on accent color.
-     *
-     * @param buttons borderless buttons to be themed
-     */
-    public void themeBorderlessButton(ThemeColorUtils themeColorUtils, @Nullable Button... buttons) {
-        if (buttons == null || buttons.length < 1) {
-            return;
-        }
-        themeBorderlessButton(themeColorUtils.primaryAccentColor(buttons[0].getContext()), buttons);
-    }
-
-    /**
-     * theme buttons based on given color.
-     *
-     * @param color   theme color
-     * @param buttons borderless buttons to be themed
-     */
-    public void themeBorderlessButton(int color, @Nullable Button... buttons) {
-        if (buttons == null || buttons.length < 1) {
-            return;
-        }
-        Context context = buttons[0].getContext();
-        int disabledColor = ContextCompat.getColor(context, R.color.disabled_text);
-        ColorStateList colorStateList = new ColorStateList(
-            new int[][]{
-                new int[]{android.R.attr.state_enabled}, // enabled
-                new int[]{-android.R.attr.state_enabled}, // disabled
-            },
-            new int[]{
-                color,
-                disabledColor
-            }
-        );
-        for (Button button: buttons) {
-            button.setTextColor(colorStateList);
-        }
-    }
-}

+ 2 - 0
app/src/main/java/com/owncloud/android/utils/theme/ThemeColorUtils.java

@@ -39,6 +39,8 @@ import static com.owncloud.android.utils.theme.CapabilityUtils.getCapability;
 
 /**
  * Utility class with methods for theming related.
+ *
+ * @deprecated use material 3 Schemes and utilities from common lib instead
  */
 @Deprecated
 public class ThemeColorUtils {

+ 1 - 0
app/src/main/java/com/owncloud/android/utils/theme/newm3/MaterialSchemesProvider.kt

@@ -26,6 +26,7 @@ import com.nextcloud.android.common.ui.theme.MaterialSchemes
 import com.nextcloud.client.account.User
 import com.owncloud.android.lib.resources.status.OCCapability
 
+// TODO schema for non-logged-in user? login and what's new screens
 interface MaterialSchemesProvider {
     fun getMaterialSchemesForUser(user: User): MaterialSchemes
     fun getMaterialSchemesForCapability(capability: OCCapability): MaterialSchemes

+ 1 - 6
app/src/test/java/com/nextcloud/client/jobs/BackgroundJobFactoryTest.kt

@@ -35,7 +35,6 @@ import com.nextcloud.client.network.ConnectivityService
 import com.nextcloud.client.preferences.AppPreferences
 import com.owncloud.android.datamodel.ArbitraryDataProvider
 import com.owncloud.android.datamodel.UploadsStorageManager
-import com.owncloud.android.utils.theme.ThemeButtonUtils
 import com.owncloud.android.utils.theme.ThemeColorUtils
 import com.owncloud.android.utils.theme.ThemeSnackbarUtils
 import org.greenrobot.eventbus.EventBus
@@ -107,9 +106,6 @@ class BackgroundJobFactoryTest {
     @Mock
     private lateinit var themeSnackbarUtils: ThemeSnackbarUtils
 
-    @Mock
-    private lateinit var themeButtonUtils: ThemeButtonUtils
-
     private lateinit var factory: BackgroundJobFactory
 
     @Before
@@ -132,8 +128,7 @@ class BackgroundJobFactoryTest {
             eventBus,
             deckApi,
             themeColorUtils,
-            themeSnackbarUtils,
-            themeButtonUtils
+            themeSnackbarUtils
         )
     }