Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Fixed some Good lock app incompatibilies
Browse files Browse the repository at this point in the history
  • Loading branch information
wanam committed Apr 5, 2016
1 parent c448f08 commit f340782
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 105 deletions.
4 changes: 2 additions & 2 deletions res/xml/wanam_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
android:title="@string/sound" >
<PreferenceCategory android:title="@string/sound" >
<CheckBoxPreference
android:defaultValue="false"
android:defaultValue="true"
android:key="disableLoudVolumeWarning"
android:summaryOff="@string/disable_loud_volume_enabled"
android:summaryOn="@string/disable_loud_volume_disabled"
Expand Down Expand Up @@ -304,7 +304,7 @@
android:summaryOff="@string/launcher_scroll_wallpaper_off"
android:summaryOn="@string/launcher_scroll_wallpaper_on"
android:title="@string/launcher_scroll_wallpaper" />
</PreferenceCategory>
</PreferenceCategory>
<PreferenceCategory
android:key="homebuttons"
android:title="@string/buttons" >
Expand Down
2 changes: 1 addition & 1 deletion src/ma/wanam/xtouchwiz/XAndroidPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void doHook(XSharedPreferences prefs, ClassLoader classLoader) {
e.printStackTrace();
}

if (prefs.getBoolean("disableLoudVolumeWarning", false)) {
if (prefs.getBoolean("disableLoudVolumeWarning", true)) {
try {
disableLoudVolumeWarningDialog();
} catch (Throwable e) {
Expand Down
9 changes: 0 additions & 9 deletions src/ma/wanam/xtouchwiz/XSecLauncherRes.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ public static void doHook(XSharedPreferences prefs, InitPackageResourcesParam re

}

if (prefs.getBoolean("hideDockLabels", false)) {
try {
resparam.res.setReplacement(Packages.LAUNCHER, "bool", "hotseat_showTitlePermKey", false);
} catch (Throwable e) {
XposedBridge.log(e.toString());

}
}

}

}
221 changes: 129 additions & 92 deletions src/ma/wanam/xtouchwiz/XSysUIFeaturePackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.ColorStateList;
import android.graphics.Color;

import com.samsung.android.multiwindow.MultiWindowStyle;
Expand All @@ -48,111 +49,116 @@ public static void doHook(final XSharedPreferences prefs, final ClassLoader clas
if (!prefs.getString("selectedMwApps", "").trim().equalsIgnoreCase("")) {
setMWApps(prefs, classLoader);
}
Class<?> classFeature = XposedHelpers.findClass(Packages.SYSTEM_UI + ".statusbar.Feature", classLoader);

try {
setExpandedVolumePanel(classLoader);
} catch (Throwable e) {
XposedBridge.log(e.toString());
if (prefs.getBoolean("expandNotifications", false)) {
try {
expandAllNotifications(classLoader);
} catch (Throwable e) {
XposedBridge.log(e);

}
}

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowDataUsageInQuickPanel",
prefs.getBoolean("showDataUsuage", false));
} catch (Throwable e) {
XposedBridge.log(e.toString());
if (prefs.getBoolean("quickPinUnlockEnabled", false)) {
try {
enableQuickUnlock(prefs, classLoader);
} catch (Throwable e) {
XposedBridge.log(e);

}
}

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowDataUsageLimitForVZW",
prefs.getBoolean("showDataUsuage", false));
setExpandedVolumePanel(classLoader);
} catch (Throwable e) {
XposedBridge.log(e);

}

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowWirelessChargerInfoPopUp",
prefs.getBoolean("showWirelessChargerInfoPopUp", false));
} catch (Throwable e) {
Class<?> classFeature = XposedHelpers.findClass(Packages.SYSTEM_UI + ".statusbar.Feature", classLoader);

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowDataUsageInQuickPanel",
prefs.getBoolean("showDataUsuage", false));
} catch (Throwable e) {
XposedBridge.log(e);

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowMobileDataOffPopup",
prefs.getBoolean("showDataPopUp", false));
} catch (Throwable e) {
XposedBridge.log(e.toString());
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowDataUsageLimitForVZW",
prefs.getBoolean("showDataUsuage", false));
} catch (Throwable e) {

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowMobileDataPopupForLgt",
prefs.getBoolean("showDataPopUp", false));
} catch (Throwable e) {
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowWirelessChargerInfoPopUp",
prefs.getBoolean("showWirelessChargerInfoPopUp", false));
} catch (Throwable e) {

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowMobileDataPopupForVZW",
prefs.getBoolean("showDataPopUp", false));
} catch (Throwable e) {
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowMobileDataOffPopup",
prefs.getBoolean("showDataPopUp", false));
} catch (Throwable e) {
XposedBridge.log(e);

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowNoSimNotification",
prefs.getBoolean("showNOSim", false));
} catch (Throwable e) {
XposedBridge.log(e.toString());
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowMobileDataPopupForLgt",
prefs.getBoolean("showDataPopUp", false));
} catch (Throwable e) {

try {
XposedHelpers.setStaticBooleanField(classFeature, "mNoSIMNotificationForTMO",
prefs.getBoolean("showNOSim", false));
} catch (Throwable e) {
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowMobileDataPopupForVZW",
prefs.getBoolean("showDataPopUp", false));
} catch (Throwable e) {

try {
XposedHelpers.setStaticBooleanField(classFeature, "mNoSIMNotificationForVZW",
prefs.getBoolean("showNOSim", false));
} catch (Throwable e) {
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowNoSimNotification",
prefs.getBoolean("showNOSim", false));
} catch (Throwable e) {
XposedBridge.log(e);

try {
XposedHelpers.setStaticBooleanField(classFeature, "mUseLTEDataIcon",
!prefs.getBoolean("show4GForLTE", false));
} catch (Throwable e) {
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mNoSIMNotificationForTMO",
prefs.getBoolean("showNOSim", false));
} catch (Throwable e) {

try {
XposedHelpers.setStaticBooleanField(classFeature, "mShowAirplaneModeONPopup",
!prefs.getBoolean("disableAirplaneModeDialog", false));
} catch (Throwable e) {
}

}
try {
XposedHelpers.setStaticBooleanField(classFeature, "mNoSIMNotificationForVZW",
prefs.getBoolean("showNOSim", false));
} catch (Throwable e) {

}

