Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -227,15 +227,15 @@ 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;
}

/**
* {@inheritDoc}
*
* <p>
* Updates action bar and second fragment, if in dual pane mode.
*/
@Override
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -336,9 +336,9 @@ public boolean onOptionsItemSelected(MenuItem item) {

break;
}
default:
retval = super.onOptionsItemSelected(item);
break;
default:
retval = super.onOptionsItemSelected(item);
break;
}

return retval;
Expand Down Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this NPE check not too late? This will explode on L414 if button is null

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!

mCancelBtn.setTextColor(ThemeUtils.primaryColor(this, true));
mCancelBtn.setOnClickListener(this);
}
}

@Override
Expand Down Expand Up @@ -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);
}
}
}
Expand All @@ -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()) {
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading