本文整理匯總了Java中de.robv.android.xposed.XposedHelpers類的典型用法代碼示例。如果您正苦於以下問題:Java XposedHelpers類的具體用法?Java XposedHelpers怎麽用?Java XposedHelpers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
XposedHelpers類屬於de.robv.android.xposed包,在下文中一共展示了XposedHelpers類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: launchCustomApp
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static void launchCustomApp(String uri) {
if (uri == null) {
try {
Handler handler = (Handler) XposedHelpers.getObjectField(mPhoneWindowManager, "mHandler");
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, mStrCustomAppNone, Toast.LENGTH_SHORT).show();
}
});
} catch (Throwable t) {
}
return;
}
try {
Intent i = Intent.parseUri(uri, 0);
launchCustomApp(i);
} catch (URISyntaxException e) {
log("launchCustomApp: error parsing uri: " + e.getMessage());
}
}
示例2: launchClockAction
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static void launchClockAction(String uri) {
if (mContext == null) return;
try {
final Intent intent = Intent.parseUri(uri, 0);
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
mContext.startActivity(intent);
if (mPhoneStatusBar != null) {
XposedHelpers.callMethod(mPhoneStatusBar, "animateCollapsePanels");
}
}
} catch (ActivityNotFoundException e) {
log("Error launching assigned app for long-press on clock: " + e.getMessage());
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例3: changeDigit
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private void changeDigit(Object key, int digit) {
XposedHelpers.setIntField(key, "mDigit", digit);
((TextView)XposedHelpers.getObjectField(key, "mDigitText"))
.setText(Integer.toString(digit));
TextView kt = (TextView) XposedHelpers.getObjectField(
key, "mKlondikeText");
kt.setText("");
kt.setVisibility(View.INVISIBLE);
if (digit >= 0) {
String[] sKlondike = (String[]) XposedHelpers.getStaticObjectField(
key.getClass(), "sKlondike");
if (sKlondike != null && sKlondike.length > digit) {
String klondike = sKlondike[digit];
if (klondike.length() > 0) {
kt.setText(klondike);
kt.setVisibility(View.VISIBLE);
}
}
}
((View)key).setContentDescription(Integer.toString(digit));
}
示例4: updateSettingsButton
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static void updateSettingsButton() {
if (mPhoneStatusBar == null || SysUiManagers.IconManager == null) return;
try {
Object header = XposedHelpers.getObjectField(mPhoneStatusBar, "mHeader");
ImageView settingsButton = (ImageView) XposedHelpers.getObjectField(
header, Utils.isSamsungRom() ? "mSettingButton" : "mSettingsButton");
if (SysUiManagers.IconManager.isColoringEnabled()) {
settingsButton.setColorFilter(SysUiManagers.IconManager.getIconColor(),
PorterDuff.Mode.SRC_IN);
} else {
settingsButton.clearColorFilter();
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例5: onCreateTileView
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
@Override
public void onCreateTileView(View tileView) throws Throwable {
super.onCreateTileView(tileView);
if (isPrimary() && hasField(tileView, "mIconFrame") && !Utils.isOxygenOs35Rom()) {
mDataOffView = new ImageView(mContext);
mDataOffView.setImageDrawable(mGbContext.getDrawable(R.drawable.ic_mobile_data_off));
mDataOffView.setVisibility(View.GONE);
FrameLayout iconFrame = (FrameLayout) XposedHelpers.getObjectField(tileView, "mIconFrame");
iconFrame.addView(mDataOffView, FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
if (mScalingFactor != 1f) {
mDataOffView.setScaleX(mScalingFactor);
mDataOffView.setScaleY(mScalingFactor);
}
if (PhoneWrapper.hasMsimSupport()) {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mDataOffView.getLayoutParams();
int marginPx = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -4,
mContext.getResources().getDisplayMetrics()));
lp.leftMargin = marginPx;
lp.topMargin = Math.round(marginPx/2f);
mDataOffView.setLayoutParams(lp);
}
}
}
示例6: setDefaultSubscription
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private boolean setDefaultSubscription(final SubType subType, final SubscriptionInfo subInfo) {
if (subInfo == null)
return false;
try {
if (subType == SubType.SMS) {
XposedHelpers.callMethod(mSubMgr, "setDefaultSmsSubId",
subInfo.getSubscriptionId());
} else if (subType == SubType.DATA) {
XposedHelpers.callMethod(mSubMgr, "setDefaultDataSubId",
subInfo.getSubscriptionId());
}
return true;
} catch (Throwable t) {
XposedBridge.log(t);
return false;
}
}
示例7: setTethering
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private void setTethering(boolean enabled) {
try {
Object pan = mBluetoothPan.get();
if (pan != null) {
XposedHelpers.callMethod(pan, "setBluetoothTethering", enabled);
if (DEBUG) log("setTethering: enabled=" + enabled);
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例8: resolveCallCardFragment
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static ClassInfo resolveCallCardFragment(ClassLoader cl) {
ClassInfo info = null;
String[] CLASS_NAMES = new String[] { "com.android.incallui.CallCardFragment", "ayv" };
String[] METHOD_NAMES = new String[] { "setDrawableToImageView" };
for (String className : CLASS_NAMES) {
Class<?> clazz = XposedHelpers.findClassIfExists(className, cl);
if (clazz == null || !Fragment.class.isAssignableFrom(clazz))
continue;
info = new ClassInfo(clazz);
for (String methodName : METHOD_NAMES) {
if (methodName.equals("setDrawableToImageView")) {
for (String realMethodName : new String[] { methodName, "b" }) {
Method m = XposedHelpers.findMethodExactIfExists(clazz, realMethodName,
Drawable.class);
if (m != null) {
info.methods.put(methodName, realMethodName);
break;
}
}
}
}
}
return info;
}
示例9: gen_smiley
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
/**
* Generate a kik smiley type, currently beta
*
* @param smiley_class smiley manager class
* @param title smiley title
* @param text smiley text used to generate it, i.e <3
* @param id smiley id
* @param installdate smiley install ID
* @return a smiley object
*/
static Object gen_smiley(Class smiley_class, String title, String text, String id, long installdate) {
/*
a = name
b = id
c and d = category/text
e = is active
f = ? (seems to always be true)
g = bought time
so constructor for it should be
name,category,id,category,time
*/
return XposedHelpers.newInstance(smiley_class, title, text, id, text, installdate);
}
示例10: init
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static void init() {
Context sysContext = (Context) XposedHelpers.callMethod(
XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null),
"currentActivityThread"),
"getSystemContext");
try {
PackageInfo pkgInfo = sysContext.getPackageManager().getPackageInfo(PKG_NAME, 0);
XposedBridge.log(String.format(Locale.getDefault(), "WCFP: Found WeChat version : %s (%d)", pkgInfo.versionName, pkgInfo.versionCode));
if ((isVersionSupported = VersionInfo.checkVersion(pkgInfo.versionCode))) {
VersionInfo.initMinify(pkgInfo.versionCode);
}
} catch (PackageManager.NameNotFoundException e) {
XposedBridge.log(e);
}
}
示例11: isOfficialConversation
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private boolean isOfficialConversation(Object value, Object messageStatus) {
String username = XposedHelpers.getObjectField(messageStatus, Constants.Value_Message_Bean_NickName).toString();
ArrayList<String> list = AppSaveInfoUtils.INSTANCE.getWhiteList("white_list_official");
boolean wcY = XposedHelpers.getBooleanField(messageStatus, Value_Message_Status_Is_OFFICIAL_1);
int wcU = XposedHelpers.getIntField(messageStatus, Value_Message_Status_Is_OFFICIAL_2);
String field_username = ((String) XposedHelpers.getObjectField(value, Value_Message_Status_Is_OFFICIAL_3));
boolean isOfficial = !"gh_43f2581f6fd6".equals(field_username) && wcY && (wcU == 1 || wcU == 2 || wcU == 3);
if (isOfficial) {
officialNickNameEntries.add(username);
for (String s : list) {
if (s.trim().equals(username)) return false;
}
}
return isOfficial;
}
示例12: findMethodGetInt
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
/**
* 劫持判斷是否使用虛擬定位
* @param loadPackageParam
*/
public static void findMethodGetInt(XC_LoadPackage.LoadPackageParam loadPackageParam){
// boolean isOpen = Settings.Secure.getInt(getContentResolver(),Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0;
XposedHelpers.findAndHookMethod("android.provider.Settings$Secure", loadPackageParam.classLoader, "getInt", ContentResolver.class, String.class, int.class, new XC_MethodHook() {
/**
* 設置返回值類型:
* 1、gpsEnabled && networkEnabled:LOCATION_MODE_HIGH_ACCURACY
* 2、gpsEnabled:LOCATION_MODE_SENSORS_ONLY
* 3、networkEnabled:LOCATION_MODE_BATTERY_SAVING
* 4、disable:LOCATION_MODE_OFF
*/
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
param.setResult(LOCATION_MODE_SENSORS_ONLY);
}
});
XposedHelpers.findAndHookMethod(Settings.Secure.class, "getInt", ContentResolver.class, String.class, int.class, new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
return LOCATION_MODE_SENSORS_ONLY;
}
});
}
示例13: canTriggerUnlock
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static boolean canTriggerUnlock(UnlockPolicy policy) {
if (policy == UnlockPolicy.DEFAULT) return true;
try {
ViewGroup stack = (ViewGroup) XposedHelpers.getObjectField(mPhoneStatusBar, "mStackScroller");
int childCount = stack.getChildCount();
int notifCount = 0;
int notifClearableCount = 0;
for (int i = 0; i < childCount; i++) {
View v = stack.getChildAt(i);
if (v.getVisibility() != View.VISIBLE ||
!v.getClass().getName().equals(CLASS_NOTIF_ROW))
continue;
notifCount++;
if ((boolean) XposedHelpers.callMethod(v, "isClearable")) {
notifClearableCount++;
}
}
return (policy == UnlockPolicy.NOTIF_NONE) ?
notifCount == 0 : notifClearableCount == 0;
} catch (Throwable t) {
XposedBridge.log(t);
return true;
}
}
示例14: setVolume
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private static void setVolume(float volume) {
Object player = XposedHelpers.getObjectField(mRingtone, "mLocalPlayer");
if (player != null) {
XposedHelpers.callMethod(player, "setVolume", volume);
} else if (XposedHelpers.getBooleanField(mRingtone, "mAllowRemote")) {
player = XposedHelpers.getObjectField(mRingtone, "mRemotePlayer");
if (player != null) {
try {
XposedHelpers.callMethod(player, "setVolume",
XposedHelpers.getObjectField(mRingtone, "mRemoteToken"),
volume);
} catch (Throwable t) {
}
}
}
}
示例15: createHooks
import de.robv.android.xposed.XposedHelpers; //導入依賴的package包/類
private void createHooks() {
try {
mCreateTileViewHook = XposedHelpers.findAndHookMethod(
mTile.getClass().getName(), mContext.getClassLoader(),
"createTileView", Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (mKey.equals(XposedHelpers.getAdditionalInstanceField(
param.thisObject, BaseTile.TILE_KEY_NAME))) {
onCreateTileView((View)param.getResult());
}
}
});
} catch (Throwable t) {
XposedBridge.log(t);
}
}