package com.ss.android.ugc.aweme.main;

import X.0CB;
import X.0CH;
import X.0CN;
import X.6Is;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import com.bytedance.covode.number.Covode;

public class TabAlphaController extends Handler implements 6Is {
    public static final String[] LIZJ = {"SM-G9500", "SM-G9550", "SM-G9600", "SM-G9608", "SM-G9650", "SM-N9500"};
    public static TabAlphaController LIZLLL;
    public View LIZ;
    public boolean LIZIZ;
    public boolean LJ;

    public void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_RESUME) {
            onResume(r2);
        } else if (r3 == 0CB.ON_PAUSE) {
            onPause();
        } else if (r3 == 0CB.ON_DESTROY) {
            onDestroy();
        }
    }

    @0CN(LIZ = 0CB.ON_PAUSE)
    public void onPause() {
        LIZ(false);
    }

    public static TabAlphaController LIZ() {
        if (LIZLLL == null) {
            LIZLLL = new TabAlphaController();
        }
        return LIZLLL;
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public void onDestroy() {
        if (hasMessages(1)) {
            removeMessages(1);
        }
        this.LIZ = null;
    }

    static {
        Covode.recordClassIndex(91648);
    }

    public TabAlphaController() {
        if (TextUtils.equals("samsung", Build.BRAND.toLowerCase())) {
            for (String equals : LIZJ) {
                if (TextUtils.equals(equals, Build.MODEL)) {
                    this.LJ = true;
                    return;
                }
            }
        }
    }

    @0CN(LIZ = 0CB.ON_RESUME)
    public void onResume(0CH r2) {
        LIZ(true);
    }

    public void handleMessage(Message message) {
        View view;
        if (message.what == 1 && (view = this.LIZ) != null && !this.LIZIZ) {
            view.setAlpha(view.getAlpha() / 2.0f);
            this.LIZIZ = true;
        }
    }

    public final void LIZ(boolean z) {
        if (this.LIZ != null && this.LJ) {
            if (!z || this.LIZIZ) {
                if (hasMessages(1)) {
                    removeMessages(1);
                }
            } else if (!hasMessages(1)) {
                sendEmptyMessageDelayed(1, 1200000);
            }
        }
    }
}
