de.robv.android.xposed.XSharedPreferences Java Examples

The following examples show how to use de.robv.android.xposed.XSharedPreferences. 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: MiuiLauncherHook.java    From XMiTools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
    if (PACKAGE_NAME.equals(lpparam.packageName)) {
        XLog.i("Hooking MIUI Launcher...");

        XSharedPreferences xsp = XSPUtils.getXSharedPreferences();

        ClassLoader classLoader = lpparam.classLoader;
        if (XSPUtils.isMainSwitchEnabled(xsp)) {
            if(!MiuiUtils.isMiui()) {
                return;
            }
            new WorkSpaceHook(classLoader, xsp).startHook();
        }

    }
}
 
Example #2
Source File: BatteryInfoManager.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
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;
    }
}
 
Example #3
Source File: TrafficMeter.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #4
Source File: NfcTile.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
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();
                }
            }
        }
    });
}
 
Example #5
Source File: SyncTile.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
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);
                }
            }
        }
    });
}
 
Example #6
Source File: PieLongPressHandler.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
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)));
}
 
Example #7
Source File: AppLauncher.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public AppLauncher(Context context, XSharedPreferences prefs) throws Throwable {
    mContext = context;
    mResources = mContext.getResources();
    mPrefs = prefs;
    mGbContext = Utils.getGbContext(mContext);
    mGbResources = mGbContext.getResources();
    mHandler = new Handler();
    mPm = mContext.getPackageManager();

    mAppSlots = new ArrayList<AppInfo>();
    mAppSlots.add(new AppInfo(R.id.quickapp1));
    mAppSlots.add(new AppInfo(R.id.quickapp2));
    mAppSlots.add(new AppInfo(R.id.quickapp3));
    mAppSlots.add(new AppInfo(R.id.quickapp4));
    mAppSlots.add(new AppInfo(R.id.quickapp5));
    mAppSlots.add(new AppInfo(R.id.quickapp6));
    mAppSlots.add(new AppInfo(R.id.quickapp7));
    mAppSlots.add(new AppInfo(R.id.quickapp8));
    mAppSlots.add(new AppInfo(R.id.quickapp9));
    mAppSlots.add(new AppInfo(R.id.quickapp10));
    mAppSlots.add(new AppInfo(R.id.quickapp11));
    mAppSlots.add(new AppInfo(R.id.quickapp12));

    IntentFilter intentFilter = new IntentFilter(Intent.ACTION_PACKAGE_FULLY_REMOVED);
    intentFilter.addDataScheme("package");
    mContext.registerReceiver(mPackageRemoveReceiver, intentFilter);
}
 
Example #8
Source File: RingerModeTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public RingerModeTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mState.label = mGbContext.getString(R.string.qs_tile_ringer_mode);
    mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);

    mSettingsObserver = new SettingsObserver(new Handler());
}
 
Example #9
Source File: QsTileEventDistributor.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public QsTileEventDistributor(Object host, XSharedPreferences prefs) {
    mHost = host;
    mPrefs = prefs;
    mListeners = new LinkedHashMap<String, QsEventListener>();
    mBroadcastSubReceivers = new ArrayList<BroadcastSubReceiver>();
    SysUiManagers.KeyguardMonitor.registerListener(this);

    createHooks();
    prepareBroadcastReceiver();
}
 
Example #10
Source File: TrafficMeterOmni.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize(XSharedPreferences prefs) throws Throwable {
    mGbContext = Utils.getGbContext(getContext());
    SYMBOLS.put("b/s", mGbContext.getString(R.string.bit_per_sec_abbr));
    SYMBOLS.put("B/s", mGbContext.getString(R.string.byte_per_sec_abbr));
    SYMBOLS.put("k", mGbContext.getString(R.string.kilo_abbr));
    SYMBOLS.put("M", mGbContext.getString(R.string.mega_abbr));
    SYMBOLS.put("G", mGbContext.getString(R.string.giga_abbr));

    mMode = Mode.valueOf(prefs.getString(GravityBoxSettings.PREF_KEY_DATA_TRAFFIC_OMNI_MODE, "IN_OUT"));
    mShowIcon = prefs.getBoolean(GravityBoxSettings.PREF_KEY_DATA_TRAFFIC_OMNI_SHOW_ICON, true);
    mAutoHide = prefs.getBoolean(GravityBoxSettings.PREF_KEY_DATA_TRAFFIC_OMNI_AUTOHIDE, false);
    mAutoHideThreshold = prefs.getInt(GravityBoxSettings.PREF_KEY_DATA_TRAFFIC_OMNI_AUTOHIDE_TH, 10);
    setSize();
}
 
