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);
        }
Example #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            await _onCreateLock.WaitAsync();

            SetContentView(Resource.Layout.activityMain);
            _preferences = new PreferenceWrapper(this);

            _authCache       = new ListCache <WearAuthenticator>(AuthenticatorCacheName, this);
            _categoryCache   = new ListCache <WearCategory>(CategoryCacheName, this);
            _customIconCache = new CustomIconCache(this);

            await _authCache.Init();

            await _categoryCache.Init();

            _authSource = new AuthenticatorSource(_authCache);
            var defaultCategory = _preferences.DefaultCategory;

            if (defaultCategory != null)
            {
                _authSource.SetCategory(defaultCategory);
            }

            RunOnUiThread(InitViews);
            _onCreateLock.Release();
        }
Example #3
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();
        }
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            await _onCreateLock.WaitAsync();

            SetContentView(Resource.Layout.activityMain);
            _preferences = new PreferenceWrapper(this);

            _authCache       = new ListCache <WearAuthenticator>(AuthenticatorCacheName, this);
            _categoryCache   = new ListCache <WearCategory>(CategoryCacheName, this);
            _customIconCache = new CustomIconCache(this);

            await _authCache.Init();

            await _categoryCache.Init();

            _authSource = new AuthenticatorSource(_authCache);
            _authSource.SetSortMode(_preferences.SortMode);

            var defaultCategory = _preferences.DefaultCategory;

            if (defaultCategory != null)
            {
                _authSource.SetCategory(defaultCategory);
            }

            RunOnUiThread(delegate
            {
                InitViews();

                if (!_authCache.GetItems().Any())
                {
                    _onCreateLock.Release();
                    return;
                }

                AnimUtil.FadeOutView(_loadingLayout, AnimUtil.LengthShort, false, delegate
                {
                    CheckEmptyState();
                    _onCreateLock.Release();
                });
            });
        }
Example #5
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            await _onCreateLock.WaitAsync();

            SetContentView(Resource.Layout.activityMain);

            _authCache       = new ListCache <WearAuthenticator>(AuthenticatorCacheName, this);
            _categoryCache   = new ListCache <WearCategory>(CategoryCacheName, this);
            _customIconCache = new CustomIconCache(this);

            await _authCache.Init();

            await _categoryCache.Init();

            _authSource = new AuthenticatorSource(_authCache);
            RunOnUiThread(InitViews);

            _onCreateLock.Release();
        }
 public AuthenticatorListAdapter(AuthenticatorSource authSource, CustomIconCache customIconCache)
 {
     _authSource      = authSource;
     _customIconCache = customIconCache;
 }
 public AuthenticatorListAdapter(AuthenticatorView authView, CustomIconCache customIconCache)
 {
     _authView        = authView;
     _customIconCache = customIconCache;
 }
 public AuthenticatorListAdapter(CustomIconCache customIconCache)
 {
     _customIconCache = customIconCache;
     Items            = new List <WearAuthenticatorResponse>();
 }