use of cyanogenmod.hardware.CMHardwareManager in project android_frameworks_base by ResurrectionRemix.
the class VibratorService method updateVibratorIntensity.
private void updateVibratorIntensity() {
final CMHardwareManager hardware = CMHardwareManager.getInstance(mContext);
final int intensity = CMSettings.Secure.getIntForUser(mContext.getContentResolver(), CMSettings.Secure.VIBRATOR_INTENSITY, hardware.getVibratorDefaultIntensity(), UserHandle.USER_CURRENT);
hardware.setVibratorIntensity(intensity);
}
use of cyanogenmod.hardware.CMHardwareManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibratorIntensity method onBindDialogView.
@Override
protected void onBindDialogView(final View view) {
super.onBindDialogView(view);
mSeekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
mValueText = (TextView) view.findViewById(R.id.value);
mWarningText = (TextView) view.findViewById(R.id.warning_text);
// Read the current value in case user wants to dismiss his changes
final CMHardwareManager hardware = CMHardwareManager.getInstance(getContext());
mOriginalValue = hardware.getVibratorIntensity();
mWarningValue = hardware.getVibratorWarningIntensity();
mMinValue = hardware.getVibratorMinIntensity();
mMaxValue = hardware.getVibratorMaxIntensity();
mDefaultValue = hardware.getVibratorDefaultIntensity();
final String message = getContext().getResources().getString(R.string.vibrator_intensity_dialog_warning, intensityToPercent(mMinValue, mMaxValue, mWarningValue));
mWarningText.setText(message);
if (mWarningValue <= 0) {
mWarningText.setVisibility(View.GONE);
}
final Drawable progressDrawable = mSeekBar.getProgressDrawable();
if (progressDrawable instanceof LayerDrawable) {
LayerDrawable ld = (LayerDrawable) progressDrawable;
mProgressDrawable = ld.findDrawableByLayerId(android.R.id.progress);
}
mProgressThumb = mSeekBar.getThumb();
mRedFilter = new LightingColorFilter(Color.BLACK, getContext().getResources().getColor(android.R.color.holo_red_light));
mSeekBar.setOnSeekBarChangeListener(this);
mSeekBar.setMax(mMaxValue - mMinValue);
mSeekBar.setProgress(mOriginalValue - mMinValue);
}
use of cyanogenmod.hardware.CMHardwareManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibratorIntensity method setVibratorIntensity.
private void setVibratorIntensity(final int intensity) {
final CMHardwareManager hardware = CMHardwareManager.getInstance(getContext());
hardware.setVibratorIntensity(intensity);
}
use of cyanogenmod.hardware.CMHardwareManager in project android_frameworks_base by crdroidandroid.
the class VibratorService method systemReady.
public void systemReady() {
mIm = mContext.getSystemService(InputManager.class);
mSettingObserver = new SettingsObserver(mH);
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
mPowerManagerInternal.registerLowPowerModeObserver(new PowerManagerInternal.LowPowerModeListener() {
@Override
public void onLowPowerModeChanged(boolean enabled) {
updateInputDeviceVibrators();
}
});
final CMHardwareManager hardware = CMHardwareManager.getInstance(mContext);
if (hardware.isSupported(CMHardwareManager.FEATURE_VIBRATOR)) {
mContext.getContentResolver().registerContentObserver(CMSettings.Secure.getUriFor(CMSettings.Secure.VIBRATOR_INTENSITY), true, mSettingObserver, UserHandle.USER_ALL);
updateVibratorIntensity();
}
mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(Settings.System.VIBRATE_INPUT_DEVICES), true, mSettingObserver, UserHandle.USER_ALL);
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
updateInputDeviceVibrators();
updateVibratorIntensity();
}
}, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mH);
updateInputDeviceVibrators();
}
use of cyanogenmod.hardware.CMHardwareManager in project android_frameworks_base by crdroidandroid.
the class VibratorService method updateVibratorIntensity.
private void updateVibratorIntensity() {
final CMHardwareManager hardware = CMHardwareManager.getInstance(mContext);
final int intensity = CMSettings.Secure.getIntForUser(mContext.getContentResolver(), CMSettings.Secure.VIBRATOR_INTENSITY, hardware.getVibratorDefaultIntensity(), UserHandle.USER_CURRENT);
hardware.setVibratorIntensity(intensity);
}
Aggregations