Example #11
Source File: ModVolumePanel.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public static void initResources(XSharedPreferences prefs, InitPackageResourcesParam resparam) {
    XModuleResources modRes = XModuleResources.createInstance(GravityBox.MODULE_PATH, resparam.res);

    mIconNotifResId = XResources.getFakeResId(modRes, R.drawable.ic_audio_notification);
    resparam.res.setReplacement(mIconNotifResId, modRes.fwd(R.drawable.ic_audio_notification));
    mIconNotifMuteResId = XResources.getFakeResId(modRes, R.drawable.ic_audio_notification_mute);
    resparam.res.setReplacement(mIconNotifMuteResId, modRes.fwd(R.drawable.ic_audio_notification_mute));
}
 
Example #12
Source File: QsQuickPulldownHandler.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public QsQuickPulldownHandler(Context context, XSharedPreferences prefs, 
        QsTileEventDistributor eventDistributor) {
    mContext = context;
    mPrefs = prefs;
    eventDistributor.registerBroadcastSubReceiver(this);

    initPreferences();
    createHooks();
    if (DEBUG) log("Quick pulldown handler created");
}
 
Example #13
Source File: ExpandedDesktopTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public ExpandedDesktopTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mHandler = new Handler();
    mSettingsObserver = new SettingsObserver(mHandler);
}
 
Example #14
Source File: GravityBoxTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public GravityBoxTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mState.icon = mGbContext.getDrawable(R.drawable.ic_qs_gravitybox);
    mState.label = "GravityBox";
}
 
Example #15
Source File: PhoneStatusBarViewHook.java    From XMiTools with GNU General Public License v3.0 5 votes vote down vote up
public PhoneStatusBarViewHook(ClassLoader classLoader, XSharedPreferences xsp) {
    super(classLoader, xsp);
    String alignment = XSPUtils.getStatusBarClockAlignment(xsp);
    if (PrefConst.ALIGNMENT_CENTER.equals(alignment)) {
        mAlignmentCenter = true;
        mAlignmentRight = false;
    } else if (PrefConst.ALIGNMENT_RIGHT.equals(alignment)) {
        mAlignmentCenter = false;
        mAlignmentRight = true;
    }
}
 
Example #16
Source File: SystemUIHook.java    From XMiTools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
    if (PACKAGE_NAME.equals(lpparam.packageName)) {
        XLog.i("Hooking SystemUI...");

        XSharedPreferences xsp = XSPUtils.getXSharedPreferences();

        ClassLoader classLoader = lpparam.classLoader;
        if (XSPUtils.isMainSwitchEnabled(xsp)) {
            if(!MiuiUtils.isMiui()) {
                return;
            }
            MiuiVersion miuiVersion = MiuiUtils.getMiuiVersion();
            if (miuiVersion.getTime() >= MiuiVersion.V_19_5_7.getTime()) {
                new MiuiKeyguardVerticalClockHook(classLoader, xsp).startHook();
                new MiuiKeyguardLeftTopClockHook(classLoader, xsp).startHook();
                new ChooseKeyguardClockActivityHook(classLoader, xsp).startHook();
                new MiuiKeyguardBaseClockHook(classLoader, xsp).startHook();
            } else {
                new MiuiKeyguardClockHook(classLoader, xsp).startHook();
            }
            new PhoneStatusBarViewHook(classLoader, xsp).startHook();
            new StatusBarClockHook(classLoader, xsp).startHook();
            new KeyguardClockContainerHook(classLoader, xsp).startHook();

            new CollapsedStatusBarFragmentHook(classLoader, xsp, miuiVersion).startHook();
            new SignalClusterViewHook(classLoader, xsp, miuiVersion).startHook();

            new HeaderViewHook(classLoader, xsp, miuiVersion).startHook();
            new BatteryMeterViewHook(classLoader, xsp, miuiVersion).startHook();
        }
    }
}
 
