- fixed titles in folders and gradle builds - converted downloading to a background service so that it continues even if the app is killed - converted listviews on home and history fragments with recyclerviews to increase speed - removed pull to refresh and floating action buttons for proper top app bar icons - added search functionality to history - added dialog if pressed delete all in history - made new downloads add to queue if a download is on progress - fixed leftover hardcoded strings - added sponsorblock functionality. Removed non music parts for audio files and added chapters for videos - fixed shimmer not removing when opening a video from share intent - showed no results image when history is empty or there are no results - made history cards clickable. You can delete them or open the link in youtube or copy the link to the clipboard
44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package com.deniscerri.ytdl;
|
|
|
|
import android.app.Notification;
|
|
import android.app.PendingIntent;
|
|
import android.app.Service;
|
|
import android.content.Intent;
|
|
import android.os.Binder;
|
|
import android.os.IBinder;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.core.app.NotificationCompat;
|
|
|
|
public class DownloaderService extends Service {
|
|
|
|
private LocalBinder binder = new LocalBinder();
|
|
private NotificationCompat.Builder builder;
|
|
|
|
@Nullable
|
|
@Override
|
|
public IBinder onBind(Intent intent) {
|
|
Intent theIntent = new Intent(this, MainActivity.class);
|
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, theIntent, PendingIntent.FLAG_IMMUTABLE);
|
|
|
|
String title = intent.getStringExtra("title");
|
|
|
|
Notification notification = App.notificationUtil.createDownloadServiceNotification(pendingIntent,title);
|
|
startForeground(NotificationUtil.DOWNLOAD_NOTIFICATION_ID, notification);
|
|
return binder;
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean onUnbind(Intent intent) {
|
|
stopForeground(true);
|
|
stopSelf();
|
|
return super.onUnbind(intent);
|
|
}
|
|
|
|
public class LocalBinder extends Binder {
|
|
|
|
DownloaderService getService() {
|
|
return DownloaderService.this;
|
|
}
|
|
}
|
|
}
|