Merge "Allow fragments set their own header view below actionbar." into nyc-mr1-dev
This commit is contained in:
@@ -40,6 +40,11 @@
|
|||||||
style="?android:attr/toolbarStyle"
|
style="?android:attr/toolbarStyle"
|
||||||
android:background="?android:attr/colorPrimary" />
|
android:background="?android:attr/colorPrimary" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/content_header_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="?android:attr/actionBarStyle" />
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/content_frame"
|
android:id="@+id/content_frame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ import android.view.ViewGroup;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
|
||||||
import com.android.settingslib.R;
|
import com.android.settingslib.R;
|
||||||
import com.android.settingslib.applications.InterestingConfigChanges;
|
import com.android.settingslib.applications.InterestingConfigChanges;
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ public class SettingsDrawerActivity extends Activity {
|
|||||||
private final List<CategoryListener> mCategoryListeners = new ArrayList<>();
|
private final List<CategoryListener> mCategoryListeners = new ArrayList<>();
|
||||||
|
|
||||||
private SettingsDrawerAdapter mDrawerAdapter;
|
private SettingsDrawerAdapter mDrawerAdapter;
|
||||||
|
private FrameLayout mContentHeaderContainer;
|
||||||
private DrawerLayout mDrawerLayout;
|
private DrawerLayout mDrawerLayout;
|
||||||
private boolean mShowingMenu;
|
private boolean mShowingMenu;
|
||||||
|
|
||||||
@@ -78,6 +81,7 @@ public class SettingsDrawerActivity extends Activity {
|
|||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
}
|
}
|
||||||
super.setContentView(R.layout.settings_with_drawer);
|
super.setContentView(R.layout.settings_with_drawer);
|
||||||
|
mContentHeaderContainer = (FrameLayout) findViewById(R.id.content_header_container);
|
||||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
if (mDrawerLayout == null) {
|
if (mDrawerLayout == null) {
|
||||||
return;
|
return;
|
||||||
@@ -174,6 +178,13 @@ public class SettingsDrawerActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContentHeaderView(View headerView) {
|
||||||
|
mContentHeaderContainer.removeAllViews();
|
||||||
|
if (headerView != null) {
|
||||||
|
mContentHeaderContainer.addView(headerView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(@LayoutRes int layoutResID) {
|
public void setContentView(@LayoutRes int layoutResID) {
|
||||||
final ViewGroup parent = (ViewGroup) findViewById(R.id.content_frame);
|
final ViewGroup parent = (ViewGroup) findViewById(R.id.content_frame);
|
||||||
|
|||||||
Reference in New Issue
Block a user