1
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-09-22 10:00:55 +02:00

Compare commits

...

124 Commits

Author SHA1 Message Date
Christian Schabesberger
ff21430b43 move on to v0.13.3
also:
- reduce snack bar error visibility time
- fix metadata error
2018-05-04 16:21:36 +02:00
Weblate
fcb67f5119 Merge remote-tracking branch 'origin/dev' into dev 2018-05-04 09:40:15 +02:00
AB
0a41fbd185 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (364 of 364 strings)
2018-05-04 09:40:14 +02:00
Oleh Ilnytskyi
d32aaf488f Translated using Weblate (Russian)
Currently translated at 89.8% (327 of 364 strings)
2018-05-04 09:40:13 +02:00
Tobias Groza
1254798013 Translated using Weblate (German)
Currently translated at 92.5% (337 of 364 strings)
2018-05-04 09:40:12 +02:00
Heimen Stoffels
c72d2a2308 Translated using Weblate (Dutch)
Currently translated at 100.0% (364 of 364 strings)
2018-05-04 09:40:11 +02:00
Marc Riera
703181655b Translated using Weblate (Catalan)
Currently translated at 100.0% (364 of 364 strings)
2018-05-04 09:40:10 +02:00
Allan Nordhøy
da4a1c5bf0 Translated using Weblate (Norwegian Bokmål)
Currently translated at 94.5% (344 of 364 strings)
2018-05-04 09:40:06 +02:00
Christian Schabesberger
1130bd502e Merge pull request #1342 from Somethingweirdhere/popupplayerdont
PopUpPlayer now also has a Play and Pause button
2018-05-03 17:25:11 +02:00
AB
27ea4ee679 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 14:36:57 +02:00
Heimen Stoffels
56e3b66d06 Translated using Weblate (Dutch)
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 11:36:33 +02:00
Nathan Follens
7d4768e151 Translated using Weblate (Dutch)
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 11:36:28 +02:00
Marc Riera
7ec1011610 Translated using Weblate (Catalan)
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 11:18:20 +02:00
Nathan Follens
e1bbd2055c Translated using Weblate (Flemish)
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 08:58:01 +02:00
Nathan Follens
8a19547d9f Translated using Weblate (Dutch)
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 08:47:28 +02:00
Jeff Huang
6e6922dab8 Translated using Weblate (Chinese (Traditional))
Currently translated at 100.0% (364 of 364 strings)
2018-05-03 02:27:38 +02:00
Weblate
e009ade922 Merge remote-tracking branch 'origin/dev' into dev 2018-05-02 23:38:15 +02:00
Freddy Morán Jr
90e15bcab9 Translated using Weblate (Spanish)
Currently translated at 99.7% (362 of 363 strings)
2018-05-02 23:38:15 +02:00
Allan Nordhøy
2a040cea4b Translated using Weblate (Norwegian Bokmål)
Currently translated at 94.4% (343 of 363 strings)
2018-05-02 23:38:14 +02:00
Yoav
72f2a7f8db Translated using Weblate (Hebrew)
Currently translated at 86.7% (315 of 363 strings)
2018-05-02 23:38:11 +02:00
Somethingweirdhere
8a8022afe6 Now the play/pause button also has the correct scale! 2018-05-02 22:08:14 +02:00
Christian Schabesberger
b692bec310 Merge pull request #1350 from comradekingu/patch-6
Spelling: Rework new strings
2018-05-02 21:03:20 +02:00
Andrea Troiano
536c01c70d Translated using Weblate (Italian)
Currently translated at 100.0% (363 of 363 strings)
2018-05-02 10:15:53 +02:00
Allan Nordhøy
ec8e14e977 reverted the other "History & Cache" 2018-05-02 09:18:04 +02:00
Allan Nordhøy
85b34f8809 New desc, "& Cache" reverted 2018-05-02 09:16:53 +02:00
Lukas Wiedemann
22951a56a5 Translated using Weblate (German)
Currently translated at 100.0% (363 of 363 strings)
2018-05-01 23:37:09 +02:00
r2308145
46ad84b101 Translated using Weblate (Czech)
Currently translated at 100.0% (363 of 363 strings)
2018-05-01 22:58:31 +02:00
Marc Riera
5efb77e520 Translated using Weblate (Catalan)
Currently translated at 100.0% (363 of 363 strings)
2018-05-01 18:34:55 +02:00
Lukas Wiedemann
76903102b8 Translated using Weblate (German)
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 23:26:35 +02:00
Nathan Follens
c8e26b429c Translated using Weblate (Flemish)
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 21:49:04 +02:00
Marc Riera
55c1310f74 Translated using Weblate (Catalan)
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 17:32:00 +02:00
Heimen Stoffels
b8278d91e0 Translated using Weblate (Dutch)
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 16:58:57 +02:00
Marian Hanzel
b032502148 Translated using Weblate (Slovak)
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 16:42:39 +02:00
Jeff Huang
bec1a4dd1a Translated using Weblate (Chinese (Traditional))
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 16:22:48 +02:00
AB
4dfb9e7977 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (363 of 363 strings)
2018-04-30 15:06:19 +02:00
Weblate
2bfa165cdc Merge remote-tracking branch 'origin/dev' into dev 2018-04-30 14:42:49 +02:00
AB
658666276d Translated using Weblate (Ukrainian)
Currently translated at 100.0% (354 of 354 strings)
2018-04-30 14:42:44 +02:00
Christian Schabesberger
62f91b9084 Merge pull request #1356 from DafabHoid/doubletap-playpause
Double-tap the middle of the player screen to pause the video
2018-04-29 17:16:09 +02:00
Christian Schabesberger
719140ab78 resolve conflict 2018-04-29 17:13:45 +02:00
Christian Schabesberger
0471fd8145 add clear orphans 2018-04-29 17:06:54 +02:00
Christian Schabesberger
a079a0c901 fix requested changes part 1 2018-04-29 13:15:52 +02:00
Christian Schabesberger
ac2fa74c8f merge chagnes with dev 2018-04-29 13:01:37 +02:00
Christian Schabesberger
4c10ef65f5 add delete while history
add delete whole history
2018-04-29 12:51:57 +02:00
Christian Schabesberger
cfa697fab2 make history ui more consistent 2018-04-29 12:51:57 +02:00
Christian Schabesberger
a09b9d3e4d made items actually deltable 2018-04-29 12:51:57 +02:00
Christian Schabesberger
c470909f19 add delete options for StatisticPlaylistFragment 2018-04-29 12:51:57 +02:00
Christian Schabesberger
5e59cfcf9d remove HistoryInfoItem again
blub
2018-04-29 12:51:57 +02:00
Christian Schabesberger
a099fe35d2 reorder playqueue/localPlaylist classes 2018-04-29 12:51:57 +02:00
Christian Schabesberger
bcfd8a2450 rename playlist to player.playqueue 2018-04-29 12:49:52 +02:00
Christian Schabesberger
8ed9d71e14 put local foo into local foo folder 2018-04-29 12:47:12 +02:00
Christian Schabesberger
004c2fa55a Project restructure for history part 1
- add HistoryInfoItem (deriving from StreamInfoItem)
  in order to add a special options menu for the list items
