From c130414bd406e4b7524696f9f55dc30b534672ca Mon Sep 17 00:00:00 2001 From: blackbox87 Date: Sun, 5 Mar 2017 19:53:59 +0000 Subject: [PATCH] Fixed theme options --- .../kmark/xhangouts/mods/UiColorize.java | 17 +++++++++++++ .../res/drawable/jump_button_background.xml | 24 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 app/src/main/res/drawable/jump_button_background.xml diff --git a/app/src/main/java/com/versobit/kmark/xhangouts/mods/UiColorize.java b/app/src/main/java/com/versobit/kmark/xhangouts/mods/UiColorize.java index b274f23..682cd86 100644 --- a/app/src/main/java/com/versobit/kmark/xhangouts/mods/UiColorize.java +++ b/app/src/main/java/com/versobit/kmark/xhangouts/mods/UiColorize.java @@ -20,6 +20,7 @@ package com.versobit.kmark.xhangouts.mods; import android.annotation.SuppressLint; +import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.XModuleResources; @@ -51,6 +52,7 @@ import com.versobit.kmark.xhangouts.XHangouts; import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XC_MethodReplacement; import de.robv.android.xposed.callbacks.XC_LayoutInflated; import static com.versobit.kmark.xhangouts.XHangouts.HANGOUTS_RES_PKG_NAME; @@ -111,6 +113,7 @@ public final class UiColorize { private static final int COLOR_GROUP_5 = 0xff424242; // Dividers and incoming message bubbles private static final int COLOR_GROUP_6 = 0xff000000; // Floating action button text color + private static final String HANGOUTS_THEME_METHOD = "fr"; private static final String HANGOUTS_RECENT_CALLS = "grn"; private static final String HANGOUTS_CONVO_LIST = "com.google.android.apps.hangouts.views.ConversationListItemView"; private static final String HANGOUTS_SNACKBAR = "com.google.android.libraries.quantum.snackbar.Snackbar"; @@ -179,6 +182,15 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } }); + // Fix theme issues for devices using Marshmallow or Nougat + findAndHookMethod(HANGOUTS_THEME_METHOD, loader, HANGOUTS_C, Context.class, int.class, new XC_MethodReplacement() { + @Override + protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { + int color = (int) param.args[1]; + return ((Context) param.args[0]).getResources().getColor(color); + } + }); + if (config.darkTheme) { // Various conversation list icons findAndHookMethod(cConversationList, HANGOUTS_A, Drawable.class, new XC_MethodHook() { @@ -622,6 +634,11 @@ public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable { replaceColor(res, HANGOUTS_COLOR_LINK_OUT_OTR, config.outgoingDarkLinkColorOTR); + // Jump button + res.setReplacement(HANGOUTS_RES_PKG_NAME, "drawable", "jump_button_background", + moduleRes.fwd(R.drawable.jump_button_background)); + + // OTR notifications, missed calls etc themeListItemView(res, "hangout_event_message", true); themeListItemView(res, "hangout_event_message_list_item_view", true); diff --git a/app/src/main/res/drawable/jump_button_background.xml b/app/src/main/res/drawable/jump_button_background.xml new file mode 100644 index 0000000..a005825 --- /dev/null +++ b/app/src/main/res/drawable/jump_button_background.xml @@ -0,0 +1,24 @@ + + + + + +