Change Nav bar style to use system nav (new style for Nexus N+)

Bug: 27612740

Change-Id: I309cf8252285130a0e1d2c03ca664706e73cce16
This commit is contained in:
Anna Galusza
2016-03-30 17:25:36 -07:00
parent 83c2670cda
commit 6b1e9dbea4
3 changed files with 4 additions and 84 deletions

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/suw_main_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<com.android.setupwizardlib.view.NavigationBar
android:id="@+id/suw_navigation_bar"
style="@style/SuwNavBarTheme"
android:layout_width="match_parent"
android:layout_height="@dimen/suw_navbar_height"
android:accessibilityTraversalAfter="@id/suw_main_content" />
</LinearLayout>

View File

@@ -385,7 +385,6 @@ public class SettingsActivity extends SettingsDrawerActivity
private boolean mIsShowingDashboard;
private boolean mIsShortcut;
private int mMainContentId = R.id.main_content;
private ViewGroup mContent;
private SearchView mSearchView;
@@ -558,7 +557,7 @@ public class SettingsActivity extends SettingsDrawerActivity
setContentView(mIsShowingDashboard ?
R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
mContent = (ViewGroup) findViewById(mMainContentId);
mContent = (ViewGroup) findViewById(R.id.main_content);
getFragmentManager().addOnBackStackChangedListener(this);
@@ -687,14 +686,6 @@ public class SettingsActivity extends SettingsDrawerActivity
+ " ms");
}
/**
* Sets the id of the view containing 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) {
@@ -975,7 +966,7 @@ public class SettingsActivity extends SettingsDrawerActivity
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(mMainContentId, fragment);
transaction.replace(R.id.main_content, fragment);
if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
@@ -996,7 +987,7 @@ public class SettingsActivity extends SettingsDrawerActivity
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(mMainContentId, f);
transaction.replace(R.id.main_content, f);
if (withTransition) {
TransitionManager.beginDelayedTransition(mContent);
}
@@ -1193,7 +1184,7 @@ public class SettingsActivity extends SettingsDrawerActivity
if (mSearchResultsFragment != null) {
return;
}
Fragment current = getFragmentManager().findFragmentById(mMainContentId);
Fragment current = getFragmentManager().findFragmentById(R.id.main_content);
if (current != null && current instanceof SearchResultsSummary) {
mSearchResultsFragment = (SearchResultsSummary) current;
} else {

View File

@@ -42,46 +42,11 @@ public class AccessibilitySettingsForSetupWizardActivity extends SettingsActivit
@Override
protected void onCreate(Bundle savedState) {
// Main content frame id should be set before calling super as that is where the first
// Fragment is inflated.
setMainContentId(R.id.suw_main_content);
super.onCreate(savedState);
// Finish configuring the content view.
FrameLayout parentLayout = (FrameLayout) findViewById(R.id.main_content);
LayoutInflater.from(this)
.inflate(R.layout.accessibility_settings_for_suw, parentLayout);
getActionBar().setDisplayHomeAsUpEnabled(true);
setIsDrawerPresent(false);
// Hide System Nav Bar.
SystemBarHelper.hideSystemBars(getWindow());
LinearLayout parentView = (LinearLayout) findViewById(R.id.content_parent);
parentView.setFitsSystemWindows(false);
// Adjust for the Status Bar.
parentView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
parentView.setPadding(0, insets.getSystemWindowInsetTop(), 0, 0);
return insets;
}
});
// Show SUW Nav Bar.
NavigationBar navigationBar = (NavigationBar) findViewById(R.id.suw_navigation_bar);
navigationBar.getNextButton().setVisibility(View.GONE);
navigationBar.setNavigationBarListener(new NavigationBar.NavigationBarListener() {
@Override
public void onNavigateBack() {
onNavigateUp();
}
@Override
public void onNavigateNext() {
// Do nothing. We don't show this button.
}
});
}
@Override