Merge pull request #8012 from nextcloud/dialogActionAlignment
Moving "cancel" dialog-button-action
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
@ -54,7 +54,7 @@ class SendShareDialogTest : AbstractIT() {
|
|||
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
shortSleep()
|
||||
|
||||
shortSleep()
|
||||
sut.requireDialog().window?.decorView.let { screenshot(it) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ import com.owncloud.android.utils.FileSortOrder;
|
|||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.PermissionUtil;
|
||||
import com.owncloud.android.utils.PushUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeSnackbarUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeToolbarUtils;
|
||||
|
||||
|
@ -301,12 +301,12 @@ public class FileDisplayActivity extends FileActivity
|
|||
AlertDialog alertDialog = new AlertDialog.Builder(this, R.style.Theme_ownCloud_Dialog)
|
||||
.setTitle(R.string.wrong_storage_path)
|
||||
.setMessage(R.string.wrong_storage_path_desc)
|
||||
.setNegativeButton(R.string.dialog_close, (dialog, which) -> dialog.dismiss())
|
||||
.setPositiveButton(R.string.dialog_close, (dialog, which) -> dialog.dismiss())
|
||||
.setIcon(R.drawable.ic_settings)
|
||||
.create();
|
||||
|
||||
alertDialog.show();
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ThemeColorUtils.primaryAccentColor(this));
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
|
||||
} catch (WindowManager.BadTokenException e) {
|
||||
Log_OC.e(TAG, "Error showing wrong storage info, so skipping it: " + e.getMessage());
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
|
|||
|
||||
int elementColor = ThemeColorUtils.primaryColor(this, true);
|
||||
|
||||
ThemeButtonUtils.themeBorderlessButton(binding.cancel, ThemeColorUtils.primaryColor(this, true));
|
||||
ThemeButtonUtils.themeBorderlessButton(ThemeColorUtils.primaryColor(this, true), binding.cancel);
|
||||
|
||||
passCodeEditTexts[0] = binding.txt0;
|
||||
ThemeTextInputUtils.colorEditText(passCodeEditTexts[0], elementColor);
|
||||
|
|
|
@ -303,7 +303,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
intent.putExtra("authorities", new String[]{MainApp.getAuthTokenType()});
|
||||
startActivityForResult(intent, REQUEST_CODE__SETUP_ACCOUNT);
|
||||
});
|
||||
builder.setNegativeButton(R.string.uploader_wrn_no_account_quit_btn_text, (dialog, which) -> getActivity().finish());
|
||||
builder.setNeutralButton(R.string.uploader_wrn_no_account_quit_btn_text,
|
||||
(dialog, which) -> getActivity().finish());
|
||||
return builder.create();
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +480,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
((ReceiveExternalFilesActivity) getActivity()).uploadFile(tmpName, filename);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.common_cancel, (dialog, id) -> dialog.cancel());
|
||||
builder.setNeutralButton(R.string.common_cancel, (dialog, id) -> dialog.cancel());
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ 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;
|
||||
|
@ -884,8 +885,6 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
|
||||
String mnemonic = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.MNEMONIC);
|
||||
|
||||
int accentColor = ThemeColorUtils.primaryAccentColor(this);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.FallbackTheming_Dialog);
|
||||
AlertDialog alertDialog = builder.setTitle(R.string.prefs_e2e_mnemonic)
|
||||
.setMessage(mnemonic)
|
||||
|
@ -893,7 +892,7 @@ public class SettingsActivity extends ThemedPreferenceActivity
|
|||
.create();
|
||||
|
||||
alertDialog.show();
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(accentColor);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Bartosz Przybylski
|
||||
|
|
|
@ -69,7 +69,6 @@ import com.owncloud.android.utils.DisplayUtils;
|
|||
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.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -204,7 +203,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
|||
.setMessage(getString(R.string.power_save_check_dialog_message))
|
||||
.show();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ThemeColorUtils.primaryAccentColor(this));
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -813,15 +812,13 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
|||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getString(R.string.battery_optimization_close), (dialog, which) -> dialog.dismiss())
|
||||
.setNeutralButton(getString(R.string.battery_optimization_close), (dialog, which) -> dialog.dismiss())
|
||||
.setIcon(R.drawable.ic_battery_alert);
|
||||
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
AlertDialog alertDialog = alertDialogBuilder.show();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(this);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ 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.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -64,12 +64,10 @@ public class AccountRemovalConfirmationDialog extends DialogFragment implements
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getActivity());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -82,7 +80,7 @@ public class AccountRemovalConfirmationDialog extends DialogFragment implements
|
|||
.setPositiveButton(R.string.common_ok,
|
||||
(dialogInterface, i) -> backgroundJobManager.startAccountRemovalJob(user.getAccountName(),
|
||||
false))
|
||||
.setNegativeButton(R.string.common_cancel, null)
|
||||
.setNeutralButton(R.string.common_cancel, null)
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,17 +114,14 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton, color);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton,
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
positiveButton.setOnClickListener(this);
|
||||
positiveButton.setEnabled(false);
|
||||
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
|
||||
|
||||
checkEnablingCreateButton();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,17 +118,13 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton, color);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton, alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
positiveButton.setOnClickListener(this);
|
||||
positiveButton.setEnabled(false);
|
||||
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
|
||||
|
||||
checkEnablingCreateButton();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import android.app.Dialog;
|
|||
import android.os.Bundle;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
@ -75,12 +75,11 @@ public class ConfirmationDialogFragment extends DialogFragment {
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
}
|
||||
|
||||
public void setOnConfirmationListener(ConfirmationDialogFragmentListener listener) {
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
import com.owncloud.android.ui.adapter.LocalFileListAdapter;
|
||||
import com.owncloud.android.ui.adapter.OCFileListAdapter;
|
||||
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;
|
||||
|
||||
|
@ -50,7 +51,6 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
@ -115,11 +115,9 @@ public class ConflictsResolveDialog extends DialogFragment {
|
|||
return;
|
||||
}
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
setPositiveButtonStatus(false);
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton, alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
positiveButton.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -173,7 +171,7 @@ public class ConflictsResolveDialog extends DialogFragment {
|
|||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.common_cancel, (dialog, which) -> {
|
||||
.setNeutralButton(R.string.common_cancel, (dialog, which) -> {
|
||||
if (listener != null) {
|
||||
listener.conflictDecisionMade(Decision.CANCEL);
|
||||
}
|
||||
|
@ -209,7 +207,7 @@ public class ConflictsResolveDialog extends DialogFragment {
|
|||
getContext());
|
||||
|
||||
View.OnClickListener checkBoxClickListener = v -> {
|
||||
setPositiveButtonStatus(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||
positiveButton.setEnabled(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||
};
|
||||
|
||||
binding.newCheckbox.setOnClickListener(checkBoxClickListener);
|
||||
|
@ -217,27 +215,16 @@ public class ConflictsResolveDialog extends DialogFragment {
|
|||
|
||||
binding.newFileContainer.setOnClickListener(v -> {
|
||||
binding.newCheckbox.setChecked(!binding.newCheckbox.isChecked());
|
||||
setPositiveButtonStatus(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||
positiveButton.setEnabled(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||
});
|
||||
binding.existingFileContainer.setOnClickListener(v -> {
|
||||
binding.existingCheckbox.setChecked(!binding.existingCheckbox.isChecked());
|
||||
setPositiveButtonStatus(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||
positiveButton.setEnabled(binding.newCheckbox.isChecked() || binding.existingCheckbox.isChecked());
|
||||
});
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
private void setPositiveButtonStatus(boolean enabled) {
|
||||
if (enabled) {
|
||||
positiveButton.setTextColor(ThemeColorUtils.primaryAccentColor(requireContext()));
|
||||
} else {
|
||||
positiveButton.setTextColor(ResourcesCompat.getColor(requireContext().getResources(),
|
||||
R.color.grey_200,
|
||||
null));
|
||||
}
|
||||
positiveButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void showDialog(AppCompatActivity activity) {
|
||||
Fragment prev = activity.getSupportFragmentManager().findFragmentByTag("dialog");
|
||||
FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
|
||||
|
|
|
@ -36,6 +36,7 @@ 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;
|
||||
|
||||
|
@ -76,12 +77,10 @@ public class CreateFolderDialogFragment
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -104,7 +103,7 @@ public class CreateFolderDialogFragment
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setView(view)
|
||||
.setPositiveButton(R.string.folder_confirm_create, this)
|
||||
.setNegativeButton(R.string.common_cancel, this)
|
||||
.setNeutralButton(R.string.common_cancel, this)
|
||||
.setTitle(R.string.uploader_info_dirname);
|
||||
AlertDialog d = builder.create();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.owncloud.android.R;
|
|||
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.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -79,11 +79,9 @@ public class LocalStoragePathPickerDialogFragment extends DialogFragment
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ 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;
|
||||
|
||||
|
@ -78,12 +79,10 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -105,7 +104,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
|
||||
builder.setView(view)
|
||||
.setPositiveButton(R.string.note_confirm, this)
|
||||
.setNegativeButton(R.string.common_cancel, this)
|
||||
.setNeutralButton(R.string.common_cancel, this)
|
||||
.setTitle(R.string.send_note);
|
||||
Dialog dialog = builder.create();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class RenameFileDialogFragment
|
|||
|
||||
if (alertDialog != null) {
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class RenameFileDialogFragment
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
|
||||
builder.setView(view)
|
||||
.setPositiveButton(R.string.file_rename, this)
|
||||
.setNegativeButton(R.string.common_cancel, this)
|
||||
.setNeutralButton(R.string.common_cancel, this)
|
||||
.setTitle(R.string.rename_dialog_title);
|
||||
Dialog d = builder.create();
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RenamePublicShareDialogFragment
|
|||
|
||||
if (alertDialog != null) {
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class RenamePublicShareDialogFragment
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
|
||||
builder.setView(view)
|
||||
.setPositiveButton(R.string.file_rename, this)
|
||||
.setNegativeButton(R.string.common_cancel, this)
|
||||
.setNeutralButton(R.string.common_cancel, this)
|
||||
.setTitle(R.string.public_share_name);
|
||||
Dialog dialog = builder.create();
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ 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 java.io.IOException;
|
||||
|
@ -84,7 +85,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
private TextView passphraseTextView;
|
||||
private ArbitraryDataProvider arbitraryDataProvider;
|
||||
private Button positiveButton;
|
||||
private Button negativeButton;
|
||||
private Button neutralButton;
|
||||
private DownloadKeysAsyncTask task;
|
||||
private TextView passwordField;
|
||||
private String keyResult;
|
||||
|
@ -108,15 +109,12 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
positiveButton.setTextColor(color);
|
||||
|
||||
negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
||||
negativeButton.setTextColor(color);
|
||||
neutralButton = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton,
|
||||
neutralButton);
|
||||
|
||||
task = new DownloadKeysAsyncTask();
|
||||
task.execute();
|
||||
|
@ -151,7 +149,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
private Dialog createDialog(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setView(v).setPositiveButton(R.string.common_ok, null)
|
||||
.setNegativeButton(R.string.common_cancel, null)
|
||||
.setNeutralButton(R.string.common_cancel, null)
|
||||
.setTitle(R.string.end_to_end_encryption_title);
|
||||
|
||||
Dialog dialog = builder.create();
|
||||
|
@ -217,7 +215,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
case KEY_GENERATE:
|
||||
passphraseTextView.setVisibility(View.GONE);
|
||||
positiveButton.setVisibility(View.GONE);
|
||||
negativeButton.setVisibility(View.GONE);
|
||||
neutralButton.setVisibility(View.GONE);
|
||||
getDialog().setTitle(R.string.end_to_end_encryption_storing_keys);
|
||||
|
||||
GenerateNewKeysAsyncTask newKeysTask = new GenerateNewKeysAsyncTask();
|
||||
|
@ -242,7 +240,7 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
|
||||
textView.setText(R.string.end_to_end_encryption_retrieving_keys);
|
||||
positiveButton.setVisibility(View.INVISIBLE);
|
||||
negativeButton.setVisibility(View.INVISIBLE);
|
||||
neutralButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -402,7 +400,6 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
|
||||
@VisibleForTesting
|
||||
public void showMnemonicInfo() {
|
||||
int color = ThemeColorUtils.primaryAccentColor(getContext());
|
||||
requireDialog().setTitle(R.string.end_to_end_encryption_passphrase_title);
|
||||
|
||||
textView.setText(R.string.end_to_end_encryption_keywords_description);
|
||||
|
@ -413,9 +410,8 @@ public class SetupEncryptionDialogFragment extends DialogFragment {
|
|||
positiveButton.setText(R.string.end_to_end_encryption_confirm_button);
|
||||
positiveButton.setVisibility(View.VISIBLE);
|
||||
|
||||
negativeButton.setVisibility(View.VISIBLE);
|
||||
positiveButton.setTextColor(color);
|
||||
negativeButton.setTextColor(color);
|
||||
neutralButton.setVisibility(View.VISIBLE);
|
||||
ThemeButtonUtils.themeBorderlessButton(positiveButton, neutralButton);
|
||||
|
||||
keyResult = KEY_GENERATE;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ 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;
|
||||
|
||||
|
@ -67,10 +68,10 @@ public class SharePasswordDialogFragment extends DialogFragment implements Dialo
|
|||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
if (alertDialog != null) {
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(ThemeColorUtils.primaryAccentColor(getContext()));
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL)
|
||||
.setTextColor(getResources().getColor(R.color.highlight_textColor_Warning));
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||
ThemeButtonUtils.themeBorderlessButton(getResources().getColor(R.color.highlight_textColor_Warning),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ 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.ThemeColorUtils;
|
||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
@ -80,13 +80,12 @@ public class SyncFileNotEnoughSpaceDialogFragment extends ConfirmationDialogFrag
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = ThemeColorUtils.primaryAccentColor(getActivity());
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
if (alertDialog != null) {
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
ThemeButtonUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL),
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,10 +206,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
mNameCollisionPolicySummary = view.findViewById(R.id.setting_instant_name_collision_policy_summary);
|
||||
|
||||
mCancel = view.findViewById(R.id.cancel);
|
||||
ThemeButtonUtils.themeBorderlessButton(mCancel, accentColor);
|
||||
|
||||
mSave = view.findViewById(R.id.save);
|
||||
ThemeButtonUtils.themeBorderlessButton(mSave, accentColor);
|
||||
|
||||
ThemeButtonUtils.themeBorderlessButton(mCancel, mSave);
|
||||
|
||||
// Set values
|
||||
setEnabled(mSyncedFolder.isEnabled());
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.widget.ImageButton;
|
|||
import com.owncloud.android.R;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/**
|
||||
|
@ -64,22 +65,42 @@ public final class ThemeButtonUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void themeBorderlessButton(Button button, int primaryColor) {
|
||||
if (button == null) {
|
||||
/**
|
||||
* theme buttons based on accent color.
|
||||
*
|
||||
* @param buttons borderless buttons to be themed
|
||||
*/
|
||||
public static void themeBorderlessButton(@Nullable Button... buttons) {
|
||||
if (buttons == null || buttons.length < 1) {
|
||||
return;
|
||||
}
|
||||
themeBorderlessButton(ThemeColorUtils.primaryAccentColor(buttons[0].getContext()), buttons);
|
||||
}
|
||||
|
||||
Context context = button.getContext();
|
||||
/**
|
||||
* theme buttons based on given color.
|
||||
*
|
||||
* @param color theme color
|
||||
* @param buttons borderless buttons to be themed
|
||||
*/
|
||||
public static 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);
|
||||
button.setTextColor(new ColorStateList(
|
||||
ColorStateList colorStateList = new ColorStateList(
|
||||
new int[][]{
|
||||
new int[]{android.R.attr.state_enabled}, // enabled
|
||||
new int[]{-android.R.attr.state_enabled}, // disabled
|
||||
},
|
||||
new int[]{
|
||||
primaryColor,
|
||||
color,
|
||||
disabledColor
|
||||
}
|
||||
));
|
||||
);
|
||||
for (Button button: buttons) {
|
||||
button.setTextColor(colorStateList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|