public override void HandleMessage(Message msg) { switch (msg.What) { case ConstantsCustomGallery.PERMISSION_GRANTED: _context.LoadImages(_context); break; case ConstantsCustomGallery.FETCH_STARTED: _context._loader.Visibility = ViewStates.Visible; _context._gridView.Visibility = ViewStates.Invisible; break; case ConstantsCustomGallery.FETCH_COMPLETED: /* * If adapter is null, this implies that the loaded images will be shown * for the first time, hence send FETCH_COMPLETED message. * However, if adapter has been initialised, this thread was run either * due to the activity being restarted or content being changed. */ if (_context._adapter == null) { _context._adapter = new CustomImageSelectAdapter(_context, _context, _context._images); _context._gridView.Adapter = (_context._adapter); _context._loader.Visibility = ViewStates.Gone; _context._gridView.Visibility = ViewStates.Visible; _context.OrientationBasedUi(_context.Resources.Configuration.Orientation); } else { _context._adapter.NotifyDataSetChanged(); /* * Some selected images may have been deleted * hence update action mode title */ _context._countSelected = msg.Arg1; //actionMode.setTitle(countSelected + " " + getString(R.string.selected)); _context._tvSelectCount.Text = _context._countSelected + " " + _context.GetString(Resource.String.selected); _context._tvSelectCount.Visibility = ViewStates.Visible; _context._tvAdd.Visibility = ViewStates.Visible; _context._tvProfile.Visibility = ViewStates.Gone; } break; case ConstantsCustomGallery.ERROR: _context._loader.Visibility = ViewStates.Gone; _context._errorDisplay.Visibility = ViewStates.Visible; break; default: base.HandleMessage(msg); break; } }
public override void OnChange(bool selfChange) { _context.LoadImages(_context); }