mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Do not show the discriminator field until one is chosen.
This commit is contained in:
committed by
Cody Henthorne
parent
f484fdbbac
commit
4ce1789110
@@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.LoggingFragment;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.contactshare.SimpleTextWatcher;
|
||||
import org.thoughtcrime.securesms.databinding.UsernameEditFragmentBinding;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.util.FragmentResultContract;
|
||||
import org.thoughtcrime.securesms.util.UsernameUtil;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
@@ -164,8 +165,6 @@ public class UsernameEditFragment extends LoggingFragment {
|
||||
}
|
||||
|
||||
private void onUiStateChanged(@NonNull UsernameEditViewModel.State state) {
|
||||
TextInputLayout usernameInputWrapper = binding.usernameTextWrapper;
|
||||
|
||||
presentProgressState(state.usernameState);
|
||||
presentButtonState(state.buttonState);
|
||||
presentSummary(state.usernameState);
|
||||
@@ -196,6 +195,14 @@ public class UsernameEditFragment extends LoggingFragment {
|
||||
binding.usernameError.setVisibility(error != null ? View.VISIBLE : View.GONE);
|
||||
binding.usernameError.setText(error);
|
||||
binding.root.setLayoutTransition(STATIC_LAYOUT);
|
||||
|
||||
if (state.usernameState.getDiscriminator() == null && SignalStore.account().getUsername() == null) {
|
||||
binding.discriminatorText.setVisibility(View.GONE);
|
||||
binding.divider.setVisibility(View.GONE);
|
||||
} else {
|
||||
binding.discriminatorText.setVisibility(View.VISIBLE);
|
||||
binding.divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void presentButtonState(@NonNull UsernameEditViewModel.ButtonState buttonState) {
|
||||
|
||||
@@ -40,8 +40,9 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/username_edit_box_fill"
|
||||
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
||||
app:layout_constraintBottom_toBottomOf="@id/username_text_wrapper"
|
||||
app:layout_constraintEnd_toEndOf="@id/discriminator_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/username_text_wrapper"
|
||||
app:layout_constraintTop_toTopOf="@id/username_text_wrapper" />
|
||||
|
||||
@@ -86,7 +87,6 @@
|
||||
style="@style/Signal.Text.BodyLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
||||
android:background="@null"
|
||||
android:hint="@string/UsernameEditFragment__00"
|
||||
android:imeOptions="actionDone"
|
||||
@@ -98,7 +98,7 @@
|
||||
android:paddingHorizontal="16dp"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/username_text_wrapper"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/username_box_fill"
|
||||
tools:text="21" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
|
||||
Reference in New Issue
Block a user