// 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.fragments; import android.app.Activity; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Switch; import android.widget.TextView; import butterknife.ButterKnife; import com.olio.data.object.assistant.rule.AutomaticReplyRule; import com.olio.data.object.assistant.rule.RemindMeLaterRule; import com.olio.data.object.assistant.rule.Rule; import com.olio.data.object.assistant.rule.SilenceNotificationsRule; import com.oliodevices.assist.app.api.models.AutomaticReplyRuleWrapper; import com.oliodevices.assist.app.api.models.EditableRule; import com.oliodevices.assist.app.api.models.RemindMeLaterRuleWrapper; import com.oliodevices.assist.app.api.models.SilenceNotificationsRuleWrapper; import com.oliodevices.assist.app.core.OlioApplication; import com.oliodevices.assist.app.core.RulesUtil; import com.oliodevices.assist.app.events.RuleUpdateEvent; import com.oliodevices.assist.app.views.RuleItem; import com.oliodevices.assist.app.views.RuleOption; import java.util.List; // Referenced classes of package com.oliodevices.assist.app.fragments: // BaseFragment, TitleChanger, RuleEditorFragment, RulesByTagFragment public class RulesFragment extends BaseFragment implements TitleChanger { private static final String INTRO_SEEN = "intro_seen"; private static final String PREF_SHOW_LIVE_RULES_ONLY = "show_live_rules_only"; ViewGroup mAutomaticReplyRulesView; ViewGroup mAutomaticReplyView; private AsyncTask mGetDataTask; View mIntroView; private boolean mIsShowLiveRulesOnly; View mMainView; ViewGroup mRemindLaterRulesView; ViewGroup mRemindLaterView; private List mRules; Switch mShowLiveRules; ViewGroup mSilenceNotificationsRulesView; public RulesFragment() { } private void addRuleItem(ViewGroup viewgroup, final EditableRule editableRule) { RuleItem ruleitem = new RuleItem(getActivity()); ruleitem.setRule(editableRule, new com.oliodevices.assist.app.views.RuleItem.Listener() { final RulesFragment this$0; final EditableRule val$editableRule; public void onEdit() { RuleEditorFragment ruleeditorfragment = RuleEditorFragment.newInstance(editableRule.getRuleType(), editableRule.getId()); startFragment(ruleeditorfragment); } public void onRuleEnabled(EditableRule editablerule) { boolean flag; if (!editablerule.isEnabled()) { flag = true; } else { flag = false; } editablerule.setIsEnabled(flag); editablerule.getRuleType(); JVM INSTR tableswitch 1 2: default 48 // 1 76 // 2 87; goto _L1 _L2 _L3 _L1: editablerule = ((SilenceNotificationsRuleWrapper)editablerule).getRule(); _L5: editablerule.save(getActivity().getContentResolver()); return; _L2: editablerule = ((AutomaticReplyRuleWrapper)editablerule).getRule(); continue; /* Loop/switch isn't completed */ _L3: editablerule = ((RemindMeLaterRuleWrapper)editablerule).getRule(); if (true) goto _L5; else goto _L4 _L4: } public void onTokenClick(RuleOption ruleoption) { ruleoption = RulesByTagFragment.newInstance(ruleoption); startFragment(ruleoption); } { this$0 = RulesFragment.this; editableRule = editablerule; super(); } }); if (viewgroup.getChildCount() > 0) { LayoutInflater.from(getActivity()).inflate(0x7f030054, viewgroup, true); } viewgroup.addView(ruleitem); } private void addRulesToViews() { mAutomaticReplyRulesView.removeAllViews(); mRemindLaterRulesView.removeAllViews(); mSilenceNotificationsRulesView.removeAllViews(); int i = 0; while (i < mRules.size()) { Object obj = (Rule)mRules.get(i); ViewGroup viewgroup; if (obj instanceof AutomaticReplyRule) { obj = new AutomaticReplyRuleWrapper((AutomaticReplyRule)obj); viewgroup = mAutomaticReplyRulesView; } else if (obj instanceof RemindMeLaterRule) { obj = new RemindMeLaterRuleWrapper((RemindMeLaterRule)obj); viewgroup = mRemindLaterRulesView; } else { obj = new SilenceNotificationsRuleWrapper((SilenceNotificationsRule)obj); viewgroup = mSilenceNotificationsRulesView; } if (!mIsShowLiveRulesOnly || RulesUtil.isRuleLive(((EditableRule) (obj)))) { addRuleItem(viewgroup, ((EditableRule) (obj))); } i++; } } private void initializeView() { SharedPreferences sharedpreferences = OlioApplication.getApplication().getDefaultSharedPreferences(); boolean flag = sharedpreferences.contains("intro_seen"); View view = mIntroView; byte byte0; if (flag) { byte0 = 8; } else { byte0 = 0; } view.setVisibility(byte0); sharedpreferences.edit().putBoolean("intro_seen", true).apply(); mIsShowLiveRulesOnly = sharedpreferences.getBoolean("show_live_rules_only", false); mShowLiveRules.setChecked(mIsShowLiveRulesOnly); mRemindLaterView.setVisibility(8); mAutomaticReplyView.setVisibility(8); } private void retrieveDataItems() { mGetDataTask = (new AsyncTask() { final RulesFragment this$0; protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Void[])aobj); } protected transient List doInBackground(Void avoid[]) { if (isCancelled()) { return null; } else { return Rule.getAllRules(getActivity().getContentResolver()); } } protected volatile void onPostExecute(Object obj) { onPostExecute((List)obj); } protected void onPostExecute(List list) { if (isAdded()) { mRules = list; addRulesToViews(); mMainView.setVisibility(0); } } protected void onPreExecute() { mMainView.setVisibility(8); } { this$0 = RulesFragment.this; super(); } }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]); } public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); setActivityTitle(getActivity()); retrieveDataItems(); } public void onAddRule(View view) { view.getId(); JVM INSTR lookupswitch 2: default 32 // 2131558744: 43 // 2131558749: 48; goto _L1 _L2 _L3 _L1: byte byte0 = 3; _L5: startFragment(RuleEditorFragment.newInstance(byte0)); return; _L2: byte0 = 1; continue; /* Loop/switch isn't completed */ _L3: byte0 = 2; if (true) goto _L5; else goto _L4 _L4: } public boolean onBackPressed() { if (mIntroView.getVisibility() == 0) { mIntroView.setVisibility(8); return true; } else { return false; } } public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle) { layoutinflater = layoutinflater.inflate(0x7f030041, viewgroup, false); ButterKnife.inject(this, layoutinflater); initializeView(); return layoutinflater; } public void onDetach() { if (mGetDataTask != null) { mGetDataTask.cancel(true); } super.onDetach(); } public void onProceed() { mIntroView.setVisibility(8); } public void onRuleUpdateEvent(RuleUpdateEvent ruleupdateevent) { retrieveDataItems(); if (ruleupdateevent.isDone) { getActivity().getSupportFragmentManager().popBackStack(); } } public void onShowRules(View view) { boolean flag = false; view.getId(); JVM INSTR lookupswitch 2: default 32 // 2131558742: 93 // 2131558747: 116; goto _L1 _L2 _L3 _L3: break MISSING_BLOCK_LABEL_116; _L1: Object obj; ViewGroup viewgroup = mSilenceNotificationsRulesView; obj = (TextView)view.findViewById(0x7f0d0152); view = viewgroup; _L4: TextView textview; int i; if (view.getVisibility() == 0) { i = 8; } else { i = 0; } view.setVisibility(i); obj = ((TextView) (obj)).getCompoundDrawables()[0]; if (view.getVisibility() == 0) { i = ((flag) ? 1 : 0); } else { i = 1; } ((Drawable) (obj)).setLevel(i); return; _L2: obj = mAutomaticReplyRulesView; textview = (TextView)view.findViewById(0x7f0d0157); view = ((View) (obj)); obj = textview; goto _L4 obj = mRemindLaterRulesView; textview = (TextView)view.findViewById(0x7f0d015c); view = ((View) (obj)); obj = textview; goto _L4 } public void onToggleInactiveRules() { boolean flag; if (!mIsShowLiveRulesOnly) { flag = true; } else { flag = false; } mIsShowLiveRulesOnly = flag; OlioApplication.getApplication().getDefaultSharedPreferences().edit().putBoolean("show_live_rules_only", mIsShowLiveRulesOnly).apply(); addRulesToViews(); } public void setActivityTitle(Activity activity) { Fragment fragment = ((FragmentActivity)activity).getSupportFragmentManager().findFragmentById(0x7f0d0067); if ((fragment instanceof TitleChanger) && fragment.isResumed()) { ((TitleChanger)fragment).setActivityTitle(activity); return; } else { activity.setTitle(0x7f060103); return; } } /* static List access$002(RulesFragment rulesfragment, List list) { rulesfragment.mRules = list; return list; } */ }