1
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-09-21 22:20:50 +02:00

Compare commits

...

123 Commits

Author SHA1 Message Date
Christian Schabesberger
140cfaec90 moved on to version 0.9.7 2017-05-20 17:45:50 +02:00
Дима Гайнуллин
a0f20aac23 Translated using Weblate (Russian)
Currently translated at 86.9% (153 of 176 strings)
2017-05-20 15:40:42 +02:00
ktln
93fafb362f Translated using Weblate (Russian)
Currently translated at 86.9% (153 of 176 strings)
2017-05-20 15:39:44 +02:00
anonymous
9152df5512 Translated using Weblate (Russian)
Currently translated at 84.0% (148 of 176 strings)
2017-05-20 15:37:48 +02:00
Anton Shestakov
415bcd9f7e Translated using Weblate (Russian)
Currently translated at 83.5% (147 of 176 strings)
2017-05-20 15:37:13 +02:00
Дима Гайнуллин
2224033a85 Translated using Weblate (Russian)
Currently translated at 82.9% (146 of 176 strings)
2017-05-20 15:36:57 +02:00
Anton Shestakov
ade0498684 Translated using Weblate (Russian)
Currently translated at 82.9% (146 of 176 strings)
2017-05-20 15:34:06 +02:00
Дима Гайнуллин
211b00fff4 Translated using Weblate (Russian)
Currently translated at 82.9% (146 of 176 strings)
2017-05-20 15:33:52 +02:00
ktln
77c72d03a8 Translated using Weblate (Russian)
Currently translated at 82.9% (146 of 176 strings)
2017-05-20 15:32:32 +02:00
Anton Shestakov
f429d93351 Translated using Weblate (Russian)
Currently translated at 82.3% (145 of 176 strings)
2017-05-20 15:25:48 +02:00
Дима Гайнуллин
e428f8b116 Translated using Weblate (Russian)
Currently translated at 82.3% (145 of 176 strings)
2017-05-20 15:20:18 +02:00
Anton Shestakov
9482b9d638 Translated using Weblate (Russian)
Currently translated at 82.3% (145 of 176 strings)
2017-05-20 15:19:15 +02:00
Дима Гайнуллин
e019c9f720 Translated using Weblate (Russian)
Currently translated at 82.3% (145 of 176 strings)
2017-05-20 15:12:17 +02:00
Anton Shestakov
e2778366e9 Translated using Weblate (Russian)
Currently translated at 82.3% (145 of 176 strings)
2017-05-20 15:11:49 +02:00
ktln
36d2f8339c Translated using Weblate (Russian)
Currently translated at 82.3% (145 of 176 strings)
2017-05-20 15:11:30 +02:00
anonymous
a4a0c3b9fd Translated using Weblate (Russian)
Currently translated at 81.2% (143 of 176 strings)
2017-05-20 15:10:44 +02:00
ktln
1b1b6c8af8 Translated using Weblate (Russian)
Currently translated at 80.6% (142 of 176 strings)
2017-05-20 15:10:20 +02:00
Anton Shestakov
064fd2bc68 Translated using Weblate (Russian)
Currently translated at 80.1% (141 of 176 strings)
2017-05-20 15:10:11 +02:00
ktln
13152ab6ea Translated using Weblate (Russian)
Currently translated at 79.5% (140 of 176 strings)
2017-05-20 15:07:58 +02:00
Anton Shestakov
1743d821eb Translated using Weblate (Russian)
Currently translated at 78.9% (139 of 176 strings)
2017-05-20 15:04:08 +02:00
ktln
ff16e577ef Translated using Weblate (Russian)
Currently translated at 78.9% (139 of 176 strings)
2017-05-20 15:02:58 +02:00
Anton Shestakov
86062c6e94 Translated using Weblate (Russian)
Currently translated at 78.4% (138 of 176 strings)
2017-05-20 15:02:43 +02:00
ktln
8ce2350563 Translated using Weblate (Russian)
Currently translated at 78.4% (138 of 176 strings)
2017-05-20 15:00:51 +02:00
Anton Shestakov
cb8989af7f Translated using Weblate (Russian)
Currently translated at 77.8% (137 of 176 strings)
2017-05-20 15:00:25 +02:00
ktln
877fa45eb4 Translated using Weblate (Russian)
Currently translated at 77.2% (136 of 176 strings)
2017-05-20 14:59:24 +02:00
Anton Shestakov
e33942486d Translated using Weblate (Russian)
Currently translated at 76.7% (135 of 176 strings)
2017-05-20 14:58:50 +02:00
Дима Гайнуллин
9606e080ef Translated using Weblate (Russian)
Currently translated at 76.7% (135 of 176 strings)
2017-05-20 14:57:45 +02:00
Anton Shestakov
d5cd9c55be Translated using Weblate (Russian)
Currently translated at 76.7% (135 of 176 strings)
2017-05-20 14:56:39 +02:00
Дима Гайнуллин
9c197ced80 Translated using Weblate (Russian)
Currently translated at 75.0% (132 of 176 strings)
2017-05-20 14:40:15 +02:00
Anton Shestakov
f8424599e1 Translated using Weblate (Russian)
Currently translated at 75.0% (132 of 176 strings)
2017-05-20 14:38:59 +02:00
naofum
ccee18057a Translated using Weblate (Japanese)
Currently translated at 100.0% (176 of 176 strings)
2017-05-20 07:11:53 +02:00
Freddy Morán Jr
1ad0f342ad Translated using Weblate (Spanish)
Currently translated at 100.0% (176 of 176 strings)
2017-05-19 15:39:44 +02:00
Eduardo Caron
7a16ac574b Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (176 of 176 strings)
2017-05-19 15:16:03 +02:00
Matej U
f46738f750 Translated using Weblate (Slovenian)
Currently translated at 100.0% (176 of 176 strings)
2017-05-19 13:49:47 +02:00
monolifed
fb8ff3fece Translated using Weblate (Turkish)
Currently translated at 100.0% (176 of 176 strings)
2017-05-19 12:20:03 +02:00
Weblate
7498dd3800 Merge remote-tracking branch 'origin/master' 2017-05-19 03:46:42 +02:00
Freddy Morán Jr
957c31b9c5 Translated using Weblate (Spanish)
Currently translated at 100.0% (172 of 172 strings)
2017-05-19 03:46:40 +02:00
Mauricio Colli
b260570e8c Merge pull request #568 from mauriciocolli/option-search-suggestions
Add option to disable the search suggestions
2017-05-16 22:17:28 -03:00
Mauricio Colli
46542747b7 Merge pull request #567 from mauriciocolli/option-gestures-player
Add option to disable the gesture controls of the player
2017-05-16 22:14:31 -03:00
Mauricio Colli
d64480fc9b Add option to disable the search suggestions 2017-05-16 22:14:07 -03:00
Mauricio Colli
c00e694d40 Add option to disable the gesture controls of the player 2017-05-16 21:45:38 -03:00
Bruno Guerreiro
f0761cc95e Translated using Weblate (Portuguese)
Currently translated at 100.0% (172 of 172 strings)
2017-05-16 21:32:24 +02:00
Eduardo Caron
068554955c Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (172 of 172 strings)
2017-05-16 21:25:48 +02:00
Freddy Morán Jr
a2f915f556 Translated using Weblate (Spanish)
Currently translated at 100.0% (172 of 172 strings)
2017-05-16 14:38:29 +02:00
Mohamad Hasan Al Banna
cffd35c974 Translated using Weblate (Indonesian)
Currently translated at 100.0% (172 of 172 strings)
2017-05-15 17:53:50 +02:00
naofum
2ef2aa98a4 Translated using Weblate (Japanese)
Currently translated at 100.0% (172 of 172 strings)
2017-05-15 17:23:57 +02:00
Théophane
ba98b30aa4 Translated using Weblate (French)
Currently translated at 100.0% (172 of 172 strings)
2017-05-15 16:23:59 +02:00
E T
87c0f9c803 Translated using Weblate (Turkish)
Currently translated at 100.0% (172 of 172 strings)
2017-05-15 16:08:54 +02:00
Matej U
ce620b9e28 Translated using Weblate (Slovenian)
Currently translated at 100.0% (172 of 172 strings)
2017-05-15 14:44:49 +02:00
Weblate
fcbb5536eb Merge remote-tracking branch 'origin/master' 2017-05-15 14:42:35 +02:00
Matej U
72df6dbd80 Translated using Weblate (Slovenian)
Currently translated at 100.0% (171 of 171 strings)
2017-05-15 14:42:32 +02:00
Christian Schabesberger
3a6b023dbf update gradle to version 2.3.2 2017-05-15 12:27:46 +02:00
Mauricio Colli
8b67f1358d Implement no-audio icon 2017-05-15 00:57:57 -03:00
Mauricio Colli
2aebb3b8db Add and update resources 2017-05-15 00:57:04 -03:00
Weblate
f2b38be2b0 Merge remote-tracking branch 'origin/master' 2017-05-14 21:46:25 +02:00
E T
a43001f30d Translated using Weblate (Turkish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-14 21:46:25 +02:00
cwgt
17abe1ea5c Translated using Weblate (Bengali (Bangladesh))
Currently translated at 100.0% (167 of 167 strings)
2017-05-14 21:46:24 +02:00
Bruno Guerreiro
6aaefab618 Translated using Weblate (Portuguese)
Currently translated at 98.2% (168 of 171 strings)
2017-05-14 21:46:22 +02:00
Mauricio Colli
cd867fb4d1 Merge pull request #559 from mauriciocolli/default-popup-resolution
Change popup default resolution
2017-05-14 14:01:12 -03:00
Mauricio Colli
25988f61a6 Change popup default resolution 2017-05-14 13:57:08 -03:00
Mauricio Colli
be421e580d Merge pull request #557 from mauriciocolli/fix-settings-rotation
Fix settings on screen rotation
2017-05-14 11:20:29 -03:00
Mauricio Colli
641ab25470 Fix Settings on screen rotation 2017-05-14 11:10:00 -03:00
Mauricio Colli
a508539c2e Merge pull request #556 from mauriciocolli/fix-audio-focus
Improve behavior on audio focus gain
2017-05-14 10:54:13 -03:00
Mauricio Colli
cac79d9a0d Improve behavior on audio focus gain 2017-05-14 10:46:28 -03:00
Christian Schabesberger
9ede8118da Merge pull request #553 from mauriciocolli/fix-screen-on
Fix keep screen on
2017-05-14 10:48:05 +02:00
Mauricio Colli
e47761750a Fix 'keep screen on' 2017-05-14 00:32:28 -03:00
Christian Schabesberger
2f181ce7c9 move on to version 0.9.6 2017-05-13 22:13:28 +02:00
Christian Schabesberger
3a13d4a1de Merge pull request #546 from mueller-ma/kodi
Change order of buttons in the title bar
2017-05-13 20:16:24 +02:00
Christian Schabesberger
719de00e0f Merge branch 'fix-menu-update' of https://github.com/mauriciocolli/NewPipe 2017-05-13 20:08:18 +02:00
cwgt
ddffe99f53 Translated using Weblate (Bengali (Bangladesh))
Currently translated at 100.0% (167 of 167 strings)
2017-05-13 11:36:43 +02:00
Eduardo Caron
9ade596f06 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (171 of 171 strings)
2017-05-11 20:33:38 +02:00
nailyk
46f413b7f2 Translated using Weblate (French)
Currently translated at 100.0% (171 of 171 strings)
2017-05-11 19:41:37 +02:00
nailyk
5fe2e7b8ad Translated using Weblate (French)
Currently translated at 92.3% (158 of 171 strings)

 popup_mode_share_menu_title a été traduit "Module popup de Newpipe", restons cohérents.
2017-05-11 19:33:46 +02:00
nailyk
3008cbb5f4 Translated using Weblate (French)
Currently translated at 91.8% (157 of 171 strings)
2017-05-11 19:20:57 +02:00
Weblate
f7983960e5 Merge remote-tracking branch 'origin/master' 2017-05-10 21:07:55 +02:00
monolifed
bb8007bb7c Translated using Weblate (Turkish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-10 21:07:55 +02:00
Freddy Morán Jr
01751ba97a Translated using Weblate (Spanish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-10 21:07:55 +02:00
Tobias Groza
f41475d11c Translated using Weblate (German)
Currently translated at 96.4% (165 of 171 strings)
2017-05-10 21:07:54 +02:00
Nathan Follens
d8914d9b6d Translated using Weblate (Dutch)
Currently translated at 100.0% (171 of 171 strings)
2017-05-10 21:07:52 +02:00
mueller-ma
94cc2ad365 change order of buttons, see https://github.com/TeamNewPipe/NewPipe/issues/471#issuecomment-300267118 2017-05-09 20:57:42 +02:00
Christian Schabesberger
e07464b81c Merge pull request #545 from mauriciocolli/fix-image-loader
Fix image loading bug
2017-05-09 20:19:43 +02:00
Jose Maeso
9d231b55b5 Translated using Weblate (Spanish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-09 18:09:23 +02:00
Freddy Morán Jr
77d8dac3c1 Translated using Weblate (Spanish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-09 18:07:54 +02:00
Freddy Morán Jr
e160015283 Translated using Weblate (Spanish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-09 18:05:47 +02:00
mueller-ma
aeb0cac3ee change order of buttons. closes #471 2017-05-09 17:11:19 +02:00
naofum
a539f94837 Translated using Weblate (Japanese)
Currently translated at 100.0% (171 of 171 strings)
2017-05-09 16:19:42 +02:00
monolifed
df70751071 Translated using Weblate (Turkish)
Currently translated at 100.0% (171 of 171 strings)
2017-05-09 14:34:49 +02:00
E T
e55f1dff78 Translated using Weblate (Turkish)
Currently translated at 97.6% (167 of 171 strings)
2017-05-09 14:12:43 +02:00
Weblate
47646e1c62 Merge remote-tracking branch 'origin/master' 2017-05-09 14:11:45 +02:00
E T
80e673f20c Translated using Weblate (Turkish)
Currently translated at 100.0% (167 of 167 strings)
2017-05-09 14:11:41 +02:00
Mauricio Colli
9ca8c5480c Fix image loader bug 2017-05-09 00:12:06 -03:00
Mauricio Colli
4d0d3c7ead Update menu items after change in settings 2017-05-08 22:23:27 -03:00
Christian Schabesberger
58137aadc9 Merge pull request #543 from mueller-ma/patch-1
Remove untranslatable string
2017-05-08 22:45:21 +02:00
mueller-ma
82a59ae479 Remove untranslatable string 2017-05-08 20:51:13 +02:00
Mauricio Colli
affd23b14e Fix animations 2017-05-08 10:33:26 -03:00
Mauricio Colli
9c7f249756 Clean and move some classes 2017-05-08 10:28:33 -03:00
Christian Schabesberger
e2a0502171 Merge pull request #538 from cwgt/bn-bd-translation
Add Bangla translation (for Bangladesh)
2017-05-08 11:44:27 +02:00
cwgt
3832a4b355 Add Bangla translation (for Bangladesh) 2017-05-08 15:27:55 +06:00
cwgt
84f059415c Create strings.xml 2017-05-08 13:32:33 +06:00
Christian Schabesberger
bb292e3199 add some more screenshots 2017-05-07 20:41:44 +02:00
Christian Schabesberger
70541bf561 moved on to version 0.9.5 2017-05-07 20:05:00 +02:00
Christian Schabesberger
48dd8e88e3 Merge branch 'master' of github.com:theScrabi/NewPipe 2017-05-07 19:48:21 +02:00
Eduardo Caron
52c2e0899d Translated using Weblate (Portuguese (Brazil))
Currently translated at 99.4% (166 of 167 strings)
2017-05-07 18:46:09 +02:00
Christian Schabesberger
9955d5b62f Merge branch 'resize' 2017-05-04 21:31:38 +02:00
Marian Hanzel
8e26247fa1 Translated using Weblate (Slovak)
Currently translated at 100.0% (167 of 167 strings)
2017-05-04 21:02:23 +02:00
Weblate
72924e2692 Merge remote-tracking branch 'origin/master' 2017-05-04 18:46:39 +02:00
Eduardo Caron
8c2c8d630f Translated using Weblate (Portuguese (Brazil))
Currently translated at 98.8% (165 of 167 strings)
2017-05-04 18:46:39 +02:00
Freddy Morán Jr
5ccf0baa6b Translated using Weblate (Spanish)
Currently translated at 100.0% (167 of 167 strings)
2017-05-04 18:46:36 +02:00
Christian Schabesberger
8fff0ccdf2 Merge pull request #532 from mauriciocolli/improve-readme
Update Readme
2017-05-04 00:10:44 +02:00
Mauricio Colli
35264bfb97 Update Readme 2017-05-03 16:13:31 -03:00
Matej U
4c9b0dc8e9 Translated using Weblate (Slovenian)
Currently translated at 100.0% (167 of 167 strings)
2017-05-02 21:02:58 +02:00
Freddy Morán Jr
4deb7caa83 Translated using Weblate (Spanish)
Currently translated at 100.0% (167 of 167 strings)
2017-05-02 17:22:14 +02:00
Enol P
45f1a512b4 Translated using Weblate (Asturian)
Currently translated at 98.2% (164 of 167 strings)
2017-05-01 18:44:12 +02:00
Mladen Pejaković
ab95fdc087 Translated using Weblate (Serbian)
Currently translated at 99.4% (166 of 167 strings)
2017-05-01 15:46:36 +02:00
Christian Schabesberger
df608b9ded Merge branch 'feature-resize' of https://github.com/mauriciocolli/NewPipe into resize 2017-05-01 15:15:30 +02:00
Tobias Groza
6a4c81d160 Translated using Weblate (German)
Currently translated at 98.2% (164 of 167 strings)
2017-05-01 12:45:14 +02:00
Mauricio Colli
040d658540 Implement resizable popup 2017-05-01 02:23:50 -03:00
naofum
cbc9913e9c Translated using Weblate (Japanese)
Currently translated at 100.0% (167 of 167 strings)
2017-04-30 05:47:23 +02:00
Wout Bertrums
f007cbd5ee Translated using Weblate (Dutch)
Currently translated at 100.0% (167 of 167 strings)
2017-04-29 18:46:39 +02:00
zmni
7351591df7 Translated using Weblate (Indonesian)
Currently translated at 100.0% (167 of 167 strings)
2017-04-29 16:52:22 +02:00
monolifed
5222d4cbba Translated using Weblate (Turkish)
Currently translated at 100.0% (167 of 167 strings)
2017-04-29 09:48:33 +02:00
Weblate
ef9966815e Merge remote-tracking branch 'origin/master' 2017-04-29 08:27:55 +02:00
anonymous
ad73440ce9 Translated using Weblate (Czech)
Currently translated at 93.9% (154 of 164 strings)
2017-04-29 08:27:51 +02:00
67 changed files with 1436 additions and 869 deletions

View File

@@ -19,11 +19,16 @@ Project status:
## Screenshots
[<img src="screenshots/screenshot_1.png" width=150>](screenshots/screenshot_1.png)
[<img src="screenshots/screenshot_2.png" width=150>](screenshots/screenshot_2.png)
[<img src="screenshots/screenshot_3.png" width=150>](screenshots/screenshot_3.png)
[<img src="screenshots/screenshot_4.png" width=150>](screenshots/screenshot_4.png)
[<img src="screenshots/screenshot_5.png" width=150>](screenshots/screenshot_5.png)
[<img src="screenshots/screenshot_1.png" width=160>](screenshots/screenshot_1.png)
[<img src="screenshots/screenshot_2.png" width=160>](screenshots/screenshot_2.png)
[<img src="screenshots/screenshot_3.png" width=160>](screenshots/screenshot_3.png)
[<img src="screenshots/screenshot_4.png" width=160>](screenshots/screenshot_4.png)
[<img src="screenshots/screenshot_5.png" width=160>](screenshots/screenshot_5.png)
[<img src="screenshots/screenshot_6.png" width=160>](screenshots/screenshot_6.png)
[<img src="screenshots/screenshot_7.png" width=160>](screenshots/screenshot_7.png)
[<img src="screenshots/screenshot_8.png" width=160>](screenshots/screenshot_8.png)
[<img src="screenshots/screenshot_9.png" width=160>](screenshots/screenshot_9.png)
## Description
@@ -35,6 +40,7 @@ NewPipe does not use any Google framework libraries, or the YouTube API. It only
* Display general information about a video
* Watch YouTube videos
* Listen to YouTube videos (experimental)
* Popup mode (floating player)
* Select the streaming player to watch the video with
* Download videos
* Download audio only

View File

@@ -8,8 +8,8 @@ android {
applicationId "org.schabi.newpipe"
minSdkVersion 15
targetSdkVersion 25
versionCode 31
versionName "0.9.4"
versionCode 34
versionName "0.9.7"
}
buildTypes {
release {

View File

@@ -1,28 +0,0 @@
package org.schabi.newpipe;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
public class ThemableActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (PreferenceManager.getDefaultSharedPreferences(this)
.getString("theme", getResources().getString(R.string.light_theme_title)).
equals(getResources().getString(R.string.dark_theme_title))) {
setTheme(R.style.DarkTheme);
}
}
@Override
protected void onResume() {
super.onResume();
if (PreferenceManager.getDefaultSharedPreferences(this)
.getString("theme", getResources().getString(R.string.light_theme_title)).
equals(getResources().getString(R.string.dark_theme_title))) {
setTheme(R.style.DarkTheme);
}
}
}

View File

@@ -1,165 +0,0 @@
package org.schabi.newpipe.download;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.schabi.newpipe.R;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
/**
* Created by Christian Schabesberger on 14.08.15.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* FileDownloader.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
// TODO: FOR HEAVEN SAKE !!! DO NOT SIMPLY USE ASYNCTASK. MAKE THIS A PROPER SERVICE !!!
public class FileDownloader extends AsyncTask<Void, Integer, Void> {
public static final String TAG = "FileDownloader";
private NotificationManager nm;
private NotificationCompat.Builder builder;
private int notifyId = 0x1234;
private int fileSize = 0xffffffff;
private final Context context;
private final String fileURL;
private final File saveFilePath;
private final String title;
private final String debugContext;
public FileDownloader(Context context, String fileURL, File saveFilePath, String title) {
this.context = context;
this.fileURL = fileURL;
this.saveFilePath = saveFilePath;
this.title = title;
this.debugContext = "'" + fileURL +
"' => '" + saveFilePath + "'";
}
/**
* Downloads a file from a URL in the background using an {@link AsyncTask}.
*
* @param fileURL HTTP URL of the file to be downloaded
* @param saveFilePath path of the directory to save the file
* @param title
* @throws IOException
*/
public static void downloadFile(final Context context, final String fileURL, final File saveFilePath, String title) {
new FileDownloader(context, fileURL, saveFilePath, title).execute();
}
/** AsyncTask impl: executed in gui thread */
@Override
protected void onPreExecute() {
super.onPreExecute();
nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Drawable icon = context.getResources().getDrawable(R.mipmap.ic_launcher);
builder = new NotificationCompat.Builder(context)
.setSmallIcon(android.R.drawable.stat_sys_download)
.setLargeIcon(((BitmapDrawable) icon).getBitmap())
.setContentTitle(saveFilePath.getName())
.setContentText(saveFilePath.getAbsolutePath())
.setProgress(fileSize, 0, false);
nm.notify(notifyId, builder.build());
}
/** AsyncTask impl: executed in background thread does the download */
@Override
protected Void doInBackground(Void... voids) {
HttpsURLConnection con = null;
InputStream inputStream = null;
FileOutputStream outputStream = null;
try {
con = NetCipher.getHttpsURLConnection(fileURL);
int responseCode = con.getResponseCode();
// always check HTTP response code first
if (responseCode == HttpURLConnection.HTTP_OK) {
fileSize = con.getContentLength();
inputStream = new BufferedInputStream(con.getInputStream());
outputStream = new FileOutputStream(saveFilePath);
int bufferSize = 8192;
int downloaded = 0;
int bytesRead = -1;
byte[] buffer = new byte[bufferSize];
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
downloaded += bytesRead;
if (downloaded % 50000 < bufferSize) {
publishProgress(downloaded);
}
}
publishProgress(bufferSize);
} else {
Log.i(TAG, "No file to download. Server replied HTTP code: " + responseCode);
}
} catch (IOException e) {
Log.e(TAG, "No file to download. Server replied HTTP code: ", e);
e.printStackTrace();
} finally {
try {
if (outputStream != null) {
outputStream.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
if (con != null) {
con.disconnect();
}
}
return null;
}
@Override
protected void onProgressUpdate(Integer... progress) {
builder.setProgress(fileSize, progress[0], false);
nm.notify(notifyId, builder.build());
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
nm.cancel(notifyId);
}
}

View File

@@ -1,7 +1,5 @@
package org.schabi.newpipe.fragments;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
@@ -28,6 +26,8 @@ import org.schabi.newpipe.R;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
public abstract class BaseFragment extends Fragment {
protected final String TAG = "BaseFragment@" + Integer.toHexString(hashCode());
protected static final boolean DEBUG = MainActivity.DEBUG;
@@ -130,70 +130,6 @@ public abstract class BaseFragment extends Fragment {
// Utils
//////////////////////////////////////////////////////////////////////////*/
public void animateView(final View view, final boolean enterOrExit, long duration) {
animateView(view, enterOrExit, duration, 0, null);
}
public void animateView(final View view, final boolean enterOrExit, long duration, final Runnable execOnEnd) {
animateView(view, enterOrExit, duration, 0, execOnEnd);
}
public void animateView(final View view, final boolean enterOrExit, long duration, long delay) {
animateView(view, enterOrExit, duration, delay, null);
}
/**
* Animate the view
*
* @param view view that will be animated
* @param enterOrExit true to enter, false to exit
* @param duration how long the animation will take, in milliseconds
* @param delay how long the animation will take to start, in milliseconds
* @param execOnEnd runnable that will be executed when the animation ends
*/
public void animateView(final View view, final boolean enterOrExit, long duration, long delay, final Runnable execOnEnd) {
if (DEBUG) Log.d(TAG, "animateView() called with: view = [" + view + "], enterOrExit = [" + enterOrExit + "], duration = [" + duration + "], execOnEnd = [" + execOnEnd + "]");
if (view == null) return;
if (view.getVisibility() == View.VISIBLE && enterOrExit) {
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);
view.setAlpha(1f);
if (execOnEnd != null) execOnEnd.run();
return;
} else if ((view.getVisibility() == View.GONE || view.getVisibility() == View.INVISIBLE) && !enterOrExit) {
view.animate().setListener(null).cancel();
view.setVisibility(View.GONE);
view.setAlpha(0f);
if (execOnEnd != null) execOnEnd.run();
return;
}
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);
if (enterOrExit) {
view.animate().alpha(1f).setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (execOnEnd != null) execOnEnd.run();
}
}).start();
} else {
view.animate().alpha(0f)
.setDuration(duration).setStartDelay(delay)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) execOnEnd.run();
}
})
.start();
}
}
protected void setErrorMessage(String message, boolean showRetryButton) {
if (errorTextView == null || activity == null) return;

View File

@@ -36,6 +36,8 @@ import java.io.Serializable;
import java.text.NumberFormat;
import java.util.ArrayList;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class ChannelFragment extends BaseFragment implements ChannelExtractorWorker.OnChannelInfoReceive {
private final String TAG = "ChannelFragment@" + Integer.toHexString(hashCode());

View File

@@ -9,11 +9,9 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.stream_info.VideoStream;
import org.schabi.newpipe.util.Utils;
@@ -40,6 +38,7 @@ import java.util.List;
*/
@SuppressWarnings("WeakerAccess")
class ActionBarHandler {
private static final String TAG = "ActionBarHandler";
@@ -70,16 +69,9 @@ class ActionBarHandler {
if (activity == null) return;
selectedVideoStream = 0;
// this array will be shown in the dropdown menu for selecting the stream/resolution.
String[] itemArray = new String[videoStreams.size()];
for (int i = 0; i < videoStreams.size(); i++) {
VideoStream item = videoStreams.get(i);
itemArray[i] = MediaFormat.getNameById(item.format) + " " + item.resolution;
}
int defaultResolutionIndex = Utils.getDefaultResolution(activity, videoStreams);
ArrayAdapter<String> itemAdapter = new ArrayAdapter<>(activity.getBaseContext(), android.R.layout.simple_spinner_dropdown_item, itemArray);
toolbarSpinner.setAdapter(itemAdapter);
boolean isExternalPlayerEnabled = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(activity.getString(R.string.use_external_video_player_key), false);
toolbarSpinner.setAdapter(new SpinnerToolbarAdapter(activity, videoStreams, isExternalPlayerEnabled));
toolbarSpinner.setSelection(defaultResolutionIndex);
toolbarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@@ -103,6 +95,10 @@ class ActionBarHandler {
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
inflater.inflate(R.menu.video_detail_menu, menu);
updateItemsVisibility();
}
public void updateItemsVisibility(){
showPlayWithKodiAction(defaultPreferences.getBoolean(activity.getString(R.string.show_play_with_kodi_key), false));
}

View File

@@ -0,0 +1,74 @@
package org.schabi.newpipe.fragments.detail;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.stream_info.VideoStream;
import java.util.List;
public class SpinnerToolbarAdapter extends BaseAdapter {
private final List<VideoStream> videoStreams;
private final boolean showIconNoAudio;
private final Context context;
public SpinnerToolbarAdapter(Context context, List<VideoStream> videoStreams, boolean showIconNoAudio) {
this.context = context;
this.videoStreams = videoStreams;
this.showIconNoAudio = showIconNoAudio;
}
@Override
public int getCount() {
return videoStreams.size();
}
@Override
public Object getItem(int position) {
return videoStreams.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent, true);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(((Spinner) parent).getSelectedItemPosition(), convertView, parent, false);
}
private View getCustomView(int position, View convertView, ViewGroup parent, boolean isDropdownItem) {
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.resolutions_spinner_item, parent, false);
}
ImageView woSoundIcon = (ImageView) convertView.findViewById(R.id.wo_sound_icon);
TextView text = (TextView) convertView.findViewById(android.R.id.text1);
VideoStream item = (VideoStream) getItem(position);
text.setText(MediaFormat.getNameById(item.format) + " " + item.resolution);
int visibility = !showIconNoAudio ? View.GONE
: item.isVideoOnly ? View.VISIBLE
: isDropdownItem ? View.INVISIBLE
: View.GONE;
woSoundIcon.setVisibility(visibility);
return convertView;
}
}

View File

@@ -19,6 +19,7 @@ import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -39,7 +40,6 @@ import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
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;
@@ -55,6 +55,8 @@ import org.schabi.newpipe.player.MainVideoPlayer;
import org.schabi.newpipe.player.PlayVideoActivity;
import org.schabi.newpipe.player.PopupVideoPlayer;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PermissionHelper;
import org.schabi.newpipe.util.Utils;
@@ -64,6 +66,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Stack;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class VideoDetailFragment extends BaseFragment implements StreamExtractorWorker.OnStreamInfoReceivedListener, SharedPreferences.OnSharedPreferenceChangeListener, View.OnClickListener {
private final String TAG = "VideoDetailFragment@" + Integer.toHexString(hashCode());
@@ -71,9 +75,6 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
private static final int INITIAL_RELATED_VIDEOS = 8;
private static final String KORE_PACKET = "org.xbmc.kore";
private static final String SERVICE_ID_KEY = "service_id_key";
private static final String VIDEO_URL_KEY = "video_url_key";
private static final String VIDEO_TITLE_KEY = "video_title_key";
private static final String STACK_KEY = "stack_key";
private static final String INFO_KEY = "info_key";
private static final String WAS_RELATED_EXPANDED_KEY = "was_related_expanded_key";
@@ -97,6 +98,7 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
private static final int RELATED_STREAMS_UPDATE_FLAG = 0x1;
private static final int RESOLUTIONS_MENU_UPDATE_FLAG = 0x2;
private static final int TOOLBAR_ITEMS_UPDATE_FLAG = 0x4;
private int updateFlags = 0;
private boolean autoPlayEnabled;
@@ -170,9 +172,9 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
if (DEBUG) Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]");
if (savedInstanceState != null) {
videoTitle = savedInstanceState.getString(VIDEO_TITLE_KEY);
videoUrl = savedInstanceState.getString(VIDEO_URL_KEY);
serviceId = savedInstanceState.getInt(SERVICE_ID_KEY, 0);
videoTitle = savedInstanceState.getString(Constants.KEY_TITLE);
videoUrl = savedInstanceState.getString(Constants.KEY_URL);
serviceId = savedInstanceState.getInt(Constants.KEY_SERVICE_ID, 0);
wasRelatedStreamsExpanded = savedInstanceState.getBoolean(WAS_RELATED_EXPANDED_KEY, false);
Serializable serializable = savedInstanceState.getSerializable(STACK_KEY);
if (serializable instanceof Stack) {
@@ -218,6 +220,8 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
if ((updateFlags & RELATED_STREAMS_UPDATE_FLAG) != 0) initRelatedVideos(currentStreamInfo);
if ((updateFlags & RESOLUTIONS_MENU_UPDATE_FLAG) != 0) setupActionBarHandler(currentStreamInfo);
}
if ((updateFlags & TOOLBAR_ITEMS_UPDATE_FLAG) != 0 && actionBarHandler != null) actionBarHandler.updateItemsVisibility();
updateFlags = 0;
}
@@ -289,9 +293,9 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
@Override
public void onSaveInstanceState(Bundle outState) {
if (DEBUG) Log.d(TAG, "onSaveInstanceState() called with: outState = [" + outState + "]");
outState.putString(VIDEO_URL_KEY, videoUrl);
outState.putString(VIDEO_TITLE_KEY, videoTitle);
outState.putInt(SERVICE_ID_KEY, serviceId);
outState.putString(Constants.KEY_URL, videoUrl);
outState.putString(Constants.KEY_TITLE, videoTitle);
outState.putInt(Constants.KEY_SERVICE_ID, serviceId);
outState.putSerializable(STACK_KEY, stack);
int nextCount = currentStreamInfo != null && currentStreamInfo.next_video != null ? 2 : 0;
@@ -326,8 +330,11 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
updateFlags |= RELATED_STREAMS_UPDATE_FLAG;
} else if (key.equals(getString(R.string.preferred_video_format_key))
|| key.equals(getString(R.string.default_resolution_key))
|| key.equals(getString(R.string.show_higher_resolutions_key))) {
|| key.equals(getString(R.string.show_higher_resolutions_key))
|| key.equals(getString(R.string.use_external_video_player_key))) {
updateFlags |= RESOLUTIONS_MENU_UPDATE_FLAG;
} else if (key.equals(getString(R.string.show_play_with_kodi_key))) {
updateFlags |= TOOLBAR_ITEMS_UPDATE_FLAG;
}
}
@@ -420,7 +427,10 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
if (isLoading.get()) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !PermissionHelper.checkSystemAlertWindowPermission(activity)) {
Toast.makeText(activity, R.string.msg_popup_permission, Toast.LENGTH_LONG).show();
Toast toast = Toast.makeText(activity, R.string.msg_popup_permission, Toast.LENGTH_LONG);
TextView messageView = (TextView) toast.getView().findViewById(android.R.id.message);
if (messageView != null) messageView.setGravity(Gravity.CENTER);
toast.show();
return;
}
@@ -673,33 +683,10 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
}
try {
Bundle args = new Bundle();
// Sometimes it may be that some information is not available due to changes fo the
// website which was crawled. Then the ui has to understand this and act right.
if (info.audio_streams != null) {
AudioStream audioStream =
info.audio_streams.get(Utils.getPreferredAudioFormat(activity, info.audio_streams));
String audioSuffix = "." + MediaFormat.getSuffixById(audioStream.format);
args.putString(DownloadDialog.AUDIO_URL, audioStream.url);
args.putString(DownloadDialog.FILE_SUFFIX_AUDIO, audioSuffix);
}
if (sortedStreamVideosList != null) {
VideoStream selectedStreamItem = sortedStreamVideosList.get(selectedStreamId);
String videoSuffix = "." + MediaFormat.getSuffixById(selectedStreamItem.format);
args.putString(DownloadDialog.FILE_SUFFIX_VIDEO, videoSuffix);
args.putString(DownloadDialog.VIDEO_URL, selectedStreamItem.url);
}
args.putString(DownloadDialog.TITLE, info.title);
DownloadDialog downloadDialog = DownloadDialog.newInstance(args);
DownloadDialog downloadDialog = DownloadDialog.newInstance(info, sortedStreamVideosList, selectedStreamId);
downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog");
} catch (Exception e) {
Toast.makeText(activity,
R.string.could_not_setup_download_menu, Toast.LENGTH_LONG).show();
Toast.makeText(activity, R.string.could_not_setup_download_menu, Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
@@ -800,7 +787,7 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
* If it is, check if the cache contains the info already.</br>
* If the cache doesn't have the info, load from the network.
*
* @param info info to prepare and load, can be null
* @param info info to prepare and load, can be null
* @param scrollToTop whether or not scroll the scrollView to y = 0
*/
public void prepareAndLoad(StreamInfo info, boolean scrollToTop) {
@@ -844,7 +831,7 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
else parallaxScrollRootView.scrollTo(0, 0);
}
animateView(contentRootLayoutHiding, false, greaterThanThreshold ? 250 : 0, new Runnable() {
animateView(contentRootLayoutHiding, false, greaterThanThreshold ? 250 : 0, 0, new Runnable() {
@Override
public void run() {
handleStreamInfo(infoFinal, false);
@@ -1052,7 +1039,7 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
private void setErrorImage(final int imageResource) {
if (thumbnailImageView == null || activity == null) return;
thumbnailImageView.setImageDrawable(ContextCompat.getDrawable(activity, imageResource));
animateView(thumbnailImageView, false, 0, new Runnable() {
animateView(thumbnailImageView, false, 0, 0, new Runnable() {
@Override
public void run() {
animateView(thumbnailImageView, true, 500);

View File

@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
@@ -37,6 +38,7 @@ import org.schabi.newpipe.extractor.search.SearchResult;
import org.schabi.newpipe.fragments.BaseFragment;
import org.schabi.newpipe.info_list.InfoItemBuilder;
import org.schabi.newpipe.info_list.InfoListAdapter;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.workers.SearchWorker;
import org.schabi.newpipe.workers.SuggestionWorker;
@@ -45,12 +47,13 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class SearchFragment extends BaseFragment implements SuggestionWorker.OnSuggestionResult, SearchWorker.OnSearchResult {
private final String TAG = "SearchFragment@" + Integer.toHexString(hashCode());
// savedInstanceBundle arguments
private static final String QUERY_KEY = "query_key";
private static final String PAGE_NUMBER_KEY = "page_number_key";
private static final String SERVICE_KEY = "service_key";
private static final String INFO_LIST_KEY = "info_list_key";
private static final String WAS_LOADING_KEY = "was_loading_key";
private static final String ERROR_KEY = "error_key";
@@ -66,6 +69,7 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
private int serviceId = -1;
private String searchQuery = "";
private int pageNumber = 0;
private boolean showSuggestions = true;
private SearchWorker curSearchWorker;
private SuggestionWorker curSuggestionWorker;
@@ -101,7 +105,7 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
setHasOptionsMenu(true);
if (savedInstanceState != null) {
searchQuery = savedInstanceState.getString(QUERY_KEY);
serviceId = savedInstanceState.getInt(SERVICE_KEY, 0);
serviceId = savedInstanceState.getInt(Constants.KEY_SERVICE_ID, 0);
pageNumber = savedInstanceState.getInt(PAGE_NUMBER_KEY, 0);
wasLoading.set(savedInstanceState.getBoolean(WAS_LOADING_KEY, false));
filterItemCheckedId = savedInstanceState.getInt(FILTER_CHECKED_ID_KEY, 0);
@@ -133,6 +137,8 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
if (pageNumber > 0) search(searchQuery, pageNumber);
else search(searchQuery, 0, true);
}
showSuggestions = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(getString(R.string.show_search_suggestions_key), true);
}
@Override
@@ -171,7 +177,7 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
String query = searchEditText != null && !TextUtils.isEmpty(searchEditText.getText().toString())
? searchEditText.getText().toString() : searchQuery;
outState.putString(QUERY_KEY, query);
outState.putInt(SERVICE_KEY, serviceId);
outState.putInt(Constants.KEY_SERVICE_ID, serviceId);
outState.putInt(PAGE_NUMBER_KEY, pageNumber);
outState.putSerializable(INFO_LIST_KEY, ((ArrayList<InfoItem>) infoListAdapter.getItemsList()));
outState.putBoolean(WAS_LOADING_KEY, curSearchWorker != null && curSearchWorker.isRunning());
@@ -521,6 +527,11 @@ public class SearchFragment extends BaseFragment implements SuggestionWorker.OnS
}
private void searchSuggestions(String query) {
if (!showSuggestions) {
if (DEBUG) Log.d(TAG, "searchSuggestions() showSuggestions is disabled");
return;
}
if (DEBUG) Log.d(TAG, "searchSuggestions() called with: query = [" + query + "]");
if (curSuggestionWorker != null && curSuggestionWorker.isRunning()) curSuggestionWorker.cancel();
curSuggestionWorker = SuggestionWorker.startForQuery(activity, serviceId, query, this);

View File

@@ -1,49 +0,0 @@
package org.schabi.newpipe.fragments.search;
import android.support.v7.widget.SearchView;
/**
* Created by Christian Schabesberger on 02.08.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* SearchSuggestionListener.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class SearchSuggestionListener implements SearchView.OnSuggestionListener{
private final SearchView searchView;
private final SuggestionListAdapter adapter;
public SearchSuggestionListener(SearchView searchView, SuggestionListAdapter adapter) {
this.searchView = searchView;
this.adapter = adapter;
}
@Override
public boolean onSuggestionSelect(int position) {
String suggestion = adapter.getSuggestion(position);
searchView.setQuery(suggestion,true);
return false;
}
@Override
public boolean onSuggestionClick(int position) {
String suggestion = adapter.getSuggestion(position);
searchView.setQuery(suggestion,true);
return false;
}
}

View File

@@ -189,6 +189,7 @@ public abstract class BasePlayer implements ExoPlayer.EventListener, AudioManage
ImageLoader.getInstance().loadImage(videoThumbnailUrl, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (simpleExoPlayer == null) return;
if (DEBUG) Log.d(TAG, "onLoadingComplete() called with: imageUri = [" + imageUri + "], view = [" + view + "], loadedImage = [" + loadedImage + "]");
videoThumbnail = loadedImage;
onThumbnailReceived(loadedImage);
@@ -319,7 +320,6 @@ public abstract class BasePlayer implements ExoPlayer.EventListener, AudioManage
if (DEBUG) Log.d(TAG, "onAudioFocusGain() called");
if (simpleExoPlayer != null) simpleExoPlayer.setVolume(DUCK_AUDIO_TO);
animateAudio(DUCK_AUDIO_TO, 1f, DUCK_DURATION);
simpleExoPlayer.setPlayWhenReady(true);
}
protected void onAudioFocusLoss() {

View File

@@ -21,10 +21,13 @@ import android.widget.TextView;
import android.widget.Toast;
import org.schabi.newpipe.R;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PermissionHelper;
import org.schabi.newpipe.util.ThemeHelper;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
/**
* Activity Player implementing VideoPlayer
*
@@ -37,14 +40,7 @@ public class MainVideoPlayer extends Activity {
private AudioManager audioManager;
private GestureDetector gestureDetector;
private final Runnable hideUiRunnable = new Runnable() {
@Override
public void run() {
hideSystemUi();
}
};
private boolean activityPaused;
private VideoPlayerImpl playerImpl;
/*//////////////////////////////////////////////////////////////////////////
@@ -188,6 +184,7 @@ public class MainVideoPlayer extends Activity {
repeatButton.setAlpha(77);
}
getRootView().setKeepScreenOn(true);
}
@Override
@@ -265,14 +262,15 @@ public class MainVideoPlayer extends Activity {
else if (v.getId() == screenRotationButton.getId()) onScreenRotationClicked();
if (getCurrentState() != STATE_COMPLETED) {
getControlsVisibilityHandler().removeCallbacksAndMessages(null);
animateView(playerImpl.getControlsRoot(), true, 300, 0, new Runnable() {
@Override
public void run() {
if (getCurrentState() == STATE_PLAYING && !playerImpl.isQualityMenuVisible()) {
animateView(playerImpl.getControlsRoot(), false, 300, DEFAULT_CONTROLS_HIDE_TIME, true);
hideControls(300, DEFAULT_CONTROLS_HIDE_TIME);
}
}
}, false);
});
}
}
@@ -285,14 +283,14 @@ public class MainVideoPlayer extends Activity {
public void onStopTrackingTouch(SeekBar seekBar) {
super.onStopTrackingTouch(seekBar);
if (playerImpl.wasPlaying()) {
animateView(playerImpl.getControlsRoot(), false, 100, 0);
hideControls(100, 0);
}
}
@Override
public void onDismiss(PopupMenu menu) {
super.onDismiss(menu);
if (isPlaying()) animateView(getControlsRoot(), false, 500, 0);
if (isPlaying()) hideControls(300, 0);
}
@Override
@@ -310,53 +308,51 @@ public class MainVideoPlayer extends Activity {
public void onLoading() {
super.onLoading();
playPauseButton.setImageResource(R.drawable.ic_pause_white);
animateView(playPauseButton, false, 100, 0);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
}
@Override
public void onBuffering() {
super.onBuffering();
animateView(playPauseButton, false, 100, 0);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
}
@Override
public void onPlaying() {
super.onPlaying();
//playPauseButton.setImageResource(R.drawable.ic_pause_white);
//animateView(playPauseButton, true, 500, 0);
animateView(playPauseButton, false, 80, 0, new Runnable() {
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, new Runnable() {
@Override
public void run() {
playPauseButton.setImageResource(R.drawable.ic_pause_white);
animateView(playPauseButton, true, 200, 0);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 200);
}
});
showSystemUi();
getRootView().setKeepScreenOn(true);
}
@Override
public void onPaused() {
super.onPaused();
//playPauseButton.setImageResource(R.drawable.ic_play_arrow_white);
//animateView(playPauseButton, true, 100, 0);
animateView(playPauseButton, false, 80, 0, new Runnable() {
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, new Runnable() {
@Override
public void run() {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white);
animateView(playPauseButton, true, 200, 0);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 200);
}
});
showSystemUi();
getRootView().setKeepScreenOn(false);
}
@Override
public void onPausedSeek() {
super.onPausedSeek();
animateView(playPauseButton, false, 100, 0);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 100);
getRootView().setKeepScreenOn(true);
}
@@ -366,14 +362,15 @@ public class MainVideoPlayer extends Activity {
playPauseButton.setImageResource(R.drawable.ic_pause_white);
} else {
showSystemUi();
animateView(playPauseButton, false, 0, 0, new Runnable() {
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 0, 0, new Runnable() {
@Override
public void run() {
playPauseButton.setImageResource(R.drawable.ic_replay_white);
animateView(playPauseButton, true, 300, 0);
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, true, 300);
}
});
}
getRootView().setKeepScreenOn(false);
super.onCompleted();
}
@@ -382,19 +379,20 @@ public class MainVideoPlayer extends Activity {
//////////////////////////////////////////////////////////////////////////*/
@Override
public void animateView(View view, boolean enterOrExit, long duration, long delay, final Runnable execOnEnd, boolean hideUi) {
//if (execOnEnd == null) playerImpl.setDefaultAnimationEnd(hideUiRunnable);
if (hideUi && execOnEnd != null) {
Runnable combinedRunnable = new Runnable() {
@Override
public void run() {
execOnEnd.run();
hideUiRunnable.run();
}
};
super.animateView(view, enterOrExit, duration, delay, combinedRunnable, true);
} else super.animateView(view, enterOrExit, duration, delay, hideUi ? hideUiRunnable : execOnEnd, hideUi);
public void hideControls(final long duration, long delay) {
if (DEBUG) Log.d(TAG, "hideControls() called with: delay = [" + delay + "]");
getControlsVisibilityHandler().removeCallbacksAndMessages(null);
getControlsVisibilityHandler().postDelayed(new Runnable() {
@Override
public void run() {
animateView(getControlsRoot(), false, duration, 0, new Runnable() {
@Override
public void run() {
hideSystemUi();
}
});
}
}, delay);
}
///////////////////////////////////////////////////////////////////////////
@@ -443,19 +441,16 @@ public class MainVideoPlayer extends Activity {
if (DEBUG) Log.d(TAG, "onSingleTapConfirmed() called with: e = [" + e + "]");
if (playerImpl.getCurrentState() != BasePlayer.STATE_PLAYING) return true;
if (playerImpl.isControlsVisible()) playerImpl.animateView(playerImpl.getControlsRoot(), false, 150, 0, true);
if (playerImpl.isControlsVisible()) playerImpl.hideControls(150, 0);
else {
playerImpl.animateView(playerImpl.getControlsRoot(), true, 500, 0, new Runnable() {
@Override
public void run() {
playerImpl.animateView(playerImpl.getControlsRoot(), false, 300, VideoPlayer.DEFAULT_CONTROLS_HIDE_TIME, true);
}
});
playerImpl.showControlsThenHide();
showSystemUi();
}
return true;
}
private final boolean isGestureControlsEnabled = playerImpl.getSharedPreferences().getBoolean(getString(R.string.player_gesture_controls_key), true);
private final float stepsBrightness = 15, stepBrightness = (1f / stepsBrightness), minBrightness = .01f;
private float currentBrightness = .5f;
@@ -473,6 +468,8 @@ public class MainVideoPlayer extends Activity {
// TODO: Improve video gesture controls
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (!isGestureControlsEnabled) return false;
//noinspection PointlessBooleanExpression
if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " +
", e1.getRaw = [" + e1.getRawX() + ", " + e1.getRawY() + "]" +
@@ -500,7 +497,7 @@ public class MainVideoPlayer extends Activity {
if (DEBUG) Log.d(TAG, "onScroll().volumeControl, currentVolume = " + currentVolume);
playerImpl.getVolumeTextView().setText(volumeUnicode + " " + Math.round((((float) currentVolume) / maxVolume) * 100) + "%");
if (playerImpl.getVolumeTextView().getVisibility() != View.VISIBLE) playerImpl.animateView(playerImpl.getVolumeTextView(), true, 200, 0);
if (playerImpl.getVolumeTextView().getVisibility() != View.VISIBLE) animateView(playerImpl.getVolumeTextView(), true, 200);
if (playerImpl.getBrightnessTextView().getVisibility() == View.VISIBLE) playerImpl.getBrightnessTextView().setVisibility(View.GONE);
} else {
WindowManager.LayoutParams lp = getWindow().getAttributes();
@@ -515,7 +512,7 @@ public class MainVideoPlayer extends Activity {
playerImpl.getBrightnessTextView().setText(brightnessUnicode + " " + (brightnessNormalized == 1 ? 0 : brightnessNormalized) + "%");
if (playerImpl.getBrightnessTextView().getVisibility() != View.VISIBLE) playerImpl.animateView(playerImpl.getBrightnessTextView(), true, 200, 0);
if (playerImpl.getBrightnessTextView().getVisibility() != View.VISIBLE) animateView(playerImpl.getBrightnessTextView(), true, 200);
if (playerImpl.getVolumeTextView().getVisibility() == View.VISIBLE) playerImpl.getVolumeTextView().setVisibility(View.GONE);
}
return true;
@@ -527,11 +524,11 @@ public class MainVideoPlayer extends Activity {
eventsNum = 0;
/* if (playerImpl.getVolumeTextView().getVisibility() == View.VISIBLE) playerImpl.getVolumeTextView().setVisibility(View.GONE);
if (playerImpl.getBrightnessTextView().getVisibility() == View.VISIBLE) playerImpl.getBrightnessTextView().setVisibility(View.GONE);*/
if (playerImpl.getVolumeTextView().getVisibility() == View.VISIBLE) playerImpl.animateView(playerImpl.getVolumeTextView(), false, 200, 200);
if (playerImpl.getBrightnessTextView().getVisibility() == View.VISIBLE) playerImpl.animateView(playerImpl.getBrightnessTextView(), false, 200, 200);
if (playerImpl.getVolumeTextView().getVisibility() == View.VISIBLE) animateView(playerImpl.getVolumeTextView(), false, 200, 200);
if (playerImpl.getBrightnessTextView().getVisibility() == View.VISIBLE) animateView(playerImpl.getBrightnessTextView(), false, 200, 200);
if (playerImpl.isControlsVisible() && playerImpl.getCurrentState() == BasePlayer.STATE_PLAYING) {
playerImpl.animateView(playerImpl.getControlsRoot(), false, 300, VideoPlayer.DEFAULT_CONTROLS_HIDE_TIME, true);
playerImpl.hideControls(300, VideoPlayer.DEFAULT_CONTROLS_HIDE_TIME);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -53,15 +53,17 @@ public class SettingsActivity extends AppCompatActivity {
actionBar.setDisplayShowTitleEnabled(true);
}
getFragmentManager().beginTransaction()
.replace(R.id.fragment_holder, new SettingsFragment())
.commit();
if (savedInstanceBundle == null) {
getFragmentManager().beginTransaction()
.replace(R.id.fragment_holder, new SettingsFragment())
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if(id == android.R.id.home) {
if (id == android.R.id.home) {
finish();
}
return true;

View File

@@ -0,0 +1,126 @@
package org.schabi.newpipe.util;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.util.Log;
import android.view.View;
import org.schabi.newpipe.player.BasePlayer;
public class AnimationUtils {
private static final String TAG = "AnimationUtils";
private static final boolean DEBUG = BasePlayer.DEBUG;
public enum Type {
ALPHA, SCALE_AND_ALPHA
}
public static void animateView(View view, boolean enterOrExit, long duration) {
animateView(view, Type.ALPHA, enterOrExit, duration, 0, null);
}
public static void animateView(View view, boolean enterOrExit, long duration, long delay) {
animateView(view, Type.ALPHA, enterOrExit, duration, delay, null);
}
public static void animateView(View view, boolean enterOrExit, long duration, long delay, Runnable execOnEnd) {
animateView(view, Type.ALPHA, enterOrExit, duration, delay, execOnEnd);
}
public static void animateView(View view, Type animationType, boolean enterOrExit, long duration) {
animateView(view, animationType, enterOrExit, duration, 0, null);
}
public static void animateView(View view, Type animationType, boolean enterOrExit, long duration, long delay) {
animateView(view, animationType, enterOrExit, duration, delay, null);
}
/**
* Animate the view
*
* @param view view that will be animated
* @param animationType {@link Type} of the animation
* @param enterOrExit true to enter, false to exit
* @param duration how long the animation will take, in milliseconds
* @param delay how long the animation will wait to start, in milliseconds
* @param execOnEnd runnable that will be executed when the animation ends
*/
public static void animateView(final View view, Type animationType, boolean enterOrExit, long duration, long delay, Runnable execOnEnd) {
if (DEBUG) {
Log.d(TAG, "animateView() called with: view = [" + view + "], animationType = [" + animationType + "], enterOrExit = [" + enterOrExit + "], duration = [" + duration + "], delay = [" + delay + "], execOnEnd = [" + execOnEnd + "]");
}
if (view.getVisibility() == View.VISIBLE && enterOrExit) {
if (DEBUG) Log.d(TAG, "animateView() view was already visible > view = [" + view + "]");
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);
view.setAlpha(1f);
if (execOnEnd != null) execOnEnd.run();
return;
} else if ((view.getVisibility() == View.GONE || view.getVisibility() == View.INVISIBLE) && !enterOrExit) {
if (DEBUG) Log.d(TAG, "animateView() view was already gone > view = [" + view + "]");
view.animate().setListener(null).cancel();
view.setVisibility(View.GONE);
view.setAlpha(0f);
if (execOnEnd != null) execOnEnd.run();
return;
}
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);
switch (animationType) {
case ALPHA:
animateAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
case SCALE_AND_ALPHA:
animateScaleAndAlpha(view, enterOrExit, duration, delay, execOnEnd);
break;
}
}
private static void animateScaleAndAlpha(final View view, boolean enterOrExit, long duration, long delay, final Runnable execOnEnd) {
if (enterOrExit) {
view.setAlpha(0f);
view.setScaleX(.8f);
view.setScaleY(.8f);
view.animate().alpha(1f).scaleX(1f).scaleY(1f).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (execOnEnd != null) execOnEnd.run();
}
}).start();
} else {
view.setAlpha(1f);
view.setScaleX(1f);
view.setScaleY(1f);
view.animate().alpha(0f).scaleX(.8f).scaleY(.8f).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) execOnEnd.run();
}
}).start();
}
}
private static void animateAlpha(final View view, boolean enterOrExit, long duration, long delay, final Runnable execOnEnd) {
if (enterOrExit) {
view.animate().alpha(1f).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (execOnEnd != null) execOnEnd.run();
}
}).start();
} else {
view.animate().alpha(0f).setDuration(duration).setStartDelay(delay).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
if (execOnEnd != null) execOnEnd.run();
}
}).start();
}
}
}

View File

@@ -1,10 +1,12 @@
package org.schabi.newpipe;
package org.schabi.newpipe.util;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import org.schabi.newpipe.R;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.ParseException;

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

View File

@@ -5,8 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:gravity="center"
android:keepScreenOn="true">
android:gravity="center">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/aspectRatioLayout"

View File

@@ -32,12 +32,11 @@
<RadioGroup
android:id="@+id/video_audio_group"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/file_name"
android:layout_marginBottom="12dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="6dp"
android:gravity="left"
android:orientation="horizontal"
tools:ignore="RtlHardcoded">
@@ -56,11 +55,22 @@
android:text="@string/audio"/>
</RadioGroup>
<Spinner
android:id="@+id/quality_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="150dp"
android:layout_below="@+id/video_audio_group"
android:layout_marginBottom="12dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
tools:listitem="@layout/resolutions_spinner_item"/>
<TextView
android:id="@+id/threads_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/video_audio_group"
android:layout_below="@+id/quality_spinner"
android:layout_marginBottom="6dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"

View File

@@ -5,7 +5,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:gravity="center">
android:gravity="center"
tools:layout_width="@dimen/popup_default_width"
tools:layout_height="101.25dp">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
@@ -189,4 +191,21 @@
android:layout_height="wrap_content"
android:indeterminate="true"/>
</RelativeLayout>
<TextView
android:id="@+id/resizing_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|top"
android:background="#6e000000"
android:gravity="center"
android:padding="5dp"
android:text="@string/popup_resizing_indicator_title"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="RtlHardcoded"
tools:visibility="visible"/>
</FrameLayout>

Some files were not shown because too many files have changed in this diff Show More