public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
            {
                // if the presenter is null, we are probably trying to recreate the fragment after it has been removed from memory.
                // don't allow that to happen
                if (_presenter == null)
                {
                    DismissAllowingStateLoss();
                    return(null);
                }

                var view = Activity.LayoutInflater.Inflate(Resource.Layout.Fragment_EditMediaListItem, container,
                                                           false);

                _coordLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.EditMediaListItem_CoordLayout);

                SetupToolbar(view.FindViewById <Toolbar>(Resource.Id.EditMediaListItem_Toolbar));
                SetupScore(_scorePicker       = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_ScorePicker), view.FindViewById <Button>(Resource.Id.EditMediaListItem_CustomScoringButton));
                SetupStatus(_statusSpinner    = view.FindViewById <AppCompatSpinner>(Resource.Id.EditMediaListItem_StatusSpinner));
                SetupProgress(_progressPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_ProgressPicker),
                              view.FindViewById <TextView>(Resource.Id.EditMediaListItem_ProgressLabel));
                SetupVolumeProgress(view.FindViewById(Resource.Id.EditMediaListItem_VolumeProgressContainer),
                                    _progressVolumesPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_VolumeProgressPicker));
                SetupRepeat(_repeatPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_RewatchedPicker),
                            view.FindViewById <TextView>(Resource.Id.EditMediaListItem_RewatchedLabel));
                SetupNotes(_notesView = view.FindViewById <EditText>(Resource.Id.EditMediaListItem_Notes));
                SetupCustomLists(view.FindViewById(Resource.Id.EditMediaListItem_CustomListsContainer),
                                 view.FindViewById <LinearLayout>(Resource.Id.EditMediaListItem_CustomLists));
                SetupStartDate(_startDateView   = view.FindViewById <DatePickerTextView>(Resource.Id.EditMediaListItem_StartDate));
                SetupFinishDate(_finishDateView = view.FindViewById <DatePickerTextView>(Resource.Id.EditMediaListItem_FinishDate));
                SetupDeleteButton(view.FindViewById(Resource.Id.EditMediaListItem_DeleteButton));

                return(view);
            }
Esempio n. 2
0
 public override bool OnNestedFling(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, float velocityX, float velocityY, bool consumed)
 {
     base.OnNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed);
     _scrollDirection = velocityY > 0 ? ScrollDirection.ScrollDirectionUp : ScrollDirection.ScrollDirectionDown;
     HandleDirection(child as View, _scrollDirection);
     return(true);
 }
Esempio n. 3
0
        public TermsAndPrivacyRenderer(Context context) : base(context)
        {
            mainActivity = (MainActivity)Context;

            _androidCoordinatorLayout = (CoordinatorLayout)mainActivity.LayoutInflater.Inflate(Resource.Layout.TermsAndPrivacy, null);

            _androidAppBarLayout = _androidCoordinatorLayout.FindViewById <AppBarLayout>(Resource.Id.termsAppBar);

            toolbar = _androidAppBarLayout.FindViewById <Toolbar>(Resource.Id.termsToolBar);

            mainActivity?.SetSupportActionBar(toolbar);
            ActionBar actionBar = mainActivity?.SupportActionBar;

            if (actionBar != null)
            {
                actionBar.SetDisplayHomeAsUpEnabled(true);
                actionBar.SetDisplayShowHomeEnabled(true);
                actionBar.SetDisplayShowTitleEnabled(false);
            }

            viewPager = _androidCoordinatorLayout.FindViewById <ViewPager>(Resource.Id.pager);

            tabLayout = _androidAppBarLayout.FindViewById <TabLayout>(Resource.Id.tabLayout1);
            tabLayout.SetupWithViewPager(viewPager);
        }
 public override void OnNestedPreScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, int dx, int dy, int[] consumed, int type)
 {
     if (Enabled)
     {
         base.OnNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
     }
 }
 public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
 {
     if (Enabled)
     {
         base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
     }
 }
Esempio n. 6
0
        public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Object child, View target,
                                            int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
        {
            base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

            var viewChild = child.JavaCast <View>();

            if (!viewChild.Enabled)
            {
                return;
            }

            if (isBottomBarVisible && scrolledDistance >= MinimalScrollDistance)
            {
                viewChild.HideWithTranslateAnimation();
                scrolledDistance   = 0;
                isBottomBarVisible = false;
            }
            else if (!isBottomBarVisible && scrolledDistance <= -MinimalScrollDistance)
            {
                viewChild.ShowWithTranslateAnimation();
                scrolledDistance   = 0;
                isBottomBarVisible = true;
            }

            if (isBottomBarVisible && dyConsumed >= 0 || !isBottomBarVisible && dyConsumed <= 0)
            {
                scrolledDistance += dyConsumed;
            }
        }
Esempio n. 7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                if (ETC.useLightTheme)
                {
                    SetTheme(Resource.Style.GFS_Toolbar_Light);
                }

                // Create your application here
                SetContentView(Resource.Layout.EventListLayout);

                eventFilePath = Path.Combine(ETC.cachePath, "Event", "EventVer.txt");

                SetSupportActionBar(FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.EventListMainToolbar));
                SupportActionBar.SetTitle(Resource.String.EventListActivity_Title);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                snackbarLayout = FindViewById <CoordinatorLayout>(Resource.Id.EventListSnackbarLayout);

                eventListSubLayout  = FindViewById <LinearLayout>(Resource.Id.EventListButtonSubLayout);
                eventListSubLayout2 = FindViewById <LinearLayout>(Resource.Id.EventListButtonSubLayout2);

                _ = InitLoad();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                Toast.MakeText(this, Resource.String.Activity_OnCreateError, ToastLength.Short).Show();
            }
        }
Esempio n. 8
0
        void ConnectControl()
        {
            //Image View
            //centerMarker = (ImageView)FindViewById(Resource.Id.centerMarker);

            rootView     = (CoordinatorLayout)FindViewById(Resource.Id.rootView);
            drawerLayout = (Android.Support.V4.Widget.DrawerLayout)FindViewById(Resource.Id.drawerLayout);
            mainToolbar  = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.mainToolbar);

            //TextView
            PickUpLocationText      = (TextView)FindViewById(Resource.Id.pickUpLocationText);
            DestinationLocationText = (TextView)FindViewById(Resource.Id.destinationLocationText);

            //Radio buttons
            PickUpRadio      = (RadioButton)FindViewById(Resource.Id.pickUpRadio);
            DestinationRadio = (RadioButton)FindViewById(Resource.Id.destinationRadio);

            PickUpRadio.Click      += PickUpRadio_Click;
            DestinationRadio.Click += DestinationRadio_Click;

            //Layouts
            layoutPickUp      = (RelativeLayout)FindViewById(Resource.Id.layoutPickUp);
            layoutDestination = (RelativeLayout)FindViewById(Resource.Id.layoutDestination);

            //attache events
            layoutPickUp.Click      += layoutPickUp_Click;
            layoutDestination.Click += layoutDestination_Click;

            SetSupportActionBar(mainToolbar);
            SupportActionBar.Title = "";
            Android.Support.V7.App.ActionBar actionBar = SupportActionBar;
            actionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_menu_action);
            actionBar.SetDisplayHomeAsUpEnabled(true);
        }
Esempio n. 9
0
        public override void OnNestedPreScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object jChild, View target, int dx, int dy, int[] consumed, int type)
        {
            base.OnNestedPreScroll(coordinatorLayout, jChild, target, dx, dy, consumed, type);
            var child = jChild.JavaCast <View>();

            child.TranslationY = System.Math.Max(child.Height, child.TranslationY + dy);
        }
        public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Object child, View target,
            int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
        {
            base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

            var floatingActionButtonChild = child.JavaCast<FloatingActionButton>();

            if (!floatingActionButtonChild.Enabled)
                return;

            if (isFabVisible && scrolledDistance >= MinimalScrollDistance)
            {
                floatingActionButtonChild.HideWithTranslateAnimation();
                scrolledDistance = 0;
                isFabVisible = false;
            }
            else if (!isFabVisible && scrolledDistance <= -MinimalScrollDistance)
            {
                floatingActionButtonChild.ShowWithTranslateAnimation();
                scrolledDistance = 0;
                isFabVisible = true;
            }

            if ((isFabVisible && dyConsumed >= 0) || (!isFabVisible && dyConsumed <= 0))
                scrolledDistance += dyConsumed;
        }
Esempio n. 11
0
 public override bool LayoutDependsOn(CoordinatorLayout parent, Java.Lang.Object child, View dependency)
 {
     // List the toolbar container as a dependency to ensure that it will
     // always be laid out before the child (which depends on the toolbar
     // container's height in onLayoutChild() below).
     return(dependency.Id == Resource.Id.toolbar_container);
 }
Esempio n. 12
0
        public override bool OnLayoutChild(CoordinatorLayout parent, Java.Lang.Object child, int layoutDirection)
        {
            BottomNavigationView childView = child.JavaCast <BottomNavigationView>();

            this.height = childView.Height;
            return(base.OnLayoutChild(parent, child, layoutDirection));
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinator);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            floatingActionBar = FindViewById <FloatingActionButton>(Resource.Id.fab);

            var adapter = new ProductListAdapter(this, products);

            var lv = FindViewById <ListView>(Resource.Id.listView);

            lv.Adapter    = adapter;
            lv.ItemClick += (sender, e) =>
            {
                var intent  = new Intent(this, typeof(DetailActivity));
                var product = products[e.Position];
                intent.PutExtra(PRODUCT_ID, product.ProductId);
                StartActivity(intent);
                OverridePendingTransition(Resource.Animation.slide_in_right, Resource.Animation.slide_out_left);
            };
        }
