导航菜单

页面标题

页面副标题

Top浏览器 v4.6.16 - DownloadService.java 源代码

正在查看: Top浏览器 v4.6.16 应用的 DownloadService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.pocket.topbrowser.browser.download;

import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import c.t.a.i.b0.b;
import c.t.a.i.y;
import c.t.a.i.z;
import c.t.a.w.n;
import com.pocket.topbrowser.browser.R$mipmap;
import java.util.Iterator;

public class DownloadService extends Service {
    public boolean a = false;

    public class a implements c.t.a.i.c0.a {
        public a() {
        }

        public void a(b bVar) {
        }

        public void b(b bVar, String str) {
            DownloadService.this.c(bVar);
        }

        public void c(b bVar) {
            DownloadService.this.c(bVar);
        }

        public void d(b bVar) {
            DownloadService.this.c(bVar);
        }

        public void e(b bVar) {
            DownloadService.this.d(bVar);
        }

        public void f(b bVar) {
        }

        public void g(b bVar) {
            DownloadService.this.d(bVar);
        }
    }

    public final void c(b bVar) {
        stopForeground(false);
        this.a = false;
        ((NotificationManager) getSystemService("notification")).cancel(bVar.e().hashCode());
    }

    public final void d(b bVar) {
        PendingIntent activity = PendingIntent.getActivity(this, 0, new Intent(this, (Class<?>) DownloadActivity.class), 33554432);
        NotificationManager notificationManager = (NotificationManager) getSystemService("notification");
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "channel_download");
        int hashCode = bVar.e().hashCode();
        if (bVar.b() == 5) {
            builder.setContentTitle(bVar.c()).setContentText("点击查看详情").setOngoing(false).setSmallIcon(R$mipmap.launcher0).setContentIntent(activity).setAutoCancel(true);
            notificationManager.notify(hashCode, builder.build());
            stopForeground(false);
            this.a = false;
            return;
        }
        if (bVar.b() != 2) {
            if (bVar.b() == 7) {
                builder.setContentTitle(bVar.c()).setContentText("m3u8文件转mp4中").setOngoing(false).setSmallIcon(R$mipmap.launcher0).setContentIntent(activity).setAutoCancel(true);
                if (this.a) {
                    notificationManager.notify(hashCode, builder.build());
                    return;
                } else {
                    startForeground(hashCode, builder.build());
                    this.a = true;
                    return;
                }
            }
            return;
        }
        if (bVar instanceof z) {
            builder.setProgress(100, (int) ((z) bVar).s(), false).setContentTitle(bVar.c()).setOngoing(false).setSmallIcon(R$mipmap.launcher0).setContentIntent(activity).setAutoCancel(true);
        } else {
            builder.setContentTitle(bVar.c()).setContentText("m3u8文件下载中(" + n.a(bVar.a()) + ")").setOngoing(false).setSmallIcon(R$mipmap.launcher0).setContentIntent(activity).setAutoCancel(true);
        }
        if (this.a) {
            notificationManager.notify(hashCode, builder.build());
        } else {
            startForeground(hashCode, builder.build());
            this.a = true;
        }
    }

    @Override
    @Nullable
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int i2, int i3) {
        Iterator it2 = y.r().s().iterator();
        while (it2.hasNext()) {
            y.r().g((b) it2.next(), new a());
        }
        return super.onStartCommand(intent, i2, i3);
    }
}