Example #17
Source File: MotoTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
protected MotoTile(Object host, String aospKey, Object tile,
        XSharedPreferences prefs, QsTileEventDistributor eventDistributor)
                throws Throwable {
    super(host, "moto_tile_"+aospKey, tile, prefs, eventDistributor);

    mAospKey = aospKey;
}
 
Example #18
Source File: CompassTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public CompassTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
    mAccelerationSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mGeomagneticFieldSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
    mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
}
 
Example #19
Source File: QsTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
protected QsTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mState = new State(mKey);

    mTile = createTileObject();
    XposedHelpers.setAdditionalInstanceField(mTile, TILE_KEY_NAME, mKey);

    if (sResourceIconClass == null) {
        sResourceIconClass = getResourceIconClass(mContext.getClassLoader());
    }
}
 
Example #20
Source File: XSPUtils.java    From XMiTools with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 获取一言刷新时间间隔,单位为min
 */
public static long getOneSentenceRefreshRate(XSharedPreferences xsp) {
    String text = xsp.getString(PrefConst.ONE_SENTENCE_REFRESH_RATE, PrefConst.ONE_SENTENCE_REFRESH_RATE_DEFAULT);
    long refreshRate;
    try {
        refreshRate = Long.parseLong(text);
    } catch (Throwable t) {
        refreshRate = Long.parseLong(PrefConst.ONE_SENTENCE_REFRESH_RATE_DEFAULT);
    }
    return refreshRate;
}
 
Example #21
Source File: QQPluginHook.java    From XposedManyMoney with GNU General Public License v2.0 5 votes vote down vote up
public static void hook(ClassLoader classLoader) {
    xsp = new XSharedPreferences(BuildConfig.APPLICATION_ID, SettingLabelView.DEFAULT_PREFERENCES_NAME);
    xsp.makeWorldReadable();
    try {
        final Class qvipPayAccountActivityClazz = XposedHelpers.findClass("com.qwallet.activity.QvipPayAccountActivity", classLoader);
        handleHook(qvipPayAccountActivityClazz);
        Method[] methods = qvipPayAccountActivityClazz.getMethods();
        for (Method method : methods) {
            if (method.getParameterTypes().length == 1
                    && method.getParameterTypes()[0] == qvipPayAccountActivityClazz
                    && method.getReturnType() == TextView.class) {

                XposedBridge.hookAllMethods(qvipPayAccountActivityClazz, method.getName(), new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        Object object = param.getResult();
                        if (object != null && object.getClass() == TextView.class) {
                            handleHook((TextView) object);
                        }
                        super.afterHookedMethod(param);
                    }
                });
            }
        }
    } catch (Error | Exception e) {
        e.printStackTrace();
    }
}
 
Example #22
Source File: Main.java    From MinMinGuard with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void initZygote(StartupParam startupParam) throws Throwable
{
    try
    {
        xposedVersionCode = XposedBridge.getXposedVersion();
    }
    catch(Exception e)
    {
        xposedVersionCode = XposedBridge.XPOSED_BRIDGE_VERSION;
    }

    MODULE_PATH = startupParam.modulePath;

    if(xposedVersionCode < 90)
        UnpackResources();
    else
        Util.log(MY_PACKAGE_NAME, "Skipping resource unpacking for now");

    notifyWorker = Executors.newSingleThreadExecutor();

    String dataDir = "data/";
    if (Build.VERSION.SDK_INT > 23) dataDir = "user_de/0/";

    File f = new File("/data/" + dataDir + MY_PACKAGE_NAME + "/shared_prefs/" + Common.MOD_PREFS + ".xml");
    pref = new XSharedPreferences(f);
}
 
Example #23
Source File: BaseTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public BaseTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    mHost = host;
    mKey = key;
    mPrefs = prefs;
    mEventDistributor = eventDistributor;
    mKgMonitor = SysUiManagers.KeyguardMonitor;

    mContext = (Context) XposedHelpers.callMethod(mHost, "getContext");
    mGbContext = Utils.getGbContext(mContext);

    mEventDistributor.registerListener(this);
    initPreferences();
}
 
Example #24
Source File: ModDialer25.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private static void reloadPrefs(XSharedPreferences prefs) {
    if ((System.currentTimeMillis() - mPrefsReloadedTstamp) > 10000) {
        if (DEBUG) log("Reloading preferences");
        prefs.reload();
        mPrefsReloadedTstamp = System.currentTimeMillis();
    }
}
 
