diff --git a/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java b/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java index 3662590a9ef7..aa821ca383d8 100644 --- a/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java @@ -73,7 +73,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C public static final String EXTRA_FILES = FolderPickerActivity.class.getCanonicalName() + ".EXTRA_FILES"; public static final String EXTRA_ACTION = FolderPickerActivity.class.getCanonicalName() + ".EXTRA_ACTION"; public static final String EXTRA_CURRENT_FOLDER = FolderPickerActivity.class.getCanonicalName() + - ".EXTRA_CURRENT_FOLDER"; + ".EXTRA_CURRENT_FOLDER"; public static final String MOVE = "MOVE"; public static final String COPY = "COPY"; @@ -158,7 +158,7 @@ protected void onStart() { } /** - * Called when the ownCloud {@link Account} associated to the Activity was just updated. + * Called when the ownCloud {@link Account} associated to the Activity was just updated. */ @Override protected void onAccountSet(boolean stateWasRecovered) { @@ -211,10 +211,10 @@ private void setBackgroundText() { if (listFragment != null) { if (!mSyncInProgress) { listFragment.setMessageForEmptyList( - R.string.file_list_empty_headline, - R.string.file_list_empty_moving, - R.drawable.ic_list_empty_create_folder, - true + R.string.file_list_empty_headline, + R.string.file_list_empty_moving, + R.drawable.ic_list_empty_create_folder, + true ); } else { listFragment.setEmptyListLoadingMessage(); @@ -227,7 +227,7 @@ private void setBackgroundText() { protected OCFileListFragment getListOfFilesFragment() { Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(FolderPickerActivity.TAG_LIST_OF_FOLDERS); if (listOfFiles != null) { - return (OCFileListFragment)listOfFiles; + return (OCFileListFragment) listOfFiles; } Log_OC.e(TAG, "Access to non existing list of files fragment!!"); return null; @@ -235,7 +235,7 @@ protected OCFileListFragment getListOfFilesFragment() { /** * {@inheritDoc} - * + *

* Updates action bar and second fragment, if in dual pane mode. */ @Override @@ -258,7 +258,7 @@ public void startSyncFolderOperation(OCFile folder, boolean ignoreETag) { // perform folder synchronization RemoteOperation refreshFolderOperation = new RefreshFolderOperation(folder, currentSyncTime, false, - ignoreETag, getStorageManager(), getAccount(), getApplicationContext()); + ignoreETag, getStorageManager(), getAccount(), getApplicationContext()); refreshFolderOperation.execute(getAccount(), this, null, null); setIndeterminate(true); @@ -313,18 +313,18 @@ public boolean onCreateOptionsMenu(Menu menu) { public boolean onOptionsItemSelected(MenuItem item) { boolean retval = true; switch (item.getItemId()) { - case R.id.action_create_dir: { - CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(getCurrentFolder()); - dialog.show(getSupportFragmentManager(), CreateFolderDialogFragment.CREATE_FOLDER_FRAGMENT); - break; - } - case android.R.id.home: { - OCFile currentDir = getCurrentFolder(); - if(currentDir != null && currentDir.getParentId() != 0) { - onBackPressed(); + case R.id.action_create_dir: { + CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(getCurrentFolder()); + dialog.show(getSupportFragmentManager(), CreateFolderDialogFragment.CREATE_FOLDER_FRAGMENT); + break; + } + case android.R.id.home: { + OCFile currentDir = getCurrentFolder(); + if (currentDir != null && currentDir.getParentId() != 0) { + onBackPressed(); + } + break; } - break; - } case R.id.action_sort: { FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); @@ -336,9 +336,9 @@ public boolean onOptionsItemSelected(MenuItem item) { break; } - default: - retval = super.onOptionsItemSelected(item); - break; + default: + retval = super.onOptionsItemSelected(item); + break; } return retval; @@ -409,15 +409,19 @@ protected void updateNavigationElementsInActionBar() { /** * Set per-view controllers */ - private void initControls(){ + private void initControls() { mCancelBtn = findViewById(R.id.folder_picker_btn_cancel); - mCancelBtn.setOnClickListener(this); mChooseBtn = findViewById(R.id.folder_picker_btn_choose); if (mChooseBtn != null) { mChooseBtn.getBackground().setColorFilter(ThemeUtils.primaryColor(this, true), PorterDuff.Mode.SRC_ATOP); mChooseBtn.setOnClickListener(this); } + + if (mCancelBtn != null) { + mCancelBtn.setTextColor(ThemeUtils.primaryColor(this, true)); + mCancelBtn.setOnClickListener(this); + } } @Override @@ -453,23 +457,23 @@ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationRe * Updates the view associated to the activity after the finish of an operation trying * to create a new folder. * - * @param operation Creation operation performed. - * @param result Result of the creation. + * @param operation Creation operation performed. + * @param result Result of the creation. */ private void onCreateFolderOperationFinish( - CreateFolderOperation operation, RemoteOperationResult result - ) { + CreateFolderOperation operation, RemoteOperationResult result + ) { if (result.isSuccess()) { refreshListOfFilesFragment(false); } 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); + Log_OC.e(TAG, "Error while trying to show fail message ", e); } } } @@ -487,23 +491,23 @@ public void onReceive(Context context, Intent intent) { 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) { if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) { mSyncInProgress = true; } else { OCFile currentFile = (getFile() == null) ? null : - getStorageManager().getFileByPath(getFile().getRemotePath()); + getStorageManager().getFileByPath(getFile().getRemotePath()); OCFile currentDir = (getCurrentFolder() == null) ? null : getStorageManager().getFileByPath(getCurrentFolder().getRemotePath()); if (currentDir == null) { // current folder was removed from the server DisplayUtils.showSnackMessage(getActivity(), R.string.sync_current_folder_was_removed, - getCurrentFolder().getFileName()); + getCurrentFolder().getFileName()); browseToRoot(); } else { if (currentFile == null && !getFile().isFolder()) { @@ -521,17 +525,17 @@ public void onReceive(Context context, Intent intent) { } 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 (ResultCode.UNAUTHORIZED.equals(syncResult.getCode()) || (syncResult.isException() - && syncResult.getException() instanceof AuthenticatorException)) { + && syncResult.getException() instanceof AuthenticatorException)) { requestCredentialsUpdate(context); } else if (RemoteOperationResult.ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED - .equals(syncResult.getCode())) { + .equals(syncResult.getCode())) { showUntrustedCertDialog(syncResult); } diff --git a/src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java b/src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java index 9674e0d68cb4..0aaacab87c20 100644 --- a/src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java @@ -81,7 +81,8 @@ protected void onCreate(Bundle savedInstanceState) { } Button deleteHistoryButton = findViewById(R.id.deleteLogHistoryButton); Button sendHistoryButton = findViewById(R.id.sendLogHistoryButton); - sendHistoryButton.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(this), PorterDuff.Mode.SRC_ATOP); + sendHistoryButton.getBackground().setColorFilter(ThemeUtils.primaryColor(this), PorterDuff.Mode.SRC_ATOP); + deleteHistoryButton.setTextColor(ThemeUtils.primaryColor(this, true)); TextView logTV = findViewById(R.id.logTV); deleteHistoryButton.setOnClickListener(new OnClickListener() { diff --git a/src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java b/src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java index 8463ff1624b7..d822d9eabee9 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java @@ -30,12 +30,11 @@ import android.view.View; import android.widget.TextView; +import com.google.android.material.button.MaterialButton; import com.owncloud.android.R; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.ThemeUtils; -import androidx.appcompat.widget.AppCompatButton; - /** * Activity providing information about ways to participate in the app's development. */ @@ -93,8 +92,8 @@ private void setupContent() { ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)), getString(R.string.contributing_link))))); - AppCompatButton reportButton = findViewById(R.id.participate_testing_report); - reportButton.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(this), PorterDuff.Mode.SRC_ATOP); + MaterialButton reportButton = findViewById(R.id.participate_testing_report); + reportButton.getBackground().setColorFilter(ThemeUtils.primaryColor(this), PorterDuff.Mode.SRC_ATOP); reportButton.setOnClickListener(v -> DisplayUtils.startLinkIntent(this, R.string.report_issue_link)); } diff --git a/src/main/java/com/owncloud/android/ui/activity/Preferences.java b/src/main/java/com/owncloud/android/ui/activity/Preferences.java index c6aacae5aa95..e6620bd810a6 100644 --- a/src/main/java/com/owncloud/android/ui/activity/Preferences.java +++ b/src/main/java/com/owncloud/android/ui/activity/Preferences.java @@ -761,7 +761,7 @@ private void setupActionBar() { .getColor(getResources(), R.color.background_color, null))); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - window.setStatusBarColor(ThemeUtils.primaryDarkColor(this)); + window.setStatusBarColor(ThemeUtils.primaryColor(this)); } // For adding content description tag to a title field in the action bar diff --git a/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java b/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java index 9a15175aedb3..68a1fece322c 100755 --- a/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java @@ -789,7 +789,7 @@ private void populateDirectoryList() { ThemeUtils.primaryColor(getAccount(), false, this))); } - ThemeUtils.colorStatusBar(this, ThemeUtils.primaryDarkColor(getAccount(), this)); + ThemeUtils.colorStatusBar(this, ThemeUtils.primaryColor(getAccount(), false, this)); ThemeUtils.colorToolbarProgressBar(this, ThemeUtils.primaryColor(getAccount(), false, this)); @@ -800,11 +800,12 @@ private void populateDirectoryList() { } Button btnNewFolder = findViewById(R.id.uploader_cancel); - btnNewFolder.setOnClickListener(this); + btnNewFolder.setTextColor(ThemeUtils.primaryColor(this, true)); + btnNewFolder.setOnClickListener(this); - mListView.setOnItemClickListener(this); - } + mListView.setOnItemClickListener(this); } + } protected void setupEmptyList() { mEmptyListContainer = findViewById(R.id.empty_list_view); diff --git a/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java b/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java index f0b270bb1f5f..f44ce3784c7d 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java @@ -63,7 +63,6 @@ protected void onCreate(Bundle savedInstanceState) { */ protected void setupToolbar(boolean useBackgroundImage) { int primaryColor = ThemeUtils.primaryColor(this, false); - int primaryDarkColor = ThemeUtils.primaryDarkColor(this); int fontColor = ThemeUtils.fontColor(this); Toolbar toolbar = findViewById(R.id.toolbar); @@ -74,14 +73,14 @@ protected void setupToolbar(boolean useBackgroundImage) { mProgressBar.setIndeterminateDrawable( ContextCompat.getDrawable(this, R.drawable.actionbar_progress_indeterminate_horizontal)); - ThemeUtils.colorToolbarProgressBar(this, ThemeUtils.primaryColor(this, false)); + ThemeUtils.colorToolbarProgressBar(this, primaryColor); } mInfoBox = findViewById(R.id.info_box); mInfoBoxMessage = findViewById(R.id.info_box_message); mPreviewImage = findViewById(R.id.preview_image); - ThemeUtils.colorStatusBar(this, primaryDarkColor); + ThemeUtils.colorStatusBar(this, primaryColor); if (toolbar.getOverflowIcon() != null) { ThemeUtils.tintDrawable(toolbar.getOverflowIcon(), fontColor); diff --git a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index 045da70850c4..54c900062cff 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -42,6 +42,7 @@ import android.widget.Spinner; import android.widget.TextView; +import com.google.android.material.button.MaterialButton; import com.owncloud.android.R; import com.owncloud.android.db.PreferenceManager; import com.owncloud.android.lib.common.utils.Log_OC; @@ -62,7 +63,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; -import androidx.appcompat.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatSpinner; import androidx.appcompat.widget.SearchView; import androidx.core.view.MenuItemCompat; @@ -160,17 +160,19 @@ public void onCreate(Bundle savedInstanceState) { if (mLocalFolderPickerMode) { findViewById(R.id.upload_options).setVisibility(View.GONE); - ((AppCompatButton) findViewById(R.id.upload_files_btn_upload)) + ((MaterialButton) findViewById(R.id.upload_files_btn_upload)) .setText(R.string.uploader_btn_alternative_text); } mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list); // Set input controllers - findViewById(R.id.upload_files_btn_cancel).setOnClickListener(this); + MaterialButton mCancelButton = findViewById(R.id.upload_files_btn_cancel); + mCancelButton.setTextColor(ThemeUtils.primaryColor(this, true)); + mCancelButton.setOnClickListener(this); - mUploadBtn = (AppCompatButton) findViewById(R.id.upload_files_btn_upload); - mUploadBtn.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(this), PorterDuff.Mode.SRC_ATOP); + mUploadBtn = findViewById(R.id.upload_files_btn_upload); + mUploadBtn.getBackground().setColorFilter(ThemeUtils.primaryColor(this, true), PorterDuff.Mode.SRC_ATOP); mUploadBtn.setOnClickListener(this); int localBehaviour = PreferenceManager.getUploaderBehaviour(this); diff --git a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java index 1c95b8a88436..dba3c5192f3e 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java @@ -338,7 +338,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { public void onStart() { super.onStart(); - int color = ThemeUtils.primaryAccentColor(getActivity()); + int color = ThemeUtils.primaryColor(getActivity()); AlertDialog alertDialog = (AlertDialog) getDialog(); diff --git a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java index a17420bbfe9e..1b32e9e5cc77 100644 --- a/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java +++ b/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java @@ -34,7 +34,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -45,6 +44,7 @@ import com.bumptech.glide.load.model.StreamEncoder; import com.bumptech.glide.load.resource.file.FileToStreamDecoder; import com.caverock.androidsvg.SVG; +import com.google.android.material.button.MaterialButton; import com.owncloud.android.R; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.RemoteOperation; @@ -135,12 +135,13 @@ public void onBindViewHolder(@NonNull NotificationViewHolder holder, int positio // add action buttons holder.buttons.removeAllViews(); - Button button; + MaterialButton button; for (Action action : notification.getActions()) { - button = new Button(notificationsActivity); + button = new MaterialButton(notificationsActivity); button.setText(action.label); + button.setCornerRadiusResource(R.dimen.button_corner_radius); if (action.primary) { button.getBackground().setColorFilter(ThemeUtils.primaryColor(notificationsActivity, true), diff --git a/src/main/java/com/owncloud/android/ui/components/CustomEditText.java b/src/main/java/com/owncloud/android/ui/components/CustomEditText.java index 5ab3a1d06372..dc7463932de7 100644 --- a/src/main/java/com/owncloud/android/ui/components/CustomEditText.java +++ b/src/main/java/com/owncloud/android/ui/components/CustomEditText.java @@ -26,13 +26,14 @@ import android.text.TextUtils; import android.util.AttributeSet; +import com.google.android.material.textfield.TextInputEditText; import com.owncloud.android.R; import com.owncloud.android.authentication.AuthenticatorActivity; /** * Custom edit text to support fixed suffix or prefix */ -public class CustomEditText extends androidx.appcompat.widget.AppCompatEditText { +public class CustomEditText extends TextInputEditText { private Rect fixedRect = new Rect(); private String fixedText = ""; private boolean isPrefixFixed; diff --git a/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java index af70fe712798..dadafebb1b8d 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/NoteDialogFragment.java @@ -24,14 +24,14 @@ import android.annotation.SuppressLint; import android.app.Dialog; import android.content.DialogInterface; -import android.graphics.PorterDuff; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.view.WindowManager.LayoutParams; -import android.widget.EditText; +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; import com.owncloud.android.R; import com.owncloud.android.lib.resources.shares.OCShare; import com.owncloud.android.ui.activity.ComponentsGetter; @@ -58,8 +58,11 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac private OCShare share; private Unbinder unbinder; + @BindView(R.id.user_input_container) + public TextInputLayout noteEditTextInputLayout; + @BindView(R.id.user_input) - EditText noteEditText; + public TextInputEditText noteEditText; public static NoteDialogFragment newInstance(OCShare share) { NoteDialogFragment frag = new NoteDialogFragment(); @@ -107,7 +110,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { // Setup layout noteEditText.setText(share.getNote()); noteEditText.requestFocus(); - noteEditText.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP); + ThemeUtils.colorTextInputLayout(noteEditTextInputLayout, accentColor); // Build the dialog AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity()); diff --git a/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java index f1048b362294..bb16a7974003 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java @@ -124,7 +124,7 @@ public void onStart() { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - int accentColor = ThemeUtils.primaryAccentColor(getContext()); + int primaryColor = ThemeUtils.primaryColor(getContext()); account = getArguments().getParcelable(ARG_ACCOUNT); arbitraryDataProvider = new ArbitraryDataProvider(getContext().getContentResolver()); @@ -137,13 +137,13 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { textView = v.findViewById(R.id.encryption_status); passphraseTextView = v.findViewById(R.id.encryption_passphrase); passwordField = v.findViewById(R.id.encryption_passwordInput); - passwordField.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP); + passwordField.getBackground().setColorFilter(primaryColor, PorterDuff.Mode.SRC_ATOP); Drawable wrappedDrawable = DrawableCompat.wrap(passwordField.getBackground()); - DrawableCompat.setTint(wrappedDrawable, accentColor); + DrawableCompat.setTint(wrappedDrawable, primaryColor); passwordField.setBackgroundDrawable(wrappedDrawable); - return createDialog(accentColor, v); + return createDialog(primaryColor, v); } @NonNull diff --git a/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java index d5c64ea2e254..2059004f1787 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/SortingOrderDialogFragment.java @@ -30,13 +30,13 @@ import android.widget.ImageButton; import android.widget.TextView; +import com.google.android.material.button.MaterialButton; 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.ThemeUtils; import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatButton; import androidx.fragment.app.DialogFragment; /** @@ -51,7 +51,7 @@ public class SortingOrderDialogFragment extends DialogFragment { private View mView; private View[] mTaggedViews; - private AppCompatButton mCancel; + private MaterialButton mCancel; private String mCurrentSortOrderName; public static SortingOrderDialogFragment newInstance(FileSortOrder sortOrder) { diff --git a/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java index 1d24176989f8..b395e0742a8a 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java @@ -34,6 +34,7 @@ import android.view.ViewGroup; import android.widget.TextView; +import com.google.android.material.button.MaterialButton; import com.owncloud.android.R; import com.owncloud.android.datamodel.MediaFolderType; import com.owncloud.android.datamodel.SyncedFolderDisplayItem; @@ -49,7 +50,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatCheckBox; import androidx.appcompat.widget.SwitchCompat; import androidx.fragment.app.DialogFragment; @@ -78,8 +78,8 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment { private TextView mRemoteFolderSummary; private SyncedFolderParcelable mSyncedFolder; - private AppCompatButton mCancel; - private AppCompatButton mSave; + private MaterialButton mCancel; + private MaterialButton mSave; private boolean behaviourDialogShown; private AlertDialog behaviourDialog; diff --git a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index ab33ce6a3d2e..263b89843237 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -199,7 +199,7 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); mSystemBarActionModeColor = getResources().getColor(R.color.action_mode_status_bar_background); - mSystemBarColor = ThemeUtils.primaryDarkColor(getContext()); + mSystemBarColor = ThemeUtils.primaryColor(getContext()); mProgressBarActionModeColor = getResources().getColor(R.color.action_mode_background); mProgressBarColor = ThemeUtils.primaryColor(getContext()); mMultiChoiceModeListener = new MultiChoiceModeListener(); @@ -444,7 +444,7 @@ public void showShareDetailView(OCFile file) { public void showActivityDetailView(OCFile file) { mContainerActivity.showDetails(file, 0); } - + @Override public void onOverflowIconClicked(OCFile file, View view) { PopupMenu popup = new PopupMenu(getActivity(), view); diff --git a/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java b/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java index a6e283df400c..0c73aa39b0c0 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java @@ -39,6 +39,7 @@ import android.widget.ScrollView; import android.widget.TextView; +import com.google.android.material.button.MaterialButton; import com.google.android.material.snackbar.Snackbar; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; @@ -60,7 +61,6 @@ import java.util.List; import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatButton; import androidx.appcompat.widget.SwitchCompat; import androidx.fragment.app.Fragment; @@ -717,8 +717,8 @@ private void updatePublicShareSection() { } // GetLink button - AppCompatButton getLinkButton = getGetLinkButton(); - getLinkButton.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(getContext()), + MaterialButton getLinkButton = getGetLinkButton(); + getLinkButton.getBackground().setColorFilter(ThemeUtils.primaryColor(getContext()), PorterDuff.Mode.SRC_ATOP); getLinkButton.setVisibility(View.VISIBLE); getLinkButton.setOnClickListener(new View.OnClickListener() { @@ -873,8 +873,8 @@ private View getHideFileListingPermissionSection() { return getView().findViewById(R.id.shareViaLinkHideFileListingPermissionSection); } - private AppCompatButton getGetLinkButton() { - return (AppCompatButton) getView().findViewById(R.id.shareViaLinkGetLinkButton); + private MaterialButton getGetLinkButton() { + return (MaterialButton) getView().findViewById(R.id.shareViaLinkGetLinkButton); } /** diff --git a/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java index 64a2a0daff14..b063088795a1 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactListFragment.java @@ -690,7 +690,7 @@ private void setChecked(boolean checked, CheckedTextView checkedTextView) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (checked) { checkedTextView.getCheckMarkDrawable() - .setColorFilter(ThemeUtils.primaryAccentColor(context), PorterDuff.Mode.SRC_ATOP); + .setColorFilter(ThemeUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP); } else { checkedTextView.getCheckMarkDrawable().clearColorFilter(); } @@ -703,7 +703,7 @@ private void toggleVCard(ContactListFragment.ContactItemViewHolder holder, int v if (holder.getName().isChecked()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { holder.getName().getCheckMarkDrawable() - .setColorFilter(ThemeUtils.primaryAccentColor(context), PorterDuff.Mode.SRC_ATOP); + .setColorFilter(ThemeUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP); } checkedVCards.add(verifiedPosition); diff --git a/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java b/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java index aeb5a138fe71..462f51bf1238 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java @@ -39,6 +39,7 @@ import com.evernote.android.job.JobRequest; import com.evernote.android.job.util.support.PersistableBundleCompat; +import com.google.android.material.button.MaterialButton; import com.google.android.material.snackbar.Snackbar; import com.owncloud.android.R; import com.owncloud.android.datamodel.ArbitraryDataProvider; @@ -63,7 +64,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; -import androidx.appcompat.widget.AppCompatButton; import androidx.appcompat.widget.SwitchCompat; import androidx.fragment.app.Fragment; import butterknife.BindView; @@ -81,13 +81,13 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi public SwitchCompat backupSwitch; @BindView(R.id.contacts_datepicker) - public AppCompatButton contactsDatePickerBtn; + public MaterialButton contactsDatePickerBtn; @BindView(R.id.contacts_last_backup_timestamp) public TextView lastBackup; @BindView(R.id.contacts_backup_now) - public AppCompatButton backupNow; + public MaterialButton backupNow; private Date selectedDate; private boolean calendarPickerOpen; @@ -183,7 +183,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { contactsDatePickerBtn.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP); contactsDatePickerBtn.setTextColor(fontColor); - AppCompatButton chooseDate = view.findViewById(R.id.contacts_datepicker); + MaterialButton chooseDate = view.findViewById(R.id.contacts_datepicker); chooseDate.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP); chooseDate.setTextColor(ThemeUtils.fontColor(getContext())); diff --git a/src/main/java/com/owncloud/android/utils/ThemeUtils.java b/src/main/java/com/owncloud/android/utils/ThemeUtils.java index b0dae44e3c44..aacc2d3c1042 100644 --- a/src/main/java/com/owncloud/android/utils/ThemeUtils.java +++ b/src/main/java/com/owncloud/android/utils/ThemeUtils.java @@ -40,6 +40,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; +import com.google.android.material.textfield.TextInputLayout; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountUtils; @@ -367,6 +368,26 @@ public static void colorToolbarProgressBar(FragmentActivity activity, int progre } } + /** + * Sets the color of the TextInputLayout to {@code color} for hint text and box stroke. + * + * @param textInputLayout the TextInputLayout instance + * @param color the color to be used for the hint text and box stroke + */ + public static void colorTextInputLayout(TextInputLayout textInputLayout, int color) { + textInputLayout.setBoxStrokeColor(color); + textInputLayout.setDefaultHintTextColor(new ColorStateList( + new int[][]{ + new int[]{-android.R.attr.state_focused}, + new int[]{android.R.attr.state_focused}, + }, + new int[]{ + Color.GRAY, + color + } + )); + } + public static void tintCheckbox(AppCompatCheckBox checkBox, int color) { CompoundButtonCompat.setButtonTintList(checkBox, new ColorStateList( new int[][]{ diff --git a/src/main/res/layout-land/account_setup.xml b/src/main/res/layout-land/account_setup.xml index 770459261621..2854b0767518 100644 --- a/src/main/res/layout-land/account_setup.xml +++ b/src/main/res/layout-land/account_setup.xml @@ -58,9 +58,8 @@ android:orientation="vertical" android:padding="@dimen/standard_half_padding" > - + android:contentDescription="@string/auth_check_server" + app:cornerRadius="@dimen/button_corner_radius"/> - - - - - + android:visibility="visible" + app:cornerRadius="@dimen/button_corner_radius"/> diff --git a/src/main/res/layout/account_setup.xml b/src/main/res/layout/account_setup.xml index 541be239ac66..a990eb7f94ef 100644 --- a/src/main/res/layout/account_setup.xml +++ b/src/main/res/layout/account_setup.xml @@ -50,9 +50,8 @@ android:orientation="vertical" android:padding="@dimen/standard_half_padding"> - + android:contentDescription="@string/auth_check_server" + app:cornerRadius="@dimen/button_corner_radius"/> @@ -168,7 +168,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - - + android:visibility="gone" + app:cornerRadius="@dimen/button_corner_radius"/> diff --git a/src/main/res/layout/activity_manage_space.xml b/src/main/res/layout/activity_manage_space.xml index 97f2181e3a8c..3d52418d4b82 100644 --- a/src/main/res/layout/activity_manage_space.xml +++ b/src/main/res/layout/activity_manage_space.xml @@ -17,9 +17,10 @@ along with this program. If not, see . --> + xmlns:app="http://schemas.android.com/apk/res-auto" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> - + android:contentDescription="@string/manage_space_clear_data" + app:cornerRadius="@dimen/button_corner_radius" /> diff --git a/src/main/res/layout/activity_sso_grant_permission.xml b/src/main/res/layout/activity_sso_grant_permission.xml index 0fd8a89abe5e..801e17bc070a 100644 --- a/src/main/res/layout/activity_sso_grant_permission.xml +++ b/src/main/res/layout/activity_sso_grant_permission.xml @@ -47,7 +47,7 @@ app:layout_constraintTop_toTopOf="parent" tools:text="Grant Nextcloud News access to your Nextcloud account incrediblyLong_username_with_123456789_number@Nextcloud_dummy.com?" /> - - - - . --> + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/contacts_linear_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> - + android:theme="@style/Button.Primary" + app:cornerRadius="@dimen/button_corner_radius" /> - + android:visibility="gone" + app:cornerRadius="@dimen/button_corner_radius" /> diff --git a/src/main/res/layout/edit_box_dialog.xml b/src/main/res/layout/edit_box_dialog.xml index 7445bcc2a82c..4e1c20d72117 100644 --- a/src/main/res/layout/edit_box_dialog.xml +++ b/src/main/res/layout/edit_box_dialog.xml @@ -24,7 +24,7 @@ android:orientation="vertical" android:padding="@dimen/standard_padding"> - . --> + android:orientation="vertical"> - - + android:layout_marginEnd="@dimen/standard_half_margin" + app:cornerRadius="@dimen/button_corner_radius" /> - + android:text="@string/folder_picker_choose_button_text" + app:cornerRadius="@dimen/button_corner_radius" /> diff --git a/src/main/res/layout/first_run_activity.xml b/src/main/res/layout/first_run_activity.xml index 31f2fa9c9fc8..25cd64d047b2 100644 --- a/src/main/res/layout/first_run_activity.xml +++ b/src/main/res/layout/first_run_activity.xml @@ -20,9 +20,10 @@ along with this program. If not, see . --> + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> -