if (prefs.getBoolean("expandNotifications", false)) {
try {
expandAllNotifications(classLoader);
XposedHelpers.setStaticBooleanField(classFeature, "mUseLTEDataIcon",
!prefs.getBoolean("show4GForLTE", false));
} catch (Throwable e) {
XposedBridge.log(e.toString());

}
}

if (prefs.getBoolean("quickPinUnlockEnabled", false)) {
try {
enableQuickUnlock(prefs, classLoader);
XposedHelpers.setStaticBooleanField(classFeature, "mShowAirplaneModeONPopup",
!prefs.getBoolean("disableAirplaneModeDialog", false));
} catch (Throwable e) {
XposedBridge.log(e.toString());

}
} catch (Throwable e1) {
XposedBridge.log(e1.getMessage());
}

}
Expand Down Expand Up @@ -198,7 +204,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
"isSupportMultiWindow", ActivityInfo.class, MultiWindowStyle.class,
XC_MethodReplacement.returnConstant(true));
} catch (Throwable e) {
XposedBridge.log(e.toString());
XposedBridge.log(e);

}

Expand Down Expand Up @@ -247,54 +253,85 @@ protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
});

} catch (Throwable e) {
XposedBridge.log(e.toString());
XposedBridge.log(e);

}
}

private static void setExpandedVolumePanel(ClassLoader classLoader) {

Class<?> mVolumePanel = null;
try {
final Class<?> VolumePanel = XposedHelpers.findClass(Packages.SYSTEM_UI + ".volume.SecVolumeDialog",
classLoader);
// Try stock Samsung implementation
mVolumePanel = XposedHelpers.findClass(Packages.SYSTEM_UI + ".volume.SecVolumeDialog", classLoader);
try {
XposedHelpers.findAndHookMethod(mVolumePanel, "updateTintColor", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {

XSysUIFeaturePackage.prefs.reload();
if (XSysUIFeaturePackage.prefs.getBoolean("semiTransparentVolumePanel", false)) {
XposedHelpers.setObjectField(
param.thisObject,
"mVolumePanelBgColor",
XposedHelpers.callMethod(param.thisObject, "colorToColorStateList",
Color.parseColor("#7fffffff")));
}

XposedHelpers.findAndHookMethod(VolumePanel, "showH", int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XSysUIFeaturePackage.prefs.reload();
XposedHelpers.callMethod(param.thisObject, "setExpandedH",
XSysUIFeaturePackage.prefs.getBoolean("autoExpandVolumePanel", false));
}
}

});
});

} catch (Throwable e) {

}
} catch (Throwable e) {
XposedBridge.log(e.toString());

// Try Good lock implementation
try {
mVolumePanel = XposedHelpers.findClass(Packages.SYSTEM_UI + ".volume.VolumeDialog", classLoader);
final Class<?> mUtils = XposedHelpers.findClass(Packages.SYSTEM_UI + ".opensesame.utils.Utils",
classLoader);
final Class<?> mVolumeRow = XposedHelpers.findClass(Packages.SYSTEM_UI
+ ".volume.VolumeDialog$VolumeRow", classLoader);

XposedHelpers.findAndHookMethod(mVolumePanel, "updateVolumeRowSliderTintH", mVolumeRow, boolean.class,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {

XSysUIFeaturePackage.prefs.reload();
if (XSysUIFeaturePackage.prefs.getBoolean("semiTransparentVolumePanel", false)) {

ColorStateList csl = (ColorStateList) XposedHelpers.callStaticMethod(mUtils,
"colorToColorStateList", Color.parseColor("#7fffffff"));

Object mDialogView = XposedHelpers.getObjectField(param.thisObject, "mDialogView");
XposedHelpers.callMethod(mDialogView, "setBackgroundTintList", csl);
}

}

});

} catch (Throwable t) {
XposedBridge.log(t.getMessage());
}
}

