mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-08 00:10:32 +00:00
Merge remote-tracking branch 'refs/remotes/origin/dev'
This commit is contained in:
commit
e3c63e395a
@ -1,13 +1,11 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
import android.app.DownloadManager;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
@ -19,8 +17,6 @@ import android.view.MenuInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Christian Schabesberger on 18.08.15.
|
* Created by Christian Schabesberger on 18.08.15.
|
||||||
*
|
*
|
||||||
@ -48,7 +44,7 @@ public class ActionBarHandler {
|
|||||||
private static ActionBarHandler handler = null;
|
private static ActionBarHandler handler = null;
|
||||||
|
|
||||||
private Context context = null;
|
private Context context = null;
|
||||||
private String webisteUrl = "";
|
private String websiteUrl = "";
|
||||||
private AppCompatActivity activity;
|
private AppCompatActivity activity;
|
||||||
private VideoInfo.VideoStream[] videoStreams = null;
|
private VideoInfo.VideoStream[] videoStreams = null;
|
||||||
private VideoInfo.AudioStream audioStream = null;
|
private VideoInfo.AudioStream audioStream = null;
|
||||||
@ -64,7 +60,7 @@ public class ActionBarHandler {
|
|||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ForamatItemSelectListener implements ActionBar.OnNavigationListener {
|
class FormatItemSelectListener implements ActionBar.OnNavigationListener {
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
|
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
|
||||||
selectFormatItem((int)itemId);
|
selectFormatItem((int)itemId);
|
||||||
@ -98,7 +94,7 @@ public class ActionBarHandler {
|
|||||||
if(activity != null) {
|
if(activity != null) {
|
||||||
ActionBar ab = activity.getSupportActionBar();
|
ActionBar ab = activity.getSupportActionBar();
|
||||||
ab.setListNavigationCallbacks(itemAdapter
|
ab.setListNavigationCallbacks(itemAdapter
|
||||||
,new ForamatItemSelectListener());
|
,new FormatItemSelectListener());
|
||||||
ab.setSelectedNavigationItem(defaultResolutionPos);
|
ab.setSelectedNavigationItem(defaultResolutionPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,9 +110,9 @@ public class ActionBarHandler {
|
|||||||
}
|
}
|
||||||
} else if(preferedFormat.equals("m4a")){
|
} else if(preferedFormat.equals("m4a")){
|
||||||
for(VideoInfo.AudioStream s : audioStreams) {
|
for(VideoInfo.AudioStream s : audioStreams) {
|
||||||
Log.d(TAG, VideoInfo.getMimeById(s.format) + " : " + Integer.toString(s.bandWidth));
|
Log.d(TAG, VideoInfo.getMimeById(s.format) + " : " + Integer.toString(s.bandwidth));
|
||||||
if(s.format == VideoInfo.I_M4A &&
|
if(s.format == VideoInfo.I_M4A &&
|
||||||
(audioStream == null || audioStream.bandWidth > s.bandWidth)) {
|
(audioStream == null || audioStream.bandwidth > s.bandwidth)) {
|
||||||
audioStream = s;
|
audioStream = s;
|
||||||
Log.d(TAG, "last choosen");
|
Log.d(TAG, "last choosen");
|
||||||
}
|
}
|
||||||
@ -162,7 +158,7 @@ public class ActionBarHandler {
|
|||||||
if(!videoTitle.isEmpty()) {
|
if(!videoTitle.isEmpty()) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(Intent.ACTION_SEND);
|
intent.setAction(Intent.ACTION_SEND);
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, webisteUrl);
|
intent.putExtra(Intent.EXTRA_TEXT, websiteUrl);
|
||||||
intent.setType("text/plain");
|
intent.setType("text/plain");
|
||||||
context.startActivity(Intent.createChooser(intent, context.getString(R.string.shareDialogTitle)));
|
context.startActivity(Intent.createChooser(intent, context.getString(R.string.shareDialogTitle)));
|
||||||
}
|
}
|
||||||
@ -192,7 +188,7 @@ public class ActionBarHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setVideoInfo(String websiteUrl, String videoTitle) {
|
public void setVideoInfo(String websiteUrl, String videoTitle) {
|
||||||
this.webisteUrl = websiteUrl;
|
this.websiteUrl = websiteUrl;
|
||||||
this.videoTitle = videoTitle;
|
this.videoTitle = videoTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +235,7 @@ public class ActionBarHandler {
|
|||||||
Intent intent = new Intent(context, PlayVideoActivity.class);
|
Intent intent = new Intent(context, PlayVideoActivity.class);
|
||||||
intent.putExtra(PlayVideoActivity.VIDEO_TITLE, videoTitle);
|
intent.putExtra(PlayVideoActivity.VIDEO_TITLE, videoTitle);
|
||||||
intent.putExtra(PlayVideoActivity.STREAM_URL, videoStreams[selectedStream].url);
|
intent.putExtra(PlayVideoActivity.STREAM_URL, videoStreams[selectedStream].url);
|
||||||
intent.putExtra(PlayVideoActivity.VIDEO_URL, webisteUrl);
|
intent.putExtra(PlayVideoActivity.VIDEO_URL, websiteUrl);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,7 +263,7 @@ public class ActionBarHandler {
|
|||||||
if(!videoTitle.isEmpty()) {
|
if(!videoTitle.isEmpty()) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse(webisteUrl));
|
intent.setData(Uri.parse(websiteUrl));
|
||||||
|
|
||||||
context.startActivity(Intent.createChooser(intent, context.getString(R.string.chooseBrowser)));
|
context.startActivity(Intent.createChooser(intent, context.getString(R.string.chooseBrowser)));
|
||||||
}
|
}
|
||||||
@ -278,7 +274,7 @@ public class ActionBarHandler {
|
|||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setPackage(KORE_PACKET);
|
intent.setPackage(KORE_PACKET);
|
||||||
intent.setData(Uri.parse(webisteUrl.replace("https", "http")));
|
intent.setData(Uri.parse(websiteUrl.replace("https", "http")));
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -310,6 +306,8 @@ public class ActionBarHandler {
|
|||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(Uri.parse(audioStream.url),
|
intent.setDataAndType(Uri.parse(audioStream.url),
|
||||||
VideoInfo.getMimeById(audioStream.format));
|
VideoInfo.getMimeById(audioStream.format));
|
||||||
|
intent.putExtra(Intent.EXTRA_TITLE, videoTitle);
|
||||||
|
intent.putExtra("title", videoTitle);
|
||||||
context.startActivity(intent); // HERE !!!
|
context.startActivity(intent); // HERE !!!
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Christian Schabesberger on 10.08.15.
|
* Created by Christian Schabesberger on 10.08.15.
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -17,15 +18,11 @@ import android.view.Display;
|
|||||||
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.Surface;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.MediaController;
|
import android.widget.MediaController;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.SeekBar;
|
|
||||||
import android.widget.VideoView;
|
import android.widget.VideoView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,6 +69,9 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
private boolean isLandscape = true;
|
private boolean isLandscape = true;
|
||||||
private boolean hasSoftKeys = false;
|
private boolean hasSoftKeys = false;
|
||||||
|
|
||||||
|
private SharedPreferences prefs;
|
||||||
|
private static final String PREF_IS_LANDSCAPE = "is_landscape";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -79,7 +79,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
setContentView(R.layout.activity_play_video);
|
setContentView(R.layout.activity_play_video);
|
||||||
|
|
||||||
isLandscape = checkIfLandscape();
|
isLandscape = checkIfLandscape();
|
||||||
hasSoftKeys = checkIfhasSoftKeys();
|
hasSoftKeys = checkIfHasSoftKeys();
|
||||||
|
|
||||||
actionBar = getSupportActionBar();
|
actionBar = getSupportActionBar();
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
@ -136,12 +136,16 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||||
|
|
||||||
|
prefs = getPreferences(Context.MODE_PRIVATE);
|
||||||
|
if(prefs.getBoolean(PREF_IS_LANDSCAPE, false) && !isLandscape) {
|
||||||
|
toggleOrientation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -179,14 +183,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
startActivity(Intent.createChooser(intent, getString(R.string.shareDialogTitle)));
|
startActivity(Intent.createChooser(intent, getString(R.string.shareDialogTitle)));
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_screen_rotation:
|
case R.id.menu_item_screen_rotation:
|
||||||
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
toggleOrientation();
|
||||||
if(display.getRotation() == Surface.ROTATION_0
|
|
||||||
|| display.getRotation() == Surface.ROTATION_180) {
|
|
||||||
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
||||||
} else if(display.getRotation() == Surface.ROTATION_90
|
|
||||||
|| display.getRotation() == Surface.ROTATION_270) {
|
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.e(TAG, "Error: MenuItem not known");
|
Log.e(TAG, "Error: MenuItem not known");
|
||||||
@ -201,10 +198,10 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
isLandscape = true;
|
isLandscape = true;
|
||||||
adjustMediaControllMetrics();
|
adjustMediaControlMetrics();
|
||||||
} else if (config.orientation == Configuration.ORIENTATION_PORTRAIT){
|
} else if (config.orientation == Configuration.ORIENTATION_PORTRAIT){
|
||||||
isLandscape = false;
|
isLandscape = false;
|
||||||
adjustMediaControllMetrics();
|
adjustMediaControlMetrics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +224,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
uiIsHidden = false;
|
uiIsHidden = false;
|
||||||
mediaController.show(100000);
|
mediaController.show(100000);
|
||||||
actionBar.show();
|
actionBar.show();
|
||||||
adjustMediaControllMetrics();
|
adjustMediaControlMetrics();
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@ -257,7 +254,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustMediaControllMetrics() {
|
private void adjustMediaControlMetrics() {
|
||||||
MediaController.LayoutParams mediaControllerLayout
|
MediaController.LayoutParams mediaControllerLayout
|
||||||
= new MediaController.LayoutParams(MediaController.LayoutParams.MATCH_PARENT,
|
= new MediaController.LayoutParams(MediaController.LayoutParams.MATCH_PARENT,
|
||||||
MediaController.LayoutParams.WRAP_CONTENT);
|
MediaController.LayoutParams.WRAP_CONTENT);
|
||||||
@ -272,7 +269,7 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
mediaController.setLayoutParams(mediaControllerLayout);
|
mediaController.setLayoutParams(mediaControllerLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkIfhasSoftKeys(){
|
private boolean checkIfHasSoftKeys(){
|
||||||
if(Build.VERSION.SDK_INT >= 17) {
|
if(Build.VERSION.SDK_INT >= 17) {
|
||||||
return getNavigationBarHeight() != 0 || getNavigationBarWidth() != 0;
|
return getNavigationBarHeight() != 0 || getNavigationBarWidth() != 0;
|
||||||
} else {
|
} else {
|
||||||
@ -319,4 +316,17 @@ public class PlayVideoActivity extends AppCompatActivity {
|
|||||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
return displayMetrics.heightPixels < displayMetrics.widthPixels;
|
return displayMetrics.heightPixels < displayMetrics.widthPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toggleOrientation() {
|
||||||
|
if(isLandscape) {
|
||||||
|
isLandscape = false;
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
} else {
|
||||||
|
isLandscape = true;
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||||
|
}
|
||||||
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
editor.putBoolean(PREF_IS_LANDSCAPE, isLandscape);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,13 +110,13 @@ public class VideoInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class AudioStream {
|
public static class AudioStream {
|
||||||
public AudioStream(String url, int format, int bandWidth, int samplingRate) {
|
public AudioStream(String url, int format, int bandwidth, int samplingRate) {
|
||||||
this.url = url; this.format = format;
|
this.url = url; this.format = format;
|
||||||
this.bandWidth = bandWidth; this.samplingRate = samplingRate;
|
this.bandwidth = bandwidth; this.samplingRate = samplingRate;
|
||||||
}
|
}
|
||||||
public String url = "";
|
public String url = "";
|
||||||
public int format = -1;
|
public int format = -1;
|
||||||
public int bandWidth = -1;
|
public int bandwidth = -1;
|
||||||
public int samplingRate = -1;
|
public int samplingRate = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
import android.content.ContentProviderOperation;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.NavUtils;
|
import android.support.v4.app.NavUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
|
||||||
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.WindowManager;
|
|
||||||
|
|
||||||
import org.schabi.newpipe.youtube.YoutubeExtractor;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,13 +3,11 @@ package org.schabi.newpipe;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.media.Image;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
@ -17,14 +15,11 @@ import android.util.Log;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.GridLayout;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
@ -216,7 +211,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
thumbnailView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.not_available_monkey));
|
thumbnailView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.not_available_monkey));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.e(TAG, "Video Availeble Status not known.");
|
Log.e(TAG, "Video Available Status not known.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(autoPlayEnabled) {
|
if(autoPlayEnabled) {
|
||||||
|
@ -2,21 +2,14 @@ package org.schabi.newpipe;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.DisplayMetrics;
|
import android.support.v7.widget.SearchView;
|
||||||
import android.util.Log;
|
|
||||||
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.WindowManager;
|
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.support.v7.widget.SearchView;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +139,6 @@ public class VideoItemListActivity extends AppCompatActivity
|
|||||||
|
|
||||||
SettingsActivity.initSettings(this);
|
SettingsActivity.initSettings(this);
|
||||||
|
|
||||||
// TODO: If exposing deep links into your app, handle intents here.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,6 @@ import android.widget.ListView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
@ -54,14 +53,14 @@ public class VideoItemListFragment extends ListFragment {
|
|||||||
|
|
||||||
private class ResultRunnable implements Runnable {
|
private class ResultRunnable implements Runnable {
|
||||||
private SearchEngine.Result result;
|
private SearchEngine.Result result;
|
||||||
private int reuqestId;
|
private int requestId;
|
||||||
public ResultRunnable(SearchEngine.Result result, int requestId) {
|
public ResultRunnable(SearchEngine.Result result, int requestId) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.reuqestId = requestId;
|
this.requestId = requestId;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateListOnResult(result, reuqestId);
|
updateListOnResult(result, requestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +212,7 @@ public class VideoItemListFragment extends ListFragment {
|
|||||||
loadThumbsThread = new Thread(loadThumbsRunnable);
|
loadThumbsThread = new Thread(loadThumbsRunnable);
|
||||||
loadThumbsThread.start();
|
loadThumbsThread.start();
|
||||||
} catch(java.lang.IllegalStateException e) {
|
} catch(java.lang.IllegalStateException e) {
|
||||||
Log.w(TAG, "Trying to set value while activity is not existing anymore.");
|
Log.w(TAG, "Trying to set value while activity doesn't exist anymore.");
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -230,7 +229,7 @@ public class VideoItemListFragment extends ListFragment {
|
|||||||
}
|
}
|
||||||
if(searchThread != null) {
|
if(searchThread != null) {
|
||||||
searchRunnable.terminate();
|
searchRunnable.terminate();
|
||||||
// No need to join, since we don't realy terminate the thread. We just demand
|
// No need to join, since we don't really terminate the thread. We just demand
|
||||||
// it to post its result runnable into the gui main loop.
|
// it to post its result runnable into the gui main loop.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,29 @@
|
|||||||
package org.schabi.newpipe.youtube;
|
package org.schabi.newpipe.youtube;
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.schabi.newpipe.Downloader;
|
|
||||||
import org.schabi.newpipe.Extractor;
|
|
||||||
import org.schabi.newpipe.VideoInfo;
|
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.parser.Parser;
|
||||||
|
import org.mozilla.javascript.Context;
|
||||||
|
import org.mozilla.javascript.Function;
|
||||||
|
import org.mozilla.javascript.ScriptableObject;
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
|
import org.schabi.newpipe.Extractor;
|
||||||
|
import org.schabi.newpipe.VideoInfo;
|
||||||
|
import org.schabi.newpipe.VideoInfoItem;
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import org.json.JSONObject;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.parser.Parser;
|
|
||||||
|
|
||||||
import org.mozilla.javascript.Context;
|
|
||||||
import org.mozilla.javascript.Function;
|
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.schabi.newpipe.VideoInfoItem;
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Christian Schabesberger on 06.08.15.
|
* Created by Christian Schabesberger on 06.08.15.
|
||||||
@ -48,8 +47,6 @@ import org.xmlpull.v1.XmlPullParser;
|
|||||||
|
|
||||||
public class YoutubeExtractor implements Extractor {
|
public class YoutubeExtractor implements Extractor {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final String TAG = YoutubeExtractor.class.toString();
|
private static final String TAG = YoutubeExtractor.class.toString();
|
||||||
|
|
||||||
// These lists only contain itag formats that are supported by the common Android Video player.
|
// These lists only contain itag formats that are supported by the common Android Video player.
|
||||||
@ -93,7 +90,7 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String decryptoinCode = "";
|
private String decryptionCode = "";
|
||||||
private static final String DECRYPTION_FUNC_NAME="decrypt";
|
private static final String DECRYPTION_FUNC_NAME="decrypt";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -189,12 +186,12 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
if(playerUrl.startsWith("//")) {
|
if(playerUrl.startsWith("//")) {
|
||||||
playerUrl = "https:" + playerUrl;
|
playerUrl = "https:" + playerUrl;
|
||||||
}
|
}
|
||||||
if(decryptoinCode.isEmpty()) {
|
if(decryptionCode.isEmpty()) {
|
||||||
decryptoinCode = loadDecryptioinCode(playerUrl);
|
decryptionCode = loadDecryptionCode(playerUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract audio
|
// extract audio
|
||||||
videoInfo.audioStreams = parseDashManifest(dashManifest, decryptoinCode);
|
videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode);
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// extract video stream url
|
// extract video stream url
|
||||||
@ -213,10 +210,10 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
|
|
||||||
// if video has a signature: decrypt it and add it to the url
|
// if video has a signature: decrypt it and add it to the url
|
||||||
if(tags.get("s") != null) {
|
if(tags.get("s") != null) {
|
||||||
if(decryptoinCode.isEmpty()) {
|
if(decryptionCode.isEmpty()) {
|
||||||
decryptoinCode = loadDecryptioinCode(playerUrl);
|
decryptionCode = loadDecryptionCode(playerUrl);
|
||||||
}
|
}
|
||||||
streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptoinCode);
|
streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptionCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(resolveFormat(itag) != -1) {
|
if(resolveFormat(itag) != -1) {
|
||||||
@ -236,7 +233,7 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
// extrating from html page
|
// extracting from html page
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -438,7 +435,7 @@ public class YoutubeExtractor implements Extractor {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String loadDecryptioinCode(String playerUrl) {
|
private String loadDecryptionCode(String playerUrl) {
|
||||||
String playerCode = Downloader.download(playerUrl);
|
String playerCode = Downloader.download(playerUrl);
|
||||||
String decryptionFuncName = "";
|
String decryptionFuncName = "";
|
||||||
String decryptionFunc = "";
|
String decryptionFunc = "";
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package org.schabi.newpipe.youtube;
|
package org.schabi.newpipe.youtube;
|
||||||
|
|
||||||
import org.schabi.newpipe.Downloader;
|
|
||||||
import org.schabi.newpipe.SearchEngine;
|
|
||||||
import org.schabi.newpipe.VideoInfoItem;
|
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
|
import org.schabi.newpipe.SearchEngine;
|
||||||
|
import org.schabi.newpipe.VideoInfoItem;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Christian Schabesberger on 09.08.15.
|
* Created by Christian Schabesberger on 09.08.15.
|
||||||
|
@ -164,10 +164,10 @@
|
|||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/playVideoButton"
|
android:id="@+id/playVideoButton"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:backgroundTint="@color/primaryColorYoutube"
|
app:backgroundTint="@color/primaryColorYoutube"
|
||||||
android:src="@drawable/ic_play_arrow_black"
|
android:src="@drawable/ic_play_arrow_black"
|
||||||
android:layout_margin="35dp"/>
|
android:layout_margin="20dp"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
@ -35,7 +35,7 @@
|
|||||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||||
<string name="showPlayWithKodiTitle">Zeige \"Mit Kodi abspielen\" Option</string>
|
<string name="showPlayWithKodiTitle">Zeige \"Mit Kodi abspielen\" Option</string>
|
||||||
<string name="showPlayWithKodiSummary">Zeigt eine Option an, über die man Videos mit dem Kodi Mediacenter abspielen kann.</string>
|
<string name="showPlayWithKodiSummary">Zeigt eine Option an, über die man Videos mit dem Kodi Mediacenter abspielen kann.</string>
|
||||||
<string name="leftHandLayoutTitle">Linkshänder freundliches Layout.</string>
|
<string name="leftPlayButtonTitle">Zeige play button auf der linken seite.</string>
|
||||||
<string name="playAudio">Audio</string>
|
<string name="playAudio">Audio</string>
|
||||||
<string name="defaultAudioFormatTitle">Bevorzugtes Audio Format</string>
|
<string name="defaultAudioFormatTitle">Bevorzugtes Audio Format</string>
|
||||||
<string name="webMAudioDescription">WebM - freies Format</string>
|
<string name="webMAudioDescription">WebM - freies Format</string>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||||
<string name="showPlayWithKodiTitle">\"Lejátszás Kodi-val\" opció mutatása</string>
|
<string name="showPlayWithKodiTitle">\"Lejátszás Kodi-val\" opció mutatása</string>
|
||||||
<string name="showPlayWithKodiSummary">Mutat egy opciót a videók Kodi médiaközponttal való lejátszására</string>
|
<string name="showPlayWithKodiSummary">Mutat egy opciót a videók Kodi médiaközponttal való lejátszására</string>
|
||||||
<string name="leftHandLayoutTitle">Bal kezes elrendezés</string>
|
<string name="leftPlayButtonTitle">Lejátszás gomb bal oldalon mutatása</string>
|
||||||
<string name="playAudio">Hang</string>
|
<string name="playAudio">Hang</string>
|
||||||
<string name="defaultAudioFormatTitle">Alapértelmezett hang formátum</string>
|
<string name="defaultAudioFormatTitle">Alapértelmezett hang formátum</string>
|
||||||
<string name="webMAudioDescription">WebM - szabad formátum</string>
|
<string name="webMAudioDescription">WebM - szabad formátum</string>
|
||||||
|
@ -29,4 +29,20 @@
|
|||||||
<string name="autoPlayThroughIntentTitle">Аутопуштање преко Интента</string>
|
<string name="autoPlayThroughIntentTitle">Аутопуштање преко Интента</string>
|
||||||
<string name="autoPlayThroughIntentSummary">Аутоматски почиње пушта видео по позиву из друге апликације.</string>
|
<string name="autoPlayThroughIntentSummary">Аутоматски почиње пушта видео по позиву из друге апликације.</string>
|
||||||
<string name="defaultResolutionPreferenceTitle">Подразумевана резолуција</string>
|
<string name="defaultResolutionPreferenceTitle">Подразумевана резолуција</string>
|
||||||
</resources>
|
<string name="playWithKodiTitle">Пусти помоћу Кодија</string>
|
||||||
|
<string name="koreNotFound">Апликација Кор није нађена. Кор (Kore) је потребан да бисте пуштали видее у Коди медија центру.</string>
|
||||||
|
<string name="installeKore">Инсталирај Кор</string>
|
||||||
|
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||||
|
<string name="showPlayWithKodiTitle">Прикажи „Пусти помоћу Кодија“</string>
|
||||||
|
<string name="showPlayWithKodiSummary">Приказ опције за пуштање видеа у Коди медија центру.</string>
|
||||||
|
<string name="leftPlayButtonTitle">Прикажи дугме за пуштање на левој страни.</string>
|
||||||
|
<string name="playAudio">Аудио</string>
|
||||||
|
<string name="defaultAudioFormatTitle">Подразумевани формат звука</string>
|
||||||
|
<string name="webMAudioDescription">WebM - слободни формат</string>
|
||||||
|
<string name="m4aAudioDescription">m4a - бољи квалитет</string>
|
||||||
|
<string name="downloadDialogTitle">Преузми</string>
|
||||||
|
<string-array name="downloadOptions">
|
||||||
|
<item>Видео</item>
|
||||||
|
<item>Аудио</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -35,7 +35,7 @@
|
|||||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||||
<string name="showPlayWithKodiTitle">Show \"Play with Kodi\" option</string>
|
<string name="showPlayWithKodiTitle">Show \"Play with Kodi\" option</string>
|
||||||
<string name="showPlayWithKodiSummary">Displays an option to play a video via Kodi media center.</string>
|
<string name="showPlayWithKodiSummary">Displays an option to play a video via Kodi media center.</string>
|
||||||
<string name="leftHandLayoutTitle">Left hand friendly layout.</string>
|
<string name="leftPlayButtonTitle">Show play button on the left side.</string>
|
||||||
<string name="playAudio">Audio</string>
|
<string name="playAudio">Audio</string>
|
||||||
<string name="defaultAudioFormatTitle">Default audio format</string>
|
<string name="defaultAudioFormatTitle">Default audio format</string>
|
||||||
<string name="webMAudioDescription">WebM - free format</string>
|
<string name="webMAudioDescription">WebM - free format</string>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/leftHandLayout"
|
android:key="@string/leftHandLayout"
|
||||||
android:title="@string/leftHandLayoutTitle"
|
android:title="@string/leftPlayButtonTitle"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
Loading…
Reference in New Issue
Block a user