Beispiel #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_makeorderpartlist, container, false);

            partList = view.FindViewById <RecyclerView>(Resource.Id.makeorderpartlist_partList);
            partList.SetLayoutManager(new LinearLayoutManager(this.Context));
            var dividerItemDecoration = new DividerItemDecoration(partList.Context, DividerItemDecoration.Vertical);

            dividerItemDecoration.SetDrawable(ContextCompat.GetDrawable(this.Context, Resource.Drawable.line_devider));
            partList.AddItemDecoration(dividerItemDecoration);

            cardView = view.FindViewById <CardView>(Resource.Id.makeorderpartlist_bottom_sheet);

            bottomSheetBehavior = From(cardView);
            bottomSheetBehavior.SetBottomSheetCallback(new PartFragmentBehavior());
            bottomSheetBehavior.PeekHeight = 140;
            image      = view.FindViewById <Android.Widget.ImageView>(Resource.Id.makeorderpartlist_image);
            zoomLayout = view.FindViewById <ZoomableLayout>(Resource.Id.zoomableLayout);

            var list    = new List <Dictionary <string, object> >();
            var adapter = new PartListAdapter(null);

            adapter.ItemClick  += PartList_ItemClick;
            adapter.LaborClick += PartList_LaborClick;
            partList.SetAdapter(adapter);
            return(view);
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            var parentThatHasBottomSheetBehavior = FindViewById <FrameLayout>(Resource.Id.bottomsheetview);

            mBottomSheetBehavior = BottomSheetBehavior.From(parentThatHasBottomSheetBehavior);
            if (mBottomSheetBehavior != null)
            {
                mBottomSheetBehavior.SetBottomSheetCallback(new PlayerBehavior(Window.DecorView.RootView));
            }

            var miniPlayer = FindViewById <RelativeLayout>(Resource.Id.miniplayerview);

            miniPlayer.Click += (sender, e) =>
            {
                mBottomSheetBehavior.State = BottomSheetBehavior.StateExpanded;
            };

            var closeButton = FindViewById <ImageView>(Resource.Id.closebutton);

            closeButton.Click += (sender, e) => {
                mBottomSheetBehavior.State = BottomSheetBehavior.StateCollapsed;
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerview);

            mOffsetText = FindViewById <TextView>(Resource.Id.offsetText);
            mStateText  = FindViewById <TextView>(Resource.Id.stateText);

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

            var linearLayoutManager = new LinearLayoutManager(this)
            {
                AutoMeasureEnabled = true
            };

            ApplicationAdapter adapter = new ApplicationAdapter(this, listApplications(this));

            recyclerView.SetLayoutManager(linearLayoutManager);
            recyclerView.SetAdapter(adapter);

            FrameLayout parentThatHasBottomSheetBehavior = (FrameLayout)recyclerView.Parent.Parent;

            mBottomSheetBehavior = BottomSheetBehavior.From(parentThatHasBottomSheetBehavior);

            if (mBottomSheetBehavior != null)
            {
                SetStateText(this, new OnStateChangeEventArgs(mBottomSheetBehavior.State));

                var bttomCallback = new BottomSheetBehaviorOverride(SetOffsetText, SetStateText);

                mBottomSheetBehavior.SetBottomSheetCallback(bttomCallback);
            }

            View peekButton = FindViewById <View>(Resource.Id.peek_me);

            peekButton.Click += delegate {
                //Let's peek it, programmatically
                View peakView = FindViewById <View>(Resource.Id.drag_me);
                mBottomSheetBehavior.PeekHeight = peakView.Height;
                peakView.RequestLayout();
            };

            View modal = FindViewById <View>(Resource.Id.as_modal);

            modal.Click += delegate {
                BottomSheetDialogFragment bottomSheetDialogFragment = new CustomBottomSheetDialogFragment();
                bottomSheetDialogFragment.Show(SupportFragmentManager, bottomSheetDialogFragment.Tag);
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Activity_BottomSheet);

            LinearLayout        sheet = FindViewById <LinearLayout>(Resource.Id.bottom_sheet);
            BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.From(sheet);

            bottomSheetBehavior.PeekHeight = 300;
            bottomSheetBehavior.Hideable   = true;

            bottomSheetBehavior.SetBottomSheetCallback(new MyBottomSheetCallBack());

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

            fab.Click += (o, e) =>
            {
                bottomSheetBehavior.State = BottomSheetBehavior.StateCollapsed;
            };
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle b)
        {
            try
            {
                var layout = inflater.Inflate(Resource.Layout.layout_control, container, false);
                Inject(layout);

                swPower.Click              += SwPowerOnCheckedChange;
                sbVol.OnProgressChanged    += SbVolOnProgressChanged;
                sbCTL.OnProgressChanged    += SbCtlOnProgressChanged;
                sbBass.OnProgressChanged   += SbBassOnProgressChanged;
                sbTreble.OnProgressChanged += SbTrebleOnProgressChanged;

                bsb = BottomSheetBehavior.From(flSheet);
                var bc = new ViewHelper.BrinBottomSheetCallBack
                {
                    OnSlideChanged       = OnSlideChanged,
                    OnStateStatusChanged = OnStateStatusChanged
                };
                bsb.SetBottomSheetCallback(bc);

                llChildAudio.Visibility = ViewStates.Gone;
                llChildVideo.Visibility = ViewStates.Gone;
                llChildInp.Visibility   = ViewStates.Gone;
                llChildSou.Visibility   = ViewStates.Gone;
                llChildNet.Visibility   = ViewStates.Gone;
                llChildSlp.Visibility   = ViewStates.Gone;


                OpenBroadcast();


                return(layout);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Beispiel #6
0
        private void SetUpBottomSheet(int height)

        {
            // Set up bottom sheet
            BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.From(bottomSheet);

            bottomSheetBehavior.PeekHeight = height;
            bottomSheetBehavior.SetBottomSheetCallback(new BSCallBack(bgFabMenu));

            // Fill sports list
            List <string> sportList = new List <string>();

            foreach (var sport in RequestSender.GetSports())
            {
                sportList.Add(sport.Name);
            }

            // Sport spinner
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, sportList);

            sportSpinner.Adapter = adapter;

            // Date picker
            searchDates.Focusable = false;
            searchDates.Click    += (sender, e) => {
                DateTime         today  = DateTime.Today;
                DatePickerDialog dialog = new DatePickerDialog(this, OnStartDateSet, today.Year, today.Month, today.Day);
                dialog.DatePicker.MinDate = today.Millisecond;
                dialog.Show();
            };

            // Load events
            List <WebApi.Classes.Event> events = RequestSender.GetBriefEvents();

            eventList.HasFixedSize = true;
            eventListLayout        = new LinearLayoutManager(this);
            eventList.SetLayoutManager(eventListLayout);
            eventListAdapter = new PulloutEventAdapter(events);
            eventList.SetAdapter(eventListAdapter);
        }
Beispiel #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestedOrientation = ScreenOrientation.Portrait;

            SetContentView(Resource.Layout.Activity_BottomSheet);
            SetUpMap();

            name_txt    = FindViewById <TextView>(Resource.Id.name_txt);
            address_txt = FindViewById <TextView>(Resource.Id.address_txt);
            time_txt    = FindViewById <TextView>(Resource.Id.time_txt);

            SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolBar);

            SupportActionBar ab = SupportActionBar;

            ab.SetHomeAsUpIndicator(Resource.Mipmap.menu_but);
            ab.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (navigationView != null)
            {
                SetUpDrawerContent(navigationView);
            }

            //var menu = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            //menu_but = FindViewById<Button>(Resource.Id.menu_but);
            //menu_but.Click += (sender, e) =>
            //{
            //    mDrawerLayout.OpenDrawer((int)GravityFlags.Left);
            //};

            cancel_ride_but        = FindViewById <Button>(Resource.Id.cancel_ride_but);
            cancel_ride_but.Click += delegate
            {
                Toast.MakeText(this, "Votre course a bien ete annuler!", ToastLength.Long).Show();
                Finish();
            };

            call_but        = FindViewById <Button>(Resource.Id.call_but);
            call_but.Click += delegate
            {
                Toast.MakeText(this, "call button clicked!", ToastLength.Long).Show();
                Finish();
            };

            message_but        = FindViewById <Button>(Resource.Id.message_but);
            message_but.Click += delegate
            {
                Toast.MakeText(this, "message button clicked!", ToastLength.Long).Show();
                Finish();
            };

            LinearLayout        sheet = FindViewById <LinearLayout>(Resource.Id.bottom_sheet);
            BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.From(sheet);

            bottomSheetBehavior.PeekHeight = 300;
            bottomSheetBehavior.Hideable   = true;

            bottomSheetBehavior.SetBottomSheetCallback(new MyBottomSheetCallBack());

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

            fab.Click += (o, e) =>
            {
                bottomSheetBehavior.State = BottomSheetBehavior.StateCollapsed;
                Finish();
            };

            // FIN MAIN____________________________________________________________________
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            SetContentView(Resource.Layout.Main);


            //Status bar
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
            }

            SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolBar);
            SupportActionBar ab = SupportActionBar;

            ab.SetHomeAsUpIndicator(Resource.Drawable.ic_menu1);
            ab.SetDisplayHomeAsUpEnabled(true);

            CollapsingToolbarLayout collapsingToolbar =
                (CollapsingToolbarLayout)FindViewById(Resource.Id.collapsing_toolbar);

            collapsingToolbar.Title = "Pronounce";


            //History
            var listView = FindViewById <ListView>(Resource.Id.listView1);

            editText         = FindViewById <EditText>(Resource.Id.editText1);
            items            = new List <string>(new[] { "History" });
            adapter          = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, items);
            listView.Adapter = adapter;
            FindViewById <Button>(Resource.Id.MyButton).Click += HandleClick;

            listView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                editText.Text = ((TextView)args.View).Text;
            };


            //Drawer
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (navigationView != null)
            {
                SetUpDrawerContent(navigationView);
            }

            // Volume bar setup
            mgr = (AudioManager)GetSystemService(Context.AudioService);

            ////
            _seekBarAlarm = FindViewById <SeekBar>(Resource.Id.seekBar1);

            // modify the ring
            initBar(_seekBarAlarm, Android.Media.Stream.Music);

            /// <summary>
            /// initBar
            /// </summary>
            /// <param name="bar"></param>
            /// <param name="stream"></param>
            ///


            //tts
            tts = new TextToSpeech(this.ApplicationContext, this);
            tts.SetLanguage(Java.Util.Locale.Default);

            Button dbutton      = FindViewById <Button>(Resource.Id.MyButton);
            Button clear_button = FindViewById <Button>(Resource.Id.button1);

            editText = FindViewById <EditText>(Resource.Id.editText1);


            //Pitch and Speed
            var txtSpeedVal = FindViewById <TextView>(Resource.Id.textSpeed);
            var txtPitchVal = FindViewById <TextView>(Resource.Id.textPitch);
            var seekSpeed   = FindViewById <SeekBar>(Resource.Id.seekSpeed);
            var seekPitch   = FindViewById <SeekBar>(Resource.Id.seekPitch);

            // set up the initial pitch and speed values then the onscreen values
            // the pitch and rate both go from 0f to 1f, however if you have a seek bar with a max of 1, you get a single step
            // therefore, a simpler option is to have the slider go from 0 to 255 and divide the position of the slider by 255 to get
            // the float
            seekSpeed.Progress = seekPitch.Progress = 255;
            txtSpeedVal.Text   = "1";
            txtPitchVal.Text   = "1";

            // set the speed and pitch
            tts.SetPitch(1.0f);
            tts.SetSpeechRate(1.0f);

            // sliders
            seekPitch.StopTrackingTouch += (object sender, SeekBar.StopTrackingTouchEventArgs e) =>
            {
                var seek     = sender as SeekBar;
                var progress = seek.Progress / 255f;
                tts.SetPitch(progress);
                txtPitchVal.Text = progress.ToString("F2");
            };
            seekSpeed.StopTrackingTouch += (object sender, SeekBar.StopTrackingTouchEventArgs e) =>
            {
                var seek     = sender as SeekBar;
                var progress = seek.Progress / 255f;
                tts.SetSpeechRate(progress);
                txtSpeedVal.Text = progress.ToString("F2");
            };



            //Bottom sheet

            LinearLayout        sheet = FindViewById <LinearLayout>(Resource.Id.bottom_sheet);
            BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.From(sheet);

            var metrics    = Resources.DisplayMetrics;
            var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

            if (heightInDp <= 731)
            {
                // it's a phone
                bottomSheetBehavior.PeekHeight = 120;
            }
            else
            {
                // it's a tablet
                bottomSheetBehavior.PeekHeight = 360;
            }

            bottomSheetBehavior.Hideable = false;

            bottomSheetBehavior.SetBottomSheetCallback(new MyBottomSheetCallBack());


            //Speak button
            dbutton.Click += Button_Click;


            //Clear button
            clear_button.Click += delegate
            {
                if (!string.IsNullOrEmpty(editText.Text))
                {
                    editText.Text = "";
                }
            };

            //Clear history button
            Button clear_history = FindViewById <Button>(Resource.Id.button3);

            clear_history.Click += delegate
            {
                adapter.Clear();
                adapter.NotifyDataSetChanged();
            };


            //setup navigation view
            _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
        }