Esempio n. 14
0
            public override bool OnDependentViewChanged(CoordinatorLayout parent, Java.Lang.Object jChild, View dependency)
            {
                if (dependency is T view)
                {
                    var child = jChild.JavaCast <View>();
                    if (_dependsOnView)
                    {
                        //TODO this 4dp margin is actual shadow layout height, which is 4 dp in bottomBar library ver. 2.0.2
                        float transitionY = view.TranslationY - view.Height + (State != StateExpanded ? PixelSizeConverter.DpToPx(4) : 0);
                        child.TranslationY = System.Math.Min(transitionY, 0);
                    }

                    if (view.TranslationY >= view.Height)
                    {
                        _dependsOnView  = false;
                        view.Visibility = ViewStates.Gone;
                    }
                    if (State != StateExpanded)
                    {
                        _dependsOnView  = true;
                        view.Visibility = ViewStates.Visible;
                    }

                    return(false);
                }

                return(base.OnDependentViewChanged(parent, jChild, dependency));
            }
        public override async void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            _mapButton         = view.FindViewById <ImageView>(Resource.Id.Fragment_PlaceDetails_MapSearchButton);
            _uberButton        = view.FindViewById <ImageView>(Resource.Id.Fragment_PlaceDetails_UberButton);
            _toolbar           = view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.Fragment_PlaceDetails_ActionBarToolbar);
            _callFAB           = view.FindViewById <FloatingActionButton>(Resource.Id.Fragment_PlaceDetails_CallFAB);
            _photoImageView    = view.FindViewById <ImageView>(Resource.Id.Fragment_PlaceDetails_PhotoImageView);
            _adressTextView    = view.FindViewById <TextView>(Resource.Id.Fragment_PlaceDetails_AdresTextView);
            _distanceTextView  = view.FindViewById <TextView>(Resource.Id.Fragment_PlaceDetails_DistanceTextView);
            _rootLayout        = view.FindViewById <CoordinatorLayout>(Resource.Id.Fragment_PlaceDetails_Root);
            _openHoursTextView = view.FindViewById <TextView>(Resource.Id.Fragment_PlaceDetails_OpenTextView);

            _rootLayout.Visibility = ViewStates.Invisible;
            var overlay = new LoadingOverlay(Activity);

            overlay.Show();

            _mapButton.Click  += OnMapButtonClick;
            _uberButton.Click += OnUberButtonClick;
            _callFAB.Click    += OnCallFABClick;

            await InitPage();

            InitActionBar();

            overlay.Hide();

            _rootLayout.Visibility = ViewStates.Visible;
        }
        public override bool OnDependentViewChanged(CoordinatorLayout parent, Java.Lang.Object jChild, View dependency)
        {
            var behavior = GetBottomSheetBehavior(dependency);

            if (behavior != null)
            {
                int peekHeight = behavior.PeekHeight;
                // The default peek height is -1, which
                // gets resolved to a 16:9 ratio with the parent
                var actualPeek = behavior.PeekHeight >= 0 ? behavior.PeekHeight : (int)(9 * (double)parent.Height / 16);

                // Only perform alpha change when view is between "hidden"/"collapsed"  and open states
                if (dependency.Top <= actualPeek)
                {
                    // calculate effective view area
                    var fullHeight = actualPeek - parent.Height;
                    //  var dy = dependency.Top - parent.Height;
                    var fractionPosition = (float)dependency.Top / fullHeight;

                    if (fractionPosition >= 0 && fractionPosition <= 1)
                    {
                        var child = jChild.JavaCast <View>();
                        child.Alpha = fractionPosition;
                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 17
0
        protected override void OnCreate(Bundle bundle)
        {
            this.ChangeStatusBarColor(Color.ParseColor("#2C2C2C"));

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.MainActivity);
            OverridePendingTransition(Resource.Animation.abc_fade_in, Resource.Animation.abc_fade_out);

            SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.Toolbar));
            SupportActionBar.SetDisplayShowHomeEnabled(false);
            SupportActionBar.SetDisplayShowTitleEnabled(false);

            runningEntryCardFrame            = FindViewById(Resource.Id.MainRunningTimeEntryFrame);
            runningEntryCardFrame.Visibility = ViewStates.Invisible;

            playButton        = FindViewById <FloatingActionButton>(Resource.Id.MainPlayButton);
            stopButton        = FindViewById <FloatingActionButton>(Resource.Id.MainStopButton);
            coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.MainCoordinatorLayout);

            disposeBag = new CompositeDisposable();

            disposeBag.Add(ViewModel.IsTimeEntryRunning.Subscribe(onTimeEntryCardVisibilityChanged));
            disposeBag.Add(ViewModel.WeakSubscribe <PropertyChangedEventArgs>(nameof(ViewModel.SyncingProgress), onSyncChanged));

            setupStartTimeEntryOnboardingStep();
            setupStopTimeEntryOnboardingStep();
            setupTapToEditOnboardingStep();
        }
Esempio n. 18
0
        public override bool OnDependentViewChanged(CoordinatorLayout parent, Object child, View dependency)
        {
            float translationY = Math.Min(0, dependency.TranslationY - dependency.Height);

            (child as View).TranslationY = translationY;
            return(true);
        }
Esempio n. 19
0
        private void FindViews()
        {
            selectCourse       = FindViewById <Spinner>(Resource.Id.spinnerSelectCourse);
            rootView           = FindViewById <CoordinatorLayout>(Resource.Id.linearLayout12);
            toolbar            = FindViewById <TextView>(Resource.Id.newChapterToolbar);
            label1             = FindViewById <TextView>(Resource.Id.newChapterLabel1);
            label2             = FindViewById <TextView>(Resource.Id.newChapterLabel2);
            label3             = FindViewById <TextView>(Resource.Id.newChapterLabel3);
            label4             = FindViewById <TextView>(Resource.Id.newChapterLabel4);
            chapterNumber      = FindViewById <EditText>(Resource.Id.newChapterNumber);
            chapterTitle       = FindViewById <EditText>(Resource.Id.newChapterTitle);
            chapterDescription = FindViewById <EditText>(Resource.Id.newChapterDescription);
            chapterContent     = FindViewById <EditText>(Resource.Id.newChapterContent);
            newCourse          = FindViewById <Button>(Resource.Id.newCourseButton);
            existingCourse     = FindViewById <Button>(Resource.Id.newExistingCourse);
            newChapterSubmit   = FindViewById <Button>(Resource.Id.newChapterSubmit);
            newCourseTitle     = FindViewById <EditText>(Resource.Id.newChapterCourse);

            Typeface tf = Typeface.CreateFromAsset(Assets, "CerebriSans-Regular.otf");

            toolbar.SetTypeface(tf, TypefaceStyle.Bold);
            label1.SetTypeface(tf, TypefaceStyle.Bold);
            label2.SetTypeface(tf, TypefaceStyle.Bold);
            label3.SetTypeface(tf, TypefaceStyle.Bold);
            label4.SetTypeface(tf, TypefaceStyle.Bold);
            newCourse.SetTypeface(tf, TypefaceStyle.Bold);
            existingCourse.SetTypeface(tf, TypefaceStyle.Bold);
            newChapterSubmit.SetTypeface(tf, TypefaceStyle.Bold);
            chapterNumber.SetTypeface(tf, TypefaceStyle.Normal);
            chapterTitle.SetTypeface(tf, TypefaceStyle.Normal);
            chapterDescription.SetTypeface(tf, TypefaceStyle.Normal);
            chapterContent.SetTypeface(tf, TypefaceStyle.Normal);
            newCourseTitle.SetTypeface(tf, TypefaceStyle.Normal);
        }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            _root = view.FindViewById <CoordinatorLayout>(Resource.Id.fragment_details_root);

            // var appBar = view.FindViewById<BottomAppBar>(Resource.Id.fragment_details_bottomAppBar);
            // if (appBar != null)
            // {
            //     appBar.NavigationClick += (sender, args) =>
            //     {
            //         var fragment = new BottomNavigationDrawerFragment();
            //         fragment.Show(ChildFragmentManager, fragment.Tag);
            //     };
            // }

            var topAppBar = view.FindViewById <MaterialToolbar>(Resource.Id.fragment_main_topAppBar);

            if (topAppBar != null)
            {
                topAppBar.NavigationClick += (sender, args) =>
                {
                    Activity.SupportFragmentManager.PopBackStack();
                };
            }

            _actionButton = view.FindViewById <FloatingActionButton>(Resource.Id.fragment_main_share_button);

            var addToCalendarButton = view.FindViewById <Button>(Resource.Id.fragment_details_add_to_calendar_button);

            addToCalendarButton.Click += AddToCalendarButtonOnClick;
        }
