package com.mbridge.msdk.e.a;

import android.os.CountDownTimer;
/* compiled from: MBCountDownTimer.java */
/* loaded from: classes5.dex */
public final class b {

    /* renamed from: a  reason: collision with root package name */
    private com.mbridge.msdk.e.a.a f3525a;
    private long b;
    private a c;
    private long d = 0;

    public final b a(long j) {
        if (j < 0) {
            j = 1000;
        }
        this.b = j;
        return this;
    }

    public final b a(com.mbridge.msdk.e.a.a aVar) {
        this.f3525a = aVar;
        return this;
    }

    public final b b(long j) {
        this.d = j;
        return this;
    }

    public final void a() {
        a aVar = this.c;
        if (aVar != null) {
            aVar.cancel();
            this.c = null;
        }
    }

    /* compiled from: MBCountDownTimer.java */
    /* loaded from: classes5.dex */
    private static class a extends CountDownTimer {

        /* renamed from: a  reason: collision with root package name */
        private com.mbridge.msdk.e.a.a f3526a;

        final void a(com.mbridge.msdk.e.a.a aVar) {
            this.f3526a = aVar;
        }

        public a(long j, long j2) {
            super(j, j2);
        }

        @Override // android.os.CountDownTimer
        public final void onTick(long j) {
            com.mbridge.msdk.e.a.a aVar = this.f3526a;
            if (aVar != null) {
                aVar.onTick(j);
            }
        }

        @Override // android.os.CountDownTimer
        public final void onFinish() {
            com.mbridge.msdk.e.a.a aVar = this.f3526a;
            if (aVar != null) {
                aVar.onFinish();
            }
        }
    }

    public final void b() {
        a aVar = this.c;
        if (aVar == null) {
            if (aVar != null) {
                aVar.cancel();
                this.c = null;
            }
            if (this.b <= 0) {
                this.b = this.d + 1000;
            }
            a aVar2 = new a(this.d, this.b);
            this.c = aVar2;
            aVar2.a(this.f3525a);
        }
        this.c.start();
    }
}
