diff options
author | KalimochoAz <calimochoazucarado@gmail.com> | 2012-04-11 15:20:21 +0200 |
---|---|---|
committer | KalimochoAz <calimochoazucarado@gmail.com> | 2012-04-24 23:01:47 +0200 |
commit | fa735c78bae900226808a703bcd5b1fca1153032 (patch) | |
tree | 3c91e23bb265bd9967915165f98f48cdfe7cbf5d | |
parent | 2a3689a80f757dc97baf7ec3f97b944cb8df23dd (diff) | |
download | device_samsung_crespo-fa735c78bae900226808a703bcd5b1fca1153032.zip device_samsung_crespo-fa735c78bae900226808a703bcd5b1fca1153032.tar.gz device_samsung_crespo-fa735c78bae900226808a703bcd5b1fca1153032.tar.bz2 |
Update Gamma tunning to meet with new kernel work on gamma
Change-Id: Ia021ddad5b7c559dea85d4b27bc72c7d37c63b0b
3 files changed, 82 insertions, 3 deletions
diff --git a/CrespoParts/res/layout/preference_dialog_gamma_tuning.xml b/CrespoParts/res/layout/preference_dialog_gamma_tuning.xml index 3ece54b..110dc32 100644 --- a/CrespoParts/res/layout/preference_dialog_gamma_tuning.xml +++ b/CrespoParts/res/layout/preference_dialog_gamma_tuning.xml @@ -80,7 +80,8 @@ android:paddingLeft="20dip" android:paddingRight="20dip" /> - <ImageView android:src="@drawable/color_tuning_preview" + <ImageView android:id="@+id/black_scale_picture" + android:src="@drawable/color_tuning_preview" android:layout_width="match_parent" android:layout_height="40dip" android:layout_below="@id/gamma_blue_seekbar" @@ -88,5 +89,31 @@ android:paddingLeft="20dip" android:paddingRight="20dip" /> + <LinearLayout + android:id="@+id/linearLayout1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/black_scale_picture" > + + <Button + android:id="@+id/btnGammaDefault" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/gamma_default_title" /> + + <Button + android:id="@+id/btnGammaCM" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/gamma_CM_title" /> + + <Button + android:id="@+id/btnGammaBright" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/gamma_bright_title" /> + + </LinearLayout> + </RelativeLayout> -</ScrollView>
\ No newline at end of file +</ScrollView> diff --git a/CrespoParts/res/values/strings.xml b/CrespoParts/res/values/strings.xml index 8ef5161..41abe8d 100644 --- a/CrespoParts/res/values/strings.xml +++ b/CrespoParts/res/values/strings.xml @@ -18,6 +18,9 @@ <string name="color_red_title">Red</string> <string name="color_green_title">Green</string> <string name="color_blue_title">Blue</string> + <string name="gamma_default_title">Default</string> + <string name="gamma_CM_title">CM Sett.</string> + <string name="gamma_bright_title">Bright Sett.</string> <string name="category_touchkey_title">Touch Keys</string> <string name="touchkey_notification_title_head">Backlight Notifications</string> diff --git a/CrespoParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java b/CrespoParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java index a6ec90e..5bedb73 100644 --- a/CrespoParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java +++ b/CrespoParts/src/com/cyanogenmod/settings/device/GammaTuningPreference.java @@ -23,14 +23,16 @@ import android.preference.DialogPreference; import android.preference.PreferenceManager; import android.util.AttributeSet; import android.view.View; +import android.view.View.OnClickListener; import android.widget.SeekBar; import android.widget.TextView; +import android.widget.Button; /** * Special preference type that allows configuration of both the ring volume and * notification volume. */ -public class GammaTuningPreference extends DialogPreference { +public class GammaTuningPreference extends DialogPreference implements OnClickListener { private static final String TAG = "GAMMA..."; @@ -80,6 +82,16 @@ public class GammaTuningPreference extends DialogPreference { TextView valueDisplay = (TextView) view.findViewById(VALUE_DISPLAY_ID[i]); mSeekBars[i] = new GammaSeekBar(seekBar, valueDisplay, FILE_PATH[i]); } + SetupButtonClickListeners(view); + } + + private void SetupButtonClickListeners(View view) { + Button mDefaultButton = (Button)view.findViewById(R.id.btnGammaDefault); + Button mCMButton = (Button)view.findViewById(R.id.btnGammaCM); + Button mBrightButton = (Button)view.findViewById(R.id.btnGammaBright); + mDefaultButton.setOnClickListener(this); + mCMButton.setOnClickListener(this); + mBrightButton.setOnClickListener(this); } @Override @@ -216,6 +228,43 @@ public class GammaTuningPreference extends DialogPreference { mValueDisplay.setText(String.format("%d", (int) progress)); } + public void SetNewValue(int iValue) { + mOriginal = iValue; + reset(); + } + + } + + public void onClick(View v) { + switch(v.getId()){ + case R.id.btnGammaDefault: + SetDefaultSettings(); + break; + case R.id.btnGammaCM: + SetCMSettings(); + break; + case R.id.btnGammaBright: + SetSBrightSettings(); + break; + } + } + + private void SetCMSettings() { + mSeekBars[0].SetNewValue(-63); + mSeekBars[1].SetNewValue(-59); + mSeekBars[2].SetNewValue(-61); + } + + private void SetSBrightSettings() { + mSeekBars[0].SetNewValue(70); + mSeekBars[1].SetNewValue(68); + mSeekBars[2].SetNewValue(61); + } + + private void SetDefaultSettings() { + mSeekBars[0].SetNewValue(0); + mSeekBars[1].SetNewValue(0); + mSeekBars[2].SetNewValue(0); } } |