Add the capability to set a pinned header to SettingsPreferenceFragment

- add a FrameLayout into the preference list fragment
- add public void setPinnedHeaderView(View pinnedHeader) and
clearPinnedHeaderView() APIs for adding and clearing the pinned header

Change-Id: I50ba5dd150167e0d49cc54bee1203f46db6d7a66
This commit is contained in:
Fabrice Di Meglio
2014-07-21 16:02:27 -07:00
parent 20b32f25f0
commit 86159283c9
3 changed files with 31 additions and 4 deletions

View File

@@ -42,10 +42,8 @@ import android.provider.MediaStore;
import android.provider.ContactsContract.DisplayPhoto;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -97,7 +95,7 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment {
if (mHeaderView == null) {
mHeaderView = LayoutInflater.from(getActivity()).inflate(
R.layout.user_info_header, null);
((ViewGroup) getListView().getParent()).addView(mHeaderView, 0);
setPinnedHeaderView(mHeaderView);
mHeaderView.setOnClickListener(this);
mUserIconView = (ImageView) mHeaderView.findViewById(android.R.id.icon);
mUserNameView = (TextView) mHeaderView.findViewById(android.R.id.title);