コード例 #1
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ideaTitleLbl       = FindViewById <TextView>(Resource.Id.itemTitle);
            ideaDescriptionLbl = FindViewById <TextView>(Resource.Id.itemDescription);
            detailsView        = FindViewById <LinearLayout>(Resource.Id.detailsView);
            addNoteFab         = FindViewById <FloatingActionButton>(Resource.Id.addNotefab);
            var editNoteBtn = FindViewById <Button>(Resource.Id.editNoteBtn);

            noteCard       = FindViewById <CardView>(Resource.Id.noteHolder);
            noteContentLbl = FindViewById <TextView>(Resource.Id.noteContent);

            addNoteFab.Click += AddNoteFab_Click;
            var swipeListener = new OnSwipeListener(this);

            swipeListener.OnSwipeRight += SwipeListener_OnSwipeRight;
            swipeListener.OnSwipeLeft  += SwipeListener_OnSwipeLeft;
            ideaDescriptionLbl.SetOnTouchListener(swipeListener);
            detailsView.SetOnTouchListener(swipeListener);

            editNoteBtn.Click += delegate
            {
                var dialog = new AddNoteDialog(bookmarkedItems[Global.IdeaScrollPosition].Note);
                dialog.OnError += () => Snackbar.Make(addNoteFab, "Invalid note. Entry fields cannot be empty.", Snackbar.LengthLong).Show();
                dialog.Show(FragmentManager, "ADDNOTEFRAG");
                dialog.OnNoteSave += (Note note) => SaveNote(note);
            };

            bookmarkedItems = await DBSerializer.DeserializeDBAsync <List <Idea> >(Global.BOOKMARKS_PATH);

            bookmarkedItems = bookmarkedItems ?? new List <Idea>();

            bookmarkedIdea = bookmarkedItems[Global.BookmarkScrollPosition];
            ideasList      = Global.Categories.FirstOrDefault(x => x.CategoryLbl == bookmarkedIdea.Category).Items;

            notes = await DBSerializer.DeserializeDBAsync <List <Note> >(Global.NOTES_PATH);

            notes = notes ?? new List <Note>();

            SetupUI();
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            //var viewGroup = ((ViewGroup)FindViewById<TextView> (Resource.Id.InstructionStep1).Parent);
            //viewGroup.SetOnTouchListener(new OnSwipeListener(this));
            _viewFlipper = FindViewById<ViewFlipper>(Resource.Id.ViewFlipper);

            // Button
            _button = FindViewById<Button>(Resource.Id.button1);
            _button.SetOnClickListener(this);

            var onSwipeListener = new OnSwipeListener (_viewFlipper, this);
            FindViewById(Resource.Id.step1View).SetOnTouchListener (onSwipeListener);
            FindViewById(Resource.Id.step2View).SetOnTouchListener (onSwipeListener);
            FindViewById(Resource.Id.step3View).SetOnTouchListener (onSwipeListener);
            FindViewById(Resource.Id.step4View).SetOnTouchListener (onSwipeListener);
        }
コード例 #3
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "bookmarks.json");
            base.OnCreate(savedInstanceState);
            ideaTitleLbl       = FindViewById <TextView>(Resource.Id.itemTitle);
            ideaDescriptionLbl = FindViewById <TextView>(Resource.Id.itemDescription);
            detailsView        = FindViewById <LinearLayout>(Resource.Id.detailsView);
            addNoteFab         = FindViewById <FloatingActionButton>(Resource.Id.addNotefab);
            editNoteBtn        = FindViewById <Button>(Resource.Id.editNoteBtn);
            noteCard           = FindViewById <CardView>(Resource.Id.noteHolder);
            noteContentLbl     = FindViewById <TextView>(Resource.Id.noteContent);

            addNoteFab.Click           += AddNoteFab_Click;
            SwipeListener               = new OnSwipeListener(this);
            SwipeListener.OnSwipeRight += SwipeListener_OnSwipeRight;
            SwipeListener.OnSwipeLeft  += SwipeListener_OnSwipeLeft;
            ideaDescriptionLbl.SetOnTouchListener(SwipeListener);
            detailsView.SetOnTouchListener(SwipeListener);

            editNoteBtn.Click += delegate
            {
                var dialog = new AddNoteDialog(bookmarkedItems[Global.ItemScrollPosition].Note);
                dialog.Show(FragmentManager, "ADDNOTEFRAG");
                dialog.OnNoteSave += (Note note) => HandleNoteSave(note);
            };

            bookmarkedItems = await DBAssist.DeserializeDBAsync <List <Idea> >(path);

            bookmarkedItems = bookmarkedItems ?? new List <Idea>();

            item      = bookmarkedItems[Global.BookmarkScrollPosition];
            ideasList = Global.Categories.FirstOrDefault(x => x.CategoryLbl == item.Category).Items;
            SetupUI();

            notes = await DBAssist.DeserializeDBAsync <List <Note> >(notesdb);

            notes = notes ?? new List <Note>();
        }
コード例 #4
0
 public void SetOnSwipeListener(OnSwipeListener onSwipeListener)
 {
     this.mOnSwipeListener = onSwipeListener;
 }