protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activityMain);

            _loadingLayout      = FindViewById <LinearLayout>(Resource.Id.layoutLoading);
            _emptyLayout        = FindViewById <LinearLayout>(Resource.Id.layoutEmpty);
            _disconnectedLayout = FindViewById <LinearLayout>(Resource.Id.layoutDisconnected);

            _retryButton        = FindViewById <MaterialButton>(Resource.Id.buttonRetry);
            _retryButton.Click += OnRetryClick;

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

            var layoutCallback = new ScrollingListLayoutCallback(Resources.Configuration.IsScreenRound);

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

            _customIconCache = new CustomIconCache(this);

            _authListAdapter              = new AuthenticatorListAdapter(_customIconCache);
            _authListAdapter.ItemClick   += ItemClick;
            _authListAdapter.HasStableIds = true;
            _authList.SetAdapter(_authListAdapter);
        }
Exemple #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activityMain);

            try
            {
                await WearableClass.GetMessageClient(this).AddListenerAsync(this);
                await FindServerNode();
            }
            catch (ApiException) { }

            _loadingLayout = FindViewById <RelativeLayout>(Resource.Id.layoutLoading);
            _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 ScrollingListLayoutCallback(Resources.Configuration.IsScreenRound);

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

            _authCache       = new ListCache <WearAuthenticator>("authenticators", this);
            _categoryCache   = new ListCache <WearCategory>("categories", this);
            _customIconCache = new CustomIconCache(this);

            await _authCache.Init();

            _authSource = new AuthenticatorSource(_authCache);

            _authListAdapter              = new AuthenticatorListAdapter(_authSource, _customIconCache);
            _authListAdapter.ItemClick   += OnItemClick;
            _authListAdapter.HasStableIds = true;
            _authList.SetAdapter(_authListAdapter);

            if (_authCache.GetItems().Count > 0 || _serverNode == null)
            {
                UpdateViewState();
            }

            await _categoryCache.Init();

            var categoriesDrawer = FindViewById <WearableNavigationDrawerView>(Resource.Id.drawerCategories);

            _categoryListAdapter = new CategoryListAdapter(this, _categoryCache);
            categoriesDrawer.SetAdapter(_categoryListAdapter);
            categoriesDrawer.ItemSelected += OnCategorySelected;

            await Refresh();
        }