mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 14:52:59 +00:00 
			
		
		
		
	antifix for android 6.0 notification z order problem
This commit is contained in:
		| @@ -294,7 +294,8 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare | ||||
|                                     R.string.background_player_time_text), title)) | ||||
|                     .setContentIntent(PendingIntent.getActivity(getApplicationContext(), | ||||
|                             noteID, openDetailViewIntent, | ||||
|                             PendingIntent.FLAG_UPDATE_CURRENT)); | ||||
|                             PendingIntent.FLAG_UPDATE_CURRENT)) | ||||
|                     .setContentIntent(openDetailView); | ||||
|  | ||||
|  | ||||
|             RemoteViews view = | ||||
| @@ -304,18 +305,30 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare | ||||
|             view.setTextViewText(R.id.notificationArtist, channelName); | ||||
|             view.setOnClickPendingIntent(R.id.notificationStop, stopPI); | ||||
|             view.setOnClickPendingIntent(R.id.notificationPlayPause, playPI); | ||||
|             view.setOnClickPendingIntent(R.id.notificationBackgroundButton, openDetailView); | ||||
|  | ||||
|             // todo: fix terrible lazy workaround | ||||
|             // sh*** because android 6.0 f**** around with z order when doing event handling | ||||
|             // Who ever designed android that way wanted to harm humanity. | ||||
|             if(android.os.Build.VERSION.SDK_INT < 23) { | ||||
|                 view.setOnClickPendingIntent(R.id.notificationBackgroundButton, openDetailView); | ||||
|             } | ||||
|  | ||||
|             //possibly found the expandedView problem, | ||||
|             //but can't test it as I don't have a 5.0 device. -medavox | ||||
|             RemoteViews expandedView = | ||||
|                     new RemoteViews(BuildConfig.APPLICATION_ID, R.layout.player_notification_expanded); | ||||
|             expandedView.setImageViewBitmap(R.id.notificationCover, videoThumbnail); | ||||
|                 expandedView.setImageViewBitmap(R.id.notificationCover, videoThumbnail); | ||||
|             expandedView.setTextViewText(R.id.notificationSongName, title); | ||||
|             expandedView.setTextViewText(R.id.notificationArtist, channelName); | ||||
|                 expandedView.setTextViewText(R.id.notificationArtist, channelName); | ||||
|             expandedView.setOnClickPendingIntent(R.id.notificationStop, stopPI); | ||||
|             expandedView.setOnClickPendingIntent(R.id.notificationPlayPause, playPI); | ||||
|             expandedView.setOnClickPendingIntent(R.id.notificationBackgroundButton, openDetailView); | ||||
|  | ||||
|             // todo: fix terrible lazy workaround | ||||
|             // sh*** because android 6.0 f**** around with z order when doing event handling | ||||
|             // Who ever designed android that way wanted to harm humanity. | ||||
|             if(android.os.Build.VERSION.SDK_INT < 23) { | ||||
|                 expandedView.setOnClickPendingIntent(R.id.notificationBackgroundButton, openDetailView); | ||||
|             } | ||||
|  | ||||
|             noteBuilder.setCategory(Notification.CATEGORY_TRANSPORT); | ||||
|  | ||||
|   | ||||
							
								
								
									
										80
									
								
								app/src/main/res/layout-v23/player_notification.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								app/src/main/res/layout-v23/player_notification.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,80 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/content" | ||||
|     android:layout_width="fill_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:clickable="true" | ||||
|     android:gravity="center_vertical" | ||||
|     android:orientation="horizontal" | ||||
|     android:background="@color/background_notification_color" | ||||
|     tools:targetApi="jelly_bean"> | ||||
|  | ||||
|     <Button | ||||
|         android:id="@+id/notificationBackgroundButton" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="64dp" | ||||
|         android:background="@android:color/transparent" /> | ||||
|  | ||||
|     <LinearLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="64dp" | ||||
|         android:gravity="center_vertical" | ||||
|         android:orientation="horizontal"> | ||||
|  | ||||
|         <ImageView | ||||
|             android:id="@+id/notificationCover" | ||||
|             android:layout_width="64dp" | ||||
|             android:layout_height="64dp" | ||||
|             android:src="@drawable/dummy_thumbnail" | ||||
|             android:scaleType="centerCrop"/> | ||||
|  | ||||
|         <LinearLayout | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginLeft="8dp" | ||||
|             android:layout_weight="1" | ||||
|             android:orientation="vertical" > | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/notificationSongName" | ||||
|                 style="@android:style/TextAppearance.StatusBar.EventContent.Title" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:ellipsize="marquee" | ||||
|                 android:singleLine="true" | ||||
|                 android:text="title" /> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/notificationArtist" | ||||
|                 style="@android:style/TextAppearance.StatusBar.EventContent" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:ellipsize="marquee" | ||||
|                 android:singleLine="true" | ||||
|                 android:text="artist" /> | ||||
|         </LinearLayout> | ||||
|  | ||||
|         <ImageButton | ||||
|             android:id="@+id/notificationPlayPause" | ||||
|             android:layout_width="40dp" | ||||
|             android:layout_height="40dp" | ||||
|             android:layout_margin="5dp" | ||||
|             android:background="#00ffffff" | ||||
|             android:clickable="true" | ||||
|             android:scaleType="fitXY" | ||||
|             android:src="@drawable/ic_pause_white_24dp" /> | ||||
|  | ||||
|         <ImageButton | ||||
|             android:id="@+id/notificationStop" | ||||
|             android:layout_width="40dp" | ||||
|             android:layout_height="40dp" | ||||
|             android:layout_margin="5dp" | ||||
|             android:background="#00ffffff" | ||||
|             android:clickable="true" | ||||
|             android:scaleType="fitXY" | ||||
|             android:src="@drawable/ic_close_white_24dp" /> | ||||
|     </LinearLayout> | ||||
|  | ||||
|  | ||||
| </RelativeLayout> | ||||
							
								
								
									
										79
									
								
								app/src/main/res/layout-v23/player_notification_expanded.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								app/src/main/res/layout-v23/player_notification_expanded.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:id="@+id/content" | ||||