Esempio n. 21
0
        public void OnStopNestedScrollOriginal(
            CoordinatorLayout coordinatorLayout, Java.Lang.Object childObject, View target)
        {
            View child = Android.Runtime.Extensions.JavaCast <View>(childObject);

            if (child.Top == mMinOffset)
            {
                setStateInternal(STATE_EXPANDED);
                return;
            }
            View nestedScrollingChild;

            mNestedScrollingChildRef.TryGetTarget(out nestedScrollingChild);
            if (target != nestedScrollingChild || !mNestedScrolled)
            {
                return;
            }
            int top;
            int targetState;

            if (mLastNestedScrollDy > 0)
            {
                top         = mMinOffset;
                targetState = STATE_EXPANDED;
            }
            else if (mHideable && shouldHide(child, getYVelocity()))
            {
                top         = mParentHeight;
                targetState = STATE_HIDDEN;
            }
            else if (mLastNestedScrollDy == 0)
            {
                int currentTop = child.Top;
                if (Math.Abs(currentTop - mMinOffset) < Math.Abs(currentTop - mMaxOffset))
                {
                    top         = mMinOffset;
                    targetState = STATE_EXPANDED;
                }
                else
                {
                    top         = mMaxOffset;
                    targetState = STATE_COLLAPSED;
                }
            }
            else
            {
                top         = mMaxOffset;
                targetState = STATE_COLLAPSED;
            }
            if (mViewDragHelper.SmoothSlideViewTo(child, child.Left, top))
            {
                setStateInternal(STATE_SETTLING);
                ViewCompat.PostOnAnimation(child, this.CreateSettleRunnable(child, targetState));
            }
            else
            {
                setStateInternal(targetState);
            }
            mNestedScrolled = false;
        }
Esempio n. 22
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.LogTimeEntriesListFragment, container, false);

            view.FindViewById <TextView> (Resource.Id.EmptyTextTextView).SetFont(Font.RobotoLight);

            experimentEmptyView         = view.FindViewById <View> (Resource.Id.ExperimentEmptyMessageView);
            emptyMessageView            = view.FindViewById <View> (Resource.Id.EmptyMessageView);
            welcomeMessage              = view.FindViewById <TextView> (Resource.Id.WelcomeTextView);
            noItemsMessage              = view.FindViewById <TextView> (Resource.Id.EmptyTitleTextView);
            layoverView                 = view.FindViewById <View> (Resource.Id.LayoverView);
            layoverView.Click          += (sender, e) => { };
            layoverDismissButton        = view.FindViewById <Button> (Resource.Id.LayoverButton);
            layoverDismissButton.Click += OnAllrightButtonClicked;
            recyclerView                = view.FindViewById <RecyclerView> (Resource.Id.LogRecyclerView);
            recyclerView.SetLayoutManager(new LinearLayoutManager(Activity));
            swipeLayout = view.FindViewById <SwipeRefreshLayout> (Resource.Id.LogSwipeContainer);
            swipeLayout.SetOnRefreshListener(this);
            coordinatorLayout = view.FindViewById <CoordinatorLayout> (Resource.Id.logCoordinatorLayout);
            StartStopBtn      = view.FindViewById <StartStopFab> (Resource.Id.StartStopBtn);
            timerComponent    = ((MainDrawerActivity)Activity).Timer; // TODO: a better way to do this?
            HasOptionsMenu    = true;

            var settingsStore = ServiceContainer.Resolve <SettingsStore> ();
            var authManager   = ServiceContainer.Resolve <AuthManager> ();

            if (settingsStore.ShowOverlay || !authManager.OfflineMode)
            {
                layoverView.Visibility = ViewStates.Gone;
            }

            return(view);
        }
Esempio n. 23
0
 ///<inheritdoc/>
 protected override void SetView()
 {
     SetContentView(Resource.Layout.MainActivityLayout);
     _coordinatorLayout               = FindViewById <CoordinatorLayout>(Resource.Id.mainActivityCoordinatorLayout);
     _floatingActionButton            = FindViewById <FloatingActionButton>(Resource.Id.floatButtonId);
     _floatingActionButton.Visibility = ViewStates.Gone;
 }
            public void UpdateSnackbar(CoordinatorLayout parent, View dependency, View child)
            {
                if (!_isTablet && _isShy && dependency is Snackbar.SnackbarLayout)
                {
                    if (_snackbarHeight == -1)
                    {
                        _snackbarHeight = dependency.Height;
                    }
                    if (Math.Abs(ViewCompat.GetTranslationY(child)) > double.Epsilon)
                    {
                        return;
                    }

                    var targetPadding = _bottomNavHeight + _snackbarHeight - _defaultOffset;

                    var layoutParams = (ViewGroup.MarginLayoutParams)dependency.LayoutParameters;
                    layoutParams.BottomMargin = targetPadding;

                    child.BringToFront();
                    child.Parent.RequestLayout();

                    if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat)
                    {
                        ((View)child.Parent).Invalidate();
                    }
                }
            }
