protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.activity_setup_sync);

            mCircularProgress = FindViewById <CircularProgressLayout>(Resource.Id.circular_progress);
            mCircularProgress.Indeterminate = true;
            mCircularProgress.Click        += (sender, e) =>
            {
                // User canceled, abort the action
                mCircularProgress.StopTimer();
                SetResult(Result.Canceled);
                Finish();
            };
            mCircularProgress.TimerFinished += (sender, e) =>
            {
                // User didn't cancel, perform the action
                // All data received finish activity
                if (SettingsDataReceived && LocationDataReceived && WeatherDataReceived)
                {
                    SetResult(Result.Ok);
                }
                else
                {
                    SetResult(Result.Canceled);
                }
                Finish();
            };
            mTextView          = FindViewById <TextView>(Resource.Id.message);
            mBroadcastReceiver = new LocalBroadcastReceiver();
            mBroadcastReceiver.BroadcastReceived += BroadcastReceiver_BroadcastReceived;

            mTextView.Text = GetString(Resource.String.message_gettingstatus);

            intentFilter = new IntentFilter();
            intentFilter.AddAction(WearableDataListenerService.ACTION_UPDATECONNECTIONSTATUS);
            intentFilter.AddAction(WearableHelper.IsSetupPath);
            intentFilter.AddAction(WearableHelper.LocationPath);
            intentFilter.AddAction(WearableHelper.SettingsPath);
            intentFilter.AddAction(WearableHelper.WeatherPath);
            intentFilter.AddAction(WearableHelper.ErrorPath);

            StartService(new Intent(this, typeof(WearableDataListenerService))
                         .SetAction(WearableDataListenerService.ACTION_UPDATECONNECTIONSTATUS));
        }
Esempio n. 2
0
        private void InitViews()
        {
            _circularProgressLayout = FindViewById <CircularProgressLayout>(Resource.Id.layoutCircularProgress);
            _emptyLayout            = FindViewById <RelativeLayout>(Resource.Id.layoutEmpty);
            _offlineLayout          = FindViewById <LinearLayout>(Resource.Id.layoutOffline);

            _authList = FindViewById <WearableRecyclerView>(Resource.Id.list);
            _authList.EdgeItemsCenteringEnabled = true;
            _authList.HasFixedSize = true;
            _authList.SetItemViewCacheSize(12);
            _authList.SetItemAnimator(null);

            var layoutCallback = new AuthenticatorListLayoutCallback(this);

            _authList.SetLayoutManager(new WearableLinearLayoutManager(this, layoutCallback));

            _authListAdapter                  = new AuthenticatorListAdapter(_authView, _customIconCache);
            _authListAdapter.ItemClicked     += OnItemClicked;
            _authListAdapter.ItemLongClicked += OnItemLongClicked;
            _authListAdapter.HasStableIds     = true;
            _authListAdapter.DefaultAuth      = _preferences.DefaultAuth;
            _authList.SetAdapter(_authListAdapter);

            _categoryList        = FindViewById <WearableNavigationDrawerView>(Resource.Id.drawerCategories);
            _categoryListAdapter = new CategoryListAdapter(this, _categoryCache);
            _categoryList.SetAdapter(_categoryListAdapter);
            _categoryList.ItemSelected += OnCategorySelected;

            if (_authView.CategoryId == null)
            {
                return;
            }

            var categoryPosition = _categoryCache.FindIndex(c => c.Id == _authView.CategoryId) + 1;

            if (categoryPosition <= -1)
            {
                return;
            }

            _preventCategorySelectEvent = true;
            _categoryList.SetCurrentItem(categoryPosition, false);
        }