// 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.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.app.Activity; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.util.ArrayMap; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.ViewPropertyAnimator; import android.widget.AbsListView; import android.widget.ArrayAdapter; import android.widget.CompoundButton; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import butterknife.ButterKnife; import com.jmedeisis.draglinearlayout.DragLinearLayout; import com.olio.communication.messages.MessageBuilder; import com.olio.communication.messages.MessagePayload; import com.olio.communication.messages.unit.WatchProfile; import com.olio.communication.requests.DeviceStatusRequest; import com.olio.data.object.bluetooth_status.BluetoothNotificationObserver; import com.olio.data.object.bluetooth_status.BluetoothStatus; import com.olio.data.object.unit.DeviceStatus; import com.olio.data.object.unit.DeviceStatusBuilder; import com.olio.data.object.unit.ui.TimeSkew; import com.olio.data.object.unit.ui.TimeSkewBuilder; import com.olio.data.object.unit.ui.TimeZone; import com.olio.data.object.unit.ui.TimeZones; import com.olio.data.object.unit.ui.WatchName; import com.olio.data.object.unit.ui.WatchNameBuilder; import com.olio.data.object.unit.ui.WatchUi; import com.olio.data.object.unit.ui.WatchUiBuilder; import com.olio.data.object.unit.ui.complication.ComplicationSettings; import com.olio.data.object.unit.ui.complication.ComplicationSettingsBuilder; import com.olio.data.object.unit.ui.complication.ComplicationsSettings; import com.olio.data.object.unit.ui.complication.ComplicationsSettingsBuilder; import com.olio.olios.model.loaders.DataCreator; import com.olio.olios.model.loaders.OnUpdate; import com.olio.olios.model.loaders.UnitLoaderConfig; import com.olio.olios.model.loaders.UserLoaderConfig; import com.olio.olios.model.record.DatabaseRecord; import com.olio.olios.model.record.SerializedRecord; import com.olio.state.DoNotDisturb; import com.olio.state.Product; import com.olio.state.RetailMode; import com.olio.state.Unit; import com.olio.util.ALog; import com.olio.util.SharedUtils; import com.oliodevices.assist.app.activities.SetupActivity; import com.oliodevices.assist.app.adapters.TimeUnitAdapter; import com.oliodevices.assist.app.api.UserManager; import com.oliodevices.assist.app.core.OlioApplication; import com.oliodevices.assist.app.detectors.BroadcastDelegate; import com.oliodevices.assist.app.views.DeleteGestureListener; import com.oliodevices.assist.app.views.WatchStatusView; import com.squareup.otto.Bus; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; // Referenced classes of package com.oliodevices.assist.app.fragments: // BaseFragment, TitleChanger, UnpairFragment public class ConfigWatchFragment extends BaseFragment implements TitleChanger { private class BatteryObserver extends BroadcastReceiver { final ConfigWatchFragment this$0; public void onReceive(Context context, Intent intent) { ALog.v("onReceive", new Object[0]); ALog.v("setBatteryLevel", new Object[0]); if (intent != null) { int i = intent.getIntExtra("battery_level", 0); mWatchStatus.setBatteryLevel(i); boolean flag = intent.getBooleanExtra("battery_charge_indicator", false); mWatchStatus.setCharging(flag); } } private BatteryObserver() { this$0 = ConfigWatchFragment.this; super(); } } public static interface ConfigWatchCallbacks { public abstract BluetoothDevice getDevice(String s); public abstract void handleUnpairing(); public abstract void onAddTimeZone(); public abstract void onChangeName(String s); } private class DNDObserver extends BroadcastReceiver { final ConfigWatchFragment this$0; public void onReceive(Context context, Intent intent) { ALog.v("onReceive", new Object[0]); ALog.v("setDND", new Object[0]); if (intent != null) { boolean flag = intent.getBooleanExtra("dnd_state", false); mWatchStatus.setDND(Boolean.valueOf(flag).booleanValue()); } } private DNDObserver() { this$0 = ConfigWatchFragment.this; super(); } } static interface ItemFactory { public abstract View create(ViewGroup viewgroup, LayoutInflater layoutinflater); public abstract void populate(ViewGroup viewgroup, View view, Object obj); } private class TimeViewScrollListener implements android.widget.AbsListView.OnScrollListener { boolean mIsScrolling; final ConfigWatchFragment this$0; public void onScroll(AbsListView abslistview, int i, int j, int k) { updateAdjustTime(); } public void onScrollStateChanged(final AbsListView view, int i) { boolean flag; if (i != 0) { flag = true; } else { flag = false; } mIsScrolling = flag; if (!mIsScrolling) { view.post((view.getFirstVisiblePosition() + 1). new Runnable() { final TimeViewScrollListener this$1; final int val$position; final AbsListView val$view; public void run() { view.smoothScrollToPositionFromTop(position, mPixelOffset, 200); int i = ((Integer)view.getItemAtPosition(position)).intValue(); mTimeSkew.setTimeSkew(i); mTimeSkew.save(getActivity().getContentResolver()); updateAdjustTime(); } { this$1 = final_timeviewscrolllistener; view = abslistview; position = I.this; super(); } }); } } private TimeViewScrollListener() { this$0 = ConfigWatchFragment.this; super(); } } private class TimeZonesObserver extends BroadcastReceiver { final ConfigWatchFragment this$0; public void onReceive(Context context, Intent intent) { ALog.v("onReceive", new Object[0]); if (mUserInterfaceElementsLoaded && intent != null && SharedUtils.getBuildNumberFromVersionString(intent.getStringExtra("watch_fw_version")) >= 79) { ButterKnife.findById(getActivity(), 0x7f0d0116).setVisibility(0); initTimeZoneLoader(); if (mTimeZonesObserver != null) { getActivity().unregisterReceiver(mTimeZonesObserver); mTimeZonesObserver = null; } } } private TimeZonesObserver() { this$0 = ConfigWatchFragment.this; super(); } } private static final int ADJUST_TIME_STATUS_AHEAD = 3; private static final int ADJUST_TIME_STATUS_BEHIND = 1; private static final int ADJUST_TIME_STATUS_ONTIME = 2; private static final String ARG_DEVICE_ADDRESS = "arg_device_address"; private static final int COMPLICATIONS_LOADER = 3; private static final long DEVICE_STATUS_REQUEST_MINIMUM_TIME; private static final int DO_NOT_DISTURB_LOADER = 7; private static final int HALF_MINUTES = 60; private static final int SMOOTH_SCROLL_DURATION_MILLIS = 200; private static final int TIMEZONES_LOADER = 4; private static final int TIME_SKEW_LOADER = 5; private static final int WATCH_MODEL_LOADER = 6; private static final int WATCH_NAME_LOADER = 1; private static final int WATCH_STATUS_LOADER = 0; private static final int WATCH_UI_LOADER = 2; private boolean loaderByPassFlag; ListView mAdjustTimeStatus; private BatteryObserver mBatteryObserver; private Bus mBus; private ConfigWatchCallbacks mCallbacks; private AsyncTask mCheckShowTimezoneTask; private ArrayMap mComplicationIdToNameMap; DragLinearLayout mComplicationList; private ComplicationsSettings mComplications; TextView mComplicationsEditButton; private DNDObserver mDNDObserver; private boolean mDNDThreadInitialized; private String mDeviceAddress; private UnitLoaderConfig mDeviceStatusLoader; private boolean mDeviceStatusThreadInitialized; private UserLoaderConfig mDoNotDisturbLoader; private final Handler mHandler = new Handler(); boolean mIsConnected; private WatchUi mNewWatchUi; private BluetoothNotificationObserver mNotificationObserver; ListView mOffsetMinutes; private int mPixelOffset; View mRetailModeAppliedView; private BroadcastReceiver mRetailModeCompleteBroadcastReceiver; View mRetailModeConfirmationView; RadioButton mTimeModeAnalog; RadioButton mTimeModeDigital; RadioGroup mTimeModeSelector; private TimeSkew mTimeSkew; DragLinearLayout mTimeZoneList; private TimeZones mTimeZones; TextView mTimeZonesEditButton; private TimeZonesObserver mTimeZonesObserver; View mTimeZonesWarningView; View mUnpairConfirmationView; View mUnpairDeviceButton; boolean mUserInterfaceElementsLoaded; private WatchName mWatchName; WatchStatusView mWatchStatus; private WatchUi mWatchUi; private boolean mWatchUiLoaderInitialized; public ConfigWatchFragment() { mIsConnected = false; mUserInterfaceElementsLoaded = false; loaderByPassFlag = true; mTimeZonesObserver = null; mRetailModeCompleteBroadcastReceiver = new BroadcastReceiver() { final ConfigWatchFragment this$0; public void onReceive(Context context, Intent intent) { } { this$0 = ConfigWatchFragment.this; super(); } }; mDNDThreadInitialized = false; mDeviceStatusThreadInitialized = false; mWatchUiLoaderInitialized = false; } private void configMinutesList() { Object obj = getResources(); mPixelOffset = (((Resources) (obj)).getDimensionPixelSize(0x7f07007a) - ((Resources) (obj)).getDimensionPixelSize(0x7f070073)) / 2; obj = new ArrayList(121); for (int i = -60; i <= 60; i++) { ((ArrayList) (obj)).add(Integer.valueOf(i)); } mOffsetMinutes.setAdapter(new TimeUnitAdapter(getActivity(), ((ArrayList) (obj)))); mOffsetMinutes.setSelectionFromTop(60, mPixelOffset); mOffsetMinutes.setOnScrollListener(new TimeViewScrollListener()); mOffsetMinutes.setOnTouchListener(new android.view.View.OnTouchListener() { final ConfigWatchFragment this$0; public boolean onTouch(View view, MotionEvent motionevent) { int j = motionevent.getActionMasked(); if (getView() == null) goto _L2; else goto _L1 _L1: j; JVM INSTR tableswitch 0 1: default 40 // 0 42 // 1 54; goto _L2 _L3 _L4 _L2: return false; _L3: view.getParent().requestDisallowInterceptTouchEvent(true); return false; _L4: view.getParent().requestDisallowInterceptTouchEvent(false); return false; } { this$0 = ConfigWatchFragment.this; super(); } }); } private void configTimeStatusList() { Resources resources = getResources(); ArrayList arraylist = new ArrayList(5); arraylist.add(""); arraylist.add(resources.getString(0x7f060082)); arraylist.add(resources.getString(0x7f060083)); arraylist.add(resources.getString(0x7f060081)); arraylist.add(""); mAdjustTimeStatus.setAdapter(new ArrayAdapter(getActivity(), 0x7f030078, arraylist)); mAdjustTimeStatus.setSelectionFromTop(2, mPixelOffset); } private int getSelectedTimeValue(ListView listview) { return ((Integer)listview.getItemAtPosition(listview.getFirstVisiblePosition() + 1)).intValue(); } private void hideUnusedViews() { ButterKnife.findById(getActivity(), 0x7f0d011a).setVisibility(8); ButterKnife.findById(getActivity(), 0x7f0d0116).setVisibility(8); } private void initComplicationsLoader() { (new UserLoaderConfig()).type("complication-settings").loaderId(3).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(ComplicationsSettings complicationssettings) { updateComplications(complicationssettings); } public volatile void onUpdate(Object obj) { onUpdate((ComplicationsSettings)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public ComplicationsSettings create() { String as[] = getResources().getStringArray(0x7f0b0000); ArrayList arraylist = new ArrayList(as.length - 1); int j = as.length; int i = 0; while (i < j) { String s = as[i]; if (!s.equals("complication.pedometer")) { arraylist.add(ComplicationSettingsBuilder.aComplicationSettings().setComplicationId(s).setEnabled(true).build()); } i++; } return ComplicationsSettingsBuilder.aComplicationsSettings().setComplications(arraylist).build(); } { this$0 = ConfigWatchFragment.this; super(); } }).register(); } private void initDNDLoader() { ALog.d("initDNDLoader", new Object[0]); if (!mDNDThreadInitialized) { mDoNotDisturbLoader = new UserLoaderConfig(); mDoNotDisturbLoader.type("do-not-disturb").loaderId(7).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(DoNotDisturb donotdisturb) { if (donotdisturb == null) { ALog.d("No DND data", new Object[0]); return; } Object obj; String s; boolean flag; if (donotdisturb.isEnabled()) { obj = "on"; } else { obj = "off"; } if (mIsConnected) { s = "connected"; } else { s = "not connected"; } ALog.d("loader.onUpdate DND (%s, %s)", new Object[] { obj, s }); obj = mWatchStatus; if (mIsConnected && donotdisturb.isEnabled()) { flag = true; } else { flag = false; } ((WatchStatusView) (obj)).setDND(flag); } public volatile void onUpdate(Object obj) { onUpdate((DoNotDisturb)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public DoNotDisturb create() { ALog.v("loader.create default DND record", new Object[0]); return new DoNotDisturb(); } { this$0 = ConfigWatchFragment.this; super(); } }); (new Thread(new Runnable() { final ConfigWatchFragment this$0; public void run() { ContentResolver contentresolver = getActivity().getContentResolver(); List list = SerializedRecord.getByType("do-not-disturb", null, contentresolver); if (list != null) { if (list.size() > 1) { ALog.d("more than 1 record", new Object[0]); } else if (list.size() == 1) { ALog.d("1 record found", new Object[0]); } else { ALog.d("0 records found", new Object[0]); } } else { ALog.d("no records found", new Object[0]); } if (list != null && list.size() > 1) { ALog.w("More than 1 record saved. Deleting all...", new Object[0]); SerializedRecord.deleteByType("do-not-disturb", contentresolver); } mHandler.post(new Runnable() { final _cls15 this$1; public void run() { ALog.d("registering DoNotDisturb loader", new Object[0]); mDoNotDisturbLoader.register(); } { this$1 = _cls15.this; super(); } }); } { this$0 = ConfigWatchFragment.this; super(); } })).start(); mDNDThreadInitialized = true; } } private void initNameLoader() { (new UnitLoaderConfig()).type("watch-name").loaderId(1).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(WatchName watchname) { mWatchName = watchname; if (!isResumed() || watchname == null) { return; } else { mWatchStatus.setWatchName(watchname.getName()); setActivityTitle(getActivity()); return; } } public volatile void onUpdate(Object obj) { onUpdate((WatchName)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public WatchName create() { Object obj = mCallbacks.getDevice(mDeviceAddress); WatchNameBuilder watchnamebuilder = WatchNameBuilder.aWatchName(); if (obj == null) { obj = mDeviceAddress; } else { obj = ((BluetoothDevice) (obj)).getName(); } return watchnamebuilder.setName(((String) (obj))).setUnitId(mDeviceAddress).build(); } { this$0 = ConfigWatchFragment.this; super(); } }).key(mDeviceAddress).register(); } private void initTimeSkewLoader() { (new UnitLoaderConfig()).type("time-skew").loaderId(5).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(TimeSkew timeskew) { if (timeskew != null) { mTimeSkew = timeskew; if (timeskew.getTimeSkew() != getSelectedTimeValue(mOffsetMinutes)) { mOffsetMinutes.setSelectionFromTop(60 - mTimeSkew.getTimeSkew(), mPixelOffset); updateAdjustTime(); return; } } } public volatile void onUpdate(Object obj) { onUpdate((TimeSkew)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public TimeSkew create() { return TimeSkewBuilder.aTimeSkew().setTimeSkew(0).setUnitId(mDeviceAddress).build(); } { this$0 = ConfigWatchFragment.this; super(); } }).key(mDeviceAddress).register(); } private void initTimeZoneLoader() { (new UserLoaderConfig()).type("time-zones").loaderId(4).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(TimeZones timezones) { ALog.d("loader.onUpdate timezone", new Object[0]); updateTimeZones(timezones); } public volatile void onUpdate(Object obj) { onUpdate((TimeZones)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public TimeZones create() { return new TimeZones(); } { this$0 = ConfigWatchFragment.this; super(); } }).register(); } private void initWatchLoader() { ALog.d("initWatchLoader", new Object[0]); if (!mDeviceStatusThreadInitialized) { mDeviceStatusLoader = new UnitLoaderConfig(); mDeviceStatusLoader.type("device-status").loaderId(0).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(DeviceStatus devicestatus) { if (devicestatus == null) { ALog.d("No DeviceStatus data", new Object[0]); return; } int i = devicestatus.getBatteryLevel(); Object obj; boolean flag; if (devicestatus.isCharging()) { obj = "charging"; } else { obj = "not charging"; } ALog.d("loader.onUpdate DeviceStatus (%d and %s)", new Object[] { Integer.valueOf(i), obj }); obj = mWatchStatus; if (mIsConnected && devicestatus.isCharging()) { flag = true; } else { flag = false; } ((WatchStatusView) (obj)).setCharging(flag); mWatchStatus.setBatteryLevel(devicestatus.getBatteryLevel()); } public volatile void onUpdate(Object obj) { onUpdate((DeviceStatus)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).key(mDeviceAddress).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public DeviceStatus create() { ALog.d("creating DeviceStatus record", new Object[0]); return DeviceStatusBuilder.aDeviceStatus().setUnitId(mDeviceAddress).build(); } { this$0 = ConfigWatchFragment.this; super(); } }); (new Thread(new Runnable() { final ConfigWatchFragment this$0; public void run() { Object obj; Object obj1; obj = getActivity().getContentResolver(); obj1 = SerializedRecord.getByType("device-status", null, ((ContentResolver) (obj))); if (obj1 != null) { if (((List) (obj1)).size() > 1) { ALog.d("more than 1 record", new Object[0]); } else if (((List) (obj1)).size() == 1) { ALog.d("1 record found", new Object[0]); } else { ALog.d("0 records found", new Object[0]); } } else { ALog.d("no records found", new Object[0]); } if (obj1 == null || ((List) (obj1)).size() != 1) goto _L2; else goto _L1 _L1: ALog.v("1 record found... checking unit", new Object[0]); obj1 = (DatabaseRecord)((List) (obj1)).get(0); try { obj1 = (DeviceStatus)((SerializedRecord)obj1).getObject(); if (!mDeviceAddress.equals(((DeviceStatus) (obj1)).getUnitId())) { ALog.w("existing record (%s) is not for this device (%s)... deleting", new Object[] { ((DeviceStatus) (obj1)).getUnitId(), mDeviceAddress }); SerializedRecord.delete(((com.olio.olios.model.record.SerializedRecord.SerializedRecordObject) (obj1)), ((DeviceStatus) (obj1)).getUnitId(), ((ContentResolver) (obj))); } } // Misplaced declaration of an exception variable catch (Object obj) { ALog.e("Didn't retrieve a deviceStatus object", new Object[0]); } // Misplaced declaration of an exception variable catch (Object obj) { ALog.e("NullPointerException", new Object[0]); } _L4: mHandler.post(new Runnable() { final _cls18 this$1; public void run() { ALog.d("registering DeviceStatus loader", new Object[0]); mDeviceStatusLoader.register(); } { this$1 = _cls18.this; super(); } }); return; _L2: if (obj1 != null && ((List) (obj1)).size() > 1) { ALog.w("More than 1 record saved. Deleting all...", new Object[0]); SerializedRecord.deleteByType("device-status", ((ContentResolver) (obj))); } if (true) goto _L4; else goto _L3 _L3: } { this$0 = ConfigWatchFragment.this; super(); } })).start(); mDeviceStatusThreadInitialized = true; } } private void initWatchModelLoader() { (new UnitLoaderConfig()).type(com/olio/state/Unit.getSimpleName()).loaderId(6).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(Unit unit) { if (!isResumed()) { return; } if (unit == null) { mWatchStatus.setWatchModelName(""); return; } Object obj = unit.getProduct().getSku(); String as[] = getResources().getStringArray(0x7f0b0004); TypedArray typedarray = getResources().obtainTypedArray(0x7f0b0005); ArrayMap arraymap = new ArrayMap(as.length); for (int i = 0; i < as.length; i++) { arraymap.put(as[i], typedarray.getDrawable(i)); } typedarray.recycle(); Drawable drawable = (Drawable)arraymap.get(obj); obj = drawable; if (drawable == null) { obj = getResources().getDrawable(0x7f0200db); } mWatchStatus.setWatchImage(((Drawable) (obj))); mWatchStatus.setWatchModelName(unit.getProduct().getName()); } public volatile void onUpdate(Object obj) { onUpdate((Unit)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).key(mDeviceAddress).register(); } private void initWatchUiLoader() { ALog.d("initWatchUiLoader", new Object[0]); if (!mWatchUiLoaderInitialized) { (new UserLoaderConfig()).type("watch-ui").loaderId(2).activity(getActivity()).updater(new OnUpdate() { final ConfigWatchFragment this$0; public void onUpdate(WatchUi watchui) { while (!isResumed() || watchui == null) { return; } ALog.d("loader.onUpdate WatchUI (%s)", new Object[] { watchui.toString() }); static class _cls34 { static final int $SwitchMap$com$olio$data$object$unit$ui$WatchUi$WatchFaceMode[]; static { $SwitchMap$com$olio$data$object$unit$ui$WatchUi$WatchFaceMode = new int[com.olio.data.object.unit.ui.WatchUi.WatchFaceMode.values().length]; try { $SwitchMap$com$olio$data$object$unit$ui$WatchUi$WatchFaceMode[com.olio.data.object.unit.ui.WatchUi.WatchFaceMode.ANALOG.ordinal()] = 1; } catch (NoSuchFieldError nosuchfielderror1) { } try { $SwitchMap$com$olio$data$object$unit$ui$WatchUi$WatchFaceMode[com.olio.data.object.unit.ui.WatchUi.WatchFaceMode.DIGITAL.ordinal()] = 2; } catch (NoSuchFieldError nosuchfielderror) { return; } } } if (mWatchUi == null) { mWatchUi = watchui; } else { mNewWatchUi = watchui; } switch (_cls34..SwitchMap.com.olio.data.object.unit.ui.WatchUi.WatchFaceMode[watchui.getWatchFaceMode().ordinal()]) { default: ALog.d("Unknown time mode: %d", new Object[] { watchui.getWatchFaceMode() }); return; case 1: // '\001' mTimeModeSelector.check(0x7f0d0111); return; case 2: // '\002' mTimeModeSelector.check(0x7f0d0112); break; } } public volatile void onUpdate(Object obj) { onUpdate((WatchUi)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).creator(new DataCreator() { final ConfigWatchFragment this$0; public volatile MessagePayload create() { return create(); } public WatchUi create() { return WatchUiBuilder.aWatchUi().setWatchFaceMode(com.olio.data.object.unit.ui.WatchUi.WatchFaceMode.ANALOG).build(); } { this$0 = ConfigWatchFragment.this; super(); } }).register(); mWatchUiLoaderInitialized = true; } } private void initializeLoaders() { initNameLoader(); initWatchModelLoader(); initWatchUiLoader(); initComplicationsLoader(); if (!loaderByPassFlag) { initWatchLoader(); initDNDLoader(); } mCheckShowTimezoneTask = (new AsyncTask() { final ConfigWatchFragment this$0; protected transient Boolean doInBackground(Void avoid[]) { if (isCancelled()) { return Boolean.valueOf(false); } avoid = UserManager.getInstance().getUnitId(); avoid = WatchProfile.get(getActivity().getContentResolver(), avoid); if (avoid == null) { return Boolean.valueOf(false); } if (SharedUtils.getBuildNumberFromVersionString(avoid.getFirmwareVersion()) >= 79) { return Boolean.valueOf(true); } else { return Boolean.valueOf(false); } } protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Void[])aobj); } protected void onPostExecute(Boolean boolean1) { label0: { if (isAdded()) { if (!boolean1.booleanValue()) { break label0; } ButterKnife.findById(getActivity(), 0x7f0d0116).setVisibility(0); initTimeZoneLoader(); } return; } ButterKnife.findById(getActivity(), 0x7f0d0116).setVisibility(8); } protected volatile void onPostExecute(Object obj) { onPostExecute((Boolean)obj); } { this$0 = ConfigWatchFragment.this; super(); } }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]); } private void initializeView() { mComplicationsEditButton.setTag(Boolean.valueOf(false)); mTimeZonesEditButton.setTag(Boolean.valueOf(false)); mComplicationsEditButton.setOnClickListener(new android.view.View.OnClickListener() { final ConfigWatchFragment this$0; public void onClick(View view) { int i; int k; boolean flag; if (!((Boolean)view.getTag()).booleanValue()) { flag = true; } else { flag = false; } view.setTag(Boolean.valueOf(flag)); view = (TextView)view; if (flag) { i = 0x7f0600a3; } else { i = 0x7f0600a9; } view.setText(i); k = mComplicationList.getChildCount(); i = 0; while (i < k) { view = ButterKnife.findById(mComplicationList.getChildAt(i), 0x7f0d0186); int j; if (flag) { j = 0; } else { j = 8; } view.setVisibility(j); i++; } } { this$0 = ConfigWatchFragment.this; super(); } }); mTimeZonesEditButton.setOnClickListener(new android.view.View.OnClickListener() { final ConfigWatchFragment this$0; public void onClick(View view) { int i; int k; boolean flag; if (!((Boolean)view.getTag()).booleanValue()) { flag = true; } else { flag = false; } view.setTag(Boolean.valueOf(flag)); view = (TextView)view; if (flag) { i = 0x7f0600a3; } else { i = 0x7f0600a9; } view.setText(i); k = mTimeZoneList.getChildCount(); i = 0; while (i < k) { view = mTimeZoneList.getChildAt(i); View view1 = ButterKnife.findById(view, 0x7f0d0186); int j; if (flag) { j = 0; } else { j = 8; } view1.setVisibility(j); setDeleteViewUI(mTimeZoneList, view, flag); i++; } } { this$0 = ConfigWatchFragment.this; super(); } }); mComplicationList.setOnViewSwapListener(new com.jmedeisis.draglinearlayout.DragLinearLayout.OnViewSwapListener() { final ConfigWatchFragment this$0; public void onSwap(View view, int i, View view1, int j) { if (i == j) { return; } else { view = mComplications.getComplications(); view.add(j, (ComplicationSettings)view.remove(i)); mComplications.save(getActivity().getContentResolver()); return; } } { this$0 = ConfigWatchFragment.this; super(); } }); mTimeZoneList.setOnViewSwapListener(new com.jmedeisis.draglinearlayout.DragLinearLayout.OnViewSwapListener() { final ConfigWatchFragment this$0; public void onSwap(View view, int i, View view1, int j) { if (i == j) { return; } else { view = mTimeZones.getTimeZones(); view.add(j, (TimeZone)view.remove(i)); mTimeZones.save(getActivity().getContentResolver()); return; } } { this$0 = ConfigWatchFragment.this; super(); } }); } public static ConfigWatchFragment newInstance(String s) { ConfigWatchFragment configwatchfragment = new ConfigWatchFragment(); Bundle bundle = new Bundle(); bundle.putString("arg_device_address", s); configwatchfragment.setArguments(bundle); return configwatchfragment; } private void registerBluetoothReceivers() { mNotificationObserver = new BluetoothNotificationObserver(getActivity().getContentResolver(), new Handler(getActivity().getMainLooper()), com.olio.data.object.bluetooth_status.BluetoothNotificationObserver.Platform.PHONE) { final ConfigWatchFragment this$0; public void connectionStatusUpdate(com.olio.data.object.bluetooth_status.BluetoothNotificationObserver.ConnectionStatusChange connectionstatuschange) { ConfigWatchFragment configwatchfragment = ConfigWatchFragment.this; boolean flag; if (connectionstatuschange == com.olio.data.object.bluetooth_status.BluetoothNotificationObserver.ConnectionStatusChange.CONNECTED) { flag = true; } else { flag = false; } configwatchfragment.mIsConnected = flag; if (mIsConnected) { connectionstatuschange = "CONNECTED"; } else { connectionstatuschange = "DISCONNECTED"; } ALog.i("connectionStatusUpdate %s", new Object[] { connectionstatuschange }); mWatchStatus.setConnected(mIsConnected); mTimeModeSelector.setEnabled(mIsConnected); mTimeModeAnalog.setEnabled(mIsConnected); mTimeModeDigital.setEnabled(mIsConnected); if (!mIsConnected) { mWatchStatus.setDND(false); if (loaderByPassFlag) { mWatchStatus.setBatteryLevel(0); mWatchStatus.setCharging(false); } } } public void statusUpdate(BluetoothStatus bluetoothstatus) { ALog.v("statusUpdate", new Object[0]); if (bluetoothstatus.getRadioStatus() == 10) { mWatchStatus.setConnected(false); } } { this$0 = ConfigWatchFragment.this; super(contentresolver, handler, platform); } }; ALog.i("Registering BT observer", new Object[0]); mNotificationObserver.register(); } private void setDeleteViewUI(final ViewGroup parent, final View itemView, boolean flag) { View view = ButterKnife.findById(itemView, 0x7f0d019a); final DeleteGestureListener deleteGesture; int i; if (flag) { i = 0; } else { i = 8; } view.setVisibility(i); view = ButterKnife.findById(itemView, 0x7f0d0036); deleteGesture = ButterKnife.findById(itemView, 0x7f0d0199); if (flag) { final TimeZone item = (TimeZone)itemView.getTag(); View view1 = ButterKnife.findById(itemView, 0x7f0d014b); View view2 = ButterKnife.findById(itemView, 0x7f0d0198); deleteGesture = new DeleteGestureListener(getActivity(), mBus, view2, deleteGesture); view1.setOnClickListener(new android.view.View.OnClickListener() { final ConfigWatchFragment this$0; final DeleteGestureListener val$deleteGesture; public void onClick(View view3) { deleteGesture.openSlider(); } { this$0 = ConfigWatchFragment.this; deleteGesture = deletegesturelistener; super(); } }); view2.setOnClickListener(new android.view.View.OnClickListener() { final ConfigWatchFragment this$0; final TimeZone val$item; final View val$itemView; final ViewGroup val$parent; public void onClick(View view3) { view3 = new AnimatorListenerAdapter() { final _cls33 this$1; public void onAnimationEnd(Animator animator) { ((DragLinearLayout)parent).removeDragView(itemView); mTimeZones.getTimeZones().remove(item); mTimeZones.save(getActivity().getContentResolver()); } { this$1 = _cls33.this; super(); } }; itemView.animate().translationX(-mTimeZoneList.getWidth()).setListener(view3).start(); } { this$0 = ConfigWatchFragment.this; parent = viewgroup; itemView = view; item = timezone; super(); } }); view.setOnTouchListener(deleteGesture); return; } else { view.setOnTouchListener(null); return; } } private void setUnpairConfirmationViewVisibility(boolean flag) { boolean flag1 = false; View view = mUnpairConfirmationView; int i; if (flag) { i = 0; } else { i = 8; } view.setVisibility(i); view = mUnpairDeviceButton; i = ((flag1) ? 1 : 0); if (flag) { i = 4; } view.setVisibility(i); } private void updateAdjustTime() { int i = getSelectedTimeValue(mOffsetMinutes); if (i < 0) { i = 1; } else if (i > 0) { i = 3; } else { i = 2; } mAdjustTimeStatus.setOnScrollListener(new android.widget.AbsListView.OnScrollListener() { final ConfigWatchFragment this$0; public void onScroll(AbsListView abslistview, int j, int k, int l) { } public void onScrollStateChanged(final AbsListView view, int j) { if (j == 0) { view.post((view.getFirstVisiblePosition() + 1). new Runnable() { final _cls6 this$1; final int val$position; final AbsListView val$view; public void run() { view.setOnScrollListener(null); view.smoothScrollToPositionFromTop(position, mPixelOffset, 200); } { this$1 = final__pcls6; view = abslistview; position = I.this; super(); } }); } } { this$0 = ConfigWatchFragment.this; super(); } }); mAdjustTimeStatus.smoothScrollToPositionFromTop(i, mPixelOffset); } private void updateComplications(ComplicationsSettings complicationssettings) { while (!isResumed() || complicationssettings == null || complicationssettings.getComplications().isEmpty()) { return; } mComplications = complicationssettings; complicationssettings = mComplications.getComplications(); ItemFactory itemfactory = new ItemFactory() { final ConfigWatchFragment this$0; public View create(ViewGroup viewgroup, LayoutInflater layoutinflater) { viewgroup = layoutinflater.inflate(0x7f030077, viewgroup, false); ButterKnife.findById(viewgroup, 0x7f0d0198).setVisibility(8); return viewgroup; } public void populate(ViewGroup viewgroup, View view, ComplicationSettings complicationsettings) { ((TextView)ButterKnife.findById(view, 0x7f0d0036)).setText((CharSequence)mComplicationIdToNameMap.get(complicationsettings.getComplicationId())); viewgroup = (CompoundButton)ButterKnife.findById(view, 0x7f0d01af); viewgroup.setChecked(complicationsettings.isEnabled()); viewgroup.setOnCheckedChangeListener(complicationsettings. new android.widget.CompoundButton.OnCheckedChangeListener() { final _cls31 this$1; final ComplicationSettings val$item; public void onCheckedChanged(CompoundButton compoundbutton, boolean flag) { item.setEnabled(flag); mComplications.save(getActivity().getContentResolver()); } { this$1 = final__pcls31; item = ComplicationSettings.this; super(); } }); } public volatile void populate(ViewGroup viewgroup, View view, Object obj) { populate(viewgroup, view, (ComplicationSettings)obj); } { this$0 = ConfigWatchFragment.this; super(); } }; updateListView(mComplicationList, complicationssettings, itemfactory); } private void updateListView(DragLinearLayout draglinearlayout, List list, ItemFactory itemfactory) { int i1; int j1; int i = draglinearlayout.getChildCount(); j1 = list.size(); i1 = i - j1; if (i1 <= 0) goto _L2; else goto _L1 _L1: for (int j = 0; j < i1; j++) { draglinearlayout.removeDragView(draglinearlayout.getChildAt(0)); } goto _L3 _L2: if (i1 >= 0) goto _L3; else goto _L4 _L4: if (getActivity() != null) goto _L6; else goto _L5 _L5: return; _L6: LayoutInflater layoutinflater = LayoutInflater.from(getActivity()); for (int k = i1; k < 0; k++) { View view = itemfactory.create(draglinearlayout, layoutinflater); draglinearlayout.addDragView(view, ButterKnife.findById(view, 0x7f0d0187)); } _L3: int l = 0; while (l < j1) { itemfactory.populate(draglinearlayout, draglinearlayout.getChildAt(l), list.get(l)); l++; } if (true) goto _L5; else goto _L7 _L7: } private void updateTimeZones(TimeZones timezones) { if (timezones == null || timezones.getTimeZones() == null || timezones.getTimeZones().isEmpty()) { return; } else { mTimeZones = timezones; timezones = mTimeZones.getTimeZones(); ItemFactory itemfactory = new ItemFactory() { final ConfigWatchFragment this$0; public View create(ViewGroup viewgroup, LayoutInflater layoutinflater) { return layoutinflater.inflate(0x7f030077, viewgroup, false); } public void populate(ViewGroup viewgroup, View view, TimeZone timezone) { view.setTag(timezone); ((TextView)ButterKnife.findById(view, 0x7f0d0036)).setText(timezone.getDisplayName()); CompoundButton compoundbutton = (CompoundButton)ButterKnife.findById(view, 0x7f0d01af); compoundbutton.setChecked(timezone.isEnabled()); compoundbutton.setOnCheckedChangeListener(timezone. new android.widget.CompoundButton.OnCheckedChangeListener() { final _cls30 this$1; final TimeZone val$item; public void onCheckedChanged(CompoundButton compoundbutton, boolean flag) { item.setEnabled(flag); mTimeZones.save(getActivity().getContentResolver()); } { this$1 = final__pcls30; item = TimeZone.this; super(); } }); boolean flag = ((Boolean)mTimeZonesEditButton.getTag()).booleanValue(); setDeleteViewUI(viewgroup, view, flag); } public volatile void populate(ViewGroup viewgroup, View view, Object obj) { populate(viewgroup, view, (TimeZone)obj); } { this$0 = ConfigWatchFragment.this; super(); } }; updateListView(mTimeZoneList, timezones, itemfactory); return; } } public String getDeviceAddress() { return mDeviceAddress; } void onAddTimezoneClicked() { if (mTimeZones == null || mTimeZones.getTimeZones().size() < 10) { mCallbacks.onAddTimeZone(); return; } else { mTimeZonesWarningView.setVisibility(0); return; } } public void onAttach(Activity activity) { super.onAttach(activity); if (!(activity instanceof ConfigWatchCallbacks)) { throw new ClassCastException(String.format("%s must implement ConfigWatchCallbacks", new Object[] { activity.getClass() })); } else { mCallbacks = (ConfigWatchCallbacks)activity; return; } } public boolean onBackPressed() { boolean flag = false; if (mUnpairConfirmationView.getVisibility() == 0) { setUnpairConfirmationViewVisibility(false); flag = true; } return flag; } public void onCancelRetailMode() { setRetailModeConfirmationVisibility(false); } public void onCancelUnpair() { setUnpairConfirmationViewVisibility(false); } void onChangeNameClicked() { mCallbacks.onChangeName(mWatchName.getName()); } public void onCompleteRetailMode() { setRetailModeAppliedVisibility(false); FragmentActivity fragmentactivity = getActivity(); if (fragmentactivity != null) { Intent intent = new Intent(fragmentactivity, com/oliodevices/assist/app/activities/SetupActivity); intent.setFlags(0x10008000); fragmentactivity.startActivity(intent); } } public void onConfirmRetailMode() { setRetailModeConfirmationVisibility(false); Object obj = new RetailMode(); ((RetailMode) (obj)).setEnabled(true); obj = (new MessageBuilder()).setAction(com.olio.communication.messages.Message.Action.CREATE_OR_UPDATE).setPayload(((MessagePayload) (obj))).setSource("phone").setDestination("watch").build(); (new BroadcastDelegate(getActivity())).sendMessage(((com.olio.communication.messages.Message) (obj))); } public void onConfirmUnpair() { setUnpairConfirmationViewVisibility(false); startFragment(new UnpairFragment()); } public void onCreate(Bundle bundle) { super.onCreate(bundle); if (loaderByPassFlag) { mDNDObserver = new DNDObserver(); mBatteryObserver = new BatteryObserver(); } if (getArguments() != null) { mDeviceAddress = getArguments().getString("arg_device_address", null); } bundle = getResources().getStringArray(0x7f0b0000); String as[] = getResources().getStringArray(0x7f0b0001); mComplicationIdToNameMap = new ArrayMap(bundle.length); for (int i = 0; i < bundle.length; i++) { Object obj = bundle[i]; String s = as[i]; mComplicationIdToNameMap.put(obj, s); } mBus = OlioApplication.getApplication().getBus(); } public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle) { layoutinflater = layoutinflater.inflate(0x7f03003b, viewgroup, false); ButterKnife.inject(this, layoutinflater); initializeView(); mUserInterfaceElementsLoaded = true; return layoutinflater; } public void onDetach() { super.onDetach(); if (mCheckShowTimezoneTask != null) { mCheckShowTimezoneTask.cancel(true); } mCallbacks = null; mBus = null; } public void onPause() { ALog.d("onPause", new Object[0]); super.onPause(); mTimeModeSelector.setOnCheckedChangeListener(null); ALog.i("Unregistering BT observer", new Object[0]); mNotificationObserver.unregister(); if (loaderByPassFlag) { ALog.i("Unregistering DND observer", new Object[0]); getActivity().unregisterReceiver(mDNDObserver); ALog.i("Unregistering Battery observer", new Object[0]); getActivity().unregisterReceiver(mBatteryObserver); } if (mTimeZonesObserver != null) { getActivity().unregisterReceiver(mTimeZonesObserver); mTimeZonesObserver = null; } } public void onResume() { ALog.d("onResume", new Object[0]); super.onResume(); setActivityTitle(getActivity()); hideUnusedViews(); initializeLoaders(); mTimeModeSelector.setOnCheckedChangeListener(new android.widget.RadioGroup.OnCheckedChangeListener() { final ConfigWatchFragment this$0; public void onCheckedChanged(RadioGroup radiogroup, int i) { if (mWatchUi != null) { com.olio.data.object.unit.ui.WatchUi.WatchFaceMode watchfacemode = mWatchUi.getWatchFaceMode(); if (i == 0x7f0d0111) { radiogroup = com.olio.data.object.unit.ui.WatchUi.WatchFaceMode.ANALOG; } else { radiogroup = com.olio.data.object.unit.ui.WatchUi.WatchFaceMode.DIGITAL; } if (radiogroup != watchfacemode) { if (mNewWatchUi != null) { mWatchUi = mNewWatchUi; mNewWatchUi = null; } mWatchUi.setWatchFaceMode(radiogroup); mWatchUi.save(getActivity().getContentResolver()); } } } { this$0 = ConfigWatchFragment.this; super(); } }); IntentFilter intentfilter1; boolean flag; if (BluetoothStatus.bluetoothStatus(getActivity().getContentResolver()).getBluetooth3ConnectionStatus() == 3) { flag = true; } else { flag = false; } mIsConnected = flag; mWatchStatus.setConnected(mIsConnected); mTimeModeSelector.setEnabled(mIsConnected); mTimeModeAnalog.setEnabled(mIsConnected); mTimeModeDigital.setEnabled(mIsConnected); if (!mIsConnected) { mWatchStatus.setDND(false); } registerBluetoothReceivers(); if (loaderByPassFlag) { IntentFilter intentfilter = new IntentFilter("com.oliodevices.assist.intent.action.UPDATE_DND"); getActivity().registerReceiver(mDNDObserver, intentfilter); intentfilter = new IntentFilter("com.oliodevices.assist.intent.action.UPDATE_BATTERY"); getActivity().registerReceiver(mBatteryObserver, intentfilter); } intentfilter1 = new IntentFilter("com.oliodevices.assist.intent.action.WATCH_VERSION"); if (getActivity().registerReceiver(null, intentfilter1) == null) { IntentFilter intentfilter2 = new IntentFilter("com.oliodevices.assist.intent.action.WATCH_VERSION"); if (mTimeZonesObserver == null) { mTimeZonesObserver = new TimeZonesObserver(); getActivity().registerReceiver(mTimeZonesObserver, intentfilter2); } } (new AsyncTask() { final ConfigWatchFragment this$0; protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Context[])aobj); } protected transient Void doInBackground(Context acontext[]) { acontext = acontext[0]; DeviceStatus devicestatus = DeviceStatus.get(acontext.getContentResolver()); if (devicestatus.getDateModified() == null || Math.abs(System.currentTimeMillis() - devicestatus.getDateModified().longValue()) > ConfigWatchFragment.DEVICE_STATUS_REQUEST_MINIMUM_TIME) { (new BroadcastDelegate(acontext)).sendMessage((new MessageBuilder()).setAction(com.olio.communication.messages.Message.Action.CREATE_OR_UPDATE).setDestination("watch").setSource("phone").setPayload(new DeviceStatusRequest()).build()); } return null; } { this$0 = ConfigWatchFragment.this; super(); } }).execute(new Context[] { getActivity().getApplicationContext() }); } public void onTimeZonesWarningDismiss() { mTimeZonesWarningView.setVisibility(8); } public void onUnpairDevice() { setUnpairConfirmationViewVisibility(true); } public void setActivityTitle(Activity activity) { Fragment fragment = getFragmentManager().findFragmentById(0x7f0d0067); if ((fragment instanceof TitleChanger) && fragment.isResumed()) { ((TitleChanger)fragment).setActivityTitle(activity); return; } else { activity.setTitle(0x7f0600fb); return; } } public void setLoaderByPassFlag(boolean flag) { loaderByPassFlag = flag; } public void setRetailModeAppliedVisibility(boolean flag) { View view = mRetailModeAppliedView; int i; if (flag) { i = 0; } else { i = 8; } view.setVisibility(i); } public void setRetailModeConfirmationVisibility(boolean flag) { View view = mRetailModeConfirmationView; int i; if (flag) { i = 0; } else { i = 8; } view.setVisibility(i); } static { DEVICE_STATUS_REQUEST_MINIMUM_TIME = TimeUnit.MINUTES.toMillis(5L); } /* static WatchName access$1802(ConfigWatchFragment configwatchfragment, WatchName watchname) { configwatchfragment.mWatchName = watchname; return watchname; } */ /* static WatchUi access$202(ConfigWatchFragment configwatchfragment, WatchUi watchui) { configwatchfragment.mWatchUi = watchui; return watchui; } */ /* static TimeSkew access$2102(ConfigWatchFragment configwatchfragment, TimeSkew timeskew) { configwatchfragment.mTimeSkew = timeskew; return timeskew; } */ /* static TimeZonesObserver access$2502(ConfigWatchFragment configwatchfragment, TimeZonesObserver timezonesobserver) { configwatchfragment.mTimeZonesObserver = timezonesobserver; return timezonesobserver; } */ /* static WatchUi access$302(ConfigWatchFragment configwatchfragment, WatchUi watchui) { configwatchfragment.mNewWatchUi = watchui; return watchui; } */ }