private void CheckEmptyState() { if (_categorySource.GetView().Count == 0) { if (_categoryList.Visibility == ViewStates.Visible) { AnimUtil.FadeOutView(_categoryList, AnimUtil.LengthShort); } if (_emptyStateLayout.Visibility == ViewStates.Invisible) { AnimUtil.FadeInView(_emptyStateLayout, AnimUtil.LengthLong); } } else { if (_categoryList.Visibility == ViewStates.Invisible) { AnimUtil.FadeInView(_categoryList, AnimUtil.LengthLong); } if (_emptyStateLayout.Visibility == ViewStates.Visible) { AnimUtil.FadeOutView(_emptyStateLayout, AnimUtil.LengthShort); } } }
private async Task ListCategories(string nodeId) { await _categorySource.Update(); var categories = _categorySource.GetView().Select(c => new WearCategory(c.Id, c.Name)).ToList(); var json = JsonConvert.SerializeObject(categories); var data = Encoding.UTF8.GetBytes(json); await WearableClass.GetMessageClient(this) .SendMessageAsync(nodeId, ListCategoriesCapability, data); }
private void CheckEmptyState() { if (_categorySource.GetView().Count == 0) { _categoryList.Visibility = ViewStates.Gone; AnimUtil.FadeInView(_emptyStateLayout, 500); } else { _emptyStateLayout.Visibility = ViewStates.Invisible; _categoryList.Visibility = ViewStates.Visible; } }
protected override async void OnResume() { base.OnResume(); if (RequiresAuthentication()) { if ((DateTime.Now - _pauseTime).TotalMinutes >= 1) { _isAuthenticated = false; } if (!_isAuthenticated) { _refreshOnActivityResume = true; StartActivityForResult(typeof(LoginActivity), ResultLogin); return; } } // Just launched if (_connection == null) { try { _connection = await Database.Connect(this); } catch (SQLiteException) { ShowDatabaseErrorDialog(); return; } await Init(); } else if (_refreshOnActivityResume) { _refreshOnActivityResume = false; _authList.Visibility = ViewStates.Invisible; await RefreshAuthenticators(); await _categorySource.Update(); await _customIconSource.Update(); // Currently visible category has been deleted if (_authSource.CategoryId != null && _categorySource.GetView().FirstOrDefault(c => c.Id == _authSource.CategoryId) == null) { await SwitchCategory(null); } } CheckEmptyState(); // Launch task that needs to wait for the activity to resume // Useful because an activity result is called before resume if (_onceResumedTask != null) { _onceResumedTask.Start(); _onceResumedTask = null; } _timer.Start(); Tick(); var showBackupReminders = PreferenceManager.GetDefaultSharedPreferences(this) .GetBoolean("pref_showBackupReminders", true); if (showBackupReminders) { RemindBackup(); } await DetectWearOSCapability(); if (_hasWearAPIs) { await WearableClass.GetCapabilityClient(this).AddListenerAsync(this, WearRefreshCapability); } }