mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Second round of MD3 review feedback
This commit is contained in:
@@ -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 -> {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user