try {
final Class<?> VolumePanel = XposedHelpers.findClass(Packages.SYSTEM_UI + ".volume.SecVolumeDialog",
classLoader);

XposedHelpers.findAndHookMethod(VolumePanel, "updateTintColor", new XC_MethodHook() {
XposedHelpers.findAndHookMethod(mVolumePanel, "showH", int.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {

XSysUIFeaturePackage.prefs.reload();
if (XSysUIFeaturePackage.prefs.getBoolean("semiTransparentVolumePanel", false)) {
XposedHelpers.setObjectField(
param.thisObject,
"mVolumePanelBgColor",
XposedHelpers.callMethod(param.thisObject, "colorToColorStateList",
Color.parseColor("#7fffffff")));
}

XposedHelpers.callMethod(param.thisObject, "setExpandedH",
XSysUIFeaturePackage.prefs.getBoolean("autoExpandVolumePanel", false));
}

});

} catch (Throwable e) {
XposedBridge.log(e.toString());
XposedBridge.log(e);

}

Expand Down
3 changes: 2 additions & 1 deletion src/ma/wanam/xtouchwiz/XTouchWizActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public class XTouchWizActivity extends Activity implements RestoreDialogListener
private static final String[] defaultSettings = new String[] { "addBrowserTerminateButton",
"enableCameraDuringCall", "disableNumberFormating", "enableCallButtonLogs", "disableSmsToMmsConversion",
"isXTouvhWizFirstLaunch", "expandNotifications", "makeMeTooLegit", "disableTIMA", "showDataUsuage",
"autoExpandVolumePanel", "semiTransparentVolumePanel", "enable4WayReboot", "mScreenshot", "mScreenrecord" };
"autoExpandVolumePanel", "semiTransparentVolumePanel", "enable4WayReboot", "mScreenshot", "mScreenrecord",
"disableLoudVolumeWarning" };

// Storage Permissions
private static final int REQUEST_EXTERNAL_STORAGE = 1;
Expand Down

0 comments on commit f340782

Please sign in to comment.