|     android:layout_width="fill_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     android:clickable="true" | ||||
|     android:background="@color/background_notification_color" | ||||
|     tools:targetApi="jelly_bean" > | ||||
|  | ||||
|     <ImageView | ||||
|         android:id="@+id/notificationCover" | ||||
|         android:layout_width="128dp" | ||||
|         android:layout_height="128dp" | ||||
|         android:layout_marginRight="8dp" | ||||
|         android:src="@drawable/dummy_thumbnail" | ||||
|         android:scaleType="centerCrop"/> | ||||
|  | ||||
|     <LinearLayout | ||||
|         android:layout_width="fill_parent" | ||||
|         android:layout_height="fill_parent" | ||||
|         android:layout_above="@+id/notificationButtons" | ||||
|         android:layout_toRightOf="@+id/notificationCover" | ||||
|         android:gravity="center_vertical" | ||||
|         android:orientation="vertical" > | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/notificationSongName" | ||||
|             style="@android:style/TextAppearance.StatusBar.EventContent.Title" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginRight="40dp" | ||||
|             android:ellipsize="marquee" | ||||
|             android:singleLine="true" | ||||
|             android:text="title" /> | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/notificationArtist" | ||||
|             style="@android:style/TextAppearance.StatusBar.EventContent" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:ellipsize="marquee" | ||||
|             android:singleLine="true" | ||||
|             android:text="artist" /> | ||||
|     </LinearLayout> | ||||
|  | ||||
|     <ImageButton | ||||
|         android:id="@+id/notificationStop" | ||||
|         android:layout_width="30dp" | ||||
|         android:layout_height="30dp" | ||||
|         android:layout_alignParentRight="true" | ||||
|         android:layout_margin="5dp" | ||||
|         android:background="#00ffffff" | ||||
|         android:clickable="true" | ||||
|         android:scaleType="fitXY" | ||||
|         android:src="@drawable/ic_close_white_24dp" /> | ||||
|  | ||||
|     <RelativeLayout | ||||
|         android:id="@+id/notificationButtons" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="50dp" | ||||
|         android:layout_alignBottom="@id/notificationCover" | ||||
|         android:layout_alignParentRight="true" | ||||
|         android:layout_toRightOf="@+id/notificationCover" | ||||
|         android:orientation="horizontal" > | ||||
|  | ||||
|         <ImageButton | ||||
|             android:id="@+id/notificationPlayPause" | ||||
|             android:layout_width="40dp" | ||||
|             android:layout_height="40dp" | ||||
|             android:background="#00ffffff" | ||||
|             android:clickable="true" | ||||
|             android:scaleType="fitXY" | ||||
|             android:src="@drawable/ic_pause_white_24dp" | ||||
|             android:layout_alignParentTop="true" | ||||
|             android:layout_centerHorizontal="true" /> | ||||
|     </RelativeLayout> | ||||
|  | ||||
| </RelativeLayout> | ||||
| @@ -10,12 +10,6 @@ | ||||
|     android:background="@color/background_notification_color" | ||||
|     tools:targetApi="jelly_bean"> | ||||
|  | ||||
|     <Button | ||||
|         android:id="@+id/notificationBackgroundButton" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="64dp" | ||||
|         android:background="@android:color/transparent"/> | ||||
|  | ||||
|     <LinearLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="64dp" | ||||
| @@ -74,7 +68,6 @@ | ||||
|             android:clickable="true" | ||||
|             android:scaleType="fitXY" | ||||
|             android:src="@drawable/ic_close_white_24dp" /> | ||||
|  | ||||
|     </LinearLayout> | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Christian Schabesberger
					Christian Schabesberger