mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 02:53:09 +01:00
Support dark theme in file picker (#699)
This commit is contained in:
parent
5b8ff28556
commit
795ba89dc4
@ -62,7 +62,7 @@ dependencies {
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
compile 'de.hdodenhof:circleimageview:2.1.0'
|
||||
compile 'com.github.nirhart:parallaxscroll:1.0'
|
||||
compile 'com.nononsenseapps:filepicker:3.0.0'
|
||||
compile 'com.nononsenseapps:filepicker:3.0.1'
|
||||
compile 'com.google.android.exoplayer:exoplayer:r2.5.1'
|
||||
|
||||
debugCompile 'com.facebook.stetho:stetho:1.5.0'
|
||||
|
@ -88,10 +88,14 @@
|
||||
<service android:name="us.shandian.giga.service.DownloadManagerService"/>
|
||||
|
||||
<activity
|
||||
android:name="com.nononsenseapps.filepicker.FilePickerActivity"
|
||||
android:name=".util.FilePickerActivityHelper"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/FilePickerTheme"/>
|
||||
android:theme="@style/FilePickerThemeDark">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ReCaptchaActivity"
|
||||
|
@ -7,9 +7,8 @@ import android.support.annotation.Nullable;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.util.Log;
|
||||
|
||||
import com.nononsenseapps.filepicker.FilePickerActivity;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.util.FilePickerActivityHelper;
|
||||
|
||||
public class DownloadSettingsFragment extends BasePreferenceFragment {
|
||||
private static final int REQUEST_DOWNLOAD_PATH = 0x1235;
|
||||
@ -48,10 +47,10 @@ public class DownloadSettingsFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
if (preference.getKey().equals(DOWNLOAD_PATH_PREFERENCE) || preference.getKey().equals(DOWNLOAD_PATH_AUDIO_PREFERENCE)) {
|
||||
Intent i = new Intent(getActivity(), FilePickerActivity.class)
|
||||
.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)
|
||||
.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true)
|
||||
.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
|
||||
Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
|
||||
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
|
||||
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, true)
|
||||
.putExtra(FilePickerActivityHelper.EXTRA_MODE, FilePickerActivityHelper.MODE_DIR);
|
||||
if (preference.getKey().equals(DOWNLOAD_PATH_PREFERENCE)) {
|
||||
startActivityForResult(i, REQUEST_DOWNLOAD_PATH);
|
||||
} else if (preference.getKey().equals(DOWNLOAD_PATH_AUDIO_PREFERENCE)) {
|
||||
|
@ -0,0 +1,17 @@
|
||||
package org.schabi.newpipe.util;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
public class FilePickerActivityHelper extends com.nononsenseapps.filepicker.FilePickerActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
if(ThemeHelper.isLightThemeSelected(this)) {
|
||||
this.setTheme(R.style.FilePickerThemeLight);
|
||||
} else {
|
||||
this.setTheme(R.style.FilePickerThemeDark);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
@ -109,23 +109,47 @@
|
||||
<item name="background">@color/video_overlay_color</item>
|
||||
</style>
|
||||
|
||||
<!-- You can also inherit from NNF_BaseTheme.Light -->
|
||||
<style name="FilePickerTheme" parent="NNF_BaseTheme.Light">
|
||||
<!-- Set these to match your theme -->
|
||||
<style name="FilePickerThemeLight" parent="NNF_BaseTheme.Light">
|
||||
<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:background">@color/light_background_color</item>
|
||||
<item name="nnf_separator_color">@color/light_separator_color</item>
|
||||
|
||||
<!-- Need to set this also to style create folder dialog -->
|
||||
<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>
|
||||
|
||||
<!-- If you want to set a specific toolbar theme, do it here -->
|
||||
<!-- <item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> -->
|
||||
<item name="alertDialogTheme">@style/FilePickerAlertDialogThemeLight</item>
|
||||
<item name="nnf_toolbarTheme">@style/FilePickerToolbarLight</item>
|
||||
</style>
|
||||
|
||||
<style name="FilePickerAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
|
||||
<style name="FilePickerAlertDialogThemeLight" parent="Theme.AppCompat.Dialog.Alert">
|
||||
<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>
|
||||
</style>
|
||||
|
||||
<style name="FilePickerToolbarLight" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
<item name="android:background">@color/light_youtube_primary_color</item>
|
||||
</style>
|
||||
|
||||
<style name="FilePickerThemeDark" parent="FilePickerThemeLight">
|
||||
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
|
||||
<item name="colorPrimaryDark">@color/dark_youtube_dark_color</item>
|
||||
<item name="colorAccent">@color/dark_youtube_accent_color</item>
|
||||
<item name="android:background">@color/dark_background_color</item>
|
||||
<item name="android:textColorPrimary">@color/dark_youtube_accent_color</item>
|
||||
<item name="nnf_separator_color">@color/black_separator_color</item>
|
||||
|
||||
<item name="alertDialogTheme">@style/FilePickerAlertDialogThemeDark</item>
|
||||
<item name="nnf_toolbarTheme">@style/FilePickerToolbarDark</item>
|
||||
</style>
|
||||
|
||||
<style name="FilePickerAlertDialogThemeDark" parent="Theme.AppCompat.Dialog.Alert">
|
||||
<item name="colorPrimary">@color/dark_youtube_primary_color</item>
|
||||
<item name="colorPrimaryDark">@color/dark_youtube_dark_color</item>
|
||||
<item name="colorAccent">@color/dark_youtube_accent_color</item>
|
||||
</style>
|
||||
|
||||
<style name="FilePickerToolbarDark" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
<item name="android:background">@color/dark_youtube_primary_color</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user