// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.oliodevices.assist.app.views; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import butterknife.ButterKnife; import com.oliodevices.assist.app.core.RulesUtil; import java.util.ArrayList; import java.util.List; // Referenced classes of package com.oliodevices.assist.app.views: // RuleOption public class RuleSelectionView extends LinearLayout { LinearLayout mColumn1; LinearLayout mColumn2; public RuleSelectionView(Context context) { this(context, null, 0); } public RuleSelectionView(Context context, AttributeSet attributeset) { this(context, attributeset, 0); } public RuleSelectionView(Context context, AttributeSet attributeset, int i) { super(context, attributeset, i); setOrientation(0); setBaselineAligned(false); LayoutInflater.from(context).inflate(0x7f03006c, this, true); ButterKnife.inject(this); } private void resetTokenStates(ViewGroup viewgroup, TextView textview) { int i = 0; while (i < viewgroup.getChildCount()) { TextView textview1 = (TextView)viewgroup.getChildAt(i); if (textview1 != textview) { boolean flag; if (!textview.isSelected()) { flag = true; } else { flag = false; } textview1.setEnabled(flag); if (textview.isSelected()) { textview1.setSelected(false); } } i++; } } private void updateTokenStates(ViewGroup viewgroup, TextView textview) { int i = 0; while (i < viewgroup.getChildCount()) { TextView textview1 = (TextView)viewgroup.getChildAt(i); if (textview1 != textview) { RuleOption ruleoption = (RuleOption)textview.getTag(); RuleOption ruleoption1 = (RuleOption)textview1.getTag(); if (ruleoption.type > 0 && ruleoption.type == ruleoption1.type) { boolean flag; if (!textview.isSelected()) { flag = true; } else { flag = false; } textview1.setEnabled(flag); } } i++; } } public ArrayList getSelectedOptions() { ArrayList arraylist = new ArrayList(); int i = 0; while (i < mColumn1.getChildCount() + mColumn2.getChildCount()) { Object obj; if (i % 2 == 0) { obj = mColumn1; } else { obj = mColumn2; } obj = ((ViewGroup) (obj)).getChildAt(i / 2); if (((View) (obj)).isSelected()) { arraylist.add((RuleOption)((View) (obj)).getTag()); } i++; } return arraylist; } public void setOptions(List list) { int i = 0; while (i < list.size()) { final RuleOption ruleOption = (RuleOption)list.get(i); LinearLayout linearlayout; TextView textview; if (i % 2 == 0) { linearlayout = mColumn1; } else { linearlayout = mColumn2; } textview = (TextView)LayoutInflater.from(getContext()).inflate(0x7f03006b, linearlayout, false); linearlayout.addView(textview); textview.setText(RulesUtil.getLabelForOptionString(getResources(), ruleOption.string)); textview.setBackground(RulesUtil.getDrawableForOptionString(getResources(), ruleOption.string)); textview.setTag(ruleOption); textview.setOnClickListener(new android.view.View.OnClickListener() { final RuleSelectionView this$0; final RuleOption val$ruleOption; public void onClick(View view) { view = (TextView)view; boolean flag; if (!view.isSelected()) { flag = true; } else { flag = false; } view.setSelected(flag); if (ruleOption.type == 3) { resetTokenStates(mColumn1, view); resetTokenStates(mColumn2, view); return; } else { updateTokenStates(mColumn1, view); updateTokenStates(mColumn2, view); return; } } { this$0 = RuleSelectionView.this; ruleOption = ruleoption; super(); } }); i++; } } public void setSelectedOptions(List list) { for (int i = 0; i < list.size(); i++) { Object obj = findViewWithTag((RuleOption)list.get(i)); if (obj != null) { obj = (TextView)obj; ((TextView) (obj)).setSelected(true); updateTokenStates(mColumn1, ((TextView) (obj))); updateTokenStates(mColumn2, ((TextView) (obj))); } } } }