Esempio n. 25
0
        void ConnectViews()
        {
            // RadioButtons
            optionARadio = (RadioButton)FindViewById(Resource.Id.optionARadio);
            optionBRadio = (RadioButton)FindViewById(Resource.Id.optionBRadio);
            optionCRadio = (RadioButton)FindViewById(Resource.Id.optionCRadio);
            optionDRadio = (RadioButton)FindViewById(Resource.Id.optionDRadio);

            optionARadio.Click += OptionARadio_Click;
            optionBRadio.Click += OptionBRadio_Click;
            optionCRadio.Click += OptionCRadio_Click;
            optionDRadio.Click += OptionDRadio_Click;

            // TextViews
            optionAText      = (TextView)FindViewById(Resource.Id.optionAText);
            optionBText      = (TextView)FindViewById(Resource.Id.optionBText);
            optionCText      = (TextView)FindViewById(Resource.Id.optionCText);
            optionDText      = (TextView)FindViewById(Resource.Id.optionDText);
            questionText     = (TextView)FindViewById(Resource.Id.questionText);
            quizPositionText = (TextView)FindViewById(Resource.Id.quizPositionText);
            timeCounterText  = (TextView)FindViewById(Resource.Id.timeCounterText);


            // Button
            proceedQuizButton        = (Button)FindViewById(Resource.Id.proceedQuizButton);
            proceedQuizButton.Click += CheckAnswerButton_Click;

            // Views
            rootView = (CoordinatorLayout)FindViewById(Resource.Id.rootView);
        }
Esempio n. 26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // VARIOUS OPTIONS (before creation)
            // OptionView.BackgroundColorSquare = Resource.Color.blue;
            // OptionView.NoBackground = true;
            // OptionView.ColorCloud = Resource.Color.red;
            // OptionView.ColorProgressBar = Resource.Color.red;
            // OptionView.ColorProgressBarInProgress = Resource.Color.darkblue;
            // OptionView.ColorProgressBarText = Resource.Color.darkblue;
            // OptionView.ColorSuccess = Resource.Color.darkblue;
            // OptionView.ColorFail = Resource.Color.orange;
            // OptionView.NoIntro = true;

            SetContentView(Resource.Layout.activity_main);

            SetSupportActionBar(FindViewById <Toolbar> (Resource.Id.toolbar));

            coordinatorLayout   = FindViewById <CoordinatorLayout> (Resource.Id.coordinatorLayout);
            elasticDownloadView = FindViewById <ElasticDownloadView> (Resource.Id.elastic_download_view);

            fabStart        = FindViewById <FloatingActionButton> (Resource.Id.fabStart);
            fabStart.Click += StartProgress;

            fabCancel            = FindViewById <FloatingActionButton> (Resource.Id.fabCancel);
            fabCancel.Visibility = ViewStates.Invisible;
            fabCancel.Click     += CancelProgress;
        }
        protected override void OnCreate(Bundle?savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var mauiApp = MauiApplication.Current.Application;

            if (mauiApp == null)
            {
                throw new InvalidOperationException($"The {nameof(IApplication)} instance was not found.");
            }

            var services = MauiApplication.Current.Services;

            if (mauiApp == null)
            {
                throw new InvalidOperationException($"The {nameof(IServiceProvider)} instance was not found.");
            }

            var mauiContext = new MauiContext(services, this);

            var state  = new ActivationState(mauiContext, savedInstanceState);
            var window = mauiApp.CreateWindow(state);

            window.MauiContext = mauiContext;

            var content = (window.Page as IView) ?? window.Page.View;

            CoordinatorLayout parent = new CoordinatorLayout(this);

            SetContentView(parent, new ViewGroup.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));

            //AddToolbar(parent);

            parent.AddView(content.ToNative(window.MauiContext), new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));
        }
Esempio n. 28
0
 public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Object child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
 {
     base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
     //if (dyConsumed > 0 && (child as FloatingActionButton).Visibility  == ViewStates.Visible)
     //{
     //    // User scrolled down and the FAB is currently visible -> hide the FAB
     //    if (thisbutton != null)
     //    {
     //        if (thisbutton == child && pager.CurrentItem == page)
     //            thisbutton.Hide();
     //        else
     //            thisbutton.Hide();
     //    }
     //    else
     //        (child as FloatingActionButton).Hide();
     //}
     //else if (dyConsumed < 0 && (child as FloatingActionButton).Visibility != ViewStates.Visible)
     //{
     //    // User scrolled up and the FAB is currently not visible -> show the FAB
     //    if (Bootlegger.BootleggerClient.CurrentUser != null)
     //        if (thisbutton != null)
     //            if (thisbutton == child && pager.CurrentItem == page)
     //                thisbutton.Show();
     //            else
     //                thisbutton.Hide();
     //        else
     //            (child as FloatingActionButton).Show();
     //}
 }
Esempio n. 29
0
 public override bool OnStartNestedScroll(CoordinatorLayout coordinatorLayout,
                                          Java.Lang.Object child, View directTargetChild, View target, int nestedScrollAxes)
 {
     return(nestedScrollAxes == (int)ScrollAxis.Vertical ||
            base.OnStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
                                     nestedScrollAxes));
 }
Esempio n. 30
0
 public override void OnDependentViewRemoved(CoordinatorLayout parent, Java.Lang.Object child, View dependency)
 {
     if (IsInstanceOf <FloatingActionMenu>(child) && IsInstanceOf <Snackbar.SnackbarLayout>(dependency))
     {
         this.UpdateTranslation(parent, (View)child, dependency);
     }
 }
