// 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.core; import android.content.res.Resources; import android.graphics.drawable.Drawable; import com.olio.data.object.assistant.rule.AutomaticReplyRule; import com.olio.data.object.assistant.rule.ContextContainer; import com.olio.data.object.assistant.rule.RemindMeLaterRule; import com.olio.data.object.assistant.rule.SilenceNotificationsRule; import com.olio.data.object.context.PersonalAssistantContext; 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.views.RuleOption; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; public class RulesUtil { private static interface TokenColor extends Annotation { } public static interface Type extends Annotation { } public static final int AutomaticReply = 1; private static final int Blue = 1; private static final int Green = 2; private static final int Orange = 3; private static final int Purple = 4; private static final int Red = 5; public static final int RemindLater = 2; public static final int SilenceNotifications = 3; private static final int TYPE_ACTIVITY = 2; public static final int TYPE_ALL = 3; private static final int TYPE_LOCATION = 1; private static final int Teal = 6; public RulesUtil() { } public static EditableRule createRule(int i) { String s = String.valueOf(System.currentTimeMillis()); RemindMeLaterRule remindmelaterrule; switch (i) { default: SilenceNotificationsRule silencenotificationsrule = new SilenceNotificationsRule(); silencenotificationsrule.setObjectId(s); silencenotificationsrule.setEnabled(true); return new SilenceNotificationsRuleWrapper(silencenotificationsrule); case 1: // '\001' AutomaticReplyRule automaticreplyrule = new AutomaticReplyRule(); automaticreplyrule.setObjectId(s); automaticreplyrule.setEnabled(true); return new AutomaticReplyRuleWrapper(automaticreplyrule); case 2: // '\002' remindmelaterrule = new RemindMeLaterRule(); break; } remindmelaterrule.setObjectId(s); remindmelaterrule.setEnabled(true); return new RemindMeLaterRuleWrapper(remindmelaterrule); } public static List createRulesOptionsFromContextContainers(List list) { if (list != null) goto _L2; else goto _L1 _L1: list = new ArrayList(); _L4: return list; _L2: ArrayList arraylist = new ArrayList(list.size()); Iterator iterator = list.iterator(); do { list = arraylist; if (!iterator.hasNext()) { continue; } list = (ContextContainer)iterator.next(); int i; if (((ContextContainer) (list)).name.equals("location") || ((ContextContainer) (list)).name.equals("physicalActivity")) { i = 1; } else { i = 2; } arraylist.add(new RuleOption(((ContextContainer) (list)).value, i)); } while (true); if (true) goto _L4; else goto _L3 _L3: } public static List createRulesOptionsFromStrings(List list) { ArrayList arraylist = new ArrayList(list.size()); for (list = list.iterator(); list.hasNext(); arraylist.add(new RuleOption((String)list.next(), 0))) { } return arraylist; } public static List getCategoryOptions() { ArrayList arraylist = new ArrayList(); arraylist.add(new RuleOption("all", 3)); arraylist.add(new RuleOption("all_sms", 0)); arraylist.add(new RuleOption("email", 0)); arraylist.add(new RuleOption("incomingCall", 0)); arraylist.add(new RuleOption("voicemail", 0)); arraylist.add(new RuleOption("social", 0)); arraylist.add(new RuleOption("entertainment", 0)); arraylist.add(new RuleOption("business", 0)); arraylist.add(new RuleOption("health", 0)); arraylist.add(new RuleOption("news", 0)); arraylist.add(new RuleOption("schedule", 0)); arraylist.add(new RuleOption("reminder", 0)); arraylist.add(new RuleOption("location", 0)); arraylist.add(new RuleOption("travel", 0)); arraylist.add(new RuleOption("weather", 0)); return arraylist; } public static int getColorForOptionString(Resources resources, String s) { getTokenColorForOptionString(s); JVM INSTR tableswitch 1 5: default 40 // 1 49 // 2 55 // 3 61 // 4 67 // 5 73; goto _L1 _L2 _L3 _L4 _L5 _L6 _L1: int i = 0x7f0c0055; _L8: return resources.getColor(i); _L2: i = 0x7f0c000b; continue; /* Loop/switch isn't completed */ _L3: i = 0x7f0c002a; continue; /* Loop/switch isn't completed */ _L4: i = 0x7f0c0038; continue; /* Loop/switch isn't completed */ _L5: i = 0x7f0c0043; continue; /* Loop/switch isn't completed */ _L6: i = 0x7f0c0044; if (true) goto _L8; else goto _L7 _L7: } public static List getContextContainersFromRuleOptions(List list) { ArrayList arraylist = new ArrayList(list.size()); RuleOption ruleoption; for (list = list.iterator(); list.hasNext(); arraylist.add(new ContextContainer(PersonalAssistantContext.contextNameForValue(ruleoption.string), ruleoption.string))) { ruleoption = (RuleOption)list.next(); } return arraylist; } public static List getContextOptions(Collection collection, List list) { ArrayList arraylist = new ArrayList(); arraylist.add(new RuleOption("home", 1)); arraylist.add(new RuleOption("work", 1)); collection = collection.iterator(); do { if (!collection.hasNext()) { break; } String s = (String)collection.next(); if (!arraylist.contains(new RuleOption(s.toLowerCase(), 1))) { arraylist.add(new RuleOption(s.toLowerCase(), 1)); } } while (true); arraylist.add(new RuleOption("meeting", 2)); arraylist.add(new RuleOption("inVehicle", 1)); arraylist.add(new RuleOption("sleep", 2)); if (list != null) { for (int i = 0; i < list.size(); i++) { collection = (RuleOption)list.get(i); if (!arraylist.contains(collection)) { arraylist.add(collection); } } } return arraylist; } public static Drawable getDrawableForOptionString(Resources resources, String s) { getTokenColorForOptionString(s); JVM INSTR tableswitch 1 5: default 40 // 1 49 // 2 55 // 3 61 // 4 67 // 5 73; goto _L1 _L2 _L3 _L4 _L5 _L6 _L1: int i = 0x7f0200cd; _L8: return resources.getDrawable(i); _L2: i = 0x7f0200c8; continue; /* Loop/switch isn't completed */ _L3: i = 0x7f0200c9; continue; /* Loop/switch isn't completed */ _L4: i = 0x7f0200ca; continue; /* Loop/switch isn't completed */ _L5: i = 0x7f0200cb; continue; /* Loop/switch isn't completed */ _L6: i = 0x7f0200cc; if (true) goto _L8; else goto _L7 _L7: } public static List getExceptionOptions() { ArrayList arraylist = new ArrayList(); arraylist.add(new RuleOption("vip", 0)); return arraylist; } public static List getHowRemindOptions() { ArrayList arraylist = new ArrayList(); arraylist.add(new RuleOption("sms", 0)); arraylist.add(new RuleOption("reminder", 0)); return arraylist; } public static List getHowReplyOptions() { ArrayList arraylist = new ArrayList(); arraylist.add(new RuleOption("sms", 0)); return arraylist; } public static String getLabelForOptionString(Resources resources, String s) { byte byte0 = -1; s.hashCode(); JVM INSTR lookupswitch 22: default 192 // -1828494428: 354 // -1221262756: 426 // -1146830912: 411 // -1018298903: 368 // -911823429: 326 // -897050771: 382 // -865698022: 516 // -697920873: 471 // -518602638: 486 // -361826745: 591 // 96673: 312 // 114009: 501 // 116765: 546 // 3208415: 561 // 3377875: 456 // 3655441: 576 // 96619420: 340 // 109522647: 621 // 500006792: 396 // 942033467: 606 // 1223440372: 531 // 1901043637: 441; goto _L1 _L2 _L3 _L4 _L5 _L6 _L7 _L8 _L9 _L10 _L11 _L12 _L13 _L14 _L15 _L16 _L17 _L18 _L19 _L20 _L21 _L22 _L23 _L1: break; /* Loop/switch isn't completed */ _L19: break MISSING_BLOCK_LABEL_621; _L24: switch (byte0) { default: return resources.getString(0x7f06018b, new Object[] { s }); case 0: // '\0' return resources.getString(0x7f060187); case 1: // '\001' return resources.getString(0x7f060188); case 2: // '\002' return resources.getString(0x7f06018e); case 3: // '\003' return resources.getString(0x7f06018d); case 4: // '\004' return resources.getString(0x7f06019c); case 5: // '\005' return resources.getString(0x7f06019a); case 6: // '\006' return resources.getString(0x7f06018f); case 7: // '\007' return resources.getString(0x7f060190); case 8: // '\b' return resources.getString(0x7f060191); case 9: // '\t' return resources.getString(0x7f060194); case 10: // '\n' return resources.getString(0x7f060195); case 11: // '\013' return resources.getString(0x7f060197); case 12: // '\f' return resources.getString(0x7f060196); case 13: // '\r' return resources.getString(0x7f060199); case 14: // '\016' return resources.getString(0x7f06019b); case 15: // '\017' return resources.getString(0x7f06019d); case 16: // '\020' return resources.getString(0x7f060189); case 17: // '\021' return resources.getString(0x7f06018a); case 18: // '\022' return resources.getString(0x7f06018c); case 19: // '\023' return resources.getString(0x7f060193); case 20: // '\024' return resources.getString(0x7f060192); case 21: // '\025' return resources.getString(0x7f060198); } _L12: if (s.equals("all")) { byte0 = 0; } goto _L24 _L6: if (s.equals("all_sms")) { byte0 = 1; } goto _L24 _L18: if (s.equals("email")) { byte0 = 2; } goto _L24 _L2: if (s.equals("incomingCall")) { byte0 = 3; } goto _L24 _L5: if (s.equals("voicemail")) { byte0 = 4; } goto _L24 _L7: if (s.equals("social")) { byte0 = 5; } goto _L24 _L20: if (s.equals("entertainment")) { byte0 = 6; } goto _L24 _L4: if (s.equals("business")) { byte0 = 7; } goto _L24 _L3: if (s.equals("health")) { byte0 = 8; } goto _L24 _L23: if (s.equals("location")) { byte0 = 9; } goto _L24 _L16: if (s.equals("news")) { byte0 = 10; } goto _L24 _L9: if (s.equals("schedule")) { byte0 = 11; } goto _L24 _L10: if (s.equals("reminder")) { byte0 = 12; } goto _L24 _L13: if (s.equals("sms")) { byte0 = 13; } goto _L24 _L8: if (s.equals("travel")) { byte0 = 14; } goto _L24 _L22: if (s.equals("weather")) { byte0 = 15; } goto _L24 _L14: if (s.equals("vip")) { byte0 = 16; } goto _L24 _L15: if (s.equals("home")) { byte0 = 17; } goto _L24 _L17: if (s.equals("work")) { byte0 = 18; } goto _L24 _L11: if (s.equals("inVehicle")) { byte0 = 19; } goto _L24 _L21: if (s.equals("meeting")) { byte0 = 20; } goto _L24 if (s.equals("sleep")) { byte0 = 21; } goto _L24 } public static int getMessageId(int i, int j, boolean flag) { switch (j) { default: return 0x7f060135; case 1: // '\001' return getStep1MessageId(i); case 2: // '\002' return getStep2MessageId(i); case 3: // '\003' return getStep3MessageId(i, flag); } } private static int getStep1MessageId(int i) { switch (i) { default: return 0x7f060163; case 1: // '\001' return 0x7f060046; case 2: // '\002' return 0x7f060132; } } private static int getStep2MessageId(int i) { switch (i) { default: return 0x7f060164; case 1: // '\001' return 0x7f060047; case 2: // '\002' return 0x7f060133; } } private static int getStep3MessageId(int i, boolean flag) { if (flag) { return 0x7f060111; } switch (i) { default: return 0x7f060165; case 1: // '\001' return 0x7f060048; case 2: // '\002' return 0x7f060134; } } public static List getStringsFromRuleOptions(List list) { ArrayList arraylist = new ArrayList(list.size()); for (list = list.iterator(); list.hasNext(); arraylist.add(((RuleOption)list.next()).string)) { } return arraylist; } private static int getTokenColorForOptionString(String s) { byte byte0; byte byte1; byte1 = 1; byte0 = -1; s.hashCode(); JVM INSTR lookupswitch 17: default 156 // -1828494428: 286 // -1221262756: 373 // -1146830912: 358 // -1018298903: 300 // -911823429: 258 // -897050771: 328 // -865698022: 448 // -697920873: 403 // -518602638: 418 // 96673: 244 // 114009: 314 // 116765: 478 // 3377875: 388 // 96619420: 272 // 500006792: 343 // 1223440372: 463 // 1901043637: 433; goto _L1 _L2 _L3 _L4 _L5 _L6 _L7 _L8 _L9 _L10 _L11 _L12 _L13 _L14 _L15 _L16 _L17 _L18 _L1: break; /* Loop/switch isn't completed */ _L13: break MISSING_BLOCK_LABEL_478; _L19: switch (byte0) { default: byte1 = 3; // fall through case 0: // '\0' case 1: // '\001' case 2: // '\002' case 3: // '\003' case 4: // '\004' case 5: // '\005' case 16: // '\020' return byte1; case 6: // '\006' case 7: // '\007' case 8: // '\b' case 9: // '\t' case 10: // '\n' return 2; case 11: // '\013' case 12: // '\f' return 5; case 13: // '\r' case 14: // '\016' return 4; case 15: // '\017' return 6; } _L11: if (s.equals("all")) { byte0 = 0; } goto _L19 _L6: if (s.equals("all_sms")) { byte0 = 1; } goto _L19 _L15: if (s.equals("email")) { byte0 = 2; } goto _L19 _L2: if (s.equals("incomingCall")) { byte0 = 3; } goto _L19 _L5: if (s.equals("voicemail")) { byte0 = 4; } goto _L19 _L12: if (s.equals("sms")) { byte0 = 5; } goto _L19 _L7: if (s.equals("social")) { byte0 = 6; } goto _L19 _L16: if (s.equals("entertainment")) { byte0 = 7; } goto _L19 _L4: if (s.equals("business")) { byte0 = 8; } goto _L19 _L3: if (s.equals("health")) { byte0 = 9; } goto _L19 _L14: if (s.equals("news")) { byte0 = 10; } goto _L19 _L9: if (s.equals("schedule")) { byte0 = 11; } goto _L19 _L10: if (s.equals("reminder")) { byte0 = 12; } goto _L19 _L18: if (s.equals("location")) { byte0 = 13; } goto _L19 _L8: if (s.equals("travel")) { byte0 = 14; } goto _L19 _L17: if (s.equals("weather")) { byte0 = 15; } goto _L19 if (s.equals("vip")) { byte0 = 16; } goto _L19 } public static List getWhatReplyToOptions() { ArrayList arraylist = new ArrayList(); arraylist.add(new RuleOption("all", 3)); arraylist.add(new RuleOption("all_sms", 0)); arraylist.add(new RuleOption("incomingCall", 0)); return arraylist; } public static boolean isRuleLive(EditableRule editablerule) { return false; } }