Example #25
Source File: SmsCodeWorker.java    From XposedSmsCode with GNU General Public License v3.0 5 votes vote down vote up
SmsCodeWorker(Context appContext, Context phoneContext, Intent smsIntent) {
    mAppContext = appContext;
    mPhoneContext = phoneContext;
    mPreferences = new XSharedPreferences(BuildConfig.APPLICATION_ID);
    mSmsIntent = smsIntent;

    HandlerThread workerThread = new HandlerThread("SmsCodeWorker");
    workerThread.start();
    workerHandler = new WorkerHandler(workerThread.getLooper());

    uiHandler = new WorkerHandler(Looper.getMainLooper());

    mPreQuitQueueCount = new AtomicInteger(DEFAULT_QUIT_COUNT);
}
 
Example #26
Source File: ModLowBatteryWarning.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
static void init(final XSharedPreferences prefs, ClassLoader classLoader) {
        try {
            if (DEBUG) log("init");

            // for debugging purposes - simulate low battery even if it's not
//            if (DEBUG) {
//                Class<?> classPowerUI = findClass(CLASS_POWER_UI, classLoader);
//                findAndHookMethod(classPowerUI, "findBatteryLevelBucket", int.class, new XC_MethodHook() {
//                    @Override
//                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
//                        param.setResult(-1);
//                    }
//                });
//            }

            Class<?> classPowerWarnings = findClass(CLASS_POWER_WARNINGS, classLoader);
            findAndHookMethod(classPowerWarnings, "updateNotification", new XC_MethodHook() {
                @Override
                protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                    if (SysUiManagers.BatteryInfoManager == null) return;

                    LowBatteryWarningPolicy policy = SysUiManagers.BatteryInfoManager
                            .getLowBatteryWarningPolicy();
                    if (DEBUG) log("showLowBatteryWarning called; policy=" + policy);
                    switch (policy) {
                        case DEFAULT:
                            return;
                        case NONINTRUSIVE:
                            XposedHelpers.setBooleanField(param.thisObject, "mPlaySound", false);
                            return;
                        case OFF:
                            XposedHelpers.setBooleanField(param.thisObject, "mWarning", false);
                            return;
                    }
                }
            });

        } catch (Throwable t) { XposedBridge.log(t); }
    }
 
Example #27
Source File: VolumeTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public VolumeTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mState.icon = mGbContext.getDrawable(R.drawable.ic_qs_volume);
    mState.label = mGbContext.getString(R.string.qs_tile_volume);
}
 
Example #28
Source File: ProgressBarView.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public ProgressBarView(ContainerType containerType, ViewGroup container,
        XSharedPreferences prefs, ProgressBarController ctrl) {
    super(container.getContext());

    mContainerType = containerType;
    mCtrl = ctrl;

    mAnimated = prefs.getBoolean(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_ANIMATED, true);
    mCentered = prefs.getBoolean(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_CENTERED, false);
    mHeightPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            prefs.getInt(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_THICKNESS, 1),
            getResources().getDisplayMetrics());
    mEdgeMarginPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            prefs.getInt(GravityBoxSettings.PREF_KEY_STATUSBAR_DOWNLOAD_PROGRESS_MARGIN, 0),
            getResources().getDisplayMetrics());

    setScaleX(0f);
    setBackgroundColor(Color.WHITE);
    setVisibility(View.GONE);
    container.addView(this);

    mAnimator = new ObjectAnimator();
    mAnimator.setTarget(this);
    mAnimator.setInterpolator(new DecelerateInterpolator());
    mAnimator.setDuration(ANIM_DURATION);
    mAnimator.setRepeatCount(0);
}
 
Example #29
Source File: ScreenshotTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public ScreenshotTile(Object host, String key, XSharedPreferences prefs,
        QsTileEventDistributor eventDistributor) throws Throwable {
    super(host, key, prefs, eventDistributor);

    mState.icon = mGbContext.getDrawable(R.drawable.ic_qs_screenshot);
    mState.label = mGbContext.getString(R.string.qs_tile_screenshot);
}
 
Example #30
Source File: ModSettings.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        // reserved for potential future use
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}