Skip to content

Commit

Permalink
Fixed theme options
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbox87 committed Mar 5, 2017
1 parent d99d119 commit c130414
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/jump_button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 Kevin Mark
This file is part of XHangouts.
XHangouts is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
XHangouts is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with XHangouts. If not, see <http://www.gnu.org/licenses/>.
-->
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="15.0dip" android:topRightRadius="15.0dip" android:bottomLeftRadius="15.0dip" android:bottomRightRadius="15.0dip" />
<solid android:color="@color/compose_message_view_bg" />
</shape>

0 comments on commit c130414

Please sign in to comment.