当前位置: 首页>>代码示例>>Java>>正文


Java XSharedPreferences类代码示例

本文整理汇总了Java中de.robv.android.xposed.XSharedPreferences的典型用法代码示例。如果您正苦于以下问题:Java XSharedPreferences类的具体用法?Java XSharedPreferences怎么用?Java XSharedPreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XSharedPreferences类属于de.robv.android.xposed包,在下文中一共展示了XSharedPreferences类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleLoadPackage

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam p1) throws Throwable
{
	String pn=p1.packageName;
	Log.d(tag, "PackageName:" + pn);
	XSharedPreferences xsp=new XSharedPreferences(this.getClass().getPackage().getName(), "xposed_blacklist");
	XSharedPreferences xsp2=new XSharedPreferences(this.getClass().getPackage().getName(), "config");
	String manufacturer=xsp2.getString("manufacturer", null);
	String model=xsp2.getString("model", null);
	String brand=xsp2.getString("brand", null);
	String product=xsp2.getString("product", null);
	String device=xsp2.getString("device", null);
	String blacklist=xsp.getString("main", null);
	if (!blacklist.contains(pn))
	{
		Log.d(tag, pn + ":return_OutOfBlackList");
		return;
	}
	Class<?> clz=XposedHelpers.findClass("android.os.Build", p1.classLoader);
	XposedHelpers.setStaticObjectField(clz, "MANUFACTURER", manufacturer);
	XposedHelpers.setStaticObjectField(clz, "BRAND", brand);
	XposedHelpers.setStaticObjectField(clz, "PRODUCT", product);
	XposedHelpers.setStaticObjectField(clz, "DEVICE", device);
	XposedHelpers.setStaticObjectField(clz, "MODEL", model);
}
 
开发者ID:nijigenirubasho,项目名称:mobiletailchanger,代码行数:26,代码来源:Xpo.java

示例2: getPref

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public static void getPref(XSharedPreferences gPref, XSharedPreferences lPref, String packageName) {
    SubscriptionKey = gPref.getString("SubscriptionKey", "");
    EnableYandex = gPref.getBoolean("EnableYandex", false);
    DelayWebView = Integer.parseInt(gPref.getString("DelayWebView", "500"));
    //boolean anon = gPref.getBoolean("Anon", true);
    //boolean debug = gPref.getBoolean("Debug", false);
    //boolean localEnabled = gPref.getBoolean(packageName, false);

    if (lPref.contains("OverRide")) {
        if (lPref.getBoolean("OverRide", false))
            gPref = lPref;
    }

    TranslateFromLanguage = gPref.getString("TranslateFromLanguage", "");
    TranslateToLanguage = gPref.getString("TranslateToLanguage", "");

    SetText = gPref.getBoolean("SetText", false);
    SetHint = gPref.getBoolean("SetHint", false);
    LoadURL = gPref.getBoolean("LoadURL", false);
    DrawText = gPref.getBoolean("DrawText", false);

    Caching = gPref.getBoolean("Cache", false);
    Delay = Integer.parseInt(gPref.getString("Delay", "0"));
}
 
开发者ID:akhilkedia,项目名称:AllTrans,代码行数:25,代码来源:PreferenceList.java

