得物.apk(点击下载) / WashServiceImpl.java


package com.shizhuang.duapp.modules.rn.wash;

import android.content.Context;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.facebook.soloader.SoLoader;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.libs.dulogger.Printer;
import com.shizhuang.duapp.modules.rn.wash.model.WashShowModel;
import com.shizhuang.duapp.modules.router.service.IWashService;
import df.b0;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import java.util.Locale;
import rd.d;
import rd.k;
import u91.e;

@Route(path = "/wash/service")
public class WashServiceImpl implements IWashService {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: a  reason: collision with root package name */
    public WashApiService f24861a;

    public class a implements View.OnAttachStateChangeListener {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ View b;

        public a(WashServiceImpl washServiceImpl, View view) {
            this.b = view;
        }

        public void onViewAttachedToWindow(View view) {
            boolean z = PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 313508, new Class[]{View.class}, Void.TYPE).isSupported;
        }

        public void onViewDetachedFromWindow(View view) {
            if (!PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 313509, new Class[]{View.class}, Void.TYPE).isSupported) {
                View view2 = this.b;
                if (view2 instanceof Disposable) {
                    ((Disposable) view2.getTag()).dispose();
                    this.b.setTag(null);
                }
            }
        }
    }

    public class b extends d<WashShowModel> {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ View f24862c;
        public final /* synthetic */ TextView d;

        public b(WashServiceImpl washServiceImpl, View view, TextView textView) {
            this.f24862c = view;
            this.d = textView;
        }

        @Override // rd.d
        public void c(int i, String str) {
            if (!PatchProxy.proxy(new Object[]{new Integer(i), str}, this, changeQuickRedirect, false, 313511, new Class[]{Integer.TYPE, String.class}, Void.TYPE).isSupported) {
                this.f24862c.setTag(null);
                Printer u4 = fo.a.u("WashServiceImpl");
                u4.e("getMineShowInfo msg=" + str + ", code=" + i, new Object[0]);
            }
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
        @Override // rd.d
        public void d(WashShowModel washShowModel) {
            WashShowModel washShowModel2 = washShowModel;
            int i = 0;
            if (!PatchProxy.proxy(new Object[]{washShowModel2}, this, changeQuickRedirect, false, 313512, new Class[]{WashShowModel.class}, Void.TYPE).isSupported) {
                boolean z = washShowModel2.isShow;
                b0.l("wash_mine_show_model", washShowModel2);
                View view = this.f24862c;
                if (!z) {
                    i = 8;
                }
                view.setVisibility(i);
                this.d.setText(String.valueOf(washShowModel2.orderCount));
            }
        }

        @Override // io.reactivex.Observer
        public void onComplete() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 313510, new Class[0], Void.TYPE).isSupported) {
                this.f24862c.setTag(null);
            }
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWashService
    public void goPage(@NonNull Context context, String str) {
        if (!PatchProxy.proxy(new Object[]{context, str}, this, changeQuickRedirect, false, 313507, new Class[]{Context.class, String.class}, Void.TYPE).isSupported) {
            e.C(context, String.format(Locale.US, "https://m.poizon.com/router/mini/open?miniId=%s&page=%s", "HuanRan", str));
        }
    }

    @Override // com.alibaba.android.arouter.facade.template.IProvider
    public void init(Context context) {
        if (!PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 313503, new Class[]{Context.class}, Void.TYPE).isSupported) {
            SoLoader.init(context, false);
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWashService
    public void initMineWashInfo(View view, TextView textView) {
        int i = 0;
        if (!PatchProxy.proxy(new Object[]{view, textView}, this, changeQuickRedirect, false, 313505, new Class[]{View.class, TextView.class}, Void.TYPE).isSupported) {
            WashShowModel washShowModel = (WashShowModel) b0.d("wash_mine_show_model", WashShowModel.class);
            if (washShowModel == null || !washShowModel.isShow) {
                i = 8;
            }
            view.setVisibility(i);
            textView.setText(washShowModel != null ? String.valueOf(washShowModel.orderCount) : "");
            view.addOnAttachStateChangeListener(new a(this, view));
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWashService
    public boolean isEnable() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 313504, new Class[0], Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        return true;
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWashService
    public void refreshMineShowInfo(View view, TextView textView) {
        if (!PatchProxy.proxy(new Object[]{view, textView}, this, changeQuickRedirect, false, 313506, new Class[]{View.class, TextView.class}, Void.TYPE).isSupported && !(view.getTag() instanceof Disposable)) {
            if (this.f24861a == null) {
                this.f24861a = (WashApiService) k.e().h().create(WashApiService.class);
            }
            view.setTag((Disposable) this.f24861a.getMineShowInfo().subscribeOn(Schedulers.io()).observeOn(ej1.a.c()).subscribeWith(new b(this, view, textView)));
        }
    }
}