导航菜单

页面标题

页面副标题

SpinDisplay v2.0.2.6 - DeviceDetailsActivity.java 源代码

正在查看: SpinDisplay v2.0.2.6 应用的 DeviceDetailsActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.dmz.f20ad.activity;

import android.R;
import android.annotation.SuppressLint;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListPopupWindow;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.TimePicker;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import b.u.y;
import butterknife.ButterKnife;
import com.dmz.f20ad.App;
import com.dmz.f20ad.activity.DeviceDetailsActivity;
import com.dmz.f20ad.connect.UdpService;
import com.dmz.f20ad.model.RouterWifiInfo;
import com.dmz.f20ad.model.RouterWifiInfoDao;
import com.dmz.f20ad.view.AngleView;
import com.suke.widget.SwitchButton;
import d.a.a.f;
import d.e.a.n.r2;
import d.e.a.p.n0;
import d.e.a.p.p0;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import me.zhanghai.android.materialprogressbar.BuildConfig;
import org.greenrobot.eventbus.ThreadMode;

public class DeviceDetailsActivity extends r2 {
    public SwitchButton autoOn;
    public SeekBar mAngleSeekBar;
    public AngleView mAngleView;
    public View mAutoOnShade;
    public TextView mBleVolume;
    public SeekBar mBrightSeekBar;
    public TextView mBrightText;
    public TextView mCapacity;
    public TextView mDeviceName;
    public TextView mFirmwareVersion;
    public TextView mGrouping;
    public RadioButton mHLButton;
    public TextView mHotspot;
    public TextView mMacAddress;
    public TextView mMatchCode;
    public TextView mModel;
    public SwitchButton mOtherControl;
    public RadioGroup mRadioGroup;
    public View mRemoteShade;
    public View mRouterShade;
    public TextView mStatus;
    public SwipeRefreshLayout mSwipeRefresh;
    public View mSyncShade;
    public RadioButton mTCButton;
    public TextView mTimingOnOff;
    public View mTimingSwitchShade;
    public View mVoiceShade;
    public String s;
    public n0 t;
    public Context u;
    public boolean v = false;
    public d.a.a.f w;

    public class a implements SwitchButton.d {

        public final View f2849a;

        public final Button f2850b;