示例3: onInitialize

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
@Override
protected void onInitialize(XSharedPreferences prefs) throws Throwable {
    Context gbContext = Utils.getGbContext(getContext());
    mB = gbContext.getString(R.string.byte_abbr);
    mKB = gbContext.getString(R.string.kilobyte_abbr);
    mMB = gbContext.getString(R.string.megabyte_abbr);
    mS = gbContext.getString(R.string.second_abbr);

    try {
        int inactivityMode = Integer.valueOf(prefs.getString(
                GravityBoxSettings.PREF_KEY_DATA_TRAFFIC_INACTIVITY_MODE, "0"));
        setInactivityMode(inactivityMode);
    } catch (NumberFormatException nfe) {
        log("Invalid preference value for PREF_KEY_DATA_TRAFFIC_INACTIVITY_MODE");
    }

    setTextSize(TypedValue.COMPLEX_UNIT_DIP, mSize);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:19,代码来源:TrafficMeter.java

示例4: LockscreenAppBar

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public LockscreenAppBar(Context ctx, Context gbCtx, ViewGroup container,
        Object statusBar, XSharedPreferences prefs) {
    mContext = ctx;
    mGbContext = gbCtx;
    mContainer = container;
    mStatusBar = statusBar;
    mPrefs = prefs;
    mPm = mContext.getPackageManager();
    mHandler = new Handler();
    mSafeLaunchEnabled = prefs.getBoolean(
            GravityBoxSettings.PREF_KEY_LOCKSCREEN_SHORTCUT_SAFE_LAUNCH, false);
    mShowBadges = prefs.getBoolean(
            GravityBoxSettings.PREF_KEY_LOCKSCREEN_SHORTCUT_SHOW_BADGES, false);

    mNdMonitor = SysUiManagers.NotifDataMonitor;
    if (mNdMonitor != null) {
        mNdMonitor.registerListener(this);
    }

    initAppSlots();

    mKgMonitor = SysUiManagers.KeyguardMonitor;
    mKgMonitor.registerListener(this);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:25,代码来源:LockscreenAppBar.java

示例5: initPackageResources

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public static void initPackageResources(final XSharedPreferences prefs, final InitPackageResourcesParam resparam) {
    try {
        XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res);
        resparam.res.setReplacement(PACKAGE_NAME, "array", "window_animation_scale_entries",
                modRes.fwd(R.array.window_animation_scale_entries));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "window_animation_scale_values",
                modRes.fwd(R.array.window_animation_scale_values));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "transition_animation_scale_entries",
                modRes.fwd(R.array.transition_animation_scale_entries));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "transition_animation_scale_values",
                modRes.fwd(R.array.transition_animation_scale_values));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "animator_duration_scale_entries",
                modRes.fwd(R.array.animator_duration_scale_entries));
        resparam.res.setReplacement(PACKAGE_NAME, "array", "animator_duration_scale_values",
                modRes.fwd(R.array.animator_duration_scale_values));
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:20,代码来源:ModSettings.java

示例6: BatteryInfoManager

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
protected BatteryInfoManager(Context context, XSharedPreferences prefs) {
    mContext = context;
    mBatteryData = new BatteryData();
    mListeners = new ArrayList<BatteryStatusListener>();
    mSounds = new Uri[4];
    mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mBatteryData.isPowerSaving = mPowerManager.isPowerSaveMode();

    setSound(BatteryInfoManager.SOUND_CHARGED,
            prefs.getString(GravityBoxSettings.PREF_KEY_BATTERY_CHARGED_SOUND, ""));
    setSound(BatteryInfoManager.SOUND_PLUGGED,
            prefs.getString(GravityBoxSettings.PREF_KEY_CHARGER_PLUGGED_SOUND, ""));
    setSound(BatteryInfoManager.SOUND_UNPLUGGED,
            prefs.getString(GravityBoxSettings.PREF_KEY_CHARGER_UNPLUGGED_SOUND, ""));

    try {
        mLowBatteryWarningPolicy = LowBatteryWarningPolicy.valueOf(prefs.getString(
            GravityBoxSettings.PREF_KEY_LOW_BATTERY_WARNING_POLICY, "DEFAULT"));
    } catch (Throwable t) {
        mLowBatteryWarningPolicy = LowBatteryWarningPolicy.DEFAULT;
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:BatteryInfoManager.java

示例7: StatusbarBatteryPercentage

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public StatusbarBatteryPercentage(TextView view, XSharedPreferences prefs,
                                  BatteryStyleController controller) {
    mPercentage = view;
    mController = controller;
    mDefaultColor = mIconColor = mPercentage.getCurrentTextColor();

    try {
        Resources res = mPercentage.getResources();
        int resId = res.getIdentifier("battery_level_text_size", "dimen",
                BatteryStyleController.PACKAGE_NAME);
        mDefaultSizePx = res.getDimensionPixelSize(resId);
    } catch (Throwable t) {
        mDefaultSizePx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16,
                mPercentage.getResources().getDisplayMetrics());
    }

    initPreferences(prefs);

    if (SysUiManagers.IconManager != null) {
        SysUiManagers.IconManager.registerListener(this);
    }
    if (SysUiManagers.BatteryInfoManager != null) {
        SysUiManagers.BatteryInfoManager.registerListener(this);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:26,代码来源:StatusbarBatteryPercentage.java

示例8: init

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        final Class<?> classDevSettings = XposedHelpers.findClass(CLASS_DEV_SETTINGS, classLoader);

        if (DEBUG) log("hooking DeveloperSettings.onCreate method");
        XposedHelpers.findAndHookMethod(classDevSettings, "onCreate", Bundle.class, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
                PreferenceFragment pf = (PreferenceFragment) param.thisObject;
                mResId = pf.getResources().getIdentifier("development_prefs", "xml", PACKAGE_NAME);
                if (DEBUG) log("mResId=" + mResId);
            }
        });
    }
    catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:19,代码来源:MtkFixDevOptions.java