- delete HistoryActivity and everything that belongs to its UI (not the
  manager tho)
- put everything that is local into local. (subscriptions still missing)
2018-04-29 12:47:12 +02:00
DafabHoid
3dd63d03cb Double-tap the middle of the player screen to pause the video 2018-04-29 11:23:21 +02:00
AB
cceedab864 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (354 of 354 strings)
2018-04-29 10:34:40 +02:00
Andrei.Rosca
b494b2ea39 Remove GSON lib 2018-04-29 01:06:34 +02:00
Rubix
0b29cf086b Translated using Weblate (Romanian)
Currently translated at 86.7% (307 of 354 strings)
2018-04-27 21:40:56 +02:00
r2308145
11d33097f7 Translated using Weblate (Czech)
Currently translated at 100.0% (354 of 354 strings)
2018-04-27 11:35:54 +02:00
ButterflyOfFire
3ae61645de Translated using Weblate (Arabic)
Currently translated at 87.8% (311 of 354 strings)
2018-04-26 15:34:21 +02:00
Weblate
4711befffa Merge remote-tracking branch 'origin/dev' into dev 2018-04-25 02:40:49 +02:00
Robson Cassiano
5673d53a20 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (354 of 354 strings)
2018-04-25 02:40:47 +02:00
Christian Schabesberger
90ca4a5e92 Merge pull request #1346 from naXa777/dev
Fix #1345 Gradle build fails
2018-04-24 22:03:36 +02:00
Allan Nordhøy
ad252956ab Translated using Weblate (Norwegian Bokmål)
Currently translated at 94.3% (334 of 354 strings)
2018-04-24 21:39:29 +02:00
Marian Hanzel
1b2c091c39 Translated using Weblate (Slovak)
Currently translated at 100.0% (354 of 354 strings)
2018-04-24 09:40:59 +02:00
anonymous
9031bc0c7b Translated using Weblate (Portuguese (Brazil))
Currently translated at 99.7% (353 of 354 strings)
2018-04-24 02:28:17 +02:00
anonymous
1d85e0ea63 Translated using Weblate (Portuguese (Brazil))
Currently translated at 99.7% (353 of 354 strings)
2018-04-24 02:27:25 +02:00
Robson Cassiano
458774aadb Translated using Weblate (Portuguese (Brazil))
Currently translated at 99.7% (353 of 354 strings)
2018-04-24 02:27:20 +02:00
ButterflyOfFire
ae89f7bea3 Translated using Weblate (Arabic)
Currently translated at 83.8% (297 of 354 strings)
2018-04-23 23:34:19 +02:00
Allan Nordhøy
fd77b8552b Rework new strings 2018-04-23 22:07:27 +02:00
Marian Hanzel
bae9f5e844 Translated using Weblate (Slovak)
Currently translated at 100.0% (354 of 354 strings)
2018-04-23 08:05:45 +02:00
Paul
e3f3d90b68 Translated using Weblate (Russian)
Currently translated at 99.1% (351 of 354 strings)
2018-04-22 19:41:32 +02:00
naXa!
7f3bd8aec2 Fix #1345 Gradle build fails with "error: unescaped apostrophe in string" 2018-04-22 14:31:59 +03:00
CaptainCrumble
4501203a7a Translated using Weblate (Portuguese)
Currently translated at 93.2% (330 of 354 strings)
2018-04-22 01:40:38 +02:00
Somethingweirdhere
06292bceb2 PopUpPlayer now has a play and pause button. Tapping now doesnt pause or unpause the video and instead shows this button. 2018-04-22 00:16:07 +02:00
Somethingweirdhere
f94f14ab65 Added settings export 2018-04-21 21:11:52 +02:00
AB
7145c68e03 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (354 of 354 strings)
2018-04-21 19:11:00 +02:00
wellinkstein
bac3825c87 Translated using Weblate (French)
Currently translated at 100.0% (354 of 354 strings)
2018-04-21 15:37:08 +02:00
Dante
fc1d283414 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (354 of 354 strings)
2018-04-21 09:35:29 +02:00
anonymous
c0652daa97 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (354 of 354 strings)
2018-04-21 09:35:24 +02:00
Q. A
553903bd9d Translated using Weblate (Albanian)
Currently translated at 12.7% (45 of 354 strings)
2018-04-21 09:34:14 +02:00
Freddy Morán Jr
a43ec25b7e Translated using Weblate (Spanish)
Currently translated at 99.7% (353 of 354 strings)
2018-04-20 16:42:38 +02:00
wellinkstein
bb2a66fd02 Translated using Weblate (French)
Currently translated at 100.0% (354 of 354 strings)
2018-04-20 14:41:22 +02:00
Ale-Ma
71ac830bfa Translated using Weblate (Italian)
Currently translated at 100.0% (354 of 354 strings)
2018-04-20 12:15:48 +02:00
r2308145
82bce80c62 Translated using Weblate (Czech)
Currently translated at 100.0% (354 of 354 strings)
2018-04-20 11:48:04 +02:00
Dante
67ddf78e18 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (354 of 354 strings)
2018-04-20 09:25:12 +02:00
Marc Riera
8285df0f3f Translated using Weblate (Catalan)
Currently translated at 99.1% (351 of 354 strings)
2018-04-19 22:35:00 +02:00
Somethingweirdhere
bdb45295b9 Merge pull request #2 from TeamNewPipe/dev
d
2018-04-19 15:30:12 +02:00
Emin Tufan Çetin
f330ee8f8d Translated using Weblate (Turkish)
Currently translated at 100.0% (354 of 354 strings)
2018-04-19 10:51:45 +02:00
Joseph Kim
7331e4a7f2 Translated using Weblate (Korean)
Currently translated at 100.0% (354 of 354 strings)
2018-04-19 04:40:40 +02:00
Jeff Huang
51252d3b61 Translated using Weblate (Chinese (Traditional))
Currently translated at 100.0% (354 of 354 strings)
2018-04-19 01:33:35 +02:00
Q. A
c4ac901c67 Added translation using Weblate (Albanian) 2018-04-18 23:38:25 +02:00
Tobias Groza
a7ce072ca2 Translated using Weblate (German)
Currently translated at 100.0% (354 of 354 strings)
2018-04-18 23:34:48 +02:00
Nathan Follens
a9b427b877 Translated using Weblate (Flemish)
Currently translated at 100.0% (354 of 354 strings)
2018-04-18 22:37:17 +02:00
Nathan Follens
67a9f3a4ad Added translation using Weblate (Flemish) 2018-04-18 22:12:00 +02:00
Nathan Follens
1a4905f36a Translated using Weblate (Dutch)
Currently translated at 100.0% (354 of 354 strings)
2018-04-18 21:57:15 +02:00
Weblate
cbb1fde7b0 Merge remote-tracking branch 'origin/dev' into dev 2018-04-18 21:41:20 +02:00
DafabHoid
b86bd019a7 Translated using Weblate (German)
Currently translated at 100.0% (353 of 353 strings)
2018-04-18 21:41:20 +02:00
anonymous
6a0bada9d2 Translated using Weblate (Polish)
Currently translated at 100.0% (353 of 353 strings)
2018-04-18 21:41:18 +02:00
Christian Schabesberger
a708278cf0 Merge pull request #1327 from Somethingweirdhere/dev
Fixed crash when trying to open a downloaded file without a player
2018-04-18 20:35:44 +02:00
Mauricio Colli
119462cbc9 Fix RouterActivity choice selection
- Improve behavior when external player is enabled
- Fixes #1324
2018-04-18 11:44:46 -03:00
Tobias Groza
0324a4928c Translated using Weblate (German)
Currently translated at 100.0% (353 of 353 strings)
2018-04-18 12:00:09 +02:00
syed muzammil
895a2a56b5 Translated using Weblate (Urdu)
Currently translated at 2.5% (9 of 353 strings)
2018-04-18 01:41:26 +02:00
horyzont
aa5d5d2b6d Translated using Weblate (Polish)
Currently translated at 100.0% (353 of 353 strings)
2018-04-17 21:20:47 +02:00
Somethingweirdhere
85dc555358 Fixed crash when trying to open a downloaded file without a player 2018-04-17 19:47:17 +02:00
Somethingweirdhere
15b4a7d055 Fixed crash when trying to open a downloaded file without a player 2018-04-17 19:19:12 +02:00
Andrea Troiano
696c94050d Translated using Weblate (Italian)
Currently translated at 100.0% (353 of 353 strings)
2018-04-17 09:38:03 +02:00
DafabHoid
b222614c4a Translated using Weblate (German)
Currently translated at 100.0% (353 of 353 strings)
2018-04-16 22:58:47 +02:00
Emin Tufan Çetin
edff694bf3 Translated using Weblate (Turkish)
Currently translated at 100.0% (353 of 353 strings)
2018-04-16 22:42:33 +02:00
Jeff Huang
be430a6ac0 Translated using Weblate (Chinese (Traditional))
Currently translated at 100.0% (353 of 353 strings)
2018-04-16 13:03:02 +02:00
AB
937d40c5f7 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (353 of 353 strings)
2018-04-16 11:42:15 +02:00
Rubix
d3979676ab Translated using Weblate (Romanian)
Currently translated at 84.1% (297 of 353 strings)
2018-04-16 10:40:03 +02:00
Emin Tufan Çetin
6716262a28 Translated using Weblate (Turkish)
Currently translated at 100.0% (353 of 353 strings)
2018-04-15 22:11:00 +02:00
r2308145
06d8bafce6 Translated using Weblate (Czech)
Currently translated at 100.0% (353 of 353 strings)
2018-04-15 19:35:47 +02:00
Anton Shestakov
f814755908 Translated using Weblate (Russian)
Currently translated at 98.8% (349 of 353 strings)
2018-04-15 16:39:47 +02:00
AB
f355fd2551 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (353 of 353 strings)
2018-04-15 10:40:28 +02:00
Andrea Troiano
ea84c62d76 Translated using Weblate (Italian)
Currently translated at 100.0% (353 of 353 strings)
2018-04-14 21:24:40 +02:00
r2308145
acda71cebb Translated using Weblate (Czech)
Currently translated at 100.0% (353 of 353 strings)
2018-04-14 19:05:22 +02:00
Heimen Stoffels
67dcd2e5c6 Translated using Weblate (Dutch)
Currently translated at 100.0% (353 of 353 strings)
2018-04-14 17:42:09 +02:00
Marc Riera
c996644613 Translated using Weblate (Catalan)
Currently translated at 100.0% (353 of 353 strings)
2018-04-14 16:00:44 +02:00
M1ck
171c3e492d Translated using Weblate (French)
Currently translated at 100.0% (353 of 353 strings)
2018-04-14 12:53:15 +02:00
Weblate
8834195cc6 Merge remote-tracking branch 'origin/dev' into dev 2018-04-14 11:39:08 +02:00
M1ck
ed57e72fa1 Translated using Weblate (French)
Currently translated at 96.9% (344 of 355 strings)
2018-04-14 11:39:07 +02:00
Dar Mackani
7e84c3e167 Translated using Weblate (Esperanto)
Currently translated at 18.3% (65 of 355 strings)
2018-04-14 11:39:07 +02:00
gensitu
4adc33471b Translated using Weblate (Chinese (Traditional))
Currently translated at 100.0% (355 of 355 strings)
2018-04-14 11:39:06 +02:00
gensitu
31d07cc1e2 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (355 of 355 strings)
2018-04-14 11:39:05 +02:00
Andrea Troiano
a349a66d5a Translated using Weblate (Italian)
Currently translated at 100.0% (355 of 355 strings)
2018-04-14 11:38:59 +02:00
128 changed files with 2163 additions and 1725 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "org.schabi.newpipe"
minSdkVersion 15
targetSdkVersion 27
versionCode 61
versionName "0.13.2"
versionCode 62
versionName "0.13.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
@@ -41,7 +41,7 @@ android {
}
ext {
supportLibVersion = '27.1.0'
supportLibVersion = '27.1.1'
exoPlayerLibVersion = '2.7.3'
roomDbLibVersion = '1.0.0'
leakCanaryLibVersion = '1.5.4'
@@ -54,8 +54,7 @@ dependencies {
exclude module: 'support-annotations'
}
implementation 'com.github.TeamNewPipe:NewPipeExtractor:77a74b8'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:bf1c771'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
@@ -66,7 +65,6 @@ dependencies {
implementation "com.android.support:recyclerview-v7:$supportLibVersion"
implementation "com.android.support:preference-v14:$supportLibVersion"
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'ch.acra:acra:4.9.2'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'

View File

@@ -80,8 +80,8 @@
android:name=".history.HistoryActivity"
android:label="@string/title_activity_history"/>
<service android:name=".subscription.services.SubscriptionsImportService"/>
<service android:name=".subscription.services.SubscriptionsExportService"/>
<service android:name=".local.subscription.services.SubscriptionsImportService"/>
<service android:name=".local.subscription.services.SubscriptionsExportService"/>
<activity
android:name=".PanicResponderActivity"

View File

@@ -151,7 +151,8 @@ public class MainActivity extends AppCompatActivity {
settings.setOnClickListener(view -> NavigationHelper.openSettings(this));
downloads.setOnClickListener(view ->NavigationHelper.openDownloads(this));
history.setOnClickListener(view -> NavigationHelper.openHistory(this));
history.setOnClickListener(view ->
NavigationHelper.openStatisticFragment(getSupportFragmentManager()));
}
private void setupDrawerHeader() {
@@ -327,16 +328,16 @@ public class MainActivity extends AppCompatActivity {
case android.R.id.home:
onHomeButtonPressed();
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
return true;
case R.id.action_show_downloads:
return NavigationHelper.openDownloads(this);
case R.id.action_history:
NavigationHelper.openStatisticFragment(getSupportFragmentManager());
return true;
case R.id.action_about:
NavigationHelper.openAbout(this);
return true;
case R.id.action_history:
NavigationHelper.openHistory(this);
case R.id.action_settings:
NavigationHelper.openSettings(this);
return true;
default:
return super.onOptionsItemSelected(item);

View File

@@ -32,10 +32,10 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.player.helper.PlayerHelper;
import org.schabi.newpipe.playlist.ChannelPlayQueue;
import org.schabi.newpipe.playlist.PlayQueue;
import org.schabi.newpipe.playlist.PlaylistPlayQueue;
import org.schabi.newpipe.playlist.SinglePlayQueue;
import org.schabi.newpipe.player.playqueue.ChannelPlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.NavigationHelper;
@@ -59,7 +59,8 @@ import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.*;
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.VIDEO;
import static org.schabi.newpipe.util.ThemeHelper.resolveResourceIdFromAttr;
/**
@@ -67,13 +68,10 @@ import static org.schabi.newpipe.util.ThemeHelper.resolveResourceIdFromAttr;
*/
public class RouterActivity extends AppCompatActivity {
@State
protected int currentServiceId = -1;
@State protected int currentServiceId = -1;
private StreamingService currentService;
@State
protected LinkType currentLinkType;
@State
protected int selectedRadioPosition = -1;
@State protected LinkType currentLinkType;
@State protected int selectedRadioPosition = -1;
protected int selectedPreviously = -1;
protected String currentUrl;
@@ -94,8 +92,7 @@ public class RouterActivity extends AppCompatActivity {
}
setTheme(ThemeHelper.isLightThemeSelected(this)
? R.style.RouterActivityThemeLight
: R.style.RouterActivityThemeDark);
? R.style.RouterActivityThemeLight : R.style.RouterActivityThemeDark);
}
@Override
@@ -162,49 +159,65 @@ public class RouterActivity extends AppCompatActivity {
protected void onSuccess() {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean isExtVideoEnabled = preferences.getBoolean(getString(R.string.use_external_video_player_key), false);
boolean isExtAudioEnabled = preferences.getBoolean(getString(R.string.use_external_audio_player_key), false);
if ((isExtAudioEnabled || isExtVideoEnabled) && currentLinkType != LinkType.STREAM) {
Toast.makeText(this, R.string.external_player_unsupported_link_type, Toast.LENGTH_LONG).show();
finish();
return;
}
final String playerChoiceKey = preferences.getString(getString(R.string.preferred_open_action_key), getString(R.string.preferred_open_action_default));
final String selectedChoiceKey = preferences.getString(getString(R.string.preferred_open_action_key), getString(R.string.preferred_open_action_default));
final String showInfoKey = getString(R.string.show_info_key);
final String videoPlayerKey = getString(R.string.video_player_key);
final String backgroundPlayerKey = getString(R.string.background_player_key);
final String popupPlayerKey = getString(R.string.popup_player_key);
final String alwaysAskKey = getString(R.string.always_ask_open_action_key);
final List<StreamingService.ServiceInfo.MediaCapability> capabilities = currentService.getServiceInfo().getMediaCapabilities();
if (selectedChoiceKey.equals(alwaysAskKey)) {
final List<AdapterChoiceItem> choices = getChoicesForService(currentService, currentLinkType);
boolean serviceSupportsPlayer = false;
if (playerChoiceKey.equals(videoPlayerKey) || playerChoiceKey.equals(popupPlayerKey)) {
serviceSupportsPlayer = capabilities.contains(VIDEO);
} else if (playerChoiceKey.equals(backgroundPlayerKey)) {
serviceSupportsPlayer = capabilities.contains(AUDIO);
}
if (playerChoiceKey.equals(alwaysAskKey) || !serviceSupportsPlayer) {
showDialog();
if (choices.size() == 1) {
handleChoice(choices.get(0).key);
} else if (choices.size() == 0) {
handleChoice(showInfoKey);
} else {
showDialog(choices);
}
} else if (selectedChoiceKey.equals(showInfoKey)) {
handleChoice(showInfoKey);
} else {
handleChoice(playerChoiceKey);
final boolean isExtVideoEnabled = preferences.getBoolean(getString(R.string.use_external_video_player_key), false);
final boolean isExtAudioEnabled = preferences.getBoolean(getString(R.string.use_external_audio_player_key), false);
final boolean isVideoPlayerSelected = selectedChoiceKey.equals(videoPlayerKey) || selectedChoiceKey.equals(popupPlayerKey);
final boolean isAudioPlayerSelected = selectedChoiceKey.equals(backgroundPlayerKey);
if (currentLinkType != LinkType.STREAM) {
if (isExtAudioEnabled && isAudioPlayerSelected || isExtVideoEnabled && isVideoPlayerSelected) {
Toast.makeText(this, R.string.external_player_unsupported_link_type, Toast.LENGTH_LONG).show();
handleChoice(showInfoKey);
return;
}
}
final List<StreamingService.ServiceInfo.MediaCapability> capabilities = currentService.getServiceInfo().getMediaCapabilities();
boolean serviceSupportsChoice = false;
if (isVideoPlayerSelected) {
serviceSupportsChoice = capabilities.contains(VIDEO);
} else if (selectedChoiceKey.equals(backgroundPlayerKey)) {
serviceSupportsChoice = capabilities.contains(AUDIO);
}
if (serviceSupportsChoice) {
handleChoice(selectedChoiceKey);
} else {
handleChoice(showInfoKey);
}
}
}
private void showDialog() {
private void showDialog(final List<AdapterChoiceItem> choices) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
final ContextThemeWrapper themeWrapperContext = new ContextThemeWrapper(this,
ThemeHelper.isLightThemeSelected(this) ? R.style.LightTheme : R.style.DarkTheme);
final Context themeWrapperContext = getThemeWrapperContext();
final LayoutInflater inflater = LayoutInflater.from(themeWrapperContext);
final LinearLayout rootLayout = (LinearLayout) inflater.inflate(R.layout.preferred_player_dialog_view, null, false);
final RadioGroup radioGroup = rootLayout.findViewById(android.R.id.list);
final List<AdapterChoiceItem> choices = getChoicesForService(themeWrapperContext, currentService);
final DialogInterface.OnClickListener dialogButtonsClickListener = (dialog, which) -> {
final int indexOfChild = radioGroup.indexOfChild(
radioGroup.findViewById(radioGroup.getCheckedRadioButtonId()));
@@ -278,21 +291,27 @@ public class RouterActivity extends AppCompatActivity {
alertDialog.show();
}
private List<AdapterChoiceItem> getChoicesForService(Context context, StreamingService service) {
private List<AdapterChoiceItem> getChoicesForService(StreamingService service, LinkType linkType) {
final Context context = getThemeWrapperContext();
final List<AdapterChoiceItem> returnList = new ArrayList<>();
final List<StreamingService.ServiceInfo.MediaCapability> capabilities = service.getServiceInfo().getMediaCapabilities();
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean isExtVideoEnabled = preferences.getBoolean(getString(R.string.use_external_video_player_key), false);
boolean isExtAudioEnabled = preferences.getBoolean(getString(R.string.use_external_audio_player_key), false);
returnList.add(new AdapterChoiceItem(getString(R.string.show_info_key), getString(R.string.show_info),
resolveResourceIdFromAttr(context, R.attr.info)));
if (capabilities.contains(VIDEO)) {
if (capabilities.contains(VIDEO) && !(isExtVideoEnabled && linkType != LinkType.STREAM)) {
returnList.add(new AdapterChoiceItem(getString(R.string.video_player_key), getString(R.string.video_player),
resolveResourceIdFromAttr(context, R.attr.play)));
returnList.add(new AdapterChoiceItem(getString(R.string.popup_player_key), getString(R.string.popup_player),
resolveResourceIdFromAttr(context, R.attr.popup)));
}
if (capabilities.contains(AUDIO)) {
if (capabilities.contains(AUDIO) && !(isExtAudioEnabled && linkType != LinkType.STREAM)) {
returnList.add(new AdapterChoiceItem(getString(R.string.background_player_key), getString(R.string.background_player),
resolveResourceIdFromAttr(context, R.attr.audio)));
}
@@ -300,6 +319,11 @@ public class RouterActivity extends AppCompatActivity {
return returnList;
}
private Context getThemeWrapperContext() {
return new ContextThemeWrapper(this,
ThemeHelper.isLightThemeSelected(this) ? R.style.LightTheme : R.style.DarkTheme);
}
private void setDialogButtonsState(AlertDialog dialog, boolean state) {
final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
final Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
@@ -309,15 +333,15 @@ public class RouterActivity extends AppCompatActivity {
positiveButton.setEnabled(state);
}
private void handleChoice(final String playerChoiceKey) {
private void handleChoice(final String selectedChoiceKey) {
final List<String> validChoicesList = Arrays.asList(getResources().getStringArray(R.array.preferred_open_action_values_list));
if (validChoicesList.contains(playerChoiceKey)) {
if (validChoicesList.contains(selectedChoiceKey)) {
PreferenceManager.getDefaultSharedPreferences(this).edit()
.putString(getString(R.string.preferred_open_action_last_selected_key), playerChoiceKey)
.putString(getString(R.string.preferred_open_action_last_selected_key), selectedChoiceKey)
.apply();
}
if (playerChoiceKey.equals(getString(R.string.popup_player_key)) && !PermissionHelper.isPopupEnabled(this)) {
if (selectedChoiceKey.equals(getString(R.string.popup_player_key)) && !PermissionHelper.isPopupEnabled(this)) {
PermissionHelper.showPopupEnablementToast(this);
finish();
return;
@@ -325,7 +349,7 @@ public class RouterActivity extends AppCompatActivity {
// stop and bypass FetcherService if InfoScreen was selected since
// StreamDetailFragment can fetch data itself
if (playerChoiceKey.equals(getString(R.string.show_info_key))) {
if (selectedChoiceKey.equals(getString(R.string.show_info_key))) {
disposables.add(Observable
.fromCallable(() -> NavigationHelper.getIntentByLink(this, currentUrl))
.subscribeOn(Schedulers.io())
@@ -342,7 +366,7 @@ public class RouterActivity extends AppCompatActivity {
}
final Intent intent = new Intent(this, FetcherService.class);
final Choice choice = new Choice(currentService.getServiceId(), currentLinkType, currentUrl, playerChoiceKey);
final Choice choice = new Choice(currentService.getServiceId(), currentLinkType, currentUrl, selectedChoiceKey);
intent.putExtra(FetcherService.KEY_CHOICE, choice);
startService(intent);

View File

@@ -32,7 +32,6 @@ public class AboutActivity extends AppCompatActivity {
new SoftwareComponent("Giga Get", "2014", "Peter Cai", "https://github.com/PaperAirplane-Dev-Team/GigaGet", StandardLicenses.GPL2),
new SoftwareComponent("NewPipe Extractor", "2017", "Christian Schabesberger", "https://github.com/TeamNewPipe/NewPipeExtractor", StandardLicenses.GPL3),
new SoftwareComponent("Jsoup", "2017", "Jonathan Hedley", "https://github.com/jhy/jsoup", StandardLicenses.MIT),
new SoftwareComponent("Google Gson", "2008", "Google Inc", "https://github.com/google/gson", StandardLicenses.APACHE2),
new SoftwareComponent("Rhino", "2015", "Mozilla", "https://www.mozilla.org/rhino/", StandardLicenses.MPL2),
new SoftwareComponent("ACRA", "2013", "Kevin Gaudin", "http://www.acra.ch", StandardLicenses.APACHE2),
new SoftwareComponent("Universal Image Loader", "2011 - 2015", "Sergey Tarasevich", "https://github.com/nostra13/Android-Universal-Image-Loader", StandardLicenses.APACHE2),

View File

@@ -9,7 +9,7 @@ import android.arch.persistence.room.PrimaryKey;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.playlist.PlayQueueItem;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
import org.schabi.newpipe.util.Constants;
import java.io.Serializable;

View File

@@ -239,7 +239,8 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
if (rootView == null && getView() != null) rootView = getView();
if (rootView == null) return;
ErrorActivity.reportError(getContext(), exception, MainActivity.class, rootView, ErrorActivity.ErrorInfo.make(userAction, serviceName, request, errorId));
ErrorActivity.reportError(getContext(), exception, MainActivity.class, rootView,
ErrorActivity.ErrorInfo.make(userAction, serviceName, request, errorId));
}
/*//////////////////////////////////////////////////////////////////////////

View File

@@ -27,10 +27,10 @@ import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.kiosk.KioskList;
import org.schabi.newpipe.fragments.list.channel.ChannelFragment;
import org.schabi.newpipe.fragments.list.feed.FeedFragment;
import org.schabi.newpipe.local.feed.FeedFragment;
import org.schabi.newpipe.fragments.list.kiosk.KioskFragment;
import org.schabi.newpipe.fragments.local.bookmark.BookmarkFragment;
import org.schabi.newpipe.fragments.subscription.SubscriptionFragment;
import org.schabi.newpipe.local.bookmark.BookmarkFragment;
import org.schabi.newpipe.local.subscription.SubscriptionFragment;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.KioskTranslator;

View File

@@ -64,15 +64,15 @@ import org.schabi.newpipe.fragments.BackPressable;
import org.schabi.newpipe.fragments.BaseStateFragment;
import org.schabi.newpipe.util.StreamItemAdapter;
import org.schabi.newpipe.util.StreamItemAdapter.StreamSizeWrapper;
import org.schabi.newpipe.fragments.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.info_list.InfoItemBuilder;
import org.schabi.newpipe.info_list.InfoItemDialog;
import org.schabi.newpipe.player.MainVideoPlayer;
import org.schabi.newpipe.player.PopupVideoPlayer;
import org.schabi.newpipe.player.helper.PlayerHelper;
import org.schabi.newpipe.player.old.PlayVideoActivity;
import org.schabi.newpipe.playlist.PlayQueue;
import org.schabi.newpipe.playlist.SinglePlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.ExtractorHelper;

View File

@@ -20,10 +20,10 @@ import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.fragments.BaseStateFragment;
import org.schabi.newpipe.fragments.OnScrollBelowItemsListener;
import org.schabi.newpipe.fragments.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.info_list.InfoItemDialog;
import org.schabi.newpipe.info_list.InfoListAdapter;
import org.schabi.newpipe.playlist.SinglePlayQueue;
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.OnClickGesture;
import org.schabi.newpipe.util.StateSaver;
@@ -140,9 +140,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
infoListAdapter.setOnStreamSelectedListener(new OnClickGesture<StreamInfoItem>() {
@Override
public void selected(StreamInfoItem selectedItem) {
onItemSelected(selectedItem);
NavigationHelper.openVideoDetailFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(),
selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
onStreamSelected(selectedItem);
}
@Override
@@ -178,6 +176,12 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
});
}
private void onStreamSelected(StreamInfoItem selectedItem) {
onItemSelected(selectedItem);
NavigationHelper.openVideoDetailFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(),
selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
}
protected void onScrollToBottom() {
if (hasMoreItems() && !isLoading.get()) {
loadMoreItems();
@@ -216,6 +220,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
new InfoItemDialog(getActivity(), item, commands, actions).show();
}
/*//////////////////////////////////////////////////////////////////////////
// Menu
//////////////////////////////////////////////////////////////////////////*/

View File

@@ -32,17 +32,15 @@ import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.channel.ChannelInfo;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.stream.Stream;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.fragments.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.info_list.InfoItemDialog;
import org.schabi.newpipe.playlist.ChannelPlayQueue;
import org.schabi.newpipe.playlist.PlayQueue;
import org.schabi.newpipe.playlist.SinglePlayQueue;
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.player.playqueue.ChannelPlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.subscription.SubscriptionService;
import org.schabi.newpipe.local.subscription.SubscriptionService;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;

View File

@@ -27,14 +27,13 @@ import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.fragments.local.RemotePlaylistManager;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.info_list.InfoItemDialog;
import org.schabi.newpipe.playlist.PlayQueue;
import org.schabi.newpipe.playlist.PlaylistPlayQueue;
import org.schabi.newpipe.playlist.SinglePlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;

View File

@@ -41,7 +41,7 @@ import org.schabi.newpipe.extractor.search.SearchEngine;
import org.schabi.newpipe.extractor.search.SearchResult;
import org.schabi.newpipe.fragments.BackPressable;
import org.schabi.newpipe.fragments.list.BaseListFragment;
import org.schabi.newpipe.history.HistoryRecordManager;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.AnimationUtils;
@@ -544,7 +544,7 @@ public class SearchFragment
howManyDeleted -> suggestionPublisher
.onNext(searchEditText.getText().toString()),
throwable -> showSnackBarError(throwable,
UserAction.SOMETHING_ELSE, "none",
UserAction.DELETE_FROM_HISTORY, "none",
"Deleting item failed", R.string.general_error)
);
disposables.add(onDelete);

View File

@@ -63,24 +63,15 @@ public class SuggestionListAdapter extends RecyclerView.Adapter<SuggestionListAd
public void onBindViewHolder(SuggestionItemHolder holder, int position) {
final SuggestionItem currentItem = getItem(position);
holder.updateFrom(currentItem);
holder.queryView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) listener.onSuggestionItemSelected(currentItem);
}
holder.queryView.setOnClickListener(v -> {
if (listener != null) listener.onSuggestionItemSelected(currentItem);
});
holder.queryView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
holder.queryView.setOnLongClickListener(v -> {
if (listener != null) listener.onSuggestionItemLongClick(currentItem);
return true;
}
});
holder.insertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) listener.onSuggestionItemInserted(currentItem);
}
holder.insertView.setOnClickListener(v -> {
if (listener != null) listener.onSuggestionItemInserted(currentItem);
});
}

View File

@@ -1,21 +0,0 @@
package org.schabi.newpipe.fragments.local.bookmark;
import org.schabi.newpipe.R;
import org.schabi.newpipe.database.stream.StreamStatisticsEntry;
import java.util.Collections;
import java.util.List;
public final class LastPlayedFragment extends StatisticsPlaylistFragment {
@Override
protected String getName() {
return getString(R.string.title_last_played);
}
@Override
protected List<StreamStatisticsEntry> processResult(List<StreamStatisticsEntry> results) {
Collections.sort(results, (left, right) ->
right.latestAccessDate.compareTo(left.latestAccessDate));
return results;
}
}

View File

@@ -1,22 +0,0 @@
package org.schabi.newpipe.fragments.local.bookmark;
import org.schabi.newpipe.R;
import org.schabi.newpipe.database.stream.StreamStatisticsEntry;
import java.util.Collections;
import java.util.List;
public final class MostPlayedFragment extends StatisticsPlaylistFragment {
@Override
protected String getName() {
return getString(R.string.title_most_played);
}
@Override
protected List<StreamStatisticsEntry> processResult(List<StreamStatisticsEntry> results) {
Collections.sort(results, (left, right) ->
((Long) right.watchCount).compareTo(left.watchCount));
return results;
}
}

View File

@@ -1,141 +0,0 @@
package org.schabi.newpipe.history;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.jakewharton.rxbinding2.view.RxView;
import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.SettingsActivity;
import org.schabi.newpipe.util.ThemeHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
public class HistoryActivity extends AppCompatActivity {
private static final String TAG = "HistoryActivity";
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
private SectionsPagerAdapter mSectionsPagerAdapter;
/**
* The {@link ViewPager} that will host the section contents.
*/
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ThemeHelper.setTheme(this);
setContentView(R.layout.activity_history);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.title_activity_history);
}
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
final FloatingActionButton fab = findViewById(R.id.fab);
RxView.clicks(fab)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ignored -> {
int currentItem = mViewPager.getCurrentItem();
HistoryFragment fragment = (HistoryFragment) mSectionsPagerAdapter
.instantiateItem(mViewPager, currentItem);
fragment.onHistoryCleared();
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_history, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case R.id.action_settings:
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
Fragment fragment;
switch (position) {
case 0:
fragment = SearchHistoryFragment.newInstance();
break;
case 1:
fragment = WatchHistoryFragment.newInstance();
break;
default:
throw new IllegalArgumentException("position: " + position);
}
return fragment;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return getString(R.string.title_history_search);
case 1:
return getString(R.string.title_history_view);
}
throw new IllegalArgumentException("position: " + position);
}
@Override
public int getCount() {
// Show 3 total pages.
return 2;
}
}
}

View File

@@ -1,145 +0,0 @@
package org.schabi.newpipe.history;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.schabi.newpipe.R;
import org.schabi.newpipe.database.history.model.SearchHistoryEntry;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
public class SearchHistoryFragment extends HistoryFragment<SearchHistoryEntry> {
@NonNull
public static SearchHistoryFragment newInstance() {
return new SearchHistoryFragment();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@NonNull
@Override
protected SearchHistoryAdapter createAdapter() {
return new SearchHistoryAdapter(getContext());
}
@Override
protected Single<List<Long>> insert(Collection<SearchHistoryEntry> entries) {
return historyRecordManager.insertSearches(entries);
}
@Override
protected Single<Integer> delete(Collection<SearchHistoryEntry> entries) {
return historyRecordManager.deleteSearches(entries);
}
@NonNull
@Override
protected Flowable<List<SearchHistoryEntry>> getAll() {
return historyRecordManager.getSearchHistory();
}
@StringRes
@Override
int getEnabledConfigKey() {
return R.string.enable_search_history_key;
}
@Override
public void onHistoryItemClick(final SearchHistoryEntry historyItem) {
NavigationHelper.openSearch(getContext(), historyItem.getServiceId(),
historyItem.getSearch());
}
@Override
public void onHistoryItemLongClick(final SearchHistoryEntry item) {
if (activity == null) return;
new AlertDialog.Builder(activity)
.setTitle(item.getSearch())
.setMessage(R.string.delete_item_search_history)
.setCancelable(true)
.setNeutralButton(R.string.cancel, null)
.setPositiveButton(R.string.delete_one, (dialog, i) -> {
final Disposable onDelete = historyRecordManager
.deleteSearches(Collections.singleton(item))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
ignored -> {/*successful*/},
error -> Log.e(TAG, "Search history Delete One failed:", error)
);
disposables.add(onDelete);
makeSnackbar(R.string.item_deleted);
})
.setNegativeButton(R.string.delete_all, (dialog, i) -> {
final Disposable onDeleteAll = historyRecordManager
.deleteSearchHistory(item.getSearch())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
ignored -> {/*successful*/},
error -> Log.e(TAG, "Search history Delete All failed:", error)
);
disposables.add(onDeleteAll);
makeSnackbar(R.string.item_deleted);
})
.show();
}
private static class ViewHolder extends RecyclerView.ViewHolder {
private final TextView search;
private final TextView info;
public ViewHolder(View itemView) {
super(itemView);
search = itemView.findViewById(R.id.search);
info = itemView.findViewById(R.id.info);
}
}
protected class SearchHistoryAdapter extends HistoryEntryAdapter<SearchHistoryEntry, ViewHolder> {
SearchHistoryAdapter(Context context) {
super(context);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View rootView = inflater.inflate(R.layout.item_search_history, parent, false);
return new ViewHolder(rootView);
}
@Override
void onBindViewHolder(ViewHolder holder, SearchHistoryEntry entry, int position) {
holder.search.setText(entry.getSearch());
final String info = Localization.concatenateStrings(
getFormattedDate(entry.getCreationDate()),
NewPipe.getNameOfService(entry.getServiceId()));
holder.info.setText(info);
}
}
}

View File

@@ -1,171 +0,0 @@
package org.schabi.newpipe.history;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.nostra13.universalimageloader.core.ImageLoader;
import org.schabi.newpipe.R;
import org.schabi.newpipe.database.history.model.StreamHistoryEntry;
import org.schabi.newpipe.info_list.holder.StreamInfoItemHolder;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
public class WatchHistoryFragment extends HistoryFragment<StreamHistoryEntry> {
@NonNull
public static WatchHistoryFragment newInstance() {
return new WatchHistoryFragment();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@StringRes
@Override
int getEnabledConfigKey() {
return R.string.enable_watch_history_key;
}
@NonNull
@Override
protected StreamHistoryAdapter createAdapter() {
return new StreamHistoryAdapter(getContext());
}
@Override
protected Single<List<Long>> insert(Collection<StreamHistoryEntry> entries) {
return historyRecordManager.insertStreamHistory(entries);
}
@Override
protected Single<Integer> delete(Collection<StreamHistoryEntry> entries) {
return historyRecordManager.deleteStreamHistory(entries);
}
@NonNull
@Override
protected Flowable<List<StreamHistoryEntry>> getAll() {
return historyRecordManager.getStreamHistory();
}
@Override
public void onHistoryItemClick(StreamHistoryEntry historyItem) {
NavigationHelper.openVideoDetail(getContext(), historyItem.serviceId, historyItem.url,
historyItem.title);
}
@Override
public void onHistoryItemLongClick(StreamHistoryEntry item) {
new AlertDialog.Builder(activity)
.setTitle(item.title)
.setMessage(R.string.delete_stream_history_prompt)
.setCancelable(true)
.setNeutralButton(R.string.cancel, null)
.setPositiveButton(R.string.delete_one, (dialog, i) -> {
final Disposable onDelete = historyRecordManager
.deleteStreamHistory(Collections.singleton(item))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
ignored -> {/*successful*/},
error -> Log.e(TAG, "Watch history Delete One failed:", error)
);
disposables.add(onDelete);
makeSnackbar(R.string.item_deleted);
})
.setNegativeButton(R.string.delete_all, (dialog, i) -> {
final Disposable onDeleteAll = historyRecordManager
.deleteStreamHistory(item.streamId)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
ignored -> {/*successful*/},
error -> Log.e(TAG, "Watch history Delete All failed:", error)
);
disposables.add(onDeleteAll);
makeSnackbar(R.string.item_deleted);
})
.show();
}
private static class StreamHistoryAdapter extends HistoryEntryAdapter<StreamHistoryEntry, ViewHolder> {
StreamHistoryAdapter(Context context) {
super(context);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View itemView = inflater.inflate(R.layout.list_stream_item, parent, false);
return new ViewHolder(itemView);
}
@Override
public void onViewRecycled(ViewHolder holder) {
holder.itemView.setOnClickListener(null);
ImageLoader.getInstance()
.cancelDisplayTask(holder.thumbnailView);
}
@Override
void onBindViewHolder(ViewHolder holder, StreamHistoryEntry entry, int position) {
final String formattedDate = getFormattedDate(entry.accessDate);
final String info;
if (entry.repeatCount > 1) {
info = Localization.concatenateStrings(formattedDate,
getFormattedViewString(entry.repeatCount));
} else {
info = formattedDate;
}
holder.info.setText(info);
holder.streamTitle.setText(entry.title);
holder.uploader.setText(entry.uploader);
holder.duration.setText(Localization.getDurationString(entry.duration));
ImageLoader.getInstance().displayImage(entry.thumbnailUrl, holder.thumbnailView,
ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS);
}
}
private static class ViewHolder extends RecyclerView.ViewHolder {
private final TextView info;
private final TextView streamTitle;
private final ImageView thumbnailView;
private final TextView uploader;
private final TextView duration;
public ViewHolder(View itemView) {
super(itemView);
thumbnailView = itemView.findViewById(R.id.itemThumbnailView);
info = itemView.findViewById(R.id.itemAdditionalDetails);
streamTitle = itemView.findViewById(R.id.itemVideoTitleView);
uploader = itemView.findViewById(R.id.itemUploaderView);
duration = itemView.findViewById(R.id.itemDurationView);
}
}
}

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local.bookmark;
package org.schabi.newpipe.local;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@@ -13,7 +13,6 @@ import android.view.View;
import org.schabi.newpipe.R;
import org.schabi.newpipe.fragments.BaseStateFragment;
import org.schabi.newpipe.fragments.list.ListViewContract;
import org.schabi.newpipe.fragments.local.LocalItemListAdapter;
import static org.schabi.newpipe.util.AnimationUtils.animateView;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local;
package org.schabi.newpipe.local;
import android.support.v7.widget.RecyclerView;
import android.view.View;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local;
package org.schabi.newpipe.local;
import android.content.Context;
import android.widget.ImageView;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local;
package org.schabi.newpipe.local;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
@@ -7,11 +7,13 @@ import android.view.View;
import android.view.ViewGroup;
import org.schabi.newpipe.database.LocalItem;
import org.schabi.newpipe.fragments.local.holder.LocalItemHolder;
import org.schabi.newpipe.fragments.local.holder.LocalPlaylistItemHolder;
import org.schabi.newpipe.fragments.local.holder.LocalPlaylistStreamItemHolder;
import org.schabi.newpipe.fragments.local.holder.LocalStatisticStreamItemHolder;
import org.schabi.newpipe.fragments.local.holder.RemotePlaylistItemHolder;
import org.schabi.newpipe.local.HeaderFooterHolder;
import org.schabi.newpipe.local.LocalItemBuilder;
import org.schabi.newpipe.local.holder.LocalItemHolder;
import org.schabi.newpipe.local.holder.LocalPlaylistItemHolder;
import org.schabi.newpipe.local.holder.LocalPlaylistStreamItemHolder;
import org.schabi.newpipe.local.holder.LocalStatisticStreamItemHolder;
import org.schabi.newpipe.local.holder.RemotePlaylistItemHolder;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.OnClickGesture;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local.bookmark;
package org.schabi.newpipe.local.bookmark;
import android.app.AlertDialog;
import android.os.Bundle;
@@ -19,8 +19,9 @@ import org.schabi.newpipe.database.LocalItem;
import org.schabi.newpipe.database.playlist.PlaylistLocalItem;
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
import org.schabi.newpipe.fragments.local.LocalPlaylistManager;
import org.schabi.newpipe.fragments.local.RemotePlaylistManager;
import org.schabi.newpipe.local.BaseLocalListFragment;
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.OnClickGesture;
@@ -38,9 +39,6 @@ import io.reactivex.disposables.CompositeDisposable;
public final class BookmarkFragment
extends BaseLocalListFragment<List<PlaylistLocalItem>, Void> {
private View lastPlayedButton;
private View mostPlayedButton;
@State
protected Parcelable itemsListState;
@@ -94,15 +92,6 @@ public final class BookmarkFragment
super.initViews(rootView, savedInstanceState);
}
@Override
protected View getListHeader() {
final View headerRootLayout = activity.getLayoutInflater()
.inflate(R.layout.bookmark_header, itemsList, false);
lastPlayedButton = headerRootLayout.findViewById(R.id.lastPlayed);
mostPlayedButton = headerRootLayout.findViewById(R.id.mostPlayed);
return headerRootLayout;
}
@Override
protected void initListeners() {
super.initListeners();
@@ -136,18 +125,6 @@ public final class BookmarkFragment
}
}
});
lastPlayedButton.setOnClickListener(view -> {
if (getParentFragment() != null) {
NavigationHelper.openLastPlayedFragment(getParentFragment().getFragmentManager());
}
});
mostPlayedButton.setOnClickListener(view -> {
if (getParentFragment() != null) {
NavigationHelper.openMostPlayedFragment(getParentFragment().getFragmentManager());
}
});
}
///////////////////////////////////////////////////////////////////////////
@@ -180,8 +157,6 @@ public final class BookmarkFragment
@Override
public void onDestroyView() {
super.onDestroyView();
if (mostPlayedButton != null) mostPlayedButton.setOnClickListener(null);
if (lastPlayedButton != null) lastPlayedButton.setOnClickListener(null);
if (disposables != null) disposables.clear();
if (databaseSubscription != null) databaseSubscription.cancel();

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local.dialog;
package org.schabi.newpipe.local.dialog;
import android.annotation.SuppressLint;
import android.os.Bundle;
@@ -18,9 +18,9 @@ import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
import org.schabi.newpipe.database.stream.model.StreamEntity;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.fragments.local.LocalItemListAdapter;
import org.schabi.newpipe.fragments.local.LocalPlaylistManager;
import org.schabi.newpipe.playlist.PlayQueueItem;
import org.schabi.newpipe.local.LocalItemListAdapter;
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
import org.schabi.newpipe.util.OnClickGesture;
import java.util.ArrayList;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local.dialog;
package org.schabi.newpipe.local.dialog;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -12,7 +12,7 @@ import android.widget.Toast;
import org.schabi.newpipe.NewPipeDatabase;
import org.schabi.newpipe.R;
import org.schabi.newpipe.database.stream.model.StreamEntity;
import org.schabi.newpipe.fragments.local.LocalPlaylistManager;
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.local.dialog;
package org.schabi.newpipe.local.dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.fragments.list.feed;
package org.schabi.newpipe.local.feed;
import android.os.Bundle;
import android.os.Handler;
@@ -22,7 +22,7 @@ import org.schabi.newpipe.extractor.channel.ChannelInfo;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.fragments.list.BaseListFragment;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.subscription.SubscriptionService;
import org.schabi.newpipe.local.subscription.SubscriptionService;
import java.util.Collections;
import java.util.HashSet;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.history;
package org.schabi.newpipe.local.history;
import android.content.Context;
import android.content.res.Resources;

View File

@@ -1,4 +1,4 @@
package org.schabi.newpipe.history;
package org.schabi.newpipe.local.history;
import android.support.annotation.Nullable;

View File

@@ -1,4 +1,22 @@
package org.schabi.newpipe.history;
package org.schabi.newpipe.local.history;
/*
* Copyright (C) Mauricio Colli 2018
* HistoryRecordManager.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/>.
*/
import android.content.Context;
import android.content.SharedPreferences;
@@ -27,6 +45,7 @@ import java.util.List;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import io.reactivex.schedulers.Schedulers;
@@ -80,6 +99,11 @@ public class HistoryRecordManager {
.subscribeOn(Schedulers.io());
}
public Single<Integer> deleteWholeStreamHistory() {
return Single.fromCallable(() -> streamHistoryTable.deleteAll())
.subscribeOn(Schedulers.io());
}
public Flowable<List<StreamHistoryEntry>> getStreamHistory() {
return streamHistoryTable.getHistory().subscribeOn(Schedulers.io());
}
@@ -114,20 +138,6 @@ public class HistoryRecordManager {
// Search History
///////////////////////////////////////////////////////
public Single<List<Long>> insertSearches(final Collection<SearchHistoryEntry> entries) {
return Single.fromCallable(() -> searchHistoryTable.insertAll(entries))
.subscribeOn(Schedulers.io());
}
public Single<Integer> deleteSearches(final Collection<SearchHistoryEntry> entries) {
return Single.fromCallable(() -> searchHistoryTable.delete(entries))
.subscribeOn(Schedulers.io());
}
public Flowable<List<SearchHistoryEntry>> getSearchHistory() {
return searchHistoryTable.getAll();
}
public Maybe<Long> onSearched(final int serviceId, final String search) {
if (!isSearchHistoryEnabled()) return Maybe.empty();
@@ -150,6 +160,11 @@ public class HistoryRecordManager {
.subscribeOn(Schedulers.io());
}
public Single<Integer> deleteWholeSearchHistory() {
return Single.fromCallable(() -> searchHistoryTable.deleteAll())
.subscribeOn(Schedulers.io());
}
public Flowable<List<SearchHistoryEntry>> getRelatedSearches(final String query,
final int similarQueryLimit,
final int uniqueQueryLimit) {

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