Second round of MD3 review feedback

This commit is contained in:
Torsten Grote
2024-06-03 11:44:43 -03:00
parent 03196b65ab
commit 675e984eaa
15 changed files with 20 additions and 163 deletions

View File

@@ -55,6 +55,7 @@ public class NicknameFragment extends BaseFragment {
private TextInputLayout contactNameLayout;
private TextInputEditText contactNameInput;
private BriarButton addButton;
@Override
public String getUniqueTag() {
@@ -91,7 +92,7 @@ public class NicknameFragment extends BaseFragment {
contactNameLayout = v.findViewById(R.id.contactNameLayout);
contactNameInput = v.findViewById(R.id.contactNameInput);
BriarButton addButton = v.findViewById(R.id.addButton);
addButton = v.findViewById(R.id.addButton);
addButton.setOnClickListener(view -> onAddButtonClicked());
return v;
@@ -112,7 +113,7 @@ public class NicknameFragment extends BaseFragment {
@Nullable
private String getNicknameOrNull() {
Editable text = contactNameInput.getText();
if (text == null || text.toString().trim().length() == 0) {
if (text == null || text.toString().trim().isEmpty()) {
contactNameLayout.setError(getString(R.string.nickname_missing));
contactNameInput.requestFocus();
return null;
@@ -129,7 +130,10 @@ public class NicknameFragment extends BaseFragment {
private void onAddButtonClicked() {
String name = getNicknameOrNull();
if (name == null) return; // invalid nickname
if (name == null) { // invalid nickname
addButton.reset();
return;
}
LifecycleOwner owner = getViewLifecycleOwner();
viewModel.getAddContactResult().observe(owner, result -> {

View File

@@ -26,7 +26,9 @@ public class BriarSnackbarBuilder {
public Snackbar make(View view, CharSequence text, int duration) {
Snackbar s = Snackbar.make(view, text, duration);
s.getView().setBackgroundResource(backgroundResId);
s.setBackgroundTint(getColor(view.getContext(), backgroundResId));
s.setTextColor(
getColor(view.getContext(), R.color.md_theme_onSecondary));
if (onClickListener != null) {
s.setActionTextColor(getColor(view.getContext(),
R.color.briar_button_text_positive));

View File

@@ -49,7 +49,7 @@ public class BriarButton extends FrameLayout {
ContextThemeWrapper wrapper = new ContextThemeWrapper(context, style);
button = isInEditMode() ? new MaterialButton(context) :
new MaterialButton(wrapper);
new MaterialButton(wrapper, null, style);
button.setText(text);
addView(button);
progressBar = findViewById(R.id.briar_button_progress_bar);