jimu-decompiled/sources/com/liulishuo/filedownloader/services/ForegroundServiceConfig.java
2025-05-13 19:24:51 +02:00

115 lines
3.0 KiB
Java

package com.liulishuo.filedownloader.services;
import android.R;
import android.annotation.TargetApi;
import android.app.Notification;
import android.content.Context;
import com.liulishuo.filedownloader.R$string;
import com.liulishuo.filedownloader.util.FileDownloadLog;
@TargetApi(26)
/* loaded from: classes.dex */
public class ForegroundServiceConfig {
private int a;
private String b;
private String c;
private Notification d;
private boolean e;
public static class Builder {
private int a;
private String b;
private String c;
private Notification d;
private boolean e;
public Builder a(boolean z) {
this.e = z;
return this;
}
public ForegroundServiceConfig a() {
ForegroundServiceConfig foregroundServiceConfig = new ForegroundServiceConfig();
String str = this.b;
if (str == null) {
str = "filedownloader_channel";
}
foregroundServiceConfig.a(str);
String str2 = this.c;
if (str2 == null) {
str2 = "Filedownloader";
}
foregroundServiceConfig.b(str2);
int i = this.a;
if (i == 0) {
i = R.drawable.arrow_down_float;
}
foregroundServiceConfig.a(i);
foregroundServiceConfig.a(this.e);
foregroundServiceConfig.a(this.d);
return foregroundServiceConfig;
}
}
public String a() {
return this.b;
}
public String b() {
return this.c;
}
public int c() {
return this.a;
}
public boolean d() {
return this.e;
}
public String toString() {
return "ForegroundServiceConfig{notificationId=" + this.a + ", notificationChannelId='" + this.b + "', notificationChannelName='" + this.c + "', notification=" + this.d + ", needRecreateChannelId=" + this.e + '}';
}
private ForegroundServiceConfig() {
}
public Notification a(Context context) {
if (this.d == null) {
if (FileDownloadLog.a) {
FileDownloadLog.a(this, "build default notification", new Object[0]);
}
this.d = b(context);
}
return this.d;
}
public void b(String str) {
this.c = str;
}
private Notification b(Context context) {
String string = context.getString(R$string.default_filedownloader_notification_title);
String string2 = context.getString(R$string.default_filedownloader_notification_content);
Notification.Builder builder = new Notification.Builder(context, this.b);
builder.setContentTitle(string).setContentText(string2).setSmallIcon(R.drawable.arrow_down_float);
return builder.build();
}
public void a(int i) {
this.a = i;
}
public void a(String str) {
this.b = str;
}
public void a(Notification notification) {
this.d = notification;
}
public void a(boolean z) {
this.e = z;
}
}