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

Commit b4d41d8c authored by Doris Ling's avatar Doris Ling
Browse files

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
parent f96376a1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@
        android:paddingTop="16dp"
        android:paddingBottom="16dp"
        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
        android:background="@android:color/white">

        <TextView
            android:id="@android:id/title"
@@ -50,10 +51,9 @@
    </LinearLayout>

    <LinearLayout
        android:id="@+id/gesture_detail"
        android:layout_width="match_parent"
        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:orientation="horizontal">

+1 −1
Original line number Diff line number Diff line
@@ -125,6 +125,6 @@
    <color name="card_background_grey">#eeeeee</color>

    <!-- Gestures settings -->
    <color name="gestures_setting_backgroud_color">#f5f5f5</color>
    <color name="gestures_setting_background_color">#f5f5f5</color>

</resources>
+12 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.PorterDuff;
import android.graphics.SurfaceTexture;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
@@ -77,10 +79,11 @@ public final class GesturePreference extends SwitchPreference {
    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        holder.setDividerAllowedAbove(false);
        holder.setDividerAllowedBelow(false);
        final TextureView video = (TextureView) holder.findViewById(R.id.gesture_video);
        final ImageView imageView = (ImageView) holder.findViewById(R.id.gesture_image);
        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);

        if (!animationAvailable) {
@@ -91,6 +94,8 @@ public final class GesturePreference extends SwitchPreference {
        Bitmap bitmap = mMediaMetadata.getFrameAtTime(0);
        if (bitmap != null) {
            imageView.setImageDrawable(new BitmapDrawable(bitmap));
            imageView.setColorFilter(mContext.getResources().getColor(
                    R.color.gestures_setting_background_color), PorterDuff.Mode.DARKEN);
        }
        imageView.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();
    }

}