Add screen for turning TalkBack on and off and remove intent to launch TB

tutorial from SUW. Also fix how Fragments are displayed (Fragment Views
were being inflated incorrectly causing bugs like the one where TB would
still see the hub elements on child screens) and  remove ripple from 
non-selectable text.
Bug: 27203716
Bug: 27218687
Bug: 27066012
Bug: 27587193

Change-Id: I4c6724b3ff6d6a7fca3d0f419a5e1c82ee1071d5
This commit is contained in:
Anna Galusza
2016-03-04 18:41:35 -08:00
parent e263401610
commit 2f1c11314b
4 changed files with 87 additions and 114 deletions

View File

@@ -372,6 +372,7 @@ public class SettingsActivity extends SettingsDrawerActivity
private boolean mIsShowingDashboard;
private boolean mIsShortcut;
private int mMainContentId = R.id.main_content;
private ViewGroup mContent;
private SearchView mSearchView;
@@ -546,7 +547,7 @@ public class SettingsActivity extends SettingsDrawerActivity
setContentView(mIsShowingDashboard ?
R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
mContent = (ViewGroup) findViewById(R.id.main_content);
mContent = (ViewGroup) findViewById(mMainContentId);
getFragmentManager().addOnBackStackChangedListener(this);
@@ -680,6 +681,14 @@ public class SettingsActivity extends SettingsDrawerActivity
+ " ms");
}
/**
* Sets the id of the view continaing the main content. Should be called before calling super's
* onCreate.
*/
protected void setMainContentId(int contentId) {
mMainContentId = contentId;
}
private void setTitleFromIntent(Intent intent) {
final int initialTitleResId = intent.getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1);
if (initialTitleResId > 0) {
@@ -962,7 +971,7 @@ public class SettingsActivity extends SettingsDrawerActivity
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, fragment);
transaction.replace(mMainContentId, fragment);
if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
@@ -983,7 +992,7 @@ public class SettingsActivity extends SettingsDrawerActivity
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, f);
transaction.replace(mMainContentId, f);
if (withTransition) {
TransitionManager.beginDelayedTransition(mContent);
}
@@ -1179,7 +1188,7 @@ public class SettingsActivity extends SettingsDrawerActivity
if (mSearchResultsFragment != null) {
return;
}
Fragment current = getFragmentManager().findFragmentById(R.id.main_content);
Fragment current = getFragmentManager().findFragmentById(mMainContentId);
if (current != null && current instanceof SearchResultsSummary) {
mSearchResultsFragment = (SearchResultsSummary) current;
} else {