add numerical edittexts to left of seekers in color edit view. Not

yet wired up but layout's ok
This commit is contained in:
eehouse 2010-05-27 02:57:21 +00:00
parent 8e06ff446a
commit 8c790edd04
3 changed files with 63 additions and 25 deletions

View file

@ -22,33 +22,51 @@
android:text="@string/red"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<SeekBar android:id="@+id/edit_red"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="1"
/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<SeekBar android:id="@+id/seek_red"
style="@style/color_seek_text"
/>
<EditText android:id="@+id/edit_red"
style="@style/color_edit_text"
/>
</LinearLayout>
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/green"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<SeekBar android:id="@+id/edit_green"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="1"
/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<SeekBar android:id="@+id/seek_green"
style="@style/color_seek_text"
/>
<EditText android:id="@+id/edit_green"
style="@style/color_edit_text"
/>
</LinearLayout>
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_width="wrap_content"
android:text="@string/blue"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<SeekBar android:id="@+id/edit_blue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="255"
android:progress="1"
/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<SeekBar android:id="@+id/seek_blue"
style="@style/color_seek_text"
/>
<EditText android:id="@+id/edit_blue"
style="@style/color_edit_text"
/>
</LinearLayout>
</LinearLayout>

View file

@ -17,4 +17,24 @@
<item name="android:textColor">#FFFFFFFF</item>
</style>
<style name="color_seek_text">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">left|center_vertical</item>
<item name="android:max">255</item>
<item name="android:layout_weight">1</item>
<item name="android:paddingRight">4dp</item>
</style>
<style name="color_edit_text">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_gravity">right|center_vertical</item>
<item name="android:numeric">decimal</item>
<item name="android:maxLength">3</item>
<item name="android:includeFontPadding">false</item>
<item name="android:ems">3</item>
</style>
</resources>

View file

@ -96,9 +96,9 @@ public class EditColorPreference extends DialogPreference {
protected void onBindDialogView( View view )
{
m_curColor = getPersistedColor();
setOneByte( view, R.id.edit_red, 16 );
setOneByte( view, R.id.edit_green, 8 );
setOneByte( view, R.id.edit_blue, 0 );
setOneByte( view, R.id.seek_red, 16 );
setOneByte( view, R.id.seek_green, 8 );
setOneByte( view, R.id.seek_blue, 0 );
View sample = (View)view.findViewById( R.id.color_edit_sample );
sample.setBackgroundColor( m_curColor );
@ -112,9 +112,9 @@ public class EditColorPreference extends DialogPreference {
@Override
public void onClick( DialogInterface dialog, int which )
{
int color = (getOneByte( dialog, R.id.edit_red ) << 16)
| (getOneByte( dialog, R.id.edit_green ) << 8)
| getOneByte( dialog, R.id.edit_blue );
int color = (getOneByte( dialog, R.id.seek_red ) << 16)
| (getOneByte( dialog, R.id.seek_green ) << 8)
| getOneByte( dialog, R.id.seek_blue );
persistInt( color );
notifyChanged();