Added Dark Theme
This commit is contained in:
parent
a2e4585fe8
commit
60dc19d2bc
|
@ -32,10 +32,10 @@ android {
|
|||
|
||||
dependencies {
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||
compile 'com.android.support:support-v4:25.1.0'
|
||||
compile 'com.android.support:design:25.1.0'
|
||||
compile 'com.android.support:recyclerview-v7:25.1.0'
|
||||
compile 'com.android.support:appcompat-v7:25.0.0'
|
||||
compile 'com.android.support:support-v4:25.0.0'
|
||||
compile 'com.android.support:design:25.0.0'
|
||||
compile 'com.android.support:recyclerview-v7:25.0.0'
|
||||
compile 'org.jsoup:jsoup:1.8.3'
|
||||
compile 'org.mozilla:rhino:1.7.7'
|
||||
compile 'info.guardianproject.netcipher:netcipher:1.2'
|
||||
|
|
|
@ -47,7 +47,6 @@ public class MainActivity extends Themer {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
mainFragment = getSupportFragmentManager()
|
||||
.findFragmentById(R.id.search_fragment);
|
||||
|
|
|
@ -2,18 +2,19 @@ package org.schabi.newpipe;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.schabi.newpipe.R.attr.theme;
|
||||
|
||||
public class Themer extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (Objects.equals(PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.getString("theme", "1"), "0")) {
|
||||
.getString("theme", getResources().getString(R.string.light_theme_title)), getResources().getString(R.string.dark_theme_title))) {
|
||||
setTheme(R.style.DarkTheme);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.util.Log;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -30,7 +31,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
@ -39,26 +39,26 @@ import com.nostra13.universalimageloader.core.ImageLoader;
|
|||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.schabi.newpipe.ActivityCommunicator;
|
||||
import org.schabi.newpipe.ChannelActivity;
|
||||
import org.schabi.newpipe.ReCaptchaActivity;
|
||||
import org.schabi.newpipe.extractor.stream_info.StreamInfo;
|
||||
import org.schabi.newpipe.extractor.stream_info.StreamPreviewInfo;
|
||||
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
||||
import org.schabi.newpipe.report.ErrorActivity;
|
||||
import org.schabi.newpipe.ImageErrorLoadingListener;
|
||||
import org.schabi.newpipe.Localization;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.ReCaptchaActivity;
|
||||
import org.schabi.newpipe.download.DownloadDialog;
|
||||
import org.schabi.newpipe.extractor.stream_info.AudioStream;
|
||||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.stream_info.AudioStream;
|
||||
import org.schabi.newpipe.extractor.stream_info.StreamInfo;
|
||||
import org.schabi.newpipe.extractor.stream_info.StreamPreviewInfo;
|
||||
import org.schabi.newpipe.extractor.stream_info.VideoStream;
|
||||
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
||||
import org.schabi.newpipe.player.BackgroundPlayer;
|
||||
import org.schabi.newpipe.player.PlayVideoActivity;
|
||||
import org.schabi.newpipe.player.ExoPlayerActivity;
|
||||
import org.schabi.newpipe.player.PlayVideoActivity;
|
||||
import org.schabi.newpipe.report.ErrorActivity;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static org.schabi.newpipe.ReCaptchaActivity.RECAPTCHA_REQUEST;
|
||||
|
@ -650,7 +650,6 @@ public class VideoItemDetailFragment extends Fragment {
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
Activity a = getActivity();
|
||||
|
||||
infoItemBuilder = new InfoItemBuilder(a, a.findViewById(android.R.id.content));
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT < 18) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.os.IBinder;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -27,9 +28,9 @@ import android.widget.SeekBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.Themer;
|
||||
import org.schabi.newpipe.report.ErrorActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.settings.SettingsActivity;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceBundle) {
|
||||
if (Objects.equals(PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.getString("theme", "1"), "0")) {
|
||||
.getString("theme", getResources().getString(R.string.light_theme_title)), getResources().getString(R.string.dark_theme_title))) {
|
||||
setTheme(R.style.DarkTheme);
|
||||
}
|
||||
getDelegate().installViewFactory();
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.schabi.newpipe.App;
|
|||
import org.schabi.newpipe.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import info.guardianproject.netcipher.proxy.OrbotHelper;
|
||||
|
||||
|
@ -67,7 +68,7 @@ public class SettingsFragment extends PreferenceFragment
|
|||
private Preference downloadPathAudioPreference;
|
||||
private Preference themePreference;
|
||||
private SharedPreferences defaultPreferences;
|
||||
|
||||
private Preference themePreference;
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
|
@ -86,6 +87,7 @@ public class SettingsFragment extends PreferenceFragment
|
|||
DOWNLOAD_PATH_AUDIO_PREFERENCE = getString(R.string.download_path_audio_key);
|
||||
THEME = getString(R.string.theme_key);
|
||||
USE_TOR_KEY = getString(R.string.use_tor_key);
|
||||
THEME = getString(R.string.theme_key);
|
||||
|
||||
// get pref objects
|
||||
defaultResolutionPreference =
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
|
@ -2,7 +2,7 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:drawable="@color/light_background_color"/>
|
||||
android:drawable="?android:attr/windowBackground"/>
|
||||
|
||||
<item>
|
||||
<bitmap
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/detail_stream_thumbnail_window_layout"
|
||||
android:background="?android:windowBackground"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -152,7 +153,7 @@
|
|||
android:contentDescription="@string/detail_likes_img_view_description"
|
||||
android:layout_width="@dimen/video_item_detail_like_image_width"
|
||||
android:layout_height="@dimen/video_item_detail_like_image_height"
|
||||
android:src="@drawable/thumbs_up" />
|
||||
android:src="?attr/thumbs_up"/>
|
||||
|
||||
<TextView android:id="@+id/detail_thumbs_up_count_view"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -165,7 +166,7 @@
|
|||
android:contentDescription="@string/detail_dislikes_img_view_description"
|
||||
android:layout_width="@dimen/video_item_detail_like_image_width"
|
||||
android:layout_height="@dimen/video_item_detail_like_image_height"
|
||||
android:src="@drawable/thumbs_down"
|
||||
android:src="?attr/thumbs_down"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"/>
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
android:id="@+id/channel_streams_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:windowBackground"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:scrollbars="vertical"/>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
android:id="@+id/errorMessageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:text="@string/info_labels"/>
|
||||
|
||||
<TextView
|
||||
|
@ -63,7 +63,7 @@
|
|||
android:id="@+id/errorInfoLabelsView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:text="@string/info_labels"/>
|
||||
|
||||
<HorizontalScrollView
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/detail_stream_thumbnail_window_layout"
|
||||
android:background="?android:windowBackground"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -154,7 +155,7 @@
|
|||
android:contentDescription="@string/detail_likes_img_view_description"
|
||||
android:layout_width="@dimen/video_item_detail_like_image_width"
|
||||
android:layout_height="@dimen/video_item_detail_like_image_height"
|
||||
android:src="@drawable/thumbs_up" />
|
||||
android:src="?attr/thumbs_up" />
|
||||
|
||||
<TextView android:id="@+id/detail_thumbs_up_count_view"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -167,7 +168,7 @@
|
|||
android:contentDescription="@string/detail_dislikes_img_view_description"
|
||||
android:layout_width="@dimen/video_item_detail_like_image_width"
|
||||
android:layout_height="@dimen/video_item_detail_like_image_height"
|
||||
android:src="@drawable/thumbs_down"
|
||||
android:src="?attr/thumbs_down"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"/>
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
<item android:id="@+id/menu_item_play_audio"
|
||||
android:title="@string/play_audio"
|
||||
app:showAsAction="ifRoom"
|
||||
android:icon="@drawable/ic_headset_black" />
|
||||
android:icon="?attr/audio" />
|
||||
|
||||
<item android:id="@+id/menu_item_download"
|
||||
app:showAsAction="ifRoom"
|
||||
android:title="@string/download"
|
||||
android:icon="@drawable/ic_file_download_black"/>
|
||||
android:icon="?attr/download"/>
|
||||
|
||||
<item android:id="@+id/menu_item_share"
|
||||
android:title="@string/share"
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="android:colorPrimary">@color/light_youtube_primary_color</item>
|
||||
<item name="android:colorPrimaryDark">@color/light_youtube_dark_color</item>
|
||||
<item name="colorPrimary">@color/light_youtube_primary_color</item>
|
||||
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
|
||||
<item name="colorAccent">@color/light_youtube_accent_color</item>
|
||||
<item name="android:colorAccent">@color/light_youtube_accent_color</item>
|
||||
<item name="android:windowBackground">@color/light_background_color</item>
|
||||
<item name="thumbs_up">@drawable/ic_thumb_up_black_24dp</item>
|
||||
<item name="thumbs_down">@drawable/ic_thumb_down_black_24dp</item>
|
||||
<item name="audio">@drawable/ic_headset_black_24dp</item>
|
||||
<item name="download">@drawable/ic_file_download_black_24dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Dark Theme-->
|
||||
<style name="DarkTheme" parent="Theme.AppCompat">
|
||||
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
|
||||
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
|
||||
<item name="colorAccent">@color/dark_youtube_accent_color</item>
|
||||
<item name="android:windowBackground">@color/dark_background_color</item>
|
||||
<item name="thumbs_up">@drawable/ic_thumb_up_white_24dp</item>
|
||||
<item name="thumbs_down">@drawable/ic_thumb_down_white_24dp</item>
|
||||
<item name="audio">@drawable/ic_headset_white_24dp</item>
|
||||
<item name="download">@drawable/ic_file_download_white_24dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Dark Theme-->
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<attr name="thumbs_up" format="reference"/>
|
||||
<attr name="thumbs_down" format="reference"/>
|
||||
<attr name="audio" format="reference"/>
|
||||
<attr name="download" format="reference"/>
|
||||
<attr name="share" format="reference"/>
|
||||
<attr name="cast" format="reference"/>
|
||||
</resources>
|
|
@ -25,14 +25,16 @@
|
|||
<string name="show_play_with_kodi_key">show_play_with_kodi</string>
|
||||
|
||||
<string name="theme_key">theme</string>
|
||||
<string name="default_theme_value">0</string>
|
||||
<string name="default_theme_value">@string/light_theme_title</string>
|
||||
<string-array name="theme_description_list">
|
||||
<item>@string/dark_theme_title</item>
|
||||
<item>@string/light_theme_title</item>
|
||||
<item>@string/dark_theme_title</item>
|
||||
<item>@string/black_theme_title</item>
|
||||
</string-array>
|
||||
<string-array name="theme_list">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>@string/light_theme_title</item>
|
||||
<item>@string/dark_theme_title</item>
|
||||
<item>@string/black_theme_title</item>
|
||||
</string-array>
|
||||
|
||||
<string name="default_audio_format_key">default_audio_format</string>
|
||||
|
|
|
@ -46,8 +46,9 @@
|
|||
<string name="webm_description">WebM — free format</string>
|
||||
<string name="m4a_description">m4a — better quality</string>
|
||||
<string name="theme_title">Theme</string>
|
||||
<string name="dark_theme_title">Dark</string>
|
||||
<string name="light_theme_title">Light</string>
|
||||
<string name="dark_theme_title">Dark</string>
|
||||
<string name="black_theme_title">Black</string>
|
||||
|
||||
<string name="download_dialog_title">Download</string>
|
||||
<string-array name="download_options">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<resources>
|
||||
|
||||
<style name="RootTheme" parent="android:Theme.Holo"></style>
|
||||
<style name="RootTheme" parent="android:Theme.Holo"/>
|
||||
|
||||
<style name="PlayerTheme" parent="@style/RootTheme">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
|
@ -13,6 +13,7 @@
|
|||
<item name="android:minWidth">40dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
|
@ -21,6 +22,33 @@
|
|||
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
|
||||
<item name="colorAccent">@color/light_youtube_accent_color</item>
|
||||
<item name="android:windowBackground">@color/light_background_color</item>
|
||||
<item name="thumbs_up">@drawable/ic_thumb_up_black_24dp</item>
|
||||
<item name="thumbs_down">@drawable/ic_thumb_down_black_24dp</item>
|
||||
<item name="audio">@drawable/ic_headset_black_24dp</item>
|
||||
<item name="download">@drawable/ic_file_download_black_24dp</item>
|
||||
<item name="share">@drawable/ic_share_black</item>
|
||||
<item name="cast">@drawable/ic_cast_black_24dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- Dark Theme-->
|
||||
<style name="DarkTheme" parent="Theme.AppCompat">
|
||||
<item name="android:actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="actionBarStyle">@style/NewPipeActionbarTheme</item>
|
||||
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
|
||||
<item name="colorPrimaryDark">@color/light_youtube_dark_color</item>
|
||||
<item name="colorAccent">@color/dark_youtube_accent_color</item>
|
||||
<item name="android:windowBackground">@color/dark_background_color</item>
|
||||
<item name="thumbs_up">@drawable/ic_thumb_up_white_24dp</item>
|
||||
<item name="thumbs_down">@drawable/ic_thumb_down_white_24dp</item>
|
||||
<item name="audio">@drawable/ic_headset_white_24dp</item>
|
||||
<item name="download">@drawable/ic_file_download_white_24dp</item>
|
||||
<item name="share">@drawable/ic_share_white_24dp</item>
|
||||
<item name="cast">@drawable/ic_cast_white_24dp</item>
|
||||
</style>
|
||||
|
||||
<style name="BlackTheme" parent="DarkTheme">
|
||||
<item name="android:windowBackground">@color/light_youtube_accent_color</item>
|
||||
</style>
|
||||
|
||||
<!-- Dark Theme-->
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
android:key="@string/settings_category_appearance"
|
||||
android:title="@string/settings_category_appearance_title"
|
||||
android:textAllCaps="true">
|
||||
|
||||
.
|
||||
<ListPreference
|
||||
android:key="@string/theme_key"
|
||||
android:title="@string/theme_title"
|
||||
|
|
Loading…
Reference in New Issue