Design improvements for registration flow.

This commit is contained in:
Nicholas
2023-01-31 09:21:13 -05:00
committed by Nicholas Tinsley
parent cb01692a50
commit c3bcba6380
16 changed files with 115 additions and 65 deletions

View File

@@ -11,6 +11,7 @@ class VerificationCodeView @JvmOverloads constructor(context: Context, attrs: At
private val containers: MutableList<TextInputLayout> = ArrayList(6)
private var listener: OnCodeEnteredListener? = null
private var index = 0
init {
inflate(context, R.layout.verification_code_view, this)
containers.add(findViewById(R.id.container_zero))
@@ -19,6 +20,8 @@ class VerificationCodeView @JvmOverloads constructor(context: Context, attrs: At
containers.add(findViewById(R.id.container_three))
containers.add(findViewById(R.id.container_four))
containers.add(findViewById(R.id.container_five))
containers.forEach { it.editText?.showSoftInputOnFocus = false }
}
fun setOnCompleteListener(listener: OnCodeEnteredListener?) {
@@ -31,7 +34,10 @@ class VerificationCodeView @JvmOverloads constructor(context: Context, attrs: At
if (index == containers.size) {
listener?.onCodeComplete(containers.joinToString("") { it.editText?.text.toString() })
return
}
containers[index].editText?.requestFocus()
}
fun delete() {

View File

@@ -42,12 +42,6 @@ public final class RegistrationNavigationActivity extends AppCompatActivity {
return intent;
}
@Override
protected void attachBaseContext(@NonNull Context newBase) {
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
super.attachBaseContext(newBase);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@@ -9,6 +9,8 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.Toast;
@@ -126,6 +128,14 @@ public final class EnterPhoneNumberFragment extends LoggingFragment implements R
if (supportActionBar != null) {
supportActionBar.setTitle(null);
}
controller.prepopulateCountryCode();
showKeyboard(number.getEditText());
}
private void showKeyboard(View viewToFocus) {
viewToFocus.requestFocus();
InputMethodManager imm = (InputMethodManager) requireContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(viewToFocus, InputMethodManager.SHOW_IMPLICIT);
}
@Override

View File

@@ -43,6 +43,10 @@ class RegistrationNumberInputController(
spinnerView.addTextChangedListener(CountryCodeEntryListener())
}
fun prepopulateCountryCode() {
spinnerView.setText(supportedCountryPrefixes[0].toString())
}
private fun advanceToPhoneNumberInput() {
if (!isUpdating) {
phoneNumberInputLayout.requestFocus()