Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            SetTheme(Resource.Style.AppTheme_BlueStatusBar_WhiteBackground);
            base.OnCreate(bundle);
            if (ViewModelWasNotCached())
            {
                BailOutToSplashScreen();
                return;
            }
            SetContentView(Resource.Layout.SelectProjectActivity);
            OverridePendingTransition(Resource.Animation.abc_slide_in_bottom, Resource.Animation.abc_fade_out);
            InitializeViews();

            var adapter = new SelectProjectRecyclerAdapter();

            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            recyclerView.SetAdapter(adapter);

            ViewModel.Suggestions
            .Subscribe(adapter.Rx().Items())
            .DisposedBy(DisposeBag);

            adapter.ItemsUpdateCompleted
            .Subscribe(scrollToTop)
            .DisposedBy(DisposeBag);

            adapter.ItemTapObservable
            .Subscribe(ViewModel.SelectProject.Inputs)
            .DisposedBy(DisposeBag);

            adapter.ToggleTasks
            .Subscribe(ViewModel.ToggleTaskSuggestions.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.PlaceholderText
            .Subscribe(searchField.Rx().Hint())
            .DisposedBy(DisposeBag);

            searchField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            closeButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.SelectProjectActivity);
            OverridePendingTransition(Resource.Animation.abc_slide_in_bottom, Resource.Animation.abc_fade_out);
            InitializeViews();

            var adapter = new SelectProjectRecyclerAdapter();

            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            recyclerView.SetAdapter(adapter);

            ViewModel.Suggestions
            .Subscribe(adapter.Rx().Items())
            .DisposedBy(DisposeBag);

            adapter.ItemTapObservable
            .Subscribe(ViewModel.SelectProject.Inputs)
            .DisposedBy(DisposeBag);

            adapter.ToggleTasks
            .Subscribe(ViewModel.ToggleTaskSuggestions.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.PlaceholderText
            .Subscribe(searchField.Rx().Hint())
            .DisposedBy(DisposeBag);

            searchField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            closeButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);
        }