Loading core/java/android/app/FragmentBreadCrumbs.java +10 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ public class FragmentBreadCrumbs extends ViewGroup private OnBreadCrumbClickListener mOnBreadCrumbClickListener; private int mGravity; private int mLayoutResId; private int mTextColor; private static final int DEFAULT_GRAVITY = Gravity.START | Gravity.CENTER_VERTICAL; Loading Loading @@ -103,6 +105,12 @@ public class FragmentBreadCrumbs extends ViewGroup mGravity = a.getInt(com.android.internal.R.styleable.FragmentBreadCrumbs_gravity, DEFAULT_GRAVITY); mLayoutResId = a.getResourceId( com.android.internal.R.styleable.FragmentBreadCrumbs_itemLayout, com.android.internal.R.layout.fragment_bread_crumb_item); mTextColor = a.getColor( com.android.internal.R.styleable.FragmentBreadCrumbs_itemColor, 0); a.recycle(); } Loading Loading @@ -311,12 +319,11 @@ public class FragmentBreadCrumbs extends ViewGroup } } if (i >= numViews) { final View item = mInflater.inflate( com.android.internal.R.layout.fragment_bread_crumb_item, this, false); final View item = mInflater.inflate(mLayoutResId, this, false); final TextView text = (TextView) item.findViewById(com.android.internal.R.id.title); text.setText(bse.getBreadCrumbTitle()); text.setTag(bse); text.setTextColor(mTextColor); if (i == 0) { item.findViewById(com.android.internal.R.id.left_icon).setVisibility(View.GONE); } Loading core/java/android/preference/PreferenceActivity.java +42 −6 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ public abstract class PreferenceActivity extends ListActivity implements private Button mNextButton; private int mPreferenceHeaderItemResId = 0; private boolean mPreferenceHeaderRemoveEmptyIcon = false; /** * The starting request code given out to preference framework. */ Loading Loading @@ -258,10 +261,15 @@ public abstract class PreferenceActivity extends ListActivity implements } private LayoutInflater mInflater; private int mLayoutResId; private boolean mRemoveIconIfEmpty; public HeaderAdapter(Context context, List<Header> objects) { public HeaderAdapter(Context context, List<Header> objects, int layoutResId, boolean removeIconBehavior) { super(context, 0, objects); mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mLayoutResId = layoutResId; mRemoveIconIfEmpty = removeIconBehavior; } @Override Loading @@ -270,8 +278,7 @@ public abstract class PreferenceActivity extends ListActivity implements View view; if (convertView == null) { view = mInflater.inflate(com.android.internal.R.layout.preference_header_item, parent, false); view = mInflater.inflate(mLayoutResId, parent, false); holder = new HeaderViewHolder(); holder.icon = (ImageView) view.findViewById(com.android.internal.R.id.icon); holder.title = (TextView) view.findViewById(com.android.internal.R.id.title); Loading @@ -284,7 +291,16 @@ public abstract class PreferenceActivity extends ListActivity implements // All view fields must be updated every time, because the view may be recycled Header header = getItem(position); if (mRemoveIconIfEmpty) { if (header.iconRes == 0) { holder.icon.setVisibility(View.GONE); } else { holder.icon.setVisibility(View.VISIBLE); holder.icon.setImageResource(header.iconRes); } } else { holder.icon.setImageResource(header.iconRes); } holder.title.setText(header.getTitle(getContext().getResources())); CharSequence summary = header.getSummary(getContext().getResources()); if (!TextUtils.isEmpty(summary)) { Loading Loading @@ -512,7 +528,26 @@ public abstract class PreferenceActivity extends ListActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.android.internal.R.layout.preference_list_content); // Theming for the PreferenceActivity layout and for the Preference Header(s) layout TypedArray sa = obtainStyledAttributes(null, com.android.internal.R.styleable.PreferenceActivity, com.android.internal.R.attr.preferenceActivityStyle, 0); final int layoutResId = sa.getResourceId( com.android.internal.R.styleable.PreferenceActivity_layout, com.android.internal.R.layout.preference_list_content); mPreferenceHeaderItemResId = sa.getResourceId( com.android.internal.R.styleable.PreferenceActivity_headerLayout, com.android.internal.R.layout.preference_header_item); mPreferenceHeaderRemoveEmptyIcon = sa.getBoolean( com.android.internal.R.styleable.PreferenceActivity_headerRemoveIconIfEmpty, false); sa.recycle(); setContentView(layoutResId); mListFooter = (FrameLayout)findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs_frame); Loading Loading @@ -582,7 +617,8 @@ public abstract class PreferenceActivity extends ListActivity implements showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } else if (mHeaders.size() > 0) { setListAdapter(new HeaderAdapter(this, mHeaders)); setListAdapter(new HeaderAdapter(this, mHeaders, mPreferenceHeaderItemResId, mPreferenceHeaderRemoveEmptyIcon)); if (!mSinglePane) { // Multi-pane. getListView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); Loading core/res/res/layout-xlarge/breadcrumbs_in_fragment_material.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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:id="@+android:id/breadcrumb_section" android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_marginStart="@dimen/preference_breadcrumbs_padding_start_material" android:layout_marginEnd="@dimen/preference_breadcrumbs_padding_end_material" > <android.app.FragmentBreadCrumbs android:id="@android:id/title" android:layout_height="72dip" android:layout_width="match_parent" android:paddingTop="16dip" android:paddingBottom="8dip" android:gravity="center_vertical|start" /> </LinearLayout> No newline at end of file core/res/res/layout/fragment_bread_crumb_item_material.xml 0 → 100644 +41 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 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="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" > <ImageView android:id="@android:id/left_icon" android:src="?attr/dividerVertical" android:layout_width="wrap_content" android:layout_height="match_parent" android:scaleType="fitXY" android:layout_marginTop="12dip" android:layout_marginBottom="12dip" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="8dip" android:paddingEnd="8dip" android:gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceMedium" android:background="?android:attr/selectableItemBackground" /> </LinearLayout> No newline at end of file core/res/res/layout/preference_header_item_material.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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. --> <!-- Layout of a header item in PreferenceActivity. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="48dp" android:background="?android:attr/activatedBackgroundIndicator" android:gravity="center_vertical" android:paddingStart="24dip" android:paddingEnd="?android:attr/scrollbarSize"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="0dip" android:layout_marginEnd="8dip" android:layout_gravity="center" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="0dip" android:layout_marginEnd="6dip" android:layout_marginTop="6dip" android:layout_marginBottom="6dip" android:layout_weight="1"> <TextView android:id="@+android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceMedium" android:ellipsize="marquee" android:fadingEdge="horizontal" /> <TextView android:id="@+android:id/summary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@android:id/title" android:layout_alignStart="@android:id/title" android:textAppearance="?android:attr/textAppearanceSmall" android:ellipsize="end" android:maxLines="2" /> </RelativeLayout> </LinearLayout> Loading
core/java/android/app/FragmentBreadCrumbs.java +10 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ public class FragmentBreadCrumbs extends ViewGroup private OnBreadCrumbClickListener mOnBreadCrumbClickListener; private int mGravity; private int mLayoutResId; private int mTextColor; private static final int DEFAULT_GRAVITY = Gravity.START | Gravity.CENTER_VERTICAL; Loading Loading @@ -103,6 +105,12 @@ public class FragmentBreadCrumbs extends ViewGroup mGravity = a.getInt(com.android.internal.R.styleable.FragmentBreadCrumbs_gravity, DEFAULT_GRAVITY); mLayoutResId = a.getResourceId( com.android.internal.R.styleable.FragmentBreadCrumbs_itemLayout, com.android.internal.R.layout.fragment_bread_crumb_item); mTextColor = a.getColor( com.android.internal.R.styleable.FragmentBreadCrumbs_itemColor, 0); a.recycle(); } Loading Loading @@ -311,12 +319,11 @@ public class FragmentBreadCrumbs extends ViewGroup } } if (i >= numViews) { final View item = mInflater.inflate( com.android.internal.R.layout.fragment_bread_crumb_item, this, false); final View item = mInflater.inflate(mLayoutResId, this, false); final TextView text = (TextView) item.findViewById(com.android.internal.R.id.title); text.setText(bse.getBreadCrumbTitle()); text.setTag(bse); text.setTextColor(mTextColor); if (i == 0) { item.findViewById(com.android.internal.R.id.left_icon).setVisibility(View.GONE); } Loading
core/java/android/preference/PreferenceActivity.java +42 −6 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ public abstract class PreferenceActivity extends ListActivity implements private Button mNextButton; private int mPreferenceHeaderItemResId = 0; private boolean mPreferenceHeaderRemoveEmptyIcon = false; /** * The starting request code given out to preference framework. */ Loading Loading @@ -258,10 +261,15 @@ public abstract class PreferenceActivity extends ListActivity implements } private LayoutInflater mInflater; private int mLayoutResId; private boolean mRemoveIconIfEmpty; public HeaderAdapter(Context context, List<Header> objects) { public HeaderAdapter(Context context, List<Header> objects, int layoutResId, boolean removeIconBehavior) { super(context, 0, objects); mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mLayoutResId = layoutResId; mRemoveIconIfEmpty = removeIconBehavior; } @Override Loading @@ -270,8 +278,7 @@ public abstract class PreferenceActivity extends ListActivity implements View view; if (convertView == null) { view = mInflater.inflate(com.android.internal.R.layout.preference_header_item, parent, false); view = mInflater.inflate(mLayoutResId, parent, false); holder = new HeaderViewHolder(); holder.icon = (ImageView) view.findViewById(com.android.internal.R.id.icon); holder.title = (TextView) view.findViewById(com.android.internal.R.id.title); Loading @@ -284,7 +291,16 @@ public abstract class PreferenceActivity extends ListActivity implements // All view fields must be updated every time, because the view may be recycled Header header = getItem(position); if (mRemoveIconIfEmpty) { if (header.iconRes == 0) { holder.icon.setVisibility(View.GONE); } else { holder.icon.setVisibility(View.VISIBLE); holder.icon.setImageResource(header.iconRes); } } else { holder.icon.setImageResource(header.iconRes); } holder.title.setText(header.getTitle(getContext().getResources())); CharSequence summary = header.getSummary(getContext().getResources()); if (!TextUtils.isEmpty(summary)) { Loading Loading @@ -512,7 +528,26 @@ public abstract class PreferenceActivity extends ListActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.android.internal.R.layout.preference_list_content); // Theming for the PreferenceActivity layout and for the Preference Header(s) layout TypedArray sa = obtainStyledAttributes(null, com.android.internal.R.styleable.PreferenceActivity, com.android.internal.R.attr.preferenceActivityStyle, 0); final int layoutResId = sa.getResourceId( com.android.internal.R.styleable.PreferenceActivity_layout, com.android.internal.R.layout.preference_list_content); mPreferenceHeaderItemResId = sa.getResourceId( com.android.internal.R.styleable.PreferenceActivity_headerLayout, com.android.internal.R.layout.preference_header_item); mPreferenceHeaderRemoveEmptyIcon = sa.getBoolean( com.android.internal.R.styleable.PreferenceActivity_headerRemoveIconIfEmpty, false); sa.recycle(); setContentView(layoutResId); mListFooter = (FrameLayout)findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs_frame); Loading Loading @@ -582,7 +617,8 @@ public abstract class PreferenceActivity extends ListActivity implements showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } else if (mHeaders.size() > 0) { setListAdapter(new HeaderAdapter(this, mHeaders)); setListAdapter(new HeaderAdapter(this, mHeaders, mPreferenceHeaderItemResId, mPreferenceHeaderRemoveEmptyIcon)); if (!mSinglePane) { // Multi-pane. getListView().setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); Loading
core/res/res/layout-xlarge/breadcrumbs_in_fragment_material.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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:id="@+android:id/breadcrumb_section" android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_marginStart="@dimen/preference_breadcrumbs_padding_start_material" android:layout_marginEnd="@dimen/preference_breadcrumbs_padding_end_material" > <android.app.FragmentBreadCrumbs android:id="@android:id/title" android:layout_height="72dip" android:layout_width="match_parent" android:paddingTop="16dip" android:paddingBottom="8dip" android:gravity="center_vertical|start" /> </LinearLayout> No newline at end of file
core/res/res/layout/fragment_bread_crumb_item_material.xml 0 → 100644 +41 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2010 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="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" > <ImageView android:id="@android:id/left_icon" android:src="?attr/dividerVertical" android:layout_width="wrap_content" android:layout_height="match_parent" android:scaleType="fitXY" android:layout_marginTop="12dip" android:layout_marginBottom="12dip" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingStart="8dip" android:paddingEnd="8dip" android:gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceMedium" android:background="?android:attr/selectableItemBackground" /> </LinearLayout> No newline at end of file
core/res/res/layout/preference_header_item_material.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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. --> <!-- Layout of a header item in PreferenceActivity. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="48dp" android:background="?android:attr/activatedBackgroundIndicator" android:gravity="center_vertical" android:paddingStart="24dip" android:paddingEnd="?android:attr/scrollbarSize"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="0dip" android:layout_marginEnd="8dip" android:layout_gravity="center" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="0dip" android:layout_marginEnd="6dip" android:layout_marginTop="6dip" android:layout_marginBottom="6dip" android:layout_weight="1"> <TextView android:id="@+android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceMedium" android:ellipsize="marquee" android:fadingEdge="horizontal" /> <TextView android:id="@+android:id/summary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@android:id/title" android:layout_alignStart="@android:id/title" android:textAppearance="?android:attr/textAppearanceSmall" android:ellipsize="end" android:maxLines="2" /> </RelativeLayout> </LinearLayout>