From 5dca0b41f0b1adf3b55de649ae9936713ad5df20 Mon Sep 17 00:00:00 2001 From: Jakob Nixdorf Date: Fri, 19 Jun 2020 07:02:21 +0200 Subject: [PATCH] Accessibility improvements (part 2) --- .../flocke/andotp/Activities/MainActivity.java | 18 ++++++++++++++++++ app/src/main/res/values/strings_main.xml | 2 ++ 2 files changed, 20 insertions(+) diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java b/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java index 56c8538d..f913b44d 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Activities/MainActivity.java @@ -208,6 +208,8 @@ public class MainActivity extends BaseActivity speedDial = findViewById(R.id.speedDial); speedDial.inflate(R.menu.menu_fab); + speedDial.getMainFab().setContentDescription(getString(R.string.button_add)); + speedDial.setOnActionSelectedListener(new SpeedDialView.OnActionSelectedListener() { @Override public boolean onActionSelected(SpeedDialActionItem speedDialActionItem) { @@ -227,6 +229,22 @@ public class MainActivity extends BaseActivity } }); + speedDial.setOnChangeListener(new SpeedDialView.OnChangeListener() { + @Override + public boolean onMainActionSelected() { + return false; + } + + @Override + public void onToggleChanged(boolean isOpen) { + if (isOpen) { + speedDial.getMainFab().setContentDescription(getString(R.string.button_close_menu)); + } else { + speedDial.getMainFab().setContentDescription(getString(R.string.button_add)); + } + } + }); + final ProgressBar progressBar = findViewById(R.id.progressBar); progressBar.setVisibility(settings.isHideGlobalTimeoutEnabled() ? View.GONE : View.VISIBLE); diff --git a/app/src/main/res/values/strings_main.xml b/app/src/main/res/values/strings_main.xml index 30fa70c2..50a9fed1 100644 --- a/app/src/main/res/values/strings_main.xml +++ b/app/src/main/res/values/strings_main.xml @@ -62,6 +62,8 @@ More options for %1$s Copy token Copy %1$s token + Add new account + Close menu Authentication failed, please try again!