翰林优商.apk(点击下载) / h.java


package com.mbridge.msdk.mbdownload;

import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.os.Build;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import com.mbridge.msdk.foundation.tools.q;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import java.lang.reflect.Field;

/* compiled from: NotificationBuilder */
public class h {
    protected Context e;
    protected Notification f;
    protected Notification.Builder g;
    protected NotificationCompat.Builder h;
    protected PendingIntent i;
    protected RemoteViews j = new RemoteViews(this.e.getPackageName(), q.a(this.e, "mbridge_download_notify_layout", TtmlNode.TAG_LAYOUT));

    public h(Context context) {
        this.e = context.getApplicationContext();
        if ((context != null ? this.e.getApplicationInfo().targetSdkVersion : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
            NotificationCompat.Builder builder = new NotificationCompat.Builder(this.e, "download");
            this.h = builder;
            builder.setCustomContentView(this.j);
        } else if (Build.VERSION.SDK_INT >= 16) {
            Notification.Builder builder2 = new Notification.Builder(context);
            this.g = builder2;
            builder2.setContent(this.j);
        } else {
            this.f = new Notification();
        }
    }

    public final void e() {
        Context context = this.e;
        if ((context != null ? context.getApplicationInfo().targetSdkVersion : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
            try {
                Field declaredField = NotificationCompat.Builder.class.getDeclaredField("mActions");
                declaredField.setAccessible(true);
                NotificationCompat.Builder builder = this.h;
                declaredField.set(builder, declaredField.get(builder).getClass().newInstance());
            } catch (Exception unused) {
            }
        } else if (Build.VERSION.SDK_INT >= 16) {
            Field declaredField2 = Notification.Builder.class.getDeclaredField("mActions");
            declaredField2.setAccessible(true);
            Notification.Builder builder2 = this.g;
            declaredField2.set(builder2, declaredField2.get(builder2).getClass().newInstance());
        }
    }

    public final h a(boolean z) {
        Context context = this.e;
        if ((context != null ? context.getApplicationInfo().targetSdkVersion : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
            this.h.setOngoing(z);
        } else if (Build.VERSION.SDK_INT >= 16) {
            this.g.setOngoing(z);
        } else if (z) {
            this.f.flags |= 2;
        } else {
            this.f.flags &= -3;
        }
        return this;
    }

    public final h b(boolean z) {
        Context context = this.e;
        if ((context != null ? context.getApplicationInfo().targetSdkVersion : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
            this.h.setAutoCancel(z);
        } else if (Build.VERSION.SDK_INT >= 16) {
            this.g.setAutoCancel(z);
        } else if (z) {
            this.f.flags |= 16;
        } else {
            this.f.flags &= -17;
        }
        return this;
    }

    public final h a(int i2) {
        Context context = this.e;
        if ((context != null ? context.getApplicationInfo().targetSdkVersion : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
            this.h.setSmallIcon(i2);
        } else if (Build.VERSION.SDK_INT >= 16) {
            this.g.setSmallIcon(i2);
        } else {
            this.f.icon = i2;
        }
        return this;
    }

    public final h a(long j2) {
        Context context = this.e;
        if ((context != null ? context.getApplicationInfo().targetSdkVersion : 0) >= 26 && Build.VERSION.SDK_INT >= 26) {
            this.h.setWhen(j2);
        } else if (Build.VERSION.SDK_INT >= 16) {
            this.g.setWhen(j2);
        } else {
            this.f.when = j2;
        }
        return this;
    }
}