Esempio n. 31
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var info = FamiStudioForm.Instance != null ? FamiStudioForm.Instance.ActiveDialog as PropertyDialogActivityInfo : null;

            if (savedInstanceState != null || info == null)
            {
                Finish();
                return;
            }

            dlg = info.Dialog;
            dlg.CloseRequested += Dlg_CloseRequested;

            var appBarLayoutParams = new AppBarLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, DroidUtils.GetSizeAttributeInPixel(this, Android.Resource.Attribute.ActionBarSize));

            appBarLayoutParams.ScrollFlags = 0;

            toolbar = new AndroidX.AppCompat.Widget.Toolbar(new ContextThemeWrapper(this, Resource.Style.ToolbarTheme));
            toolbar.LayoutParameters = appBarLayoutParams;
            toolbar.SetTitleTextAppearance(this, Resource.Style.LightGrayTextMediumBold);
            SetSupportActionBar(toolbar);

            ActionBar actionBar = SupportActionBar;

            if (actionBar != null)
            {
                actionBar.SetDisplayHomeAsUpEnabled(true);
                actionBar.SetHomeButtonEnabled(true);
                actionBar.SetHomeAsUpIndicator(Android.Resource.Drawable.IcMenuCloseClearCancel);
                actionBar.Title = dlg.Title;
            }

            appBarLayout = new AppBarLayout(this);
            appBarLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            appBarLayout.AddView(toolbar);

            fragmentView = new FragmentContainerView(this);
            fragmentView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            fragmentView.Id = FragmentViewId;

            var scrollViewLayoutParams = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            scrollViewLayoutParams.Behavior = new AppBarLayout.ScrollingViewBehavior(this, null);

            scrollView = new NestedScrollView(new ContextThemeWrapper(this, Resource.Style.DarkBackgroundStyle));
            scrollView.LayoutParameters = scrollViewLayoutParams;
            scrollView.AddView(fragmentView);

            coordLayout = new CoordinatorLayout(this);
            coordLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            coordLayout.AddView(appBarLayout);
            coordLayout.AddView(scrollView);

            SetContentView(coordLayout);

            SupportFragmentManager.BeginTransaction().SetReorderingAllowed(true).Add(fragmentView.Id, dlg.Properties, "PropertyDialog").Commit();
        }
Esempio n. 32
0
 private void EnsureDependables ()
 {
     if (mBehavior == null) {
         var lp = (CoordinatorLayout.LayoutParams)LayoutParameters;
         mBehavior = (AppBarLayout.Behavior)lp.Behavior;
     }
     if (xParent == null) {
         xParent = Android.Runtime.Extensions.JavaCast<CoordinatorLayout> (Parent);
     }
 }
        public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
        {
            base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

            var floatingActionButtonChild = child.JavaCast<FloatingActionButton>();

            if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible)
                floatingActionButtonChild.Hide();
            else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible)
                floatingActionButtonChild.Show();
        }
