gpt4 book ai didi

android.content.res.XResources类的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 21:39:05 61 4
gpt4 key购买 nike

本文整理了Java中android.content.res.XResources类的一些代码示例,展示了XResources类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XResources类的具体详情如下:
包路径:android.content.res.XResources
类名称:XResources

XResources介绍

暂无

代码示例

代码示例来源:origin: picone/ZhihuXposed

private void replaceCopyright(XC_InitPackageResources.InitPackageResourcesParam resourcesParam) {
    int copyrightId = resourcesParam.res.getIdentifier("label_app_copyright", "string", ZhihuConstant.PACKAGE_NAME);
    String copyright = resourcesParam.res.getString(copyrightId);
    copyright += "\n@知乎助手 by ChienHo";
    resourcesParam.res.setReplacement(copyrightId, copyright);
  }
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

public static void hookRes(final XC_InitPackageResources.InitPackageResourcesParam resparam, String modulePath) {
  try {
    if (ConfigUtils.others().package_installer) {
      final XModuleResources modRes = XModuleResources.createInstance(modulePath, resparam.res);
      resparam.res.setReplacement(PACKAGE_PACKAGEINSTALLER, "string", "install_failed_inconsistent_certificates", modRes.fwd(R.string.install_failed_conflict));
      resparam.res.setReplacement(PACKAGE_PACKAGEINSTALLER, "string", "install_failed_cpu_abi_incompatible", modRes.fwd(R.string.install_failed_incompatible));
      resparam.res.setReplacement(PACKAGE_PACKAGEINSTALLER, "string", "install_failed_older_sdk", modRes.fwd(R.string.install_failed_blocked));
      resparam.res.hookLayout(PACKAGE_PACKAGEINSTALLER, "layout", "install_start", install_start);
      resparam.res.hookLayout(PACKAGE_PACKAGEINSTALLER, "layout", "app_details", app_details);
      resparam.res.hookLayout(PACKAGE_PACKAGEINSTALLER, "layout", "install_confirm", install_confirm);
      resparam.res.hookLayout(PACKAGE_PACKAGEINSTALLER, "layout", "op_progress", op_progress);
      resparam.res.hookLayout(PACKAGE_PACKAGEINSTALLER, "layout", "uninstall_confirm", uninstall_confirm);
      resparam.res.hookLayout(PACKAGE_PACKAGEINSTALLER, "layout", "uninstall_progress", uninstall_progress);
    }
  } catch (Throwable t) {
    XposedHook.logE(TAG, "Error hooking PackageInstaller resources", t);
  }
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

public static void hookResSystemUI(XC_InitPackageResources.InitPackageResourcesParam resparam, String modulePath) {
  XModuleResources modRes = XModuleResources.createInstance(modulePath, resparam.res);
  R_drawable_ic_qs_data_disabled = resparam.res.addResource(modRes, R.drawable.ic_qs_data_disabled);
  R_drawable_stat_sys_data_disabled = resparam.res.addResource(modRes, R.drawable.stat_sys_data_disabled);
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

@SuppressWarnings("deprecation")
private static RippleDrawable getNotificationBackgroundDimmed(XResources xRes) {
  mNotificationBgDimmedColor = xRes.getColor(xRes.getIdentifier("notification_material_background_dimmed_color", "color", PACKAGE_SYSTEMUI));
  return new RippleDrawable(
      ColorStateList.valueOf(xRes.getColor(xRes.getIdentifier("notification_ripple_untinted_color", "color", PACKAGE_SYSTEMUI))),
      getBackgroundRippleContent(mNotificationBgDimmedColor),
      null);
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

R_string_battery_panel_title = resparam.res.addResource(modRes, R.string.battery_panel_title);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_panel_width", modRes.fwd(R.dimen.notification_panel_width));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "qs_peek_height", zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "status_bar_header_height", modRes.fwd(R.dimen.status_bar_header_height));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "status_bar_header_height_expanded", modRes.fwd(R.dimen.status_bar_header_height));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "qs_emergency_calls_only_text_size", modRes.fwd(R.dimen.emergency_calls_only_text_size));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "qs_date_collapsed_size", modRes.fwd(R.dimen.date_time_collapsed_size));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "multi_user_avatar_collapsed_size", modRes.fwd(R.dimen.multi_user_avatar_size));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "qs_brightness_padding_top", modRes.fwd(R.dimen.brightness_slider_padding_top));
if (ConfigUtils.M)
  resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "multi_user_avatar_expanded_size", modRes.fwd(R.dimen.multi_user_avatar_size));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "color", "qs_tile_divider", 0x00000000);
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "status_bar_expanded_header", new XC_LayoutInflated() {
  @Override
  public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
  resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "zz_moto_status_bar_expanded_header", new XC_LayoutInflated() {
    @Override
    public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "qs_detail_header", new XC_LayoutInflated() {
  @Override
  public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "qs_panel", new XC_LayoutInflated() {
  @Override

代码示例来源:origin: iAcn/BiliNeat

@Override
  public void handleLayoutInflated(LayoutInflatedParam layoutInflatedParam) throws Throwable {
    TextView game = (TextView) layoutInflatedParam.view.findViewById(layoutInflatedParam.res
        .getIdentifier("more_action", "id", Constant.biliPackageName));
    game.setVisibility(View.GONE);
  }
});

代码示例来源:origin: marzika/Snapprefs

public static void addSnapprefsBtn(XC_InitPackageResources.InitPackageResourcesParam resparam, final XModuleResources mResources) {
  resparam.res.hookLayout(Common.PACKAGE_SNAP, "layout", "stories", new XC_LayoutInflated() {
    public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
      final FrameLayout relativeLayout = (FrameLayout) liparam.view.findViewById(liparam.res.getIdentifier("top_panel", "id", Common.PACKAGE_SNAP));

代码示例来源:origin: MrYawnie/SpotifySkip

@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam lpparam) throws Throwable {
  // Enables unlimited skips
  if (!lpparam.packageName.equals("com.spotify.music"))
    return;
  lpparam.res.setReplacement("com.spotify.music", "bool", "is_tablet", true);
}

代码示例来源:origin: marzika/Snapprefs

FriendListDialog.name = XResources.getFakeResId(modRes, name);
resparam.res.setReplacement(FriendListDialog.name, modRes.fwd(name));
FriendListDialog.checkBox = XResources.getFakeResId(modRes, checkBox);
resparam.res.setReplacement(FriendListDialog.checkBox, modRes.fwd(checkBox));
FriendListDialog.friend_item = XResources.getFakeResId(modRes, checkBox);
resparam.res.setReplacement(FriendListDialog.friend_item, modRes.fwd(friend_item));
GroupDialog.group_item = XResources.getFakeResId(modRes, group_item);
resparam.res.setReplacement(GroupDialog.group_item, modRes.fwd(group_item));

代码示例来源:origin: marzika/Snapprefs

public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
  final int padding = px(10f);
  final int topMargin = 0;
  final int size = px((int) resparam.res.getDimension(resparam.res.getIdentifier("profile_picture_button_size", "dimen", Common.PACKAGE_SNAP)));
      (RelativeLayout) liparam.view.findViewById(liparam.res.getIdentifier("camera_preview_layout", "id", Common.PACKAGE_SNAP));

代码示例来源:origin: iAcn/BiliNeat

@Override
  public void handleLayoutInflated(LayoutInflatedParam layoutInflatedParam) throws Throwable {
    RelativeLayout rl = (RelativeLayout) layoutInflatedParam.view.findViewById(layoutInflatedParam.res
        .getIdentifier("group", "id", Constant.biliPackageName));
    rl.setVisibility(View.GONE);
  }
});

代码示例来源:origin: marzika/Snapprefs

public static void fullScreenFilter(
    XC_InitPackageResources.InitPackageResourcesParam resparam) {
  try {
    resparam.res.hookLayout(Common.PACKAGE_SNAP, "layout", "battery_view", new XC_LayoutInflated() {
      LinearLayout.LayoutParams batteryLayoutParams =
          new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
      @Override
      public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
        View battery =
            liparam.view.findViewById(liparam.res.getIdentifier("battery_icon", "id", "com.snapchat.android"));
        battery.setLayoutParams(batteryLayoutParams);
        battery.setPadding(0, 0, 0, 0);
        Logger.log("fullScreenFilter", true);
      }
    });
  } catch (Resources.NotFoundException ignore) {
  }
}

代码示例来源:origin: suraj0208/WhatsappExtensions

@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam initPackageResourcesParam) throws Throwable {
  if (!initPackageResourcesParam.packageName.equals("com.whatsapp"))
    return;
  modRes = XModuleResources.createInstance(MODULE_PATH, initPackageResourcesParam.res);
  if (sharedPreferences != null && sharedPreferences.getBoolean("hideTabs", false))
    initPackageResourcesParam.res.setReplacement("com.whatsapp", "dimen", "tab_height", modRes.fwd(R.dimen.tab_height));
  if (sharedPreferences != null && sharedPreferences.getBoolean("showBlackTicks", false)) {
    initPackageResourcesParam.res.setReplacement("com.whatsapp", "drawable", "message_got_read_receipt_from_target", modRes.fwd(R.mipmap.ic_black_tick_conv));
    initPackageResourcesParam.res.setReplacement("com.whatsapp", "drawable", "message_got_read_receipt_from_target_onmedia", modRes.fwd(R.mipmap.ic_black_tick_conv));
    initPackageResourcesParam.res.setReplacement("com.whatsapp", "drawable", "msg_status_client_read", modRes.fwd(R.mipmap.ic_black_tick_main));
  }
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

@SuppressWarnings("deprecation")
private static RippleDrawable getNotificationBackground(XResources xRes) {
  mNotificationBgColor = xRes.getColor(xRes.getIdentifier("notification_material_background_color", "color", PACKAGE_SYSTEMUI));
  return new RippleDrawable(
      ColorStateList.valueOf(xRes.getColor(xRes.getIdentifier("notification_ripple_untinted_color", "color", PACKAGE_SYSTEMUI))),
      getBackgroundRippleContent(mNotificationBgColor),
      null);
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_side_padding", zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notifications_top_padding", zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_padding", ConfigUtils.notifications().enable_notifications_background ? modRes.fwd(R.dimen.notification_divider_height) : zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_padding_dimmed", ConfigUtils.notifications().enable_notifications_background ? modRes.fwd(R.dimen.notification_divider_height) : zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_material_rounded_rect_radius", zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "speed_bump_height", zero);
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_min_height", modRes.fwd(R.dimen.notification_min_height));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_mid_height", modRes.fwd(R.dimen.notification_mid_height));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "notification_max_height", modRes.fwd(R.dimen.notification_max_height));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "min_stack_height", modRes.fwd(R.dimen.min_stack_height));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "keyguard_clock_notifications_margin_min", modRes.fwd(R.dimen.keyguard_clock_notifications_margin_min));
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "keyguard_clock_notifications_margin_max", modRes.fwd(R.dimen.keyguard_clock_notifications_margin_max));
  resparam.res.setReplacement(PACKAGE_SYSTEMUI, "color", "notification_material_background_color", modRes.fwd(R.color.notification_material_background_color));
  resparam.res.setReplacement(PACKAGE_SYSTEMUI, "color", "notification_material_background_dimmed_color", modRes.fwd(R.color.notification_material_background_dimmed_color));
  resparam.res.setReplacement(PACKAGE_SYSTEMUI, "color", "notification_material_background_low_priority_color", modRes.fwd(R.color.notification_material_background_low_priority_color));
  resparam.res.setReplacement(PACKAGE_SYSTEMUI, "integer", "keyguard_max_notification_count", config.notifications.keyguard_max);
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "notification_public_default", notification_public_default);
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "status_bar_no_notifications", status_bar_no_notifications);
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "status_bar_notification_row", status_bar_notification_row);
resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "status_bar_notification_keyguard_overflow", status_bar_notification_row);
try {
  resparam.res.hookLayout(PACKAGE_SYSTEMUI, "layout", "status_bar_notification_row_media", status_bar_notification_row);
} catch (Throwable ignore) {
resparam.res.setReplacement(PACKAGE_SYSTEMUI, "drawable", "notification_material_bg", new XResources.DrawableLoader() {
  @Override

代码示例来源:origin: marzika/Snapprefs

@Override
  public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
    View battery =
        liparam.view.findViewById(liparam.res.getIdentifier("battery_icon", "id", "com.snapchat.android"));
    battery.setLayoutParams(batteryLayoutParams);
    battery.setPadding(0, 0, 0, 0);
    Logger.log("fullScreenFilter", true);
  }
});

