import android.app.FragmentTransaction;
import android.os.Bundle;
import android.text.TextUtils;
+import android.view.accessibility.AccessibilityEvent;
import android.view.Menu;
import android.view.View;
public class AccessibilitySettingsForSetupWizardActivity extends SettingsActivity {
+ private boolean mSendExtraWindowStateChanged;
+
@Override
protected void onCreate(Bundle savedState) {
super.onCreate(savedState);
}
@Override
+ public void onResume() {
+ super.onResume();
+ mSendExtraWindowStateChanged = false;
+ }
+
+ @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Return true, so we get notified when items in the menu are clicked.
return true;
@Override
public boolean onNavigateUp() {
onBackPressed();
+
+ // Clear accessibility focus and let the screen reader announce the new title.
+ getWindow().getDecorView()
+ .sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+
return true;
}
// Start the new Fragment.
args.putInt(SettingsPreferenceFragment.HELP_URI_RESOURCE_KEY, 0);
startPreferenceFragment(Fragment.instantiate(this, fragmentClass, args), true);
+ mSendExtraWindowStateChanged = true;
+ }
+
+ @Override
+ public void onAttachFragment(Fragment fragment) {
+ if (mSendExtraWindowStateChanged) {
+ // Clear accessibility focus and let the screen reader announce the new title.
+ getWindow().getDecorView()
+ .sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ }
}
/**