Update UI for the Gestures settings.

1. Remove list divider
2. Set title background color to white
3. Set color filter on animation preview so that its color matches the
color of the video.

Bug: 28565958
Change-Id: I496915ebdb8e358a0f7682f6075d32a04d8d358a
This commit is contained in:
Doris Ling
2016-06-21 18:25:11 -07:00
parent f96376a186
commit b4d41d8c71
3 changed files with 16 additions and 5 deletions

View File

@@ -30,7 +30,8 @@
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingBottom="16dp" android:paddingBottom="16dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"> android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="@android:color/white">
<TextView <TextView
android:id="@android:id/title" android:id="@android:id/title"
@@ -50,10 +51,9 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/gesture_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/gestures_setting_backgroud_color" android:background="@color/gestures_setting_background_color"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="horizontal"> android:orientation="horizontal">

View File

@@ -125,6 +125,6 @@
<color name="card_background_grey">#eeeeee</color> <color name="card_background_grey">#eeeeee</color>
<!-- Gestures settings --> <!-- Gestures settings -->
<color name="gestures_setting_backgroud_color">#f5f5f5</color> <color name="gestures_setting_background_color">#f5f5f5</color>
</resources> </resources>

View File

@@ -18,7 +18,9 @@ import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.PorterDuff;
import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture;
import android.media.MediaMetadataRetriever; import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer; import android.media.MediaPlayer;
@@ -77,10 +79,11 @@ public final class GesturePreference extends SwitchPreference {
@Override @Override
public void onBindViewHolder(PreferenceViewHolder holder) { public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder); super.onBindViewHolder(holder);
holder.setDividerAllowedAbove(false);
holder.setDividerAllowedBelow(false);
final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video); final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video);
final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image); final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image);
final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button); final ImageView playButton = (ImageView) holder.findViewById(R.id.gesture_play_button);
final View detailView = holder.findViewById(R.id.gesture_detail);
final View animationFrame = holder.findViewById(R.id.gesture_animation_frame); final View animationFrame = holder.findViewById(R.id.gesture_animation_frame);
if (!animationAvailable) { if (!animationAvailable) {
@@ -91,6 +94,8 @@ public final class GesturePreference extends SwitchPreference {
Bitmap bitmap = mMediaMetadata.getFrameAtTime(0); Bitmap bitmap = mMediaMetadata.getFrameAtTime(0);
if (bitmap != null) { if (bitmap != null) {
imageView.setImageDrawable(new BitmapDrawable(bitmap)); imageView.setImageDrawable(new BitmapDrawable(bitmap));
imageView.setColorFilter(mContext.getResources().getColor(
R.color.gestures_setting_background_color), PorterDuff.Mode.DARKEN);
} }
imageView.setVisibility(View.VISIBLE); imageView.setVisibility(View.VISIBLE);
playButton.setVisibility(View.VISIBLE); playButton.setVisibility(View.VISIBLE);
@@ -157,4 +162,10 @@ public final class GesturePreference extends SwitchPreference {
} }
@Override
public void onDetached() {
mMediaMetadata.release();
super.onDetached();
}
} }