1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-24 22:23:19 +00:00

Nav drawer now moves behind the status bar and the colors also work correctly.

This commit is contained in:
Somethingweirdhere 2018-06-14 01:55:55 +02:00 committed by Christian Schabesberger
parent 409bebd5bc
commit d4101c4f43
5 changed files with 63 additions and 8 deletions

View File

@ -23,14 +23,19 @@ package org.schabi.newpipe;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
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.widget.Toolbar;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
@ -88,6 +96,11 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
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) {
initFragments();
}

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe.fragments;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -93,6 +94,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.registerOnSharedPreferenceChangeListener(listener);
return inflater.inflate(R.layout.fragment_main, container, false);
}

View 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>

View File

@ -2,20 +2,24 @@
<resources>
<!-- YouTube -->
<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_statusbar_color">#ff4336</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_statusbar_color">#ff4336</color>
<!-- SoundCloud -->
<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_statusbar_color">#ff9100</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_statusbar_color">#ff9100</color>
</resources>

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 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="BlackTheme.YouTube" parent="BlackTheme.Switchable"/>
<style name="DarkTheme.YouTube" parent="DarkTheme.Switchable">
</style>
<style name="BlackTheme.YouTube" parent="BlackTheme.Switchable">
</style>
<!-- SoundCloud -->
<style name="LightTheme.SoundCloud" parent="LightTheme.Switchable">
<item name="colorPrimary">@color/light_soundcloud_primary_color</item>