        public a(View view, Button button) {
            this.f2849a = view;
            this.f2850b = button;
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            DeviceDetailsActivity.this.v = false;
            View view = this.f2849a;
            if (z) {
                view.setVisibility(8);
                this.f2850b.setEnabled(true);
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.a(1, 0));
                DeviceDetailsActivity.this.t.f5172e.F = 1;
                return;
            }
            view.setVisibility(0);
            this.f2850b.setEnabled(false);
            DeviceDetailsActivity.this.t.a(d.e.a.t.h.a(0, 0));
            DeviceDetailsActivity.this.t.f5172e.F = 0;
        }
    }

    public class b implements View.OnClickListener {
        public b() {
        }

        @Override
        public void onClick(View view) {
            DeviceDetailsActivity deviceDetailsActivity = DeviceDetailsActivity.this;
            deviceDetailsActivity.v = true;
            deviceDetailsActivity.t.a(d.e.a.t.h.a(2, 0));
        }
    }

    public class c implements View.OnClickListener {
        public c() {
        }

        @Override
        public void onClick(View view) {
            if (DeviceDetailsActivity.this.t != null) {
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.d(1));
            }
            DeviceDetailsActivity.this.w.dismiss();
        }
    }

    public class d implements SwitchButton.d {

        public final View f2854a;

        public final TextView f2855b;

        public d(DeviceDetailsActivity deviceDetailsActivity, View view, TextView textView) {
            this.f2854a = view;
            this.f2855b = textView;
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            boolean z2;
            TextView textView;
            View view = this.f2854a;
            if (z) {
                view.setVisibility(8);
                textView = this.f2855b;
                z2 = true;
            } else {
                z2 = false;
                view.setVisibility(0);
                textView = this.f2855b;
            }
            textView.setClickable(z2);
        }
    }

    public class e implements SwitchButton.d {

        public final View f2856a;

        public final TextView f2857b;

        public e(DeviceDetailsActivity deviceDetailsActivity, View view, TextView textView) {
            this.f2856a = view;
            this.f2857b = textView;
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            boolean z2;
            TextView textView;
            View view = this.f2856a;
            if (z) {
                view.setVisibility(8);
                textView = this.f2857b;
                z2 = true;
            } else {
                z2 = false;
                view.setVisibility(0);
                textView = this.f2857b;
            }
            textView.setClickable(z2);
        }
    }

    public class f implements View.OnClickListener {

        public final TextView f2858b;

        public final int f2859c;

        public final int f2860d;

        public class a implements TimePickerDialog.OnTimeSetListener {
            public a() {
            }

            @Override
            public void onTimeSet(TimePicker timePicker, int i2, int i3) {
                f.this.f2858b.setText(y.a(y.b(i2 + ":" + i3, "H:m"), "HH:mm"));
            }
        }

        public f(TextView textView, int i2, int i3) {
            this.f2858b = textView;
            this.f2859c = i2;
            this.f2860d = i3;
        }

        @Override
        public void onClick(View view) {
            new TimePickerDialog(DeviceDetailsActivity.this, 3, new a(), this.f2859c, this.f2860d, true).show();
        }
    }

    public class g implements View.OnClickListener {

        public final TextView f2863b;

        public final int f2864c;

        public final int f2865d;

        public class a implements TimePickerDialog.OnTimeSetListener {
            public a() {
            }

            @Override
            public void onTimeSet(TimePicker timePicker, int i2, int i3) {
                g.this.f2863b.setText(y.a(y.b(i2 + ":" + i3, "H:m"), "HH:mm"));
            }
        }

        public g(TextView textView, int i2, int i3) {
            this.f2863b = textView;
            this.f2864c = i2;
            this.f2865d = i3;
        }

        @Override
        public void onClick(View view) {
            new TimePickerDialog(DeviceDetailsActivity.this, 3, new a(), this.f2864c, this.f2865d, true).show();
        }
    }

    public class h implements View.OnClickListener {

        public final TextView f2868b;

        public final TextView f2869c;

        public final SwitchButton f2870d;

        public final SwitchButton f2871e;

        public final d.a.a.f f2872f;

        public h(TextView textView, TextView textView2, SwitchButton switchButton, SwitchButton switchButton2, d.a.a.f fVar) {
            this.f2868b = textView;
            this.f2869c = textView2;
            this.f2870d = switchButton;
            this.f2871e = switchButton2;
            this.f2872f = fVar;
        }

        @Override
        public void onClick(View view) {
            Date b2 = y.b((String) this.f2868b.getText(), "HH:mm");
            Date b3 = y.b((String) this.f2869c.getText(), "HH:mm");
            boolean isChecked = this.f2870d.isChecked();
            boolean isChecked2 = this.f2871e.isChecked();
            int parseInt = Integer.parseInt(y.a(b2, "H"));
            int parseInt2 = Integer.parseInt(y.a(b2, "m"));
            int parseInt3 = Integer.parseInt(y.a(b3, "H"));
            int parseInt4 = Integer.parseInt(y.a(b3, "m"));
            n0 n0Var = DeviceDetailsActivity.this.t;
            if (n0Var != null) {
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.a(n0Var.f5172e.E, isChecked2 ? 1 : 0, isChecked ? 1 : 0, parseInt3, parseInt4, parseInt, parseInt2));
                d.e.a.t.f fVar = DeviceDetailsActivity.this.t.f5172e;
                fVar.z = isChecked ? 1 : 0;
                fVar.C = parseInt;
                fVar.D = parseInt2;
                fVar.y = isChecked2 ? 1 : 0;
                fVar.A = parseInt3;
                fVar.B = parseInt4;
            }
            this.f2872f.dismiss();
        }
    }

    public class i implements SwitchButton.d {

        public final EditText f2874a;

        public i(EditText editText) {
            this.f2874a = editText;
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            EditText editText;
            Resources resources;
            int i2;
            EditText editText2 = this.f2874a;
            if (z) {
                editText2.setEnabled(true);
                editText = this.f2874a;
                resources = DeviceDetailsActivity.this.getResources();
                i2 = 2131099719;
            } else {
                editText2.setEnabled(false);
                editText = this.f2874a;
                resources = DeviceDetailsActivity.this.getResources();
                i2 = 2131099722;
            }
            editText.setTextColor(resources.getColor(i2));
        }
    }

    public class j implements AdapterView.OnItemSelectedListener {

        public final RelativeLayout f2876b;

        public j(DeviceDetailsActivity deviceDetailsActivity, RelativeLayout relativeLayout) {
            this.f2876b = relativeLayout;
        }

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i2, long j2) {
            this.f2876b.setVisibility(i2 == 0 ? 4 : 0);
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    }

    public class k implements SeekBar.OnSeekBarChangeListener {
        public k() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
            DeviceDetailsActivity.this.mBrightText.setText(String.format("%d%%", Integer.valueOf((i2 * 10) + 50)));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        @SuppressLint({"LongLogTag"})
        public void onStopTrackingTouch(SeekBar seekBar) {
            int progress = seekBar.getProgress();
            if (DeviceDetailsActivity.this.t == null) {
                return;
            }
            DeviceDetailsActivity.this.t.a(d.e.a.t.h.c(progress));
        }
    }

    public class l implements SwitchButton.d {
        public l(DeviceDetailsActivity deviceDetailsActivity) {
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
        }
    }

    public class m implements SwitchButton.d {

        public final EditText f2878a;

        public final EditText f2879b;

        public m(EditText editText, EditText editText2) {
            this.f2878a = editText;
            this.f2879b = editText2;
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            boolean z2;
            EditText editText;
            Resources resources;
            int i2;
            EditText editText2 = this.f2878a;
            if (z) {
                z2 = true;
                editText2.setEnabled(true);
                editText = this.f2878a;
                resources = DeviceDetailsActivity.this.getResources();
                i2 = 2131099719;
            } else {
                z2 = false;
                editText2.setEnabled(false);
                editText = this.f2878a;
                resources = DeviceDetailsActivity.this.getResources();
                i2 = 2131099722;
            }
            editText.setTextColor(resources.getColor(i2));
            this.f2879b.setEnabled(z2);
            this.f2879b.setTextColor(DeviceDetailsActivity.this.getResources().getColor(i2));
        }
    }

    public class n implements SeekBar.OnSeekBarChangeListener {
        public n() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
            DeviceDetailsActivity.this.mAngleView.setValue((i2 - 360) / 2.0f);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        @SuppressLint({"LongLogTag"})
        public void onStopTrackingTouch(SeekBar seekBar) {
            if (DeviceDetailsActivity.this.t == null) {
                return;
            }
            int progress = seekBar.getProgress() - 360;
            if (progress < 0) {
                progress += 720;
            }
            DeviceDetailsActivity.this.t.a(d.e.a.t.h.a(progress));
            DeviceDetailsActivity.this.t.f5172e.H = progress;
        }
    }

    public class o implements SwitchButton.d {
        public o() {
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            n0 n0Var = DeviceDetailsActivity.this.t;
            if (n0Var == null) {
                return;
            }
            d.e.a.t.f fVar = n0Var.f5172e;
            if (z != fVar.E) {
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.a(z ? 1 : 0, fVar.y, fVar.z, fVar.A, fVar.B, fVar.C, fVar.D));
                DeviceDetailsActivity.this.t.f5172e.E = z ? 1 : 0;
            }
        }
    }

    public class p implements SwitchButton.d {
        public p() {
        }

        @Override
        public void a(SwitchButton switchButton, boolean z) {
            n0 n0Var = DeviceDetailsActivity.this.t;
            if (n0Var == null) {
                return;
            }
            ByteBuffer a2 = d.b.a.a.a.a(ByteBuffer.allocate(7), ByteOrder.LITTLE_ENDIAN, (byte) 104, (byte) 6, (short) 1);
            a2.putShort((short) d.b.a.a.a.a(a2, z ? (byte) 1 : (byte) 0, 0, 5));
            n0Var.a(a2.array());
            DeviceDetailsActivity deviceDetailsActivity = DeviceDetailsActivity.this;
            deviceDetailsActivity.t.f5172e.x = z ? 1 : 0;
            if (z) {
                f.b bVar = new f.b(deviceDetailsActivity.u);
                bVar.a(2131755141);
                bVar.b(2131755066);
                bVar.b();
            }
        }
    }

    public class q implements RadioGroup.OnCheckedChangeListener {
        public q() {
        }

        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i2) {
            int i3;
            n0 n0Var;
            if (i2 == DeviceDetailsActivity.this.mHLButton.getId()) {
                i3 = 0;
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.b(0));
                n0Var = DeviceDetailsActivity.this.t;
            } else {
                if (i2 != DeviceDetailsActivity.this.mTCButton.getId()) {
                    return;
                }
                i3 = 1;
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.b(1));
                n0Var = DeviceDetailsActivity.this.t;
            }
            n0Var.f5172e.J = i3;
        }
    }

    public class r implements View.OnClickListener {

        public final EditText f2885b;

        public final CheckBox f2886c;

        public final d.a.a.f f2887d;

        public r(EditText editText, CheckBox checkBox, d.a.a.f fVar) {
            this.f2885b = editText;
            this.f2886c = checkBox;
            this.f2887d = fVar;
        }

        @Override
        public void onClick(View view) {
            String obj = this.f2885b.getText().toString();
            if (obj == null || obj.isEmpty()) {
                y.e(2131755166);
                return;
            }
            boolean isChecked = this.f2886c.isChecked();
            ByteBuffer a2 = d.b.a.a.a.a(ByteBuffer.allocate(32), ByteOrder.LITTLE_ENDIAN, (byte) 104, (byte) 22, (short) 26);
            int i2 = 24;
            try {
                byte[] a3 = d.e.a.u.c.a(obj, 24);
                byte[] bArr = new byte[25];
                if (a3.length <= 24) {
                    i2 = a3.length;
                }
                System.arraycopy(a3, 0, bArr, 0, i2);
                a2.put(bArr);
                a2.put((byte) (isChecked ? 1 : 0));
            } catch (Exception e2) {
                d.b.a.a.a.a(e2, d.b.a.a.a.a("DeviceNameSetting: "), "Send");
            }
            a2.putShort((short) d.e.a.t.b.a(a2.array(), 0, 30));
            DeviceDetailsActivity.this.t.a(a2.array());
            DeviceDetailsActivity.this.mDeviceName.setText(obj);
            if (isChecked) {
                y.f(2131755154);
            }
            this.f2887d.dismiss();
        }
    }

    public class s implements View.OnClickListener {

        public final d.a.a.f f2889b;

        public s(d.a.a.f fVar) {
            this.f2889b = fVar;
        }

        @Override
        public void onClick(View view) {
            if (DeviceDetailsActivity.this.t != null) {
                ByteBuffer a2 = d.b.a.a.a.a(ByteBuffer.allocate(7), ByteOrder.LITTLE_ENDIAN, (byte) 104, (byte) 25, (short) 1);
                a2.putShort((short) d.b.a.a.a.a(a2, (byte) 85, 0, 5));
                DeviceDetailsActivity.this.t.a(a2.array());
            }
            this.f2889b.dismiss();
        }
    }

    public class t implements View.OnClickListener {

        public final d.a.a.f f2891b;

        public t(d.a.a.f fVar) {
            this.f2891b = fVar;
        }

        @Override
        public void onClick(View view) {
            if (DeviceDetailsActivity.this.t != null) {
                DeviceDetailsActivity.this.t.a(d.e.a.t.h.c(1, 0));
            }
            this.f2891b.dismiss();
        }
    }

    public class u implements SeekBar.OnSeekBarChangeListener {

        public final TextView f2893a;

        public u(TextView textView) {
            this.f2893a = textView;
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
            this.f2893a.setText(BuildConfig.FLAVOR + i2);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            int progress = seekBar.getProgress();
            if (DeviceDetailsActivity.this.t == null) {
                return;
            }
            DeviceDetailsActivity.this.t.a(d.e.a.t.h.a(3, progress));
            DeviceDetailsActivity.this.t.f5172e.G = progress;
        }
    }

    public static void a(RouterWifiInfoDao routerWifiInfoDao, List list, int i2, List list2, ListView listView, ListPopupWindow listPopupWindow, d.a.a.f fVar, d.a.a.b bVar) {
        routerWifiInfoDao.delete((RouterWifiInfo) list.get(i2));
        list2.remove(i2);
        ((ArrayAdapter) listView.getAdapter()).notifyDataSetChanged();
        if (list2.size() == 0) {
            listPopupWindow.dismiss();
        }
    }

    public static void a(List list, EditText editText, EditText editText2, ListPopupWindow listPopupWindow, AdapterView adapterView, View view, int i2, long j2) {
        String ssid = ((RouterWifiInfo) list.get(i2)).getSsid();
        String password = ((RouterWifiInfo) list.get(i2)).getPassword();
        editText.setText(ssid);
        editText.setSelection(ssid.length());
        editText2.setText(password);
        editText2.setSelection(password.length());
        listPopupWindow.dismiss();
    }

    public static boolean a(final EditText editText, final RouterWifiInfoDao routerWifiInfoDao, final Context context, final EditText editText2, View view, MotionEvent motionEvent) {
        if (motionEvent.getAction() == 1 && motionEvent.getX() >= editText.getWidth() - editText.getCompoundDrawables()[2].getBounds().width()) {
            l.a.b.k.f<RouterWifiInfo> queryBuilder = routerWifiInfoDao.queryBuilder();
            queryBuilder.a(RouterWifiInfoDao.Properties.Ssid);
            final List<RouterWifiInfo> b2 = queryBuilder.b();
            if (b2.size() > 0) {
                final ArrayList arrayList = new ArrayList(b2.size());
                for (int i2 = 0; i2 < b2.size(); i2++) {
                    arrayList.add(String.format("%s / %s", b2.get(i2).getSsid(), b2.get(i2).getPassword()));
                }
                final ListPopupWindow listPopupWindow = new ListPopupWindow(context);
                listPopupWindow.setBackgroundDrawable(new ColorDrawable(context.getResources().getColor(2131099714)));
                listPopupWindow.setAdapter(new ArrayAdapter(context, R.layout.simple_list_item_1, arrayList));
                listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public final void onItemClick(AdapterView adapterView, View view2, int i3, long j2) {
                        DeviceDetailsActivity.a(b2, editText, editText2, listPopupWindow, adapterView, view2, i3, j2);
                    }
                });
                listPopupWindow.setAnchorView(editText);
                listPopupWindow.setModal(true);
                listPopupWindow.show();
                final ListView listView = listPopupWindow.getListView();
                if (listView != null) {
                    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                        @Override
                        public final boolean onItemLongClick(AdapterView adapterView, View view2, int i3, long j2) {
                            DeviceDetailsActivity.a(context, routerWifiInfoDao, b2, arrayList, listView, listPopupWindow, adapterView, view2, i3, j2);
                            return true;
                        }
                    });
                }
                return true;
            }
        }
        return false;
    }

    public void a(float f2) {
        if (this.t == null) {
            return;
        }
        int i2 = (int) (f2 * 2.0f);
        if (i2 < 0) {
            i2 += 720;
        }
        this.t.a(d.e.a.t.h.a(i2));
        this.t.f5172e.H = i2;
    }

    public void b(Context context) {
        if (this.t == null) {
            return;
        }
        String string = context.getResources().getString(2131755173, this.t.f5172e.f5363d);
        f.b bVar = new f.b(context);
        bVar.d(2131755127);
        bVar.a(string);
        bVar.M = false;
        bVar.c(2131755081);
        bVar.b(2131755041);
        d.a.a.f fVar = new d.a.a.f(bVar);
        fVar.a(d.a.a.b.POSITIVE).setOnClickListener(new t(fVar));
        fVar.show();
    }

    @SuppressLint({"WrongConstant"})
    public void c(Context context) {
        if (this.t == null) {
            return;
        }
        f.b bVar = new f.b(context);
        bVar.d(2131755134);
        bVar.a(2131492939, true);
        bVar.c(2131755081);
        bVar.b(2131755041);
        final d.a.a.f fVar = new d.a.a.f(bVar);
        final SwitchButton switchButton = (SwitchButton) fVar.f3751d.s.findViewById(2131296788);
        final Spinner spinner = (Spinner) fVar.f3751d.s.findViewById(2131296514);
        RelativeLayout relativeLayout = (RelativeLayout) fVar.f3751d.s.findViewById(2131296781);
        ArrayAdapter arrayAdapter = new ArrayAdapter(this, 2131492972, getResources().getStringArray(2130903041));
        arrayAdapter.setDropDownViewResource(2131492971);
        spinner.setOnItemSelectedListener(new j(this, relativeLayout));
        spinner.setAdapter((SpinnerAdapter) arrayAdapter);
        spinner.setSelection(0);
        switchButton.setOnCheckedChangeListener(new l(this));
        fVar.a(d.a.a.b.POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DeviceDetailsActivity.this.a(spinner, switchButton, fVar, view);
            }
        });
        spinner.setSelection(this.t.f5172e.O);
        switchButton.setChecked(this.t.f5172e.N == 1);
        if (spinner.getSelectedItemPosition() == 0) {
            relativeLayout.setVisibility(4);
        } else {
            relativeLayout.setVisibility(0);
        }
        fVar.show();
    }

    @SuppressLint({"ClickableViewAccessibility", "LongLogTag"})
    public void d(final Context context) {
        if (this.t == null) {
            return;
        }
        final RouterWifiInfoDao routerWifiInfoDao = App.f2838g.c().getRouterWifiInfoDao();
        f.b bVar = new f.b(context);
        bVar.d(2131755274);
        bVar.a(2131492931, true);
        bVar.c(2131755081);
        bVar.b(2131755041);
        final d.a.a.f fVar = new d.a.a.f(bVar);
        final SwitchButton switchButton = (SwitchButton) fVar.f3751d.s.findViewById(2131296699);
        final EditText editText = (EditText) fVar.f3751d.s.findViewById(2131296700);
        final EditText editText2 = (EditText) fVar.f3751d.s.findViewById(2131296702);
        switchButton.setOnCheckedChangeListener(new m(editText, editText2));
        editText2.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                return DeviceDetailsActivity.a(editText2, routerWifiInfoDao, context, editText, view, motionEvent);
            }
        });
        fVar.a(d.a.a.b.POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DeviceDetailsActivity.this.a(editText2, editText, switchButton, fVar, routerWifiInfoDao, view);
            }
        });
        editText2.setText(this.t.f5172e.s);
        editText.setText(this.t.f5172e.t);
        switchButton.setChecked(this.t.f5172e.v == 1);
        if (!switchButton.isChecked()) {
            editText.setEnabled(false);
            editText.setTextColor(getResources().getColor(2131099722));
            editText2.setEnabled(false);
            editText2.setTextColor(getResources().getColor(2131099722));
        }
        fVar.show();
    }

    @SuppressLint({"WrongConstant"})
    public void e(final Context context) {
        if (this.t == null) {
            return;
        }
        f.b bVar = new f.b(context);
        bVar.d(2131755278);
        bVar.a(2131492941, true);
        bVar.c(2131755081);
        bVar.b(2131755041);
        final d.a.a.f fVar = new d.a.a.f(bVar);
        final SwitchButton switchButton = (SwitchButton) fVar.f3751d.s.findViewById(2131296574);
        final EditText editText = (EditText) fVar.f3751d.s.findViewById(2131296573);
        switchButton.setOnCheckedChangeListener(new i(editText));
        fVar.a(d.a.a.b.POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                DeviceDetailsActivity.this.a(editText, context, switchButton, fVar, view);
            }
        });
        editText.setText(this.t.f5172e.u);
        switchButton.setChecked(this.t.f5172e.w == 1);
        if (!switchButton.isChecked()) {
            editText.setEnabled(false);
            editText.setTextColor(getResources().getColor(2131099722));
        }
        fVar.show();
    }

    public void f(Context context) {
        if (this.t == null) {
            return;
        }
        this.t.a(d.e.a.t.h.d(0));
        f.b bVar = new f.b(context);
        bVar.d(2131755139);
        bVar.a(2131755178);
        bVar.M = false;
        bVar.c(2131755177);
        this.w = new d.a.a.f(bVar);
        this.w.a(d.a.a.b.POSITIVE).setOnClickListener(new c());
        this.w.show();
    }

    public void g(Context context) {
        if (this.t == null) {
            return;
        }
        f.b bVar = new f.b(context);
        bVar.d(2131755152);
        bVar.a(2131492932, true);
        bVar.c(2131755081);
        bVar.b(2131755041);
        bVar.M = true;
        d.a.a.f fVar = new d.a.a.f(bVar);
        EditText editText = (EditText) fVar.f3751d.s.findViewById(2131296810);
        CheckBox checkBox = (CheckBox) fVar.f3751d.s.findViewById(2131296385);
        editText.setText(this.t.f5172e.f5363d);
        fVar.a(d.a.a.b.POSITIVE).setOnClickListener(new r(editText, checkBox, fVar));
        fVar.show();
    }

    public void h(Context context) {
        if (this.t == null) {
            return;
        }
        f.b bVar = new f.b(context);
        bVar.d(2131755142);
        bVar.a(2131755179);
        bVar.M = false;
        bVar.c(2131755081);
        bVar.b(2131755041);
        d.a.a.f fVar = new d.a.a.f(bVar);
        fVar.a(d.a.a.b.POSITIVE).setOnClickListener(new s(fVar));
        fVar.show();
    }

    public void i(Context context) {
        TextView textView;
        n0 n0Var = this.t;
        if (n0Var == null) {
            return;
        }
        d.e.a.t.f fVar = n0Var.f5172e;
        int i2 = fVar.z;
        int i3 = fVar.y;
        int i4 = fVar.C;
        int i5 = fVar.D;
        int i6 = fVar.A;
        int i7 = fVar.B;
        f.b bVar = new f.b(context);
        bVar.d(2131755143);
        bVar.a(2131492942, true);
        bVar.c(2131755081);
        bVar.b(2131755041);
        d.a.a.f fVar2 = new d.a.a.f(bVar);
        SwitchButton switchButton = (SwitchButton) fVar2.f3751d.s.findViewById(2131296784);
        SwitchButton switchButton2 = (SwitchButton) fVar2.f3751d.s.findViewById(2131296783);
        TextView textView2 = (TextView) fVar2.f3751d.s.findViewById(2131296821);
        TextView textView3 = (TextView) fVar2.f3751d.s.findViewById(2131296820);
        View findViewById = fVar2.f3751d.s.findViewById(2131296733);
        View findViewById2 = fVar2.f3751d.s.findViewById(2131296732);
        switchButton.setOnCheckedChangeListener(new d(this, findViewById, textView2));
        switchButton2.setOnCheckedChangeListener(new e(this, findViewById2, textView3));
        textView2.setOnClickListener(new f(textView2, i4, i5));
        textView3.setOnClickListener(new g(textView3, i6, i7));
        fVar2.a(d.a.a.b.POSITIVE).setOnClickListener(new h(textView2, textView3, switchButton, switchButton2, fVar2));
        boolean z = false;
        switchButton.setChecked(i2 == 1);
        switchButton2.setChecked(i3 == 1);
        findViewById.setVisibility(i2 == 1 ? 8 : 0);
        findViewById2.setVisibility(i3 != 1 ? 0 : 8);
        textView2.setClickable(i2 == 1);
        if (i3 == 1) {
            textView = textView3;
            z = true;
        } else {
            textView = textView3;
        }
        textView.setClickable(z);
        textView2.setText(y.a(y.b(i4 + ":" + i5, "H:m"), "HH:mm"));
        textView.setText(y.a(y.b(i6 + ":" + i7, "H:m"), "HH:mm"));
        fVar2.show();
    }

    @l.a.a.m(threadMode = ThreadMode.MAIN)
    @SuppressLint({"WrongConstant"})
    public void onBusEvent(p0 p0Var) {
        int i2;
        String str = p0Var.f5197a;
        if (str.equals("matchcode")) {
            int intValue = ((Integer) p0Var.f5199c).intValue();
            if (intValue == 0) {
                return;
            }
            d.a.a.f fVar = this.w;
            if (fVar != null && fVar.isShowing()) {
                this.w.dismiss();
            }
            y.e(getString(intValue == 2 ? 2131755246 : 2131755245));
            return;
        }
        if (str.equals("blevolume") && this.v) {
            i2 = 2131755102;
        } else if (str.equals("deviceclear")) {
            i2 = 2131755119;
        } else if (!str.equals("devicereset")) {
            return;
        } else {
            i2 = 2131755324;
        }
        y.f(i2);
    }

    public void onClick(View view) {
        n0 n0Var = this.t;
        if (n0Var == null) {
        }
        d.e.a.t.f fVar = n0Var.f5172e;
        switch (view.getId()) {
            case 2131296352:
                if (!App.h()) {
                    d.e.a.t.f fVar2 = this.t.f5172e;
                    if (fVar2.O > 0 && fVar2.N != 1) {
                        y.e(2131755146);
                        break;
                    } else {
                        a((Context) this);
                        break;
                    }
                }
                break;
            case 2131296399:
                if (!App.h()) {
                    b(this);
                    break;
                }
                break;
            case 2131296418:
                if (!App.h()) {
                    d(this);
                    break;
                }
                break;
            case 2131296444:
                if (!App.h()) {
                    g(this);
                    break;
                }
                break;
            case 2131296581:
                f(this);
                break;
            case 2131296692:
                if (!App.h()) {
                    h(this);
                    break;
                }
                break;
            case 2131296729:
                if (!App.h()) {
                    c(this);
                    break;
                }
                break;
            case 2131296730:
                if (!App.h()) {
                    e(this);
                    break;
                }
                break;
            case 2131296831:
                i(this);
                break;
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        RadioButton radioButton;
        String action;
        super.onCreate(bundle);
        setContentView(2131492895);
        ButterKnife.a(this);
        this.u = this;
        this.mSwipeRefresh.setEnabled(false);
        Intent intent = getIntent();
        if (intent != null && (action = intent.getAction()) != null) {
            char c2 = 65535;
            if (action.hashCode() == 741055000 && action.equals("com.xddzkj.rainbowifi.action.SHOW_DEVICE")) {
                c2 = 0;
            }
            if (c2 == 0) {
                this.s = intent.getStringExtra("com.xddzkj.rainbowifi.extra.DEVICE_ADDRESS");
                String str = this.s;
                if (str == null) {
                    throw new NullPointerException("Device address should not be null!");
                }
                this.t = UdpService.f3079f.get(str);
            }
        }
        this.mBrightSeekBar.setOnSeekBarChangeListener(new k());
        this.mAngleSeekBar.setOnSeekBarChangeListener(new n());
        this.mAngleView.setOnValueChangeListener(new AngleView.a() {
            @Override
            public final void a(float f2) {
                DeviceDetailsActivity.this.a(f2);
            }
        });
        this.autoOn.setOnCheckedChangeListener(new o());
        this.mOtherControl.setOnCheckedChangeListener(new p());
        this.mRadioGroup.setOnCheckedChangeListener(new q());
        l.a.a.c.c().b(this);
        n0 n0Var = this.t;
        if (n0Var != null) {
            d.e.a.t.f fVar = n0Var.f5172e;
            d.e.a.t.c cVar = n0Var.r;
            int i2 = fVar.I;
            this.mBrightText.setText(String.format("%d%%", Integer.valueOf((i2 * 10) + 50)));
            this.mBrightSeekBar.setProgress(i2);
            int i3 = fVar.H;
            if (i3 > 360) {
                i3 -= 720;
            }
            StringBuilder a2 = d.b.a.a.a.a("onCreate: :");
            a2.append(fVar.E);
            Log.d("wyt DeviceDetails", a2.toString());
            this.autoOn.setChecked(fVar.E == 1);
            this.mAngleView.setValue(i3 / 2.0f);
            this.mAngleSeekBar.setProgress(i3 + 360);
            this.mDeviceName.setText(fVar.f5363d);
            this.mFirmwareVersion.setText(getResources().getString(2131755132, (cVar.f5345a / 100) + "." + ((cVar.f5345a % 100) / 10) + "." + (cVar.f5345a % 10)));
            this.mMacAddress.setText(getResources().getString(2131755138, fVar.f5362c));
            this.mCapacity.setText(getResources().getString(2131755125, String.format("%.1f", Double.valueOf((((double) fVar.f5361b) * 100.0d) / ((double) fVar.f5360a)))));
            this.mModel.setText(getResources().getString(2131755129, fVar.f5367h));
            this.mStatus.setText(getResources().getString(2131755131, this.t.f5180m + BuildConfig.FLAVOR));
            this.mHotspot.setText(getResources().getString(2131755135, this.t.f5172e.r));
            this.mOtherControl.setChecked(fVar.x == 1);
            if (fVar.f5369j == 1) {
                this.mAutoOnShade.setVisibility(0);
            }
            if (fVar.f5370k == 1) {
                this.mTimingSwitchShade.setVisibility(0);
            }
            if (fVar.p == 1) {
                this.mRouterShade.setVisibility(0);
            }
            if (fVar.f5373n == 1) {
                this.mSyncShade.setVisibility(0);
            }
            if (fVar.o == 1) {
                this.mRemoteShade.setVisibility(0);
            }
            if (fVar.q == 1) {
                this.mVoiceShade.setVisibility(0);
            }
            int i4 = fVar.J;
            if (i4 == 0) {
                radioButton = this.mHLButton;
            } else if (i4 != 1) {
                return;
            } else {
                radioButton = this.mTCButton;
            }
            radioButton.setChecked(true);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        l.a.a.c.c().c(this);
    }

    public void onviewClick(View view) {
    }

    public void a(Spinner spinner, SwitchButton switchButton, d.a.a.f fVar, View view) {
        int selectedItemPosition = spinner.getSelectedItemPosition();
        n0 n0Var = this.t;
        if (n0Var != null) {
            if (selectedItemPosition == 0) {
                n0Var.f5172e.N = 0;
            } else {
                n0Var.f5172e.N = switchButton.isChecked() ? 1 : 0;
            }
            d.e.a.t.f fVar2 = this.t.f5172e;
            fVar2.O = selectedItemPosition;
            int i2 = fVar2.O;
            int i3 = fVar2.N;
            ByteBuffer a2 = d.b.a.a.a.a(ByteBuffer.allocate(8), ByteOrder.LITTLE_ENDIAN, (byte) 104, (byte) 81, (short) 2);
            a2.put((byte) i2);
            a2.putShort((short) d.b.a.a.a.a(a2, (byte) i3, 0, 6));
            this.t.a(a2.array());
        }
        fVar.dismiss();
    }

    public static boolean a(Context context, final RouterWifiInfoDao routerWifiInfoDao, final List list, final List list2, final ListView listView, final ListPopupWindow listPopupWindow, AdapterView adapterView, View view, final int i2, long j2) {
        f.b bVar = new f.b(context);
        bVar.a(2131755272);
        bVar.c(2131755081);
        bVar.b(2131755041);
        bVar.A = new f.k() {
            @Override
            public final void a(d.a.a.f fVar, d.a.a.b bVar2) {
                DeviceDetailsActivity.a(RouterWifiInfoDao.this, list, i2, list2, listView, listPopupWindow, fVar, bVar2);
            }
        };
        bVar.b();
        return true;
    }

    public void a(EditText editText, EditText editText2, SwitchButton switchButton, d.a.a.f fVar, RouterWifiInfoDao routerWifiInfoDao, View view) {
        String obj = editText.getText().toString();
        String obj2 = editText2.getText().toString();
        switchButton.isChecked();
        if (obj.equals(BuildConfig.FLAVOR)) {
            y.e(2131755290);
            return;
        }
        if (obj2.equals(BuildConfig.FLAVOR)) {
            y.e(2131755289);
            return;
        }
        if (this.t != null) {
            this.t.a(d.e.a.t.h.a(switchButton.isChecked() ? 1 : 0, obj, obj2));
            this.t.f5172e.v = switchButton.isChecked() ? 1 : 0;
            d.e.a.t.f fVar2 = this.t.f5172e;
            fVar2.s = obj;
            fVar2.t = obj2;
            y.f(2131755338);
        }
        fVar.dismiss();
        l.a.b.k.f<RouterWifiInfo> queryBuilder = routerWifiInfoDao.queryBuilder();
        queryBuilder.a(RouterWifiInfoDao.Properties.Ssid.a(obj), new l.a.b.k.h[0]);
        List<RouterWifiInfo> a2 = queryBuilder.a().a();
        if (a2.size() > 0) {
            for (int i2 = 0; i2 < a2.size(); i2++) {
                if (a2.get(i2).getPassword().equals(obj2)) {
                    return;
                }
            }
        }
        routerWifiInfoDao.insert(new RouterWifiInfo(obj, obj2));
    }

    public void a(EditText editText, Context context, SwitchButton switchButton, d.a.a.f fVar, View view) {
        String obj = editText.getText().toString();
        int i2 = 8;
        if (obj.getBytes(Charset.forName("UTF-8")).length != 8) {
            y.e(context.getResources().getString(2131755049));
            return;
        }
        if (this.t != null) {
            boolean isChecked = switchButton.isChecked();
            ByteBuffer a2 = d.b.a.a.a.a(ByteBuffer.allocate(16), ByteOrder.LITTLE_ENDIAN, (byte) 104, (byte) 5, (short) 10);
            a2.put(isChecked ? (byte) 1 : (byte) 0);
            try {
                byte[] bytes = obj.getBytes("UTF-8");
                byte[] bArr = new byte[9];
                if (bytes.length <= 8) {
                    i2 = bytes.length;
                }
                System.arraycopy(bytes, 0, bArr, 0, i2);
                a2.put(bArr);
            } catch (Exception e2) {
                d.b.a.a.a.a(e2, d.b.a.a.a.a("UdpCheck: "), "Send");
            }
            a2.putShort((short) d.e.a.t.b.a(a2.array(), 0, 14));
            this.t.a(a2.array());
        }
        fVar.dismiss();
    }

    public void a(Context context) {
        if (this.t == null) {
            return;
        }
        f.b bVar = new f.b(context);
        bVar.d(2131755123);
        bVar.a(2131492926, true);
        bVar.L = true;
        bVar.M = true;
        d.a.a.f fVar = new d.a.a.f(bVar);
        View findViewById = fVar.f3751d.s.findViewById(2131296353);
        SwitchButton switchButton = (SwitchButton) fVar.f3751d.s.findViewById(2131296351);
        Button button = (Button) fVar.f3751d.s.findViewById(2131296350);
        SeekBar seekBar = (SeekBar) fVar.f3751d.s.findViewById(2131296882);
        TextView textView = (TextView) fVar.f3751d.s.findViewById(2131296881);
        seekBar.setProgress(this.t.f5172e.G);
        textView.setText(BuildConfig.FLAVOR + this.t.f5172e.G);
        seekBar.setOnSeekBarChangeListener(new u(textView));
        switchButton.setOnCheckedChangeListener(new a(findViewById, button));
        button.setOnClickListener(new b());
        boolean z = this.t.f5172e.F == 1;
        switchButton.setChecked(z);
        findViewById.setVisibility(z ? 8 : 0);
        button.setEnabled(z);
        fVar.show();
    }
}