Esempio n. 34
0
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate (Resource.Layout.LogTimeEntriesListFragment, container, false);
            view.FindViewById<TextView> (Resource.Id.EmptyTitleTextView).SetFont (Font.Roboto);
            view.FindViewById<TextView> (Resource.Id.EmptyTextTextView).SetFont (Font.RobotoLight);

            emptyMessageView = view.FindViewById<View> (Resource.Id.EmptyMessageView);
            emptyMessageView.Visibility = ViewStates.Gone;
            recyclerView = view.FindViewById<RecyclerView> (Resource.Id.LogRecyclerView);
            recyclerView.SetLayoutManager (new LinearLayoutManager (Activity));
            coordinatorLayout = view.FindViewById<CoordinatorLayout> (Resource.Id.logCoordinatorLayout);
            return view;
        }
		public override void OnNestedScroll (CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
		{
			base.OnNestedScroll (coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

			var button = child as FloatingActionButton;

			if (dyConsumed > 0 && button.Visibility == ViewStates.Visible) {

				button.Hide ();

			} else if (dyConsumed < 0 && button.Visibility != ViewStates.Visible) {

				button.Show ();
			}
		}
Esempio n. 36
0
 public override bool OnInterceptTouchEvent(CoordinatorLayout parent, Object child, MotionEvent ev)
 {
     if (parent.IsPointInChildBounds(child as SnackbarLayout, (int) ev.GetX(), (int) ev.GetY()))
     {
         switch (ev.ActionMasked)
         {
             case MotionEventActions.Down:
                 SnackbarManager.Instance().CancelTimeout(TSnackbar.getInstace().mManagerCallback);
                 break;
             case MotionEventActions.Up:
             case MotionEventActions.Cancel:
                 SnackbarManager.Instance().RestoreTimeout(TSnackbar.getInstace().mManagerCallback);
                 break;
         }
     }
     return base.OnInterceptTouchEvent(parent, child, ev);
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.activity_snackbar);
            this.fabSend = FindViewById<FloatingActionButton>(Resource.Id.fabSend);
            this.fabDelete = FindViewById<FloatingActionButton>(Resource.Id.fabDelete);
            this.coordinator = FindViewById<CoordinatorLayout>(Resource.Id.coordinatorLayout);
            this.fab = FindViewById<FloatingActionButton>(Resource.Id.fab);

            this.fam = FindViewById<FloatingActionMenu>(Resource.Id.menu);
            this.fam.HideMenuButton(false);
            this.fam.PostDelayed(() => this.fam.ShowMenuButton(true), 200);

            this.fab.Hide(false);
            this.fab.PostDelayed(() => fab.Show(true), 200);
        }
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate (Resource.Layout.LogTimeEntriesListFragment, container, false);
            view.FindViewById<TextView> (Resource.Id.EmptyTextTextView).SetFont (Font.RobotoLight);

            emptyMessageView = view.FindViewById<View> (Resource.Id.EmptyMessageView);
            emptyMessageView.Visibility = ViewStates.Gone;
            recyclerView = view.FindViewById<RecyclerView> (Resource.Id.LogRecyclerView);
            recyclerView.SetLayoutManager (new LinearLayoutManager (Activity));
            swipeLayout = view.FindViewById<SwipeRefreshLayout> (Resource.Id.LogSwipeContainer);
            swipeLayout.SetOnRefreshListener (this);
            coordinatorLayout = view.FindViewById<CoordinatorLayout> (Resource.Id.logCoordinatorLayout);
            StartStopBtn = view.FindViewById<StartStopFab> (Resource.Id.StartStopBtn);
            timerComponent = ((MainDrawerActivity)Activity).Timer; // TODO: a better way to do this?
            HasOptionsMenu = true;

            return view;
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.backup_path_fragment, container, false);
			backupPathLayout = view.FindViewById<LinearLayout>(Resource.Id.backup_path_layout);
			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			string backupPath = Pref.BackupPath;
			backupPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.backup_path_fragment);
			backupPathFragment.RefreshFilesList(backupPath);
			backupPathFragment.SnackbarView = coordinatorLayout;
			//backupPathFragment.PrefKey = Pref.BackupPathKey;

			etBackupPath = view.FindViewById<EditText>(Resource.Id.etBackupPath);
			etBackupPath.Text = backupPath;
			etBackupPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
			{
				try {
					var dir = new DirectoryInfo(etBackupPath.Text);
					if (dir.IsDirectory()) {
						Pref.BackupPath = etBackupPath.Text;
					} else {
						Show("잘못된 경로: " + etBackupPath.Text);
						etBackupPath.Text = Pref.BackupPath;
					}
				} catch {
					Show("잘못된 경로: " + etBackupPath.Text);
					etBackupPath.Text = Pref.BackupPath;
				}
				backupPathFragment.RefreshFilesList(etBackupPath.Text);
			};
			etBackupPath.KeyPress += (object sender, View.KeyEventArgs e) =>
			{
				e.Handled = false;
				if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) {
					var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(etBackupPath.WindowToken, 0);
					etBackupPath.ClearFocus();
					e.Handled = true;
				}
			};

			backupPathToolbar = view.FindViewById<Toolbar>(Resource.Id.backup_path_toolbar);
			backupPathToolbar.InflateMenu(Resource.Menu.toolbar_backup_path_menu);
			backupPathToolbar.MenuItemClick += (sender, e) =>
			{
				switch (e.Item.ItemId) {
					case Resource.Id.toolbar_backup_path_menu_up:
						OnBackPressedFragment();
						break;
					case Resource.Id.toolbar_backup_path_menu_home:
						Refresh(Pref.BackupPath);
						break;
					case Resource.Id.toolbar_backup_path_menu_restore:
						Show(Restore());
						break;
				}
			};

			fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab);
			fab.Click += (sender, e) =>
			{
				Show(Backup());
			};

			return view;
		}
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate (Resource.Layout.LogTimeEntriesListFragment, container, false);
            view.FindViewById<TextView> (Resource.Id.EmptyTextTextView).SetFont (Font.RobotoLight);

            experimentEmptyView = view.FindViewById<View> (Resource.Id.ExperimentEmptyMessageView);
            emptyMessageView = view.FindViewById<View> (Resource.Id.EmptyMessageView);
            welcomeMessage = view.FindViewById<TextView> (Resource.Id.WelcomeTextView);
            noItemsMessage = view.FindViewById<TextView> (Resource.Id.EmptyTitleTextView);
            layoverView = view.FindViewById<View> (Resource.Id.LayoverView);
            layoverView.Click += (sender, e) => { };
            layoverDismissButton = view.FindViewById<Button> (Resource.Id.LayoverButton);
            layoverDismissButton.Click += OnAllrightButtonClicked;
            recyclerView = view.FindViewById<RecyclerView> (Resource.Id.LogRecyclerView);
            recyclerView.SetLayoutManager (new LinearLayoutManager (Activity));
            swipeLayout = view.FindViewById<SwipeRefreshLayout> (Resource.Id.LogSwipeContainer);
            swipeLayout.SetOnRefreshListener (this);
            coordinatorLayout = view.FindViewById<CoordinatorLayout> (Resource.Id.logCoordinatorLayout);
            StartStopBtn = view.FindViewById<StartStopFab> (Resource.Id.StartStopBtn);
            timerComponent = ((MainDrawerActivity)Activity).Timer; // TODO: a better way to do this?
            HasOptionsMenu = true;
            Activity.InvalidateOptionsMenu ();

            var settingsStore = ServiceContainer.Resolve<SettingsStore> ();
            var authManager = ServiceContainer.Resolve<AuthManager> ();
            if (settingsStore.ShowOverlay || !authManager.OfflineMode) {
                layoverView.Visibility = ViewStates.Gone;
            }
            return view;
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.work_path_fragment, container, false);
			workPathLayout = view.FindViewById<LinearLayout>(Resource.Id.work_path_layout);
			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			string workPath = Pref.WorkPath;
			workPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.work_path_fragment);
			workPathFragment.RefreshFilesList(workPath);
			workPathFragment.SnackbarView = coordinatorLayout;
			//workPathFragment.PrefKey = Pref.WorkPathKey;

			etWorkPath = view.FindViewById<EditText>(Resource.Id.etWorkPath);
			etWorkPath.Text = workPath;
			etWorkPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
			{
				try {
					var dir = new DirectoryInfo(etWorkPath.Text);
					if (dir.IsDirectory()) {
						Pref.WorkPath = etWorkPath.Text;
					} else {
						Show("잘못된 경로: " + etWorkPath.Text);
						etWorkPath.Text = Pref.WorkPath;
					}
				} catch {
					Show("잘못된 경로: " + etWorkPath.Text);
					etWorkPath.Text = Pref.WorkPath;
				}
				workPathFragment.RefreshFilesList(etWorkPath.Text);
			};
			etWorkPath.KeyPress += (object sender, View.KeyEventArgs e) =>
			{
				e.Handled = false;
				if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) {
					var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(etWorkPath.WindowToken, 0);
					etWorkPath.ClearFocus();
					e.Handled = true;
				}
			};

			workPathToolbar = view.FindViewById<Toolbar>(Resource.Id.work_path_toolbar);
			workPathToolbar.InflateMenu(Resource.Menu.toolbar_work_path_menu);
			workPathToolbar.MenuItemClick += (sender, e) =>
			{
				//Toast.MakeText(this, "Bottom toolbar pressed: " + e.Item.TitleFormatted, ToastLength.Short).Show();
				bool ret;
				switch (e.Item.ItemId) {
					case Resource.Id.toolbar_work_path_menu_up:
					OnBackPressedFragment();
					break;
					case Resource.Id.toolbar_work_path_menu_home:
					if (!Refresh(Pref.WorkPath))
						Show("경로 이동 실패: " + Pref.WorkPath);
					break;
					case Resource.Id.toolbar_work_path_menu_storage:
					if (!Refresh("/storage"))
						Show("경로 이동 실패: " + "/storage");
					break;
					case Resource.Id.toolbar_work_path_menu_sdcard:
					if (!Refresh(Environment.ExternalStorageDirectory.AbsolutePath))
						Show("경로 이동 실패: " + Environment.ExternalStorageDirectory.AbsolutePath);
					break;
					case Resource.Id.toolbar_work_path_menu_extsdcard:
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("ext") || item.Name.ToLower().StartsWith("sdcard1")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (Refresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "SD 카드");
					break;
					case Resource.Id.toolbar_work_path_menu_usbstorage:
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("usb")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (Refresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "USB 저장소");
					break;
				}
			};

			fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab);
			fab.Click += (sender, e) =>
			{
				etWorkPath.Text = workPathFragment.DirPath;
				Pref.WorkPath = etWorkPath.Text;
				workPathFragment.RefreshFilesList();
				Show("경로 설정 완료: " + etWorkPath.Text);
			};

			return view;
		}
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.weld_condition_fragment, container, false);

			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			selectedBackGroundColor = Context.Resources.GetColor(Resource.Color.tab3_textview_background);
			listView = view.FindViewById<ListView>(Resource.Id.wcdListView);
			listView.Adapter = wcdListAdapter;
			listView.FastScrollEnabled = false;
			listView.ChoiceMode = ChoiceMode.Multiple;
			listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
			{
				wcdListAdapter[e.Position].ItemChecked = listView.IsItemChecked(e.Position);
				if (listView.IsItemChecked(e.Position)) {
					lastPosition = e.Position;
					e.View.SetBackgroundColor(selectedBackGroundColor);
				} else {
					e.View.SetBackgroundColor(defaultBackgroundColor);  // 기본 백그라운드 색깔
				}

				try {
					if (wcdListAdapter.Count == 0)
						fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
					else if (listView.CheckedItemCount == 0)
						fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
					else
						fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
				} catch { }

				if (snackbar == null)
					snackbar = Snackbar.Make(coordinatorLayout, listView.CheckedItemCount.ToString() + "개 항목 선택됨", Snackbar.LengthIndefinite)
							.SetAction("선택 취소", (view) => { CheckListItem(); snackbar = null; });
				if (listView.CheckedItemCount > 0) {
					if (snackbar.IsShown)
						snackbar.SetText(listView.CheckedItemCount.ToString() + "개 항목 선택됨");
					else
						snackbar.Show();
				} else if (snackbar != null) {
					snackbar.Dismiss();
					snackbar = null;
				}
			};
			listView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) =>
			{
				FabWcd_Click(sender, e);
			};

			var refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.srl);
			if (refresher != null) {
				refresher.Refresh += delegate
				{
					Refresh(forced: true);
					refresher.Refreshing = false;
				};
			}

			// 떠 있는 액션버튼
			fabWcd = view.FindViewById<FloatingActionButton>(Resource.Id.fab_wcd);
			fabWcd.Click += (object sender, EventArgs e) =>
			{
				if (listView.CheckedItemCount == 0)
					Pref.TextViewDialog(Context, robotPath);
				else
					FabWcd_Click(sender, e);
			};

			try {
				if (wcdListAdapter.Count == 0)
					fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
				else if (listView.CheckedItemCount == 0)
					fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
				else
					fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
			} catch { }

			return view;
		}
 public override bool OnStartNestedScroll(CoordinatorLayout coordinatorLayout, Object child,
     View directTargetChild, View target, int nestedScrollAxes)
 {
     return nestedScrollAxes == ViewCompat.ScrollAxisVertical ||
            base.OnStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
 }
Esempio n. 44
0
		public override bool LayoutDependsOn (CoordinatorLayout parent, Java.Lang.Object child, View dependency)
		{
			return dependency is InfoPane;
		}
Esempio n. 45
0
		public override bool OnDependentViewChanged (CoordinatorLayout parent, Java.Lang.Object child, View dependency)
		{
			// Move the fab vertically to place correctly wrt the info pane
			var fab = child.JavaCast<SwitchableFab> ();
			var currentInfoPaneY = ViewCompat.GetTranslationY (dependency);
			var newTransY = (int)Math.Max (0, dependency.Height - currentInfoPaneY - minMarginBottom - fab.Height / 2);
			ViewCompat.SetTranslationY (fab, -newTransY);

			// If alternating between open/closed state, change the FAB face
			if (wasOpened ^ ((InfoPane)dependency).Opened) {
				fab.Switch ();
				wasOpened = !wasOpened;
			}

			return true;
		}