mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 23:03:00 +00:00 
			
		
		
		
	Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
		| @@ -4,6 +4,7 @@ import android.content.Intent; | |||||||
| import android.view.MenuItem; | import android.view.MenuItem; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
|  | import org.schabi.newpipe.util.PermissionHelper; | ||||||
|  |  | ||||||
| import static org.schabi.newpipe.player.BackgroundPlayer.ACTION_CLOSE; | import static org.schabi.newpipe.player.BackgroundPlayer.ACTION_CLOSE; | ||||||
|  |  | ||||||
| @@ -48,6 +49,12 @@ public final class BackgroundPlayerActivity extends ServicePlayerActivity { | |||||||
|     @Override |     @Override | ||||||
|     public boolean onPlayerOptionSelected(MenuItem item) { |     public boolean onPlayerOptionSelected(MenuItem item) { | ||||||
|         if (item.getItemId() == R.id.action_switch_popup) { |         if (item.getItemId() == R.id.action_switch_popup) { | ||||||
|  |  | ||||||
|  |             if (!PermissionHelper.isPopupEnabled(this)) { | ||||||
|  |                 PermissionHelper.showPopupEnablementToast(this); | ||||||
|  |                 return true; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             this.player.setRecovery(); |             this.player.setRecovery(); | ||||||
|             getApplicationContext().sendBroadcast(getPlayerShutdownIntent()); |             getApplicationContext().sendBroadcast(getPlayerShutdownIntent()); | ||||||
|             getApplicationContext().startService(getSwitchIntent(PopupVideoPlayer.class)); |             getApplicationContext().startService(getSwitchIntent(PopupVideoPlayer.class)); | ||||||
|   | |||||||
| @@ -25,7 +25,6 @@ import android.content.Intent; | |||||||
| import android.content.SharedPreferences; | import android.content.SharedPreferences; | ||||||
| import android.content.pm.ActivityInfo; | import android.content.pm.ActivityInfo; | ||||||
| import android.content.res.Configuration; | import android.content.res.Configuration; | ||||||
| import android.content.res.Resources; |  | ||||||
| import android.graphics.Color; | import android.graphics.Color; | ||||||
| import android.media.AudioManager; | import android.media.AudioManager; | ||||||
| import android.os.Build; | import android.os.Build; | ||||||
| @@ -65,8 +64,6 @@ import org.schabi.newpipe.util.PermissionHelper; | |||||||
| import org.schabi.newpipe.util.PopupMenuIconHacker; | import org.schabi.newpipe.util.PopupMenuIconHacker; | ||||||
| import org.schabi.newpipe.util.ThemeHelper; | import org.schabi.newpipe.util.ThemeHelper; | ||||||
|  |  | ||||||
| import java.lang.reflect.Field; |  | ||||||
| import java.lang.reflect.Method; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| import static org.schabi.newpipe.util.AnimationUtils.animateView; | import static org.schabi.newpipe.util.AnimationUtils.animateView; | ||||||
| @@ -400,9 +397,8 @@ public final class MainVideoPlayer extends Activity { | |||||||
|             if (DEBUG) Log.d(TAG, "onFullScreenButtonClicked() called"); |             if (DEBUG) Log.d(TAG, "onFullScreenButtonClicked() called"); | ||||||
|             if (simpleExoPlayer == null) return; |             if (simpleExoPlayer == null) return; | ||||||
|  |  | ||||||
|             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M |             if (!PermissionHelper.isPopupEnabled(context)) { | ||||||
|                     && !PermissionHelper.checkSystemAlertWindowPermission(MainVideoPlayer.this)) { |                 PermissionHelper.showPopupEnablementToast(context); | ||||||
|                 Toast.makeText(MainVideoPlayer.this, R.string.msg_popup_permission, Toast.LENGTH_LONG).show(); |  | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -183,7 +183,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity | |||||||
|                 this.player.getPlaybackSpeed(), |                 this.player.getPlaybackSpeed(), | ||||||
|                 this.player.getPlaybackPitch(), |                 this.player.getPlaybackPitch(), | ||||||
|                 null |                 null | ||||||
|         ); |         ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||||
|     } |     } | ||||||
|     //////////////////////////////////////////////////////////////////////////// |     //////////////////////////////////////////////////////////////////////////// | ||||||
|     // Service Connection |     // Service Connection | ||||||
|   | |||||||
| @@ -43,7 +43,8 @@ public class SettingsActivity extends AppCompatActivity implements BasePreferenc | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected void onCreate(Bundle savedInstanceBundle) { |     protected void onCreate(Bundle savedInstanceBundle) { | ||||||
|         ThemeHelper.setTheme(this); |         setTheme(ThemeHelper.getSettingsThemeStyle(this)); | ||||||
|  |  | ||||||
|         super.onCreate(savedInstanceBundle); |         super.onCreate(savedInstanceBundle); | ||||||
|         setContentView(R.layout.settings_layout); |         setContentView(R.layout.settings_layout); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -49,6 +49,21 @@ public class ThemeHelper { | |||||||
|         return PreferenceManager.getDefaultSharedPreferences(context).getString(themeKey, defaultTheme); |         return PreferenceManager.getDefaultSharedPreferences(context).getString(themeKey, defaultTheme); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @StyleRes | ||||||
|  |     public static int getSettingsThemeStyle(Context context) { | ||||||
|  |         String lightTheme = context.getResources().getString(R.string.light_theme_key); | ||||||
|  |         String darkTheme = context.getResources().getString(R.string.dark_theme_key); | ||||||
|  |         String blackTheme = context.getResources().getString(R.string.black_theme_key); | ||||||
|  |  | ||||||
|  |         String selectedTheme = getSelectedTheme(context); | ||||||
|  |  | ||||||
|  |         if (selectedTheme.equals(lightTheme)) return R.style.LightSettingsTheme; | ||||||
|  |         else if (selectedTheme.equals(blackTheme)) return R.style.BlackSettingsTheme; | ||||||
|  |         else if (selectedTheme.equals(darkTheme)) return R.style.DarkSettingsTheme; | ||||||
|  |             // Fallback | ||||||
|  |         else return R.style.DarkSettingsTheme; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Get a resource id from a resource styled according to the the context's theme. |      * Get a resource id from a resource styled according to the the context's theme. | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ | |||||||
|     <color name="light_youtube_primary_color">#e53935</color> |     <color name="light_youtube_primary_color">#e53935</color> | ||||||
|     <color name="light_youtube_dark_color">#d32f2f</color> |     <color name="light_youtube_dark_color">#d32f2f</color> | ||||||
|     <color name="light_youtube_accent_color">#000000</color> |     <color name="light_youtube_accent_color">#000000</color> | ||||||
|  |     <color name="light_settings_accent_color">#e53935</color> | ||||||
|     <color name="light_separator_color">#32000000</color> |     <color name="light_separator_color">#32000000</color> | ||||||
|     <color name="light_ripple_color">#48868686</color> |     <color name="light_ripple_color">#48868686</color> | ||||||
|     <color name="light_selected_color">#2a868686</color> |     <color name="light_selected_color">#2a868686</color> | ||||||
| @@ -20,6 +21,7 @@ | |||||||
|     <color name="dark_youtube_primary_color">#CD322E</color> |     <color name="dark_youtube_primary_color">#CD322E</color> | ||||||
|     <color name="dark_youtube_dark_color">#BC211D</color> |     <color name="dark_youtube_dark_color">#BC211D</color> | ||||||
|     <color name="dark_youtube_accent_color">#FFFFFF</color> |     <color name="dark_youtube_accent_color">#FFFFFF</color> | ||||||
|  |     <color name="dark_settings_accent_color">#ff5252</color> | ||||||
|     <color name="dark_separator_color">#0affffff</color> |     <color name="dark_separator_color">#0affffff</color> | ||||||
|     <color name="dark_ripple_color">#48ffffff</color> |     <color name="dark_ripple_color">#48ffffff</color> | ||||||
|     <color name="dark_selected_color">#2affffff</color> |     <color name="dark_selected_color">#2affffff</color> | ||||||
| @@ -31,6 +33,7 @@ | |||||||
|  |  | ||||||
|     <!-- Black Theme --> |     <!-- Black Theme --> | ||||||
|     <color name="black_background_color">#000</color> |     <color name="black_background_color">#000</color> | ||||||
|  |     <color name="black_settings_accent_color">@color/dark_settings_accent_color</color> | ||||||
|     <color name="black_separator_color">#1effffff</color> |     <color name="black_separator_color">#1effffff</color> | ||||||
|     <color name="black_contrast_background_color">#23454545</color> |     <color name="black_contrast_background_color">#23454545</color> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -90,6 +90,20 @@ | |||||||
|         <item name="contrast_background_color">@color/black_contrast_background_color</item> |         <item name="contrast_background_color">@color/black_contrast_background_color</item> | ||||||
|     </style> |     </style> | ||||||
|  |  | ||||||
|  |     <!-- Settings --> | ||||||
|  |     <style name="LightSettingsTheme" parent="LightTheme"> | ||||||
|  |         <item name="colorAccent">@color/light_settings_accent_color</item> | ||||||
|  |     </style> | ||||||
|  |  | ||||||
|  |     <style name="DarkSettingsTheme" parent="DarkTheme"> | ||||||
|  |         <item name="colorAccent">@color/dark_settings_accent_color</item> | ||||||
|  |     </style> | ||||||
|  |  | ||||||
|  |     <style name="BlackSettingsTheme" parent="BlackTheme"> | ||||||
|  |         <item name="colorAccent">@color/black_settings_accent_color</item> | ||||||
|  |     </style> | ||||||
|  |  | ||||||
|  |  | ||||||
|     <style name="PlayerTheme" parent="Theme.AppCompat.NoActionBar"> |     <style name="PlayerTheme" parent="Theme.AppCompat.NoActionBar"> | ||||||
|         <item name="android:windowNoTitle">true</item> |         <item name="android:windowNoTitle">true</item> | ||||||
|         <item name="android:windowBackground">@android:color/black</item> |         <item name="android:windowBackground">@android:color/black</item> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Weblate
					Weblate