PreferenceFragment showing the breadcrumb when not needed.

The breadcrumb section is used for a single pane mode for showing
the current user location. The breadcrumb should not be shown if
its title and subtitle are empty. The code in PreferenceActivity
onCreate updates the breadcrumb with the title and subtitle in
a single page mode but does not hide it if they are empty. This
change fixes that.

bug:11242762

Change-Id: Ib1ba9e8afd9d0ab2e85d78a65ca7c18489464f6d
This commit is contained in:
Svetoslav
2013-11-01 11:47:28 -07:00
parent a3315270e0
commit 7db97b0a29

View File

@@ -33,7 +33,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
import android.view.LayoutInflater;
@@ -125,8 +124,6 @@ public abstract class PreferenceActivity extends ListActivity implements
PreferenceManager.OnPreferenceTreeClickListener,
PreferenceFragment.OnPreferenceStartFragmentCallback {
private static final String TAG = "PreferenceActivity";
// Constants for state save/restore
private static final String HEADERS_TAG = ":android:headers";
private static final String CUR_HEADER_TAG = ":android:cur_header";
@@ -576,12 +573,14 @@ public abstract class PreferenceActivity extends ListActivity implements
// Single pane, showing just a prefs fragment.
findViewById(com.android.internal.R.id.headers).setVisibility(View.GONE);
mPrefsContainer.setVisibility(View.VISIBLE);
CharSequence initialTitleStr = null;
CharSequence initialShortTitleStr = null;
if (initialTitle != 0) {
CharSequence initialTitleStr = getText(initialTitle);
CharSequence initialShortTitleStr = initialShortTitle != 0
initialTitleStr = getText(initialTitle);
initialShortTitleStr = initialShortTitle != 0
? getText(initialShortTitle) : null;
showBreadCrumbs(initialTitleStr, initialShortTitleStr);
}
showBreadCrumbs(initialTitleStr, initialShortTitleStr);
} else if (mHeaders.size() > 0) {
setListAdapter(new HeaderAdapter(this, mHeaders));
if (!mSinglePane) {