Skip to content

Commit

Permalink
announcing help - only once
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurzaczek committed May 14, 2014
1 parent 1914393 commit f68e101
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
10 changes: 10 additions & 0 deletions src/net/zaczek/launcherforblind/DialerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions src/net/zaczek/launcherforblind/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
5 changes: 3 additions & 2 deletions src/net/zaczek/launcherforblind/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public void onUtteranceCompleted(String utteranceId) {
onTTSCompleted();
}
});

announceHelp();
}

@Override
Expand Down

0 comments on commit f68e101

Please sign in to comment.