Java Code Examples for de.robv.android.xposed.XposedHelpers#setIntField()
The following examples show how to use
de.robv.android.xposed.XposedHelpers#setIntField() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LockscreenPinScrambler.java From GravityBox with Apache License 2.0 | 6 votes |
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)); }
Example 2
Source File: StatusbarBattery.java From GravityBox with Apache License 2.0 | 6 votes |
public void setColors(int mainColor, int frameColor, int chargeColor) { if (mBattery != null) { try { Object drawable = getDrawable(); final int[] colors = (int[]) XposedHelpers.getObjectField(drawable, "mColors"); colors[colors.length - 1] = mainColor; if (Utils.isLineageOs()) { Drawable frameDrawable = (Drawable) XposedHelpers.getObjectField(drawable, "mFrameDrawable"); frameDrawable.setAlpha(mFrameAlpha); frameDrawable.setTint(frameColor); Paint paint = (Paint) XposedHelpers.getObjectField(drawable, "mTextAndBoltPaint"); paint.setColor(chargeColor); } else { final Paint framePaint = (Paint) XposedHelpers.getObjectField(drawable, "mFramePaint"); framePaint.setColor(frameColor); framePaint.setAlpha(mFrameAlpha); XposedHelpers.setIntField(drawable, "mChargeColor", chargeColor); } XposedHelpers.setIntField(drawable, "mIconTint", mainColor); } catch (Throwable t) { XposedBridge.log(t); } } }
Example 3
Source File: StatusbarSignalCluster.java From GravityBox with Apache License 2.0 | 6 votes |
protected void updateBatteryPadding() { if (Utils.isXperiaDevice()) return; try { if (mBatteryPaddingOriginal == null) { mBatteryPaddingOriginal = XposedHelpers.getIntField(mView, "mEndPadding"); } int padding = mBatteryPaddingOriginal; if (mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_NONE) { if ((mContainerType == ContainerType.STATUSBAR && !mPercentTextSb) || (mContainerType == ContainerType.KEYGUARD)) { padding = Math.round((float) mBatteryPaddingOriginal / 4f); } } XposedHelpers.setIntField(mView, "mEndPadding", padding); } catch (Throwable t) { XposedBridge.log(t); } }
Example 4
Source File: XposedHelpersWraper.java From MIUIAnesthetist with MIT License | 5 votes |
public static void setIntField(Object obj, String fieldName, int value) { try { XposedHelpers.setIntField(obj, fieldName, value); } catch (Throwable t) { log(t); } }
Example 5
Source File: RevokeMsgHook.java From XposedWechatHelper with GNU General Public License v2.0 | 5 votes |
private static void handleMessageRecall(ContentValues contentValues) { long msgId = contentValues.getAsLong("msgId"); Object msg = msgCacheMap.get(msgId); if (msg != null) { long createTime = XposedHelpers.getLongField(msg, "field_createTime"); XposedHelpers.setIntField(msg, "field_type", contentValues.getAsInteger("type")); XposedHelpers.setObjectField(msg, "field_content", contentValues.getAsString("content") + "(已被阻止)"); XposedHelpers.setLongField(msg, "field_createTime", createTime + 1L); XposedHelpers.callMethod(storageInsertObject, ApiFactory.getCurrent().storage_MsgInfoStorage_insert_method, msg, false); } }
Example 6
Source File: AntiRevoke.java From WechatEnhancement with GNU General Public License v3.0 | 5 votes |
private void handleMessageRecall(ContentValues contentValues) { long msgId = contentValues.getAsLong("msgId"); Object msg = msgCacheMap.get(msgId); long createTime = XposedHelpers.getLongField(msg, "field_createTime"); XposedHelpers.setIntField(msg, "field_type", contentValues.getAsInteger("type")); XposedHelpers.setObjectField(msg, "field_content", contentValues.getAsString("content") + "(已被阻止)"); XposedHelpers.setLongField(msg, "field_createTime", createTime + 1L); XposedHelpers.callMethod(storageInsertClazz, HookParams.getInstance().MsgInfoStorageInsertMethod, msg, false); }
Example 7
Source File: ModNavigationBar.java From GravityBox with Apache License 2.0 | 5 votes |
private static void updateRecentsKeyCode() { if (mRecentsKeys == null) return; try { final boolean hasAction = recentsKeyHasAction(); for (Object o : mRecentsKeys) { if (o != null) { XposedHelpers.setIntField(o, "mCode", hasAction ? KeyEvent.KEYCODE_APP_SWITCH : 0); } } } catch (Throwable t) { XposedBridge.log(t); } }
Example 8
Source File: BaseTile.java From GravityBox with Apache License 2.0 | 5 votes |
@Override public void onCreateTileView(View tileView) throws Throwable { XposedHelpers.setAdditionalInstanceField(tileView, TILE_KEY_NAME, mKey); mScalingFactor = QsPanel.getScalingFactor(Integer.valueOf(mPrefs.getString( GravityBoxSettings.PREF_KEY_QUICK_SETTINGS_TILES_PER_ROW, "0")), mPrefs.getInt(GravityBoxSettings.PREF_KEY_QS_SCALE_CORRECTION, 0)); if (mScalingFactor != 1f) { int iconSizePx = XposedHelpers.getIntField(tileView, "mIconSizePx"); XposedHelpers.setIntField(tileView, "mIconSizePx", Math.round(iconSizePx*mScalingFactor)); int tileSpacingPx = XposedHelpers.getIntField(tileView, "mTileSpacingPx"); XposedHelpers.setIntField(tileView, "mTileSpacingPx", Math.round(tileSpacingPx*mScalingFactor)); int tilePaddingBelowIconPx = XposedHelpers.getIntField(tileView, "mTilePaddingBelowIconPx"); XposedHelpers.setIntField(tileView, "mTilePaddingBelowIconPx", Math.round(tilePaddingBelowIconPx*mScalingFactor)); int dualTileVerticalPaddingPx = XposedHelpers.getIntField(tileView, "mDualTileVerticalPaddingPx"); XposedHelpers.setIntField(tileView, "mDualTileVerticalPaddingPx", Math.round(dualTileVerticalPaddingPx*mScalingFactor)); updateLabelLayout(tileView); updatePaddingTop(tileView); if (tileView.getClass().getName().equals(CLASS_SIGNAL_TILE_VIEW) && Utils.isMotoXtDevice()) { updateMotoXtSignalIconLayout(tileView); } } }
Example 9
Source File: ModDisplay.java From GravityBox with Apache License 2.0 | 4 votes |
private static void updateAutobrightnessConfig(int[] lux, int[] brightness) { if (mDisplayPowerController == null || mContext == null) return; if (DEBUG) log("updateAutobrightnessConfig called"); Resources res = mContext.getResources(); boolean mtkVirtualValuesSupport = false; boolean mtkVirtualValues = false; int screenBrightnessDim = res.getInteger(res.getIdentifier( "config_screenBrightnessDim", "integer", "android")); int screenBrightnessMinimum = res.getInteger(res.getIdentifier( "config_screenBrightnessSettingMinimum", "integer", "android")); screenBrightnessMinimum = Math.min(screenBrightnessDim, screenBrightnessMinimum); boolean useSwAutobrightness = XposedHelpers.getBooleanField( mDisplayPowerController, "mUseSoftwareAutoBrightnessConfig"); if (useSwAutobrightness) { // brightness array must have one more element than lux array int[] brightnessAdj = new int[lux.length + 1]; for (int i = 0; i < brightnessAdj.length; i++) { if (i < brightness.length) { brightnessAdj[i] = brightness[i]; } else { brightnessAdj[i] = 255; } } if (DEBUG) log("updateAutobrightnessConfig: lux=" + Utils.intArrayToString(lux) + "; brightnessAdj=" + Utils.intArrayToString(brightnessAdj)); if (Utils.isMtkDevice()) { try { mtkVirtualValues = (boolean) XposedHelpers.getStaticBooleanField( mDisplayPowerController.getClass(), "MTK_ULTRA_DIMMING_SUPPORT"); int resId = res.getIdentifier("config_screenBrightnessVirtualValues", "bool", "android"); if (resId != 0) { mtkVirtualValues &= res.getBoolean(resId); } mtkVirtualValuesSupport = true; if (DEBUG) log("MTK brightness virtual values: " + mtkVirtualValues); } catch (Throwable t) { if (DEBUG) log("Couldn't detect MTK virtual values feature"); } } Object autoBrightnessSpline = mtkVirtualValuesSupport ? XposedHelpers.callMethod( mDisplayPowerController, "createAutoBrightnessSpline", lux, brightnessAdj, mtkVirtualValues) : XposedHelpers.callMethod(mDisplayPowerController, "createAutoBrightnessSpline", lux, brightnessAdj); if (autoBrightnessSpline != null) { Object abrCtrl = XposedHelpers.getObjectField(mDisplayPowerController, "mAutomaticBrightnessController"); XposedHelpers.setObjectField(abrCtrl, "mScreenAutoBrightnessSpline", autoBrightnessSpline); if (brightnessAdj[0] < screenBrightnessMinimum) { screenBrightnessMinimum = brightnessAdj[0]; } } else { XposedHelpers.setBooleanField(mDisplayPowerController, "mUseSoftwareAutoBrightnessConfig", false); log("Error computing auto-brightness spline: lux=" + Utils.intArrayToString(lux) + "; brightnessAdj=" + Utils.intArrayToString(brightnessAdj)); } } int screenBrightnessRangeMinimum = mtkVirtualValuesSupport ? (Integer) XposedHelpers.callMethod(mDisplayPowerController, "clampAbsoluteBrightness", screenBrightnessMinimum, mtkVirtualValues) : (Integer) XposedHelpers.callMethod( mDisplayPowerController, "clampAbsoluteBrightness", screenBrightnessMinimum); XposedHelpers.setIntField(mDisplayPowerController, "mScreenBrightnessRangeMinimum", screenBrightnessRangeMinimum); if (DEBUG) log("Autobrightness config updated"); }
Example 10
Source File: ModExpandedDesktop.java From GravityBox with Apache License 2.0 | 4 votes |
private static void setInt(String field, int value) { XposedHelpers.setIntField(mPhoneWindowManager, field, value); }
Example 11
Source File: BaseTile.java From GravityBox with Apache License 2.0 | 4 votes |
private void updatePaddingTop(View tileView) { int tilePaddingTopPx = XposedHelpers.getIntField(tileView, "mTilePaddingTopPx"); XposedHelpers.setIntField(tileView, "mTilePaddingTopPx", Math.round(tilePaddingTopPx*mScalingFactor)); }
Example 12
Source File: QuickAppTile.java From GravityBox with Apache License 2.0 | 4 votes |
@Override public boolean handleLongClick() { LayoutInflater inflater = LayoutInflater.from(mGbContext); View appv = inflater.inflate(R.layout.quick_settings_app_dialog, null); int count = 0; AppInfo lastAppInfo = null; for (AppInfo ai : mAppSlots) { TextView tv = (TextView) appv.findViewById(ai.getResId()); if (ai.getValue() == null) { tv.setVisibility(View.GONE); continue; } tv.setText(ai.getAppName()); tv.setTextSize(1, 10); tv.setMaxLines(2); tv.setEllipsize(TruncateAt.END); tv.setCompoundDrawablesWithIntrinsicBounds(null, ai.getAppIcon(), null, null); tv.setClickable(true); tv.setOnClickListener(mOnSlotClick); count++; lastAppInfo = ai; } if (count == 1) { try { startActivity(lastAppInfo.getIntent()); } catch (Throwable t) { log(getKey() + ": Unable to start activity: " + t.getMessage()); } } else if (count > 1) { mDialog = new Dialog(mContext, android.R.style.Theme_Material_Dialog_NoActionBar); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setContentView(appv); mDialog.setCanceledOnTouchOutside(true); mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL); int pf = XposedHelpers.getIntField(mDialog.getWindow().getAttributes(), "privateFlags"); pf |= 0x00000010; XposedHelpers.setIntField(mDialog.getWindow().getAttributes(), "privateFlags", pf); mDialog.getWindow().clearFlags(LayoutParams.FLAG_DIM_BEHIND); mDialog.show(); mHandler.removeCallbacks(mDismissDialogRunnable); mHandler.postDelayed(mDismissDialogRunnable, 4000); } return true; }