示例9: initResources

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public static void initResources(final XSharedPreferences prefs, final InitPackageResourcesParam resparam) {
    try {
        // Lockscreen: disable menu key in lock screen
        Utils.TriState triState = Utils.TriState.valueOf(prefs.getString(
                GravityBoxSettings.PREF_KEY_LOCKSCREEN_MENU_KEY, "DEFAULT"));
        if (DEBUG) log(GravityBoxSettings.PREF_KEY_LOCKSCREEN_MENU_KEY + ": " + triState);
        if (triState != Utils.TriState.DEFAULT) {
            resparam.res.setReplacement(PACKAGE_NAME, "bool", "config_disableMenuKeyInLockScreen",
                    triState == Utils.TriState.DISABLED);
            if (DEBUG)
                log("config_disableMenuKeyInLockScreen: " + (triState == Utils.TriState.DISABLED));
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:17,代码来源:ModLockscreen.java

示例10: initAndroid

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
static void initAndroid(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        if (DEBUG) log("init");

        updatePreference(prefs);

        Class<?> classPhoneWindowManager = findClass("com.android.server.policy.PhoneWindowManager", classLoader);
        XposedBridge.hookAllConstructors(classPhoneWindowManager, handleConstructPhoneWindowManager);

        // take advantage of screenTurnedOff method for refreshing state of allowSkipTrack preference
        findAndHookMethod(classPhoneWindowManager, "screenTurnedOff", new XC_MethodHook() {

            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                if (DEBUG) log("screenTurnedOff");
                updatePreference(prefs);
            }
        });

        findAndHookMethod(classPhoneWindowManager, "interceptKeyBeforeQueueing",
                KeyEvent.class, int.class, handleInterceptKeyBeforeQueueing);
    } catch (Throwable t) { XposedBridge.log(t); }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:24,代码来源:ModVolumeKeySkipTrack.java

示例11: init

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        final Class<?> classDownloadService = XposedHelpers.findClass(CLASS_DOWNLOAD_SERVICE, classLoader);

        XposedHelpers.findAndHookMethod(classDownloadService, "updateLocked", new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                final boolean isActive = (Boolean) param.getResult();
                if (mIsActive != isActive) { 
                    mIsActive = isActive;
                    if (DEBUG) log("Download state changed; active=" + mIsActive);
                    final Context context = (Context) param.thisObject;
                    Intent intent = new Intent(ACTION_DOWNLOAD_STATE_CHANGED);
                    intent.putExtra(EXTRA_ACTIVE, mIsActive);
                    context.sendBroadcast(intent);
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:ModDownloadProvider.java

示例12: PieLongPressHandler

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public PieLongPressHandler(Context context, XSharedPreferences prefs) {
    mContext = context;

    mActions = new HashMap<ButtonType, ModHwKeys.HwKeyAction>();
    mActions.put(ButtonType.BACK, new ModHwKeys.HwKeyAction(Integer.valueOf(
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_BACK_LONGPRESS, "0")),
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_BACK_LONGPRESS+"_custom", null)));
    mActions.put(ButtonType.HOME, new ModHwKeys.HwKeyAction(Integer.valueOf(
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_HOME_LONGPRESS, "0")),
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_HOME_LONGPRESS+"_custom", null)));
    mActions.put(ButtonType.RECENT, new ModHwKeys.HwKeyAction(Integer.valueOf(
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_RECENTS_LONGPRESS, "0")),
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_RECENTS_LONGPRESS+"_custom", null)));
    mActions.put(ButtonType.SEARCH, new ModHwKeys.HwKeyAction(Integer.valueOf(
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_SEARCH_LONGPRESS, "0")),
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_SEARCH_LONGPRESS+"_custom", null)));
    mActions.put(ButtonType.MENU, new ModHwKeys.HwKeyAction(Integer.valueOf(
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_MENU_LONGPRESS, "0")),
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_MENU_LONGPRESS+"_custom", null)));
    mActions.put(ButtonType.APP_LAUNCHER, new ModHwKeys.HwKeyAction(Integer.valueOf(
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_APP_LONGPRESS, "0")),
            prefs.getString(GravityBoxSettings.PREF_KEY_PIE_APP_LONGPRESS+"_custom", null)));
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:24,代码来源:PieLongPressHandler.java

