Merge pull request #134 from eighthave/intent-filters-and-other-fixes
Intent filters and other fixes
This commit is contained in:
commit
592eee7d3d
13 changed files with 62 additions and 85 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@
|
|||
/app/app.iml
|
||||
/.idea
|
||||
/*.iml
|
||||
gradle.properties
|
||||
|
|
|
@ -29,43 +29,46 @@
|
|||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".VideoItemListActivity" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="youtube.com"
|
||||
android:scheme="http"
|
||||
android:pathPattern="/?*#*/*watch"/>
|
||||
<data
|
||||
android:host="youtube.com"
|
||||
android:scheme="https"
|
||||
android:pathPattern="/?*#*/*watch"/>
|
||||
<data
|
||||
android:host="www.youtube.com"
|
||||
android:scheme="http"
|
||||
android:pathPattern="/?*#*/*watch"/>
|
||||
<data
|
||||
android:host="www.youtube.com"
|
||||
android:scheme="https"
|
||||
android:pathPattern="/?*#*/*watch"/>
|
||||
<data
|
||||
android:host="m.youtube.com"
|
||||
android:scheme="http"
|
||||
android:pathPattern="/?*#*/*watch"/>
|
||||
<data
|
||||
android:host="m.youtube.com"
|
||||
android:scheme="https"
|
||||
android:pathPattern="/?*#*/*watch"/>
|
||||
<data
|
||||
android:host="youtu.be"
|
||||
android:scheme="https"
|
||||
android:pathPrefix="/"/>
|
||||
<data
|
||||
android:host="youtu.be"
|
||||
android:scheme="http"
|
||||
android:pathPrefix="/"/>
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:host="youtube.com" />
|
||||
<data android:host="m.youtube.com" />
|
||||
<data android:host="www.youtube.com" />
|
||||
<data android:pathPrefix="/v/" />
|
||||
<data android:pathPrefix="/watch" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="http" />
|
||||
<data android:scheme="https" />
|
||||
<data android:host="youtu.be" />
|
||||
<data android:pathPrefix="/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="vnd.youtube" />
|
||||
<data android:scheme="vnd.youtube.launch" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".PlayVideoActivity"
|
||||
|
@ -74,12 +77,10 @@
|
|||
android:parentActivityName=".VideoItemDetailActivity"
|
||||
tools:ignore="UnusedAttribute">
|
||||
</activity>
|
||||
<!--TODO: make label a translatable string -->
|
||||
<service
|
||||
android:name=".BackgroundPlayer"
|
||||
android:label="NewPipe Background Player"
|
||||
android:exported="false" >
|
||||
</service>
|
||||
android:label="@string/background_player_name"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:label="@string/title_activity_settings" >
|
||||
|
|
|
@ -57,26 +57,29 @@ public class DownloadDialog extends DialogFragment {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Context context = getActivity();
|
||||
SharedPreferences defaultPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String suffix = "";
|
||||
String title = arguments.getString(TITLE);
|
||||
String url = "";
|
||||
String downloadFolder = "Download";
|
||||
switch(which) {
|
||||
case 0: // Video
|
||||
suffix = arguments.getString(FILE_SUFFIX_VIDEO);
|
||||
url = arguments.getString(VIDEO_URL);
|
||||
downloadFolder = "Movies";
|
||||
break;
|
||||
case 1:
|
||||
suffix = arguments.getString(FILE_SUFFIX_AUDIO);
|
||||
url = arguments.getString(AUDIO_URL);
|
||||
downloadFolder = "Music";
|
||||
break;
|
||||
default:
|
||||
Log.d(TAG, "lolz");
|
||||
}
|
||||
//to avoid hard-coded string like "/storage/emulated/0/NewPipe"
|
||||
final File dir = new File(defaultPreferences.getString(
|
||||
"download_path_preference",
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/NewPipe"));
|
||||
//to avoid hard-coded string like "/storage/emulated/0/Movies"
|
||||
String downloadPath = prefs.getString(getString(R.string.downloadPathPreference),
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + downloadFolder);
|
||||
final File dir = new File(downloadPath);
|
||||
if(!dir.exists()) {
|
||||
boolean mkdir = dir.mkdir(); //attempt to create directory
|
||||
if(!mkdir && !dir.isDirectory()) {
|
||||
|
@ -87,9 +90,7 @@ public class DownloadDialog extends DialogFragment {
|
|||
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
DownloadManager.Request request = new DownloadManager.Request(
|
||||
Uri.parse(url));
|
||||
request.setDestinationUri(Uri.fromFile(new File(
|
||||
defaultPreferences.getString("download_path_preference", "/storage/emulated/0/NewPipe")
|
||||
+ "/" + title + suffix)));
|
||||
request.setDestinationUri(Uri.fromFile(new File(dir + "/" + title + suffix)));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
try {
|
||||
dm.enqueue(request);
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package org.schabi.newpipe;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.ActionBar;
|
||||
|
@ -148,17 +144,4 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void initSettings(Context context) {
|
||||
PreferenceManager.setDefaultValues(context, R.xml.settings_screen, false);
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if(sp.getString(context.getString(R.string.downloadPathPreference), "").isEmpty()){
|
||||
SharedPreferences.Editor spEditor = sp.edit();
|
||||
String newPipeDownloadStorage =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/NewPipe";
|
||||
spEditor.putString(context.getString(R.string.downloadPathPreference)
|
||||
, newPipeDownloadStorage);
|
||||
spEditor.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.schabi.newpipe;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
|
@ -171,7 +172,7 @@ public class VideoItemListActivity extends AppCompatActivity
|
|||
}
|
||||
}
|
||||
|
||||
SettingsActivity.initSettings(this);
|
||||
PreferenceManager.setDefaultValues(this, R.xml.settings_screen, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Loading"
|
||||
android:text="@string/loading"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ProgressBar
|
||||
|
|
1
app/src/main/res/values-id
Symbolic link
1
app/src/main/res/values-id
Symbolic link
|
@ -0,0 +1 @@
|
|||
values-in
|
3
app/src/main/res/values-in/strings.xml
Normal file
3
app/src/main/res/values-in/strings.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
</resources>
|
1
app/src/main/res/values-iw
Symbolic link
1
app/src/main/res/values-iw
Symbolic link
|
@ -0,0 +1 @@
|
|||
values-he
|
|
@ -71,6 +71,7 @@
|
|||
<item>sl</item>
|
||||
<item>fi</item>
|
||||
<item>sv</item>
|
||||
<item>bo</item>
|
||||
<item>vi</item>
|
||||
<item>tr</item>
|
||||
<item>bg</item>
|
||||
|
@ -149,6 +150,7 @@
|
|||
<item>Slovenščina</item>
|
||||
<item>Suomi</item>
|
||||
<item>Svenska</item>
|
||||
<item>Tibetan བོད་སྐད།</item>
|
||||
<item>Tiếng Việt</item>
|
||||
<item>Türkçe</item>
|
||||
<item>Български</item>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">NewPipe</string>
|
||||
<string name="background_player_name">NewPipe Background Player</string>
|
||||
<string name="title_videoitem_detail" translatable="false">NewPipe</string>
|
||||
<string name="viewCountText">%1$s views</string>
|
||||
<string name="uploadDateText">Uploaded on %1$s</string>
|
||||
|
@ -10,6 +11,7 @@
|
|||
<string name="fdroidVLCurl" translatable="false">https://f-droid.org/repository/browse/?fdfilter=vlc&fdid=org.videolan.vlc</string>
|
||||
<string name="open_in_browser">Open in browser</string>
|
||||
<string name="share">Share</string>
|
||||
<string name="loading">Loading</string>
|
||||
<string name="download">Download</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="settings">Settings</string>
|
||||
|
|
|
@ -64,8 +64,7 @@
|
|||
android:key="@string/downloadPathPreference"
|
||||
android:title="@string/downloadLocation"
|
||||
android:summary="@string/downloadLocationSummary"
|
||||
android:dialogTitle="@string/downloadLocationDialogTitle"
|
||||
android:defaultValue=""/>
|
||||
android:dialogTitle="@string/downloadLocationDialogTitle" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/autoPlayThroughIntent"
|
||||
|
@ -74,4 +73,4 @@
|
|||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
Loading…
Reference in a new issue