Beispiel #9
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup c, Bundle b)
        {
            try
            {
                var layout = inflater.Inflate(Resource.Layout.layout_remote, c, false);
                Inject(layout);

                prefsMain = new Preferences();

                int lastTab = prefsMain.spMain.GetInt(PREF_FRAG_REM_LAST, 1);
                ViewHelper.AddTabLayoutTab(tlMain, "Player", lastTab == 0);
                ViewHelper.AddTabLayoutTab(tlMain, "Receiver", lastTab == 1);
                ViewHelper.AddTabLayoutTab(tlMain, "TV", lastTab == 2);

                tlMain.TabSelected += delegate
                {
                    prefsMain.PutInt(PREF_FRAG_REM_LAST, tlMain.SelectedTabPosition);
                    int lastState = BottomSheetBehavior.StateCollapsed;
                    if (bsbMain.State == BottomSheetBehavior.StateCollapsed ||
                        bsbMain.State == BottomSheetBehavior.StateExpanded)
                    {
                        lastState = bsbMain.State;
                    }
                    bsbMain.Hideable = true;
                    bsbMain.State    = BottomSheetBehavior.StateHidden;

                    RefreshButtons();


                    nvSheet.Post(delegate
                    {
                        try
                        {
                            bsbMain.State    = lastState;
                            bsbMain.Hideable = false;
                        }
                        catch (Exception e)
                        {
                            Toast.MakeText(Activity, $"UI Error: {e.Message}", ToastLength.Short).Show();
                        }
                    });
                };
                gt = new ViewHelper.GestureDetector(flGesture, Application.Context);
                gt.OnGestureEvent += delegate(int id)
                {
                    string cmd = GetCurCmd();
                    switch (id)
                    {
                    case 1:
                        cmd += CmdHelper.Menu.UP;
                        break;

                    case 2:
                        cmd += CmdHelper.Menu.LEFT;
                        break;

                    case 3:
                        cmd += CmdHelper.Menu.DOWN;
                        break;

                    case 4:
                        cmd += CmdHelper.Menu.RIGHT;
                        break;

                    case 5:
                        cmd += CmdHelper.Menu.ENTER;
                        break;
                    }
                    DeviceService.SendCommand($"{cmd}");
                };

                bsbMain = BottomSheetBehavior.From(nvSheet);
                var bsc = new ViewHelper.BrinBottomSheetCallBack();
                bsbMain.SetBottomSheetCallback(bsc);

                nvSheet.PostDelayed(delegate
                {
                    try
                    {
                        bsbMain.Hideable = true;
                        bsbMain.State    = BottomSheetBehavior.StateHidden;
                        bsbMain.State    = BottomSheetBehavior.StateCollapsed;
                        bsbMain.Hideable = false;
                    }
                    catch (Exception e)
                    {
                    }
                }, 1000);


                RefreshButtons();

                LayoutTransition transition = new LayoutTransition();
                transition.SetAnimateParentHierarchy(false);
                //llRemHolder.LayoutTransition = transition;

                OpenBroadcast();
                return(layout);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }