Exemplo n.º 1
0
 private void setMode(int mode) {
   Settings.System.putIntForUser(
       mContext.getContentResolver(),
       Settings.System.SCREEN_BRIGHTNESS_MODE,
       mode,
       mUserTracker.getCurrentUserId());
 }
  @Override
  public void onSnap(EdgeGesturePosition position) {
    if (position == mPosition) {
      return;
    }

    doHapticTriggerFeedback();

    if (DEBUG) {
      Slog.d(TAG, "onSnap from " + position.name());
    }

    int triggerSlots =
        Settings.System.getIntForUser(
            mContext.getContentResolver(),
            Settings.System.PIE_GRAVITY,
            EdgeGesturePosition.LEFT.FLAG,
            UserHandle.USER_CURRENT);

    triggerSlots = triggerSlots & ~mPosition.FLAG | position.FLAG;

    Settings.System.putIntForUser(
        mContext.getContentResolver(),
        Settings.System.PIE_GRAVITY,
        triggerSlots,
        UserHandle.USER_CURRENT);
  }
 @Override
 public boolean onPreferenceChange(Preference preference, Object objValue) {
   if (preference == mLiveDisplay) {
     Settings.System.putIntForUser(
         getContentResolver(),
         Settings.System.DISPLAY_TEMPERATURE_MODE,
         Integer.valueOf((String) objValue),
         UserHandle.USER_CURRENT);
   }
   return true;
 }
 public boolean onPreferenceChange(Preference preference, Object objValue) {
   if (preference == mRecentsClearAll) {
     boolean show = (Boolean) objValue;
     Settings.System.putIntForUser(
         getActivity().getContentResolver(),
         Settings.System.SHOW_CLEAR_ALL_RECENTS,
         show ? 1 : 3,
         UserHandle.USER_CURRENT);
     return true;
   } else if (preference == mRecentsClearAllLocation) {
     int location = Integer.valueOf((String) objValue);
     Settings.System.putIntForUser(
         getActivity().getContentResolver(),
         Settings.System.RECENTS_CLEAR_ALL_LOCATION,
         location,
         UserHandle.USER_CURRENT);
     updateRecentsLocation(location);
     return true;
   }
   return false;
 }