From f68e101debeaa30accfed4d7bc970ce818b04a37 Mon Sep 17 00:00:00 2001 From: Arthur Zaczek Date: Wed, 14 May 2014 15:21:31 +0200 Subject: [PATCH] announcing help - only once --- src/net/zaczek/launcherforblind/DialerActivity.java | 10 ++++++++++ src/net/zaczek/launcherforblind/MainActivity.java | 10 +++++++--- src/net/zaczek/launcherforblind/Settings.java | 5 +++-- .../activitysupport/AbstractActivity.java | 2 ++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/net/zaczek/launcherforblind/DialerActivity.java b/src/net/zaczek/launcherforblind/DialerActivity.java index 9b4e2c4..249eb9f 100644 --- a/src/net/zaczek/launcherforblind/DialerActivity.java +++ b/src/net/zaczek/launcherforblind/DialerActivity.java @@ -52,6 +52,16 @@ public void onCreate(Bundle savedInstanceState) { txtCurrentDigit = (TextView) findViewById(R.id.txtCurrentDigit); txtCurrentDigit.setText(R.string.digit_help); } + + @Override + protected boolean announceHelp() { + if (Settings.announceDialerHelp()) { + say(getString(R.string.digit_help)); + Settings.updateAnnounceDialerHelp(); + return true; + } + return false; + } @Override public boolean onTouchEvent(MotionEvent event) { diff --git a/src/net/zaczek/launcherforblind/MainActivity.java b/src/net/zaczek/launcherforblind/MainActivity.java index 9ffeb82..39dd521 100644 --- a/src/net/zaczek/launcherforblind/MainActivity.java +++ b/src/net/zaczek/launcherforblind/MainActivity.java @@ -45,10 +45,14 @@ protected ListEntry[] getList() { protected void giveFeedback(String label) { txtMain.setText(label); } - + @Override protected boolean announceHelp() { - say(getString(R.string.main_help)); - return true; + if (Settings.announceMainHelp()) { + say(getString(R.string.main_help)); + Settings.updateAnnounceMainHelp(); + return true; + } + return false; } } diff --git a/src/net/zaczek/launcherforblind/Settings.java b/src/net/zaczek/launcherforblind/Settings.java index e34f043..09b9976 100644 --- a/src/net/zaczek/launcherforblind/Settings.java +++ b/src/net/zaczek/launcherforblind/Settings.java @@ -20,7 +20,8 @@ public static boolean announceMainHelp() { public synchronized static void updateAnnounceMainHelp() { load(); - sharedPref.edit().putBoolean("announceMainHelp", true).commit(); + sharedPref.edit().putBoolean("announceMainHelp", false).commit(); + sharedPref = null; } public static boolean announceDialerHelp() { @@ -30,6 +31,6 @@ public static boolean announceDialerHelp() { public synchronized static void updateAnnounceDialerHelp() { load(); - sharedPref.edit().putBoolean("announceDialerHelp", true).commit(); + sharedPref.edit().putBoolean("announceDialerHelp", false).commit(); } } diff --git a/src/net/zaczek/launcherforblind/activitysupport/AbstractActivity.java b/src/net/zaczek/launcherforblind/activitysupport/AbstractActivity.java index 1bad9fd..ae6c23c 100644 --- a/src/net/zaczek/launcherforblind/activitysupport/AbstractActivity.java +++ b/src/net/zaczek/launcherforblind/activitysupport/AbstractActivity.java @@ -50,6 +50,8 @@ public void onUtteranceCompleted(String utteranceId) { onTTSCompleted(); } }); + + announceHelp(); } @Override