Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6a19b18 authored by Abhisek Devkota's avatar Abhisek Devkota Committed by Gerrit Code Review
Browse files

Merge "Settings: remove 'Brightness adjustment' from auto brightness dialog" into cm-11.0

parents 9ee0a741 c461a39f
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -28,22 +28,6 @@
            android:gravity="center_horizontal"
            android:paddingBottom="20dip">

        <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dip"
                android:layout_marginStart="12dip"
                android:layout_marginEnd="20dip"
                android:text="@string/auto_brightness_adjustment_title" />

        <com.android.settings.cyanogenmod.MagneticCenterSeekBar android:id="@+id/adjustment"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dip"
                android:layout_marginStart="20dip"
                android:layout_marginEnd="20dip"
                android:max="10000" />

        <CheckBox android:id="@+id/twilight_adjustment"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
+0 −15
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ public class AutoBrightnessSetup extends AlertActivity implements
    private AutoBrightnessCustomizeDialog mCustomizeDialog;
    private CheckBox mTwilightAdjustment;
    private Spinner mSensitivity;
    private SeekBar mAdjustment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
@@ -64,7 +63,6 @@ public class AutoBrightnessSetup extends AlertActivity implements

        mTwilightAdjustment = (CheckBox) view.findViewById(R.id.twilight_adjustment);
        mSensitivity = (Spinner) view.findViewById(R.id.sensitivity);
        mAdjustment = (SeekBar) view.findViewById(R.id.adjustment);

        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
                R.array.auto_brightness_sensitivity_entries,
@@ -107,12 +105,6 @@ public class AutoBrightnessSetup extends AlertActivity implements
            }
        }

        float adjustmentValue = Settings.System.getFloat(resolver,
                Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f);
        // valid range is -1.0..1.0, but we clamp the extreme values
        adjustmentValue = Math.min(Math.max(adjustmentValue, -0.5f), 0.5f);
        mAdjustment.setProgress((int) ((adjustmentValue + 0.5f) * mAdjustment.getMax()));

        mTwilightAdjustment.setChecked(Settings.System.getInt(resolver,
                Settings.System.AUTO_BRIGHTNESS_TWILIGHT_ADJUSTMENT, 0) != 0);
    }
@@ -127,7 +119,6 @@ public class AutoBrightnessSetup extends AlertActivity implements
            state.putBundle(STATE_CUSTOMIZE_STATE, mCustomizeDialog.onSaveInstanceState());
        }
        state.putInt(STATE_SENSITIVITY, mSensitivity.getSelectedItemPosition());
        state.putInt(STATE_ADJUSTMENT, mAdjustment.getProgress());
        state.putBoolean(STATE_TWILIGHT, mTwilightAdjustment.isChecked());
    }

@@ -140,7 +131,6 @@ public class AutoBrightnessSetup extends AlertActivity implements
            showCustomizeDialog(dialogState);
        }
        mSensitivity.setSelection(state.getInt(STATE_SENSITIVITY));
        mAdjustment.setProgress(state.getInt(STATE_ADJUSTMENT));
        mTwilightAdjustment.setChecked(state.getBoolean(STATE_TWILIGHT));
    }

@@ -161,11 +151,6 @@ public class AutoBrightnessSetup extends AlertActivity implements
                    Settings.System.AUTO_BRIGHTNESS_RESPONSIVENESS, sensitivity);
        }

        float adjustmentValue =
                ((float) mAdjustment.getProgress() / (float) mAdjustment.getMax()) - 0.5f;
        Settings.System.putFloat(resolver,
                Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, adjustmentValue);

        Settings.System.putInt(resolver,
                Settings.System.AUTO_BRIGHTNESS_TWILIGHT_ADJUSTMENT,
                mTwilightAdjustment.isChecked() ? 1 : 0);