示例13: SyncTile

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public SyncTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mHandler = new Handler();
    mReceiver = new GravityBoxResultReceiver(mHandler);
    mReceiver.setReceiver(new Receiver() {
        @Override
        public void onReceiveResult(int resultCode, Bundle resultData) {
            if (resultCode == GravityBoxService.RESULT_SYNC_STATUS) {
                final boolean oldState = mSyncState;
                mSyncState = resultData.getBoolean(GravityBoxService.KEY_SYNC_STATUS);
                if (mSyncState != oldState) { 
                    refreshState();
                    if (DEBUG) log(getKey() + ": onReceiveResult: mSyncState=" + mSyncState);
                }
            }
        }
    });
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:21,代码来源:SyncTile.java

示例14: NfcTile

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public NfcTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mHandler = new Handler();
    mReceiver = new GravityBoxResultReceiver(mHandler);
    mReceiver.setReceiver(new Receiver() {
        @Override
        public void onReceiveResult(int resultCode, Bundle resultData) {
            if (resultData != null && resultData.containsKey("nfcState")) {
                int newState = resultData.getInt("nfcState");
                if (mNfcState != newState) {
                    mNfcState = newState;
                    refreshState();
                }
            }
        }
    });
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:20,代码来源:NfcTile.java

示例15: TorchTile

import de.robv.android.xposed.XSharedPreferences; //导入依赖的package包/类
public TorchTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mReceiver = new GravityBoxResultReceiver(new Handler());
    mReceiver.setReceiver(new Receiver() {
        @Override
        public void onReceiveResult(int resultCode, Bundle resultData) {
            final int oldState = mTorchStatus;
            mTorchStatus = resultData.getInt(TorchService.EXTRA_TORCH_STATUS);
            if (mTorchStatus != oldState) { 
                refreshState();
                if (DEBUG) log(getKey() + ": onReceiveResult: mTorchStatus=" + mTorchStatus);
            }
        }
    });
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:18,代码来源:TorchTile.java


注:本文中的de.robv.android.xposed.XSharedPreferences类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。