代码示例来源:origin: wasdennnoch/AndroidN-ify

resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_material_action", notification_material_action);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_material_action_list", notification_material_action_list);
try { //OOS
  resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_material_action_list_padding", notification_material_action_list);
} catch (Throwable ignore) {}
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_base", notification_template_material_base);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_base", notification_template_material_base);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_text", notification_template_material_base);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_inbox", notification_template_material_base);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_media", notification_template_material_media);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_base", notification_template_material_big_base); // Extra treatment
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_media", notification_template_material_big_media);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_media_narrow", notification_template_material_big_media);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_picture", notification_template_material_big_picture);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_big_text", notification_template_material_big_text);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_material_inbox", notification_template_material_inbox);
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_material_media_action", new XC_LayoutInflated() {
  @Override
  public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_part_line1", new XC_LayoutInflated() {
  @Override
  public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {
resparam.res.hookLayout(PACKAGE_ANDROID, "layout", "notification_template_part_line3", new XC_LayoutInflated() {
  @Override
  public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable {

代码示例来源:origin: wasdennnoch/AndroidN-ify

public static void hookResSystemui(XC_InitPackageResources.InitPackageResourcesParam resparam, String modulePath) {
  try {
    ConfigUtils config = ConfigUtils.getInstance();
    XModuleResources modRes = XModuleResources.createInstance(modulePath, resparam.res);
    if (config.recents.no_recents_image) {
      resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "recents_stack_top_padding", modRes.fwd(R.dimen.recents_stack_top_padding));
      try {
        resparam.res.setReplacement(PACKAGE_SYSTEMUI, "layout", "recents_empty", modRes.fwd(R.layout.recents_empty));
      } catch (Throwable t) {
        // AICP
        resparam.res.setReplacement(PACKAGE_SYSTEMUI, "layout", "no_recents_holder", modRes.fwd(R.layout.recents_empty));
      }
    }
    if (config.recents.large_recents) {
      resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "recents_stack_top_padding", modRes.fwd(R.dimen.recents_stack_top_padding));
      // srsly bliss? 12 dp looks ugly as hell...
      resparam.res.setReplacement(PACKAGE_SYSTEMUI, "dimen", "recents_task_view_rounded_corners_radius", new XResources.DimensionReplacement(2, TypedValue.COMPLEX_UNIT_DIP));
    }
  } catch (Throwable t) {
    XposedHook.logE(TAG, "Error hooking SystemUI resources", t);
  }
}

代码示例来源:origin: GermainZ/Identiconizer

@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
  if (!resparam.packageName.equals("com.android.providers.contacts"))
    return;
  Resources res = XModuleResources.createInstance(MODULE_PATH, resparam.res);
  NOTIF_ICON_RES_ID = resparam.res.addResource(res, R.drawable.ic_settings_identicons);
}

代码示例来源:origin: iAcn/BiliNeat

@Override
  public void handleLayoutInflated(LayoutInflatedParam layoutInflatedParam) throws Throwable {
    TextView textView = (TextView) layoutInflatedParam.view.findViewById(layoutInflatedParam.res
        .getIdentifier("message", "id", Constant.biliPackageName));
    textView.setAutoLinkMask(Linkify.WEB_URLS);
  }
});

61 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com