mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-26 18:10:32 +00:00
Nav drawer now moves behind the status bar and the colors also work correctly.
This commit is contained in:
parent
f5fb59d74f
commit
af187550c5
@ -23,14 +23,19 @@ package org.schabi.newpipe;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
@ -38,11 +43,14 @@ import android.support.v7.app.ActionBarDrawerToggle;
|
|||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -86,6 +94,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
Window w = getWindow();
|
||||||
|
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
}
|
||||||
|
|
||||||
if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) {
|
||||||
initFragments();
|
initFragments();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.fragments;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@ -92,6 +93,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
prefs.registerOnSharedPreferenceChangeListener(listener);
|
prefs.registerOnSharedPreferenceChangeListener(listener);
|
||||||
|
|
||||||
return inflater.inflate(R.layout.fragment_main, container, false);
|
return inflater.inflate(R.layout.fragment_main, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
app/src/main/res/values-v21/styles_services.xml
Normal file
34
app/src/main/res/values-v21/styles_services.xml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- YouTube -->
|
||||||
|
<style name="LightTheme.YouTube" parent="LightTheme.Switchable">
|
||||||
|
<item name="colorPrimaryDark">@color/light_youtube_statusbar_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="DarkTheme.YouTube" parent="DarkTheme.Switchable">
|
||||||
|
<item name="colorPrimaryDark">@color/dark_youtube_statusbar_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="BlackTheme.YouTube" parent="BlackTheme.Switchable">
|
||||||
|
<item name="colorPrimaryDark">@color/dark_youtube_statusbar_color</item>
|
||||||
|
</style>
|
||||||
|
<!-- SoundCloud -->
|
||||||
|
<style name="LightTheme.SoundCloud" parent="LightTheme.Switchable">
|
||||||
|
<item name="colorPrimary">@color/light_soundcloud_primary_color</item>
|
||||||
|
<item name="colorPrimaryDark">@color/light_soundcloud_statusbar_color</item>
|
||||||
|
<item name="colorAccent">@color/light_soundcloud_accent_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="DarkTheme.SoundCloud" parent="DarkTheme.Switchable">
|
||||||
|
<item name="colorPrimary">@color/dark_soundcloud_primary_color</item>
|
||||||
|
<item name="colorPrimaryDark">@color/dark_soundcloud_statusbar_color</item>
|
||||||
|
<item name="colorAccent">@color/dark_soundcloud_accent_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="BlackTheme.SoundCloud" parent="BlackTheme.Switchable">
|
||||||
|
<item name="colorPrimary">@color/dark_soundcloud_primary_color</item>
|
||||||
|
<item name="colorPrimaryDark">@color/dark_soundcloud_statusbar_color</item>
|
||||||
|
<item name="colorAccent">@color/dark_soundcloud_accent_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
@ -2,20 +2,24 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<!-- YouTube -->
|
<!-- YouTube -->
|
||||||
<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">#992722</color>
|
||||||
<color name="light_youtube_accent_color">#000000</color>
|
<color name="light_youtube_accent_color">#000000</color>
|
||||||
|
<color name="light_youtube_statusbar_color">#ff4336</color>
|
||||||
|
|
||||||
<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">#992722</color>
|
||||||
<color name="dark_youtube_accent_color">#FFFFFF</color>
|
<color name="dark_youtube_accent_color">#FFFFFF</color>
|
||||||
|
<color name="dark_youtube_statusbar_color">#ff4336</color>
|
||||||
|
|
||||||
<!-- SoundCloud -->
|
<!-- SoundCloud -->
|
||||||
<color name="light_soundcloud_primary_color">#f57c00</color>
|
<color name="light_soundcloud_primary_color">#f57c00</color>
|
||||||
<color name="light_soundcloud_dark_color">#ef6c00</color>
|
<color name="light_soundcloud_dark_color">#995700</color>
|
||||||
<color name="light_soundcloud_accent_color">#000000</color>
|
<color name="light_soundcloud_accent_color">#000000</color>
|
||||||
|
<color name="light_soundcloud_statusbar_color">#ff9100</color>
|
||||||
|
|
||||||
<color name="dark_soundcloud_primary_color">#f57c00</color>
|
<color name="dark_soundcloud_primary_color">#f57c00</color>
|
||||||
<color name="dark_soundcloud_dark_color">#ef6c00</color>
|
<color name="dark_soundcloud_dark_color">#995700</color>
|
||||||
<color name="dark_soundcloud_accent_color">#FFFFFF</color>
|
<color name="dark_soundcloud_accent_color">#FFFFFF</color>
|
||||||
|
<color name="dark_soundcloud_statusbar_color">#ff9100</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -1,12 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- YouTube -->
|
<!-- YouTube -->
|
||||||
<style name="LightTheme.YouTube" parent="LightTheme.Switchable"/>
|
<style name="LightTheme.YouTube" parent="LightTheme.Switchable">
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="DarkTheme.YouTube" parent="DarkTheme.Switchable"/>
|
<style name="DarkTheme.YouTube" parent="DarkTheme.Switchable">
|
||||||
|
</style>
|
||||||
<style name="BlackTheme.YouTube" parent="BlackTheme.Switchable"/>
|
|
||||||
|
|
||||||
|
<style name="BlackTheme.YouTube" parent="BlackTheme.Switchable">
|
||||||
|
</style>
|
||||||
<!-- SoundCloud -->
|
<!-- SoundCloud -->
|
||||||
<style name="LightTheme.SoundCloud" parent="LightTheme.Switchable">
|
<style name="LightTheme.SoundCloud" parent="LightTheme.Switchable">
|
||||||
<item name="colorPrimary">@color/light_soundcloud_primary_color</item>
|
<item name="colorPrimary">@color/light_soundcloud_primary_color</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user