Skip to content

Commit

Permalink
Cursor focus improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrebane committed May 27, 2024
1 parent 09be171 commit 71d7f0f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/ee/ria/DigiDoc/android/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ public final class Constants {

public static final Object VOID = new Object();

/*
* Relying Party
*/
public static final String SETTINGS_DEFAULT_RELYING_PARTY_UUID = "00000000-0000-0000-0000-000000000000";

/*
* Request codes for startActivityForResult
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
public void onTextChanged(CharSequence s, int start, int before, int count) {
summary.setSingleLine(summary.getText() != null && summary.getText().length() != 0);
handleTsaUrlContentDescription(view, checkBox);
if (summary.getText().toString().isEmpty()) {
summary.setHint(configurationProvider.getTsaUrl());
summary.setContentDescription(getResources().getText(R.string.main_settings_tsa_url_title));
} else {
summary.setHint("");
summary.setContentDescription("");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package ee.ria.DigiDoc.android.main.settings.signing;

import static android.view.accessibility.AccessibilityEvent.TYPE_ANNOUNCEMENT;
import static ee.ria.DigiDoc.android.Constants.SETTINGS_DEFAULT_RELYING_PARTY_UUID;

import android.content.Context;
import android.text.TextUtils;
Expand Down Expand Up @@ -92,7 +93,7 @@ public CheckBox getCheckBox() {
public CharSequence getSummary() {
String text = getText();
if (TextUtils.isEmpty(text)) {
return "00000000-0000-0000-0000-000000000000";
return SETTINGS_DEFAULT_RELYING_PARTY_UUID;
}
char[] password = new char[text.length()];
Arrays.fill(password, '·');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package ee.ria.DigiDoc.android.main.settings.signing;

import static android.view.accessibility.AccessibilityEvent.TYPE_ANNOUNCEMENT;
import static ee.ria.DigiDoc.android.Constants.SETTINGS_DEFAULT_RELYING_PARTY_UUID;

import android.app.Dialog;
import android.graphics.Color;
Expand Down Expand Up @@ -82,7 +83,7 @@ protected void onBindDialogView(@NonNull View view) {
if (appCompatEditText != null) {
setAccessibilityForEditText(uuidPreference, appCompatEditText, appCompatTextView);
if (AccessibilityUtils.isTalkBackEnabled()) {
AccessibilityUtils.setTextViewContentDescription(getContext(), true, "00000000-0000-0000-0000-000000000000", appCompatTextView.getText().toString(), appCompatEditText);
AccessibilityUtils.setTextViewContentDescription(getContext(), true, SETTINGS_DEFAULT_RELYING_PARTY_UUID, appCompatTextView.getText().toString(), appCompatEditText);
}
}

Expand Down Expand Up @@ -123,6 +124,13 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
handleUuidUrlContentDescription(view, checkBox);
if (summary.getText().toString().isEmpty()) {
summary.setHint(SETTINGS_DEFAULT_RELYING_PARTY_UUID);
summary.setContentDescription(getResources().getText(R.string.main_settings_uuid_title));
} else {
summary.setHint("");
summary.setContentDescription("");
}
}

@Override
Expand Down Expand Up @@ -150,7 +158,7 @@ private void setAccessibilityForEditText(
private void disableTextViewOnChecked(AppCompatEditText appCompatEditText) {
appCompatEditText.setText(null);
appCompatEditText.setSingleLine(false);
appCompatEditText.setHint("00000000-0000-0000-0000-000000000000");
appCompatEditText.setHint(SETTINGS_DEFAULT_RELYING_PARTY_UUID);
appCompatEditText.clearFocus();
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/signature_update_mobile_id.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@
android:id="@id/signatureUpdateMobileIdPhoneNo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:inputType="phone|textNoSuggestions"
android:digits="0123456789"
android:imeOptions="actionDone"
android:lines="1"
android:maxLines="1"
android:hint="@string/mobile_id_country_code_and_phone_number_placeholder"
android:accessibilityTraversalAfter="@id/signatureUpdateMobileIdPhoneNoText"
android:minHeight="@dimen/material_baseline_grid_6x"
android:importantForAutofill="no"
android:autofillHints=""
android:background="@drawable/bottom_border_background"/>

</com.google.android.material.textfield.TextInputLayout>
Expand Down

0 comments on commit 71d7f0f

Please sign in to comment.