导航菜单

页面标题

页面副标题

SpinDisplay v2.0.2.6 - GroupDetailsActivity.java 源代码

正在查看: SpinDisplay v2.0.2.6 应用的 GroupDetailsActivity.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.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListPopupWindow;
import android.widget.ListView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.TimePicker;
import b.u.y;
import butterknife.ButterKnife;
import com.dmz.f20ad.App;
import com.dmz.f20ad.activity.GroupDetailsActivity;
import com.dmz.f20ad.connect.UdpService;
import com.dmz.f20ad.model.RouterWifiInfo;
import com.dmz.f20ad.model.RouterWifiInfoDao;
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.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import l.a.a.m;
import me.zhanghai.android.materialprogressbar.BuildConfig;
import org.greenrobot.eventbus.ThreadMode;

public class GroupDetailsActivity extends r2 {
    public SwitchButton autoOn;
    public View mAutoOnShade;
    public TextView mBleVolume;
    public SeekBar mBrightSeekBar;
    public TextView mBrightText;
    public TextView mTimingOnOff;
    public View mTimingSwitchShade;
    public View mVoiceShade;
    public List<n0> s = new ArrayList();
    public boolean t = false;
    public n0 u = null;

    public class a implements SwitchButton.d {

        public final EditText f2923a;

        public final EditText f2924b;

        public a(EditText editText, EditText editText2) {
            this.f2923a = editText;
            this.f2924b = editText2;
        }

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

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

        @Override
        public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
            GroupDetailsActivity.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) {
            byte[] c2 = d.e.a.t.h.c(seekBar.getProgress());
            Iterator<n0> it2 = GroupDetailsActivity.this.s.iterator();
            while (it2.hasNext()) {
                it2.next().a(c2);
            }
        }
    }

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

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

    public class d implements SwitchButton.d {

        public final View f2928a;

        public final Button f2929b;

        public d(View view, Button button) {
            this.f2928a = view;
            this.f2929b = button;
        }

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

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

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

    public class f implements SwitchButton.d {

        public final View f2932a;

        public final TextView f2933b;

        public f(GroupDetailsActivity groupDetailsActivity, View view, TextView textView) {
            this.f2932a = view;
            this.f2933b = textView;
        }

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

    public class g implements SwitchButton.d {

        public final View f2934a;

        public final TextView f2935b;

        public g(GroupDetailsActivity groupDetailsActivity, View view, TextView textView) {
            this.f2934a = view;
            this.f2935b = textView;
        }

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

    public class h implements View.OnClickListener {

        public final TextView f2936b;

        public final int f2937c;

        public final int f2938d;

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

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

        public h(TextView textView, int i2, int i3) {
            this.f2936b = textView;
            this.f2937c = i2;
            this.f2938d = i3;
        }

        @Override
        public void onClick(View view) {
            new TimePickerDialog(GroupDetailsActivity.this, 3, new a(), this.f2937c, this.f2938d, true).show();
        }
    }

    public class i implements View.OnClickListener {

        public final TextView f2941b;

        public final int f2942c;

        public final int f2943d;

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

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

        public i(TextView textView, int i2, int i3) {
            this.f2941b = textView;
            this.f2942c = i2;
            this.f2943d = i3;
        }

        @Override
        public void onClick(View view) {
            new TimePickerDialog(GroupDetailsActivity.this, 3, new a(), this.f2942c, this.f2943d, true).show();
        }
    }

    public class j implements View.OnClickListener {

        public final TextView f2946b;

        public final TextView f2947c;

        public final SwitchButton f2948d;

        public final SwitchButton f2949e;

        public final d.a.a.f f2950f;

        public j(TextView textView, TextView textView2, SwitchButton switchButton, SwitchButton switchButton2, d.a.a.f fVar) {
            this.f2946b = textView;
            this.f2947c = textView2;
            this.f2948d = switchButton;
            this.f2949e = switchButton2;
            this.f2950f = fVar;
        }

        @Override
        public void onClick(View view) {
            Date b2 = y.b((String) this.f2946b.getText(), "HH:mm");
            Date b3 = y.b((String) this.f2947c.getText(), "HH:mm");
            boolean isChecked = this.f2948d.isChecked();
            boolean isChecked2 = this.f2949e.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"));
            for (n0 n0Var : GroupDetailsActivity.this.s) {
                n0Var.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 = n0Var.f5172e;
                fVar.z = isChecked ? 1 : 0;
                fVar.C = parseInt;
                fVar.D = parseInt2;
                fVar.y = isChecked2 ? 1 : 0;
                fVar.A = parseInt3;
                fVar.B = parseInt4;
            }
            this.f2950f.dismiss();
        }
    }

    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(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) {
                GroupDetailsActivity.a(RouterWifiInfoDao.this, list, i2, list2, listView, listPopupWindow, fVar, bVar2);
            }
        };
        bVar.b();
        return true;
    }

    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) {
                        GroupDetailsActivity.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) {
                            GroupDetailsActivity.a(context, routerWifiInfoDao, b2, arrayList, listView, listPopupWindow, adapterView, view2, i3, j2);
                            return true;
                        }
                    });
                }
                return true;
            }
        }
        return false;
    }

    @SuppressLint({"ClickableViewAccessibility", "LongLogTag"})
    public void b(final Context context) {
        this.u = null;
        Iterator<n0> it2 = this.s.iterator();
        while (true) {
            if (!it2.hasNext()) {
                break;
            }
            n0 next = it2.next();
            if (next.f5172e.N == 1) {
                this.u = next;
                break;
            }
        }
        if (this.u == null) {
            this.u = this.s.get(0);
        }
        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 a(editText, editText2));
        editText2.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                return GroupDetailsActivity.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) {
                GroupDetailsActivity.this.a(editText2, editText, switchButton, fVar, routerWifiInfoDao, view);
            }
        });
        editText2.setText(this.u.f5172e.s);
        editText.setText(this.u.f5172e.t);
        switchButton.setChecked(this.u.f5172e.v == 1);
        if (!switchButton.isChecked()) {
            editText.setEnabled(false);
            editText.setTextColor(getResources().getColor(2131099722));
            editText2.setEnabled(false);
            editText2.setTextColor(getResources().getColor(2131099722));
        }
        fVar.show();
    }

    public void c(Context context) {
        TextView textView;
        boolean z;
        this.u = null;
        Iterator<n0> it2 = this.s.iterator();
        while (true) {
            if (!it2.hasNext()) {
                break;
            }
            n0 next = it2.next();
            if (next.f5172e.N == 1) {
                this.u = next;
                break;
            }
        }
        if (this.u == null) {
            this.u = this.s.get(0);
        }
        d.e.a.t.f fVar = this.u.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 f(this, findViewById, textView2));
        switchButton2.setOnCheckedChangeListener(new g(this, findViewById2, textView3));
        textView2.setOnClickListener(new h(textView2, i4, i5));
        textView3.setOnClickListener(new i(textView3, i6, i7));
        fVar2.a(d.a.a.b.POSITIVE).setOnClickListener(new j(textView2, textView3, switchButton, switchButton2, fVar2));
        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;
            z = false;
        }
        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();
    }

    @m(threadMode = ThreadMode.MAIN)
    public void onBusEvent(p0 p0Var) {
        if (p0Var.f5197a.equals("blevolume") && this.t) {
            y.f(2131755102);
        }
    }

    public void onClick(View view) {
        int i2;
        String string;
        switch (view.getId()) {
            case 2131296352:
                a((Context) this);
                break;
            case 2131296418:
                if (!App.h()) {
                    b(this);
                    break;
                }
                break;
            case 2131296787:
                ArrayList arrayList = new ArrayList();
                List<d.e.a.t.e> list = arrayList;
                int i3 = 0;
                for (n0 n0Var : this.s) {
                    if (n0Var.f5172e.N == 1) {
                        i3++;
                        list = n0Var.p;
                    }
                }
                if (i3 == 0) {
                    i2 = 2131755220;
                } else if (i3 > 1) {
                    i2 = 2131755221;
                } else {
                    for (n0 n0Var2 : this.s) {
                        if (n0Var2.p.size() != list.size()) {
                            string = getResources().getString(2131755218, n0Var2.f5172e.f5363d);
                        } else {
                            List<d.e.a.t.e> list2 = n0Var2.p;
                            for (int i4 = 0; i4 < list.size(); i4++) {
                                if (list2.get(i4).f5355c != list.get(i4).f5355c) {
                                    string = getResources().getString(2131755219, list2.get(i4).f5353a);
                                }
                            }
                        }
                        y.d(string);
                        break;
                    }
                    i2 = 2131755222;
                }
                y.e(i2);
                break;
            case 2131296831:
                c(this);
                break;
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131492897);
        String[] stringArrayExtra = getIntent().getStringArrayExtra("com.dmz.f20ad.extra.group.devices");
        HashMap<String, n0> hashMap = UdpService.f3079f;
        for (String str : stringArrayExtra) {
            if (hashMap.containsKey(str)) {
                this.s.add(hashMap.get(str));
            }
        }
        ButterKnife.a(this);
        l.a.a.c.c().b(this);
        this.mBrightSeekBar.setOnSeekBarChangeListener(new b());
        this.autoOn.setOnCheckedChangeListener(new c());
        this.u = null;
        Iterator<n0> it2 = this.s.iterator();
        while (true) {
            if (!it2.hasNext()) {
                break;
            }
            n0 next = it2.next();
            if (next.f5172e.N == 1) {
                this.u = next;
                break;
            }
        }
        if (this.u == null) {
            this.u = this.s.get(0);
        }
        d.e.a.t.f fVar = this.u.f5172e;
        int i2 = fVar.I;
        this.mBrightText.setText(String.format("%d%%", Integer.valueOf((i2 * 10) + 50)));
        this.mBrightSeekBar.setProgress(i2);
        this.autoOn.setChecked(fVar.E == 1);
        if (fVar.f5369j == 1) {
            this.mAutoOnShade.setVisibility(0);
        }
        if (fVar.f5370k == 1) {
            this.mTimingSwitchShade.setVisibility(0);
        }
        if (fVar.q == 1) {
            this.mVoiceShade.setVisibility(0);
        }
    }

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

    public void onviewClick(View view) {
    }

    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;
        }
        byte[] a2 = d.e.a.t.h.a(switchButton.isChecked() ? 1 : 0, obj, obj2);
        for (n0 n0Var : this.s) {
            n0Var.a(a2);
            n0Var.f5172e.v = switchButton.isChecked() ? 1 : 0;
            d.e.a.t.f fVar2 = n0Var.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> a3 = queryBuilder.a().a();
        if (a3.size() > 0) {
            for (int i2 = 0; i2 < a3.size(); i2++) {
                if (a3.get(i2).getPassword().equals(obj2)) {
                    return;
                }
            }
        }
        routerWifiInfoDao.insert(new RouterWifiInfo(obj, obj2));
    }

    public void a(Context context) {
        this.u = null;
        Iterator<n0> it2 = this.s.iterator();
        while (true) {
            if (!it2.hasNext()) {
                break;
            }
            n0 next = it2.next();
            if (next.f5172e.N == 1) {
                this.u = next;
                break;
            }
        }
        if (this.u == null) {
            this.u = this.s.get(0);
        }
        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);
        switchButton.setOnCheckedChangeListener(new d(findViewById, button));
        button.setOnClickListener(new e());
        boolean z = this.u.f5172e.F == 1;
        switchButton.setChecked(z);
        findViewById.setVisibility(z ? 8 : 0);
        button.setEnabled(z);
        fVar.show();
    }
}