void ChangeGestureName() { string name = mInput.Text.ToString(); if (!string.IsNullOrEmpty(name)) { NamedGesture renameGesture = mCurrentRenameGesture; GesturesAdapter adapter = mAdapter; int count = adapter.Count; // Simple linear search, there should not be enough items to warrant // a more sophisticated search for (int i = 0; i < count; i++) { NamedGesture gesture = adapter.GetItem(i); if (gesture.Gesture.ID == renameGesture.Gesture.ID) { sStore.RemoveGesture(gesture.Name, gesture.Gesture); gesture.Name = mInput.Text.ToString(); sStore.AddGesture(gesture.Name, gesture.Gesture); sStore.Save(); ReloadGestures(null); break; } } adapter.NotifyDataSetChanged(); } mCurrentRenameGesture = null; }
internal void DeleteGesture(NamedGesture gesture) { sStore.RemoveGesture(gesture.Name, gesture.Gesture); sStore.Save(); GesturesAdapter adapter = mAdapter; adapter.SetNotifyOnChange(false); adapter.Remove(gesture); adapter.Sort(mSorter); CheckForEmpty(); adapter.NotifyDataSetChanged(); Toast.MakeText(this, Resource.String.gestures_delete_success, ToastLength.Short).Show(); }
protected override void OnProgressUpdate(params NamedGesture [] values) { base.OnProgressUpdate(values); GesturesAdapter adapter = parent.mAdapter; adapter.SetNotifyOnChange(false); foreach (NamedGesture gesture in values) { adapter.Add(gesture); } adapter.Sort(parent.mSorter); adapter.NotifyDataSetChanged(); }