Hopefully fixed the "transparent notification bug" for Samsung (TouchWiz) devices.

This commit is contained in:
Karim Abou Zeid 2015-07-16 20:46:18 +02:00
commit 0a0ba498be
2 changed files with 255 additions and 229 deletions

View file

@ -14,125 +14,139 @@
~ limitations under the License ~ limitations under the License
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <!--This FrameLayout IS necessary in order tp prevent fucking TouchWiz to interpret the "background="#00000000" as making the whole notification transparent-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android" xmlns:internal="http://schemas.android.com/apk/prv/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:background="#00000000"
android:orientation="horizontal"
internal:layout_maxHeight="64dp" internal:layout_maxHeight="64dp"
internal:layout_minHeight="64dp" internal:layout_minHeight="64dp">
tools:ignore="DisableBaselineAlignment">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
android:id="@+id/root"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android" xmlns:internal="http://schemas.android.com/apk/prv/res/android"
android:id="@+id/icon_group" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/notification_large_icon_width"
android:layout_height="@dimen/notification_large_icon_height"
android:layout_weight="0">
<ImageView
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="12dp"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:scaleType="centerInside"
tools:ignore="ContentDescription" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1"
android:minHeight="@dimen/notification_large_icon_height"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:gravity="bottom"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
android:textColor="@color/notification_content_color"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification"
android:textColor="@color/notification_secondary_content_color" />
</LinearLayout>
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical|end" android:background="#00000000"
android:layout_marginEnd="6dp" android:baselineAligned="false"
android:layout_marginRight="6dp"
android:layoutDirection="ltr"
android:orientation="horizontal" android:orientation="horizontal"
tools:ignore="UnusedAttribute"> tools:ignore="UselessParent">
<!-- media buttons will be added here -->
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_prev"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_36dp"
tools:ignore="ContentDescription" />
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout
android:id="@+id/action_play_pause" android:id="@+id/icon_group"
style="@style/Widget.AppCompat.Button.Borderless" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp" xmlns:internal="http://schemas.android.com/apk/prv/res/android"
android:layout_height="match_parent" android:layout_width="@dimen/notification_large_icon_width"
android:layout_marginLeft="2dp" android:layout_height="@dimen/notification_large_icon_height"
android:layout_marginRight="2dp" android:layout_weight="0">
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_play_arrow_white_36dp"
tools:ignore="ContentDescription" />
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" <ImageView
android:id="@+id/action_next" android:id="@+id/icon"
style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="match_parent"
android:layout_width="48dp" android:layout_height="match_parent"
android:layout_height="match_parent" android:layout_marginBottom="12dp"
android:layout_marginLeft="2dp" android:layout_marginEnd="12dp"
android:layout_marginRight="2dp" android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:scaleType="centerInside"
tools:ignore="ContentDescription" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/notification_selector" android:minHeight="@dimen/notification_large_icon_height"
android:gravity="center" android:orientation="vertical">
android:padding="8dp"
android:scaleType="fitCenter" <TextView
android:src="@drawable/ic_skip_next_white_36dp" android:id="@+id/title"
tools:ignore="ContentDescription" /> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:gravity="bottom"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
android:textColor="@color/notification_content_color"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification"
android:textColor="@color/notification_secondary_content_color" />
</LinearLayout>
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="6dp"
android:layout_marginRight="6dp"
android:layoutDirection="ltr"
android:orientation="horizontal"
tools:ignore="UnusedAttribute">
<!-- media buttons will be added here -->
<ImageButton
android:id="@+id/action_prev"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_36dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/action_play_pause"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_play_arrow_white_36dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/action_next"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_next_white_36dp"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </FrameLayout>

View file

@ -15,142 +15,154 @@
--> -->
<!-- Layout to be used with only max 3 actions. It has a much larger picture at the left side--> <!-- Layout to be used with only max 3 actions. It has a much larger picture at the left side-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<!--This FrameLayout IS necessary in order tp prevent fucking TouchWiz to interpret the "background="#00000000" as making the whole notification transparent-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:background="#00000000"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="128dp"> android:layout_height="128dp">
<ImageView <RelativeLayout
android:id="@+id/icon" android:id="@+id/root"
android:layout_width="@dimen/notification_big_image_size"
android:layout_height="@dimen/notification_big_image_size"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" />
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_quit"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:background="@drawable/notification_selector"
android:src="@drawable/ic_close_white_24dp"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/text_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="match_parent"
android:layout_marginBottom="8dp" android:background="#00000000"
android:layout_marginLeft="12dp" tools:ignore="UselessParent">
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:layout_toEndOf="@id/icon"
android:layout_toLeftOf="@id/action_quit"
android:layout_toRightOf="@id/icon"
android:layout_toStartOf="@id/action_quit"
android:minHeight="@dimen/notification_large_icon_height"
android:orientation="vertical">
<TextView <ImageView
android:id="@+id/title" android:id="@+id/icon"
android:layout_width="match_parent" android:layout_width="@dimen/notification_big_image_size"
android:layout_height="wrap_content" android:layout_height="@dimen/notification_big_image_size"
android:layout_weight="1" android:scaleType="centerCrop"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
android:textColor="@color/notification_content_color" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-1dp"
android:layout_marginTop="-1dp"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification"
android:textColor="@color/notification_secondary_content_color" />
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification"
android:textColor="@color/notification_secondary_content_color" />
</LinearLayout>
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@+id/text_container"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="@id/icon"
android:layout_toRightOf="@id/icon"
android:layoutDirection="ltr"
android:orientation="horizontal"
tools:ignore="UnusedAttribute">
<!-- media buttons will be added here -->
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_prev"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_36dp"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" <ImageButton
android:id="@+id/action_play_pause" android:id="@+id/action_quit"
style="@style/Widget.AppCompat.Button.Borderless" style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="36dp"
android:layout_marginLeft="2dp" android:layout_height="36dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:layout_weight="1" android:layout_marginTop="2dp"
android:background="@drawable/notification_selector" android:background="@drawable/notification_selector"
android:gravity="center" android:src="@drawable/ic_close_white_24dp"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_play_arrow_white_36dp"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
android:id="@+id/action_next" android:id="@+id/text_container"
style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="match_parent"
android:layout_width="48dp" android:layout_height="64dp"
android:layout_height="match_parent" android:layout_marginBottom="8dp"
android:layout_marginLeft="2dp" android:layout_marginLeft="12dp"
android:layout_marginRight="2dp" android:layout_marginStart="12dp"
android:layout_weight="1" android:layout_marginTop="8dp"
android:background="@drawable/notification_selector" android:layout_toEndOf="@id/icon"
android:gravity="center" android:layout_toLeftOf="@id/action_quit"
android:padding="8dp" android:layout_toRightOf="@id/icon"
android:scaleType="fitCenter" android:layout_toStartOf="@id/action_quit"
android:src="@drawable/ic_skip_next_white_36dp" android:minHeight="@dimen/notification_large_icon_height"
tools:ignore="ContentDescription" /> android:orientation="vertical">
</LinearLayout>
</RelativeLayout> <TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification.Title"
android:textColor="@color/notification_content_color" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-1dp"
android:layout_marginTop="-1dp"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification"
android:textColor="@color/notification_secondary_content_color" />
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="@style/Theme.MaterialMusic.Notification"
android:textColor="@color/notification_secondary_content_color" />
</LinearLayout>
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@+id/text_container"
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="@id/icon"
android:layout_toRightOf="@id/icon"
android:layoutDirection="ltr"
android:orientation="horizontal"
tools:ignore="UnusedAttribute">
<!-- media buttons will be added here -->
<ImageButton
android:id="@+id/action_prev"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_previous_white_36dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/action_play_pause"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_play_arrow_white_36dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/action_next"
style="@style/Widget.AppCompat.Button.Borderless"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:gravity="center"
android:padding="8dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_skip_next_white_36dp"
tools:ignore="ContentDescription" />
</LinearLayout>
</RelativeLayout>
</FrameLayout>