本文整理汇总了Java中android.preference.PreferenceActivity.Header类的典型用法代码示例。如果您正苦于以下问题:Java Header类的具体用法?Java Header怎么用?Java Header使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Header类属于android.preference.PreferenceActivity包,在下文中一共展示了Header类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerSettingsAppHook
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public static void registerSettingsAppHook(LoadPackageParam lpparam,
final LXSettingsCallback iface) {
if (!lpparam.packageName.equals("com.android.settings"))
return;
if (settingsAppHooked)
return;
Class<?> SettingsClazz = XposedHelpers.findClass(
"com.android.settings.Settings", lpparam.classLoader);
XposedBridge.hookAllMethods(SettingsClazz, "updateHeaderList",
new XC_MethodHook() {
@SuppressWarnings("unchecked")
@Override
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
List<Header> headers = (List<Header>) param.args[0];
iface.updateHeaderList(headers);
}
});
settingsAppHooked = true;
}
示例2: hookLoadHeadersFromResource
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
protected void hookLoadHeadersFromResource(LoadPackageParam lpparam, String className, final int[] hookResIds, final int addAfterHeaderId) throws Throwable
{
hookLoadHeadersFromResource(lpparam, className, new XC_MethodHook() {
@SuppressWarnings("unchecked")
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable
{
final int xmlResId = (Integer) param.args[0];
debug("loadHeadersFromResource: xmlResId=" + xmlResId);
for(int hookResId : hookResIds)
{
if(xmlResId == hookResId)
{
addAppOpsHeader((List<Header>) param.args[1], addAfterHeaderId, (Context) param.thisObject);
break;
}
}
}
});
}
示例3: getView
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
Header header = getItem(position);
int headerType = header.extras.getInt(UniversalHeader.HEADER_TYPE_KEY);
View view = null;
switch (headerType) {
case UniversalHeader.TYPE_CATEGORY:
view = mInflater.inflate(android.R.layout.preference_category, parent, false);
((TextView) view.findViewById(android.R.id.title)).setText(header.getTitle(getContext()
.getResources()));
break;
case UniversalHeader.TYPE_NORMAL:
case UniversalHeader.TYPE_ABOUT_DIALOG:
case UniversalHeader.TYPE_ONE_TIME_INTENT:
int customLayoutResource = header.extras==null? 0 : header.extras.getInt(UniversalHeader.HEADER_CUSTOM_LAYOUT_RESOURCE_KEY);
view = mInflater.inflate(customLayoutResource==0?mHeaderLayoutResource:customLayoutResource, parent, false);
((ImageView) view.findViewById(android.R.id.icon)).setImageResource(header.iconRes);
TextView titleView = ((TextView) view.findViewById(android.R.id.title));
titleView.setText(header.getTitle(getContext().getResources()));
TextView summaryView = ((TextView) view.findViewById(android.R.id.summary));
if (header.summaryRes!=0){
summaryView.setText(header.getSummary(getContext().getResources()));
} else {
summaryView.setVisibility(View.GONE);
}
break;
}
return view;
}
示例4: onCreateAppOpsHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
protected Object onCreateAppOpsHeader(Context context, int addAfterHeaderId)
{
final Header appOpsHeader = new Header();
appOpsHeader.title = getAppOpsTitle();
appOpsHeader.id = R.id.app_ops_settings;
appOpsHeader.iconRes = getAppOpsHeaderIcon();
appOpsHeader.intent = Util.createAppOpsIntent(null);
return appOpsHeader;
}
示例5: addAppOpsHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
private void addAppOpsHeader(LoadPackageParam lpparam)
{
final int settingsHeadersId = Res.getSettingsIdentifier("xml/settings_headers");
final int personalSectionId = Res.getSettingsIdentifier("id/personal_section");
if(settingsHeadersId != 0)
{
try
{
hookLoadHeadersFromResource(lpparam, settingsHeadersId, personalSectionId);
return;
}
catch(Throwable t)
{
debug(t);
}
}
// This is a last resort only, since we might end up with multiple occurences of
// "App ops" within settings, which is ugly.
log("Hooking onBuildHeaders :-(");
XposedHelpers.findAndHookMethod("com.android.settings.Settings", lpparam.classLoader,
"onBuildHeaders", List.class, new XC_MethodHook() {
@SuppressWarnings("unchecked")
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable
{
addAppOpsHeader((List<Header>) param.args[0], personalSectionId, (Context) param.thisObject);
}
});
}
示例6: onCreateAppOpsHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
@Override
protected Object onCreateAppOpsHeader(Context context, int addAfterHeaderId)
{
final Header header = (Header) super.onCreateAppOpsHeader(context, addAfterHeaderId);
if(mForceCompatibilityMode)
{
header.fragment = null;
header.intent = Util.createAppOpsIntent(null);
}
return header;
}
示例7: onBuildHeaders
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
/**
* We override this method to provide PreferenceActivity with the top-level preference headers.
*/
@Override
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.device_admin_headers, target);
}
示例8: onBuildHeaders
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
/**
* Populate the activity with the top-level headers.
*/
@Override
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.preference_headers, target);
}
示例9: onGetInitialHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public Header onGetInitialHeader() {
// return super.onGetInitialHeader();
return null;
}
示例10: onGetNewHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public Header onGetNewHeader() {
//do NOT edit this file, auto-generated by host_target.groovy from Target_Activity.java.template
// return super.onGetNewHeader();
return null;
}
示例11: loadHeadersFromResource
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public void loadHeadersFromResource(int resid, List<Header> target) {
mHostActivity.loadHeadersFromResource(resid, target);
}
示例12: onHeaderClick
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public void onHeaderClick(Header header, int position) {
// super.onHeaderClick(header, position);
}
示例13: switchToHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public void switchToHeader(Header header) {
mHostActivity.switchToHeader(header);
}
示例14: createHeader
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public Header createHeader(Context context){
if (headerType==TYPE_ONE_TIME_INTENT){
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
if (sharedPrefs.getBoolean(oneTimeIntentPrefNamePressed, false))
return null; //it's been pressed before. don't create the header.
}
header = new Header();
header.title = context.getString(titleRes);
if (headerType==TYPE_ONE_TIME_INTENT){
header.intent = new Intent(Intent.ACTION_VIEW);
header.intent.setData(Uri.parse(oneTimeIntentUrl));
} else if (intent!=null){
header.intent = intent;
} else if (fragment!=null){
header.fragment = fragment;
}
header.iconRes = iconRes;
header.summaryRes = summaryRes;
Bundle extras = new Bundle();
extras.putInt(HEADER_TYPE_KEY, headerType);
if (customLayoutRes != 0){
extras.putInt(HEADER_CUSTOM_LAYOUT_RESOURCE_KEY,customLayoutRes);
}
if (headerType==TYPE_ABOUT_DIALOG){
extras.putInt(ABOUT_DIALOG_VERSION_RESOURCE, aboutDialogVersionRes);
extras.putInt(ABOUT_DIALOG_HTML_MESSAGE_RESOURCE, aboutDialogHtmlMessageRes);
extras.putInt(ABOUT_DIALOG_ICON_RESOURCE, aboutDialogIconRes);
}
if (headerType==TYPE_ONE_TIME_INTENT){
extras.putString(ONE_TIME_INTENT_PREF_NAME_PRESSED, oneTimeIntentPrefNamePressed);
}
header.extras = extras;
return header;
}
示例15: UniversalHeaderAdapter
import android.preference.PreferenceActivity.Header; //导入依赖的package包/类
public UniversalHeaderAdapter(Context context, List<Header> objects, int headerLayoutResource) {
super(context, 0, objects);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mHeaderLayoutResource = headerLayoutResource;
}