Ejemplo n.º 1
0
            public ItemView(FragmentConnections frag) : base(frag.themeWrapper)
            {
                this.Orientation = Orientation.Vertical;

                tv1 = new TextView(frag.themeWrapper);
                tv2 = new TextView(frag.themeWrapper);

                tv2.Gravity = GravityFlags.End;
                tv2.SetBackgroundColor(Color.Argb(30, 128, 128, 128));

                this.LayoutParameters = new LinearLayout.LayoutParams(-1, -2)
                {
                    BottomMargin = frag.DpInt(4)
                };

                this.AddView(tv1);
                this.AddView(tv2);

                this.SetOnLongClickListener(this);
            }
Ejemplo n.º 2
0
        private void onNavigationItemSelected(IMenuItem menuItem)
        {
            if (menuItem.IsChecked)
            {
                drawer.CloseDrawers();
                return;
            }
            MyBaseFragment frag   = null;
            int            itemId = menuItem.ItemId;

            switch (itemId)
            {
            case R.Id.nav_home:
                frag = new FragmentHome();
                break;

            case R.Id.nav_logs:
                frag = new FragmentLogs();
                break;

            case R.Id.nav_connections:
                frag = new FragmentConnections();
                break;

            case R.Id.nav_adapters:
                frag = new FragmentAdapters();
                break;

            case R.Id.nav_console:
                frag = new FragmentConsole();
                break;

            case R.Id.nav_start:
                startService();
                break;

            case R.Id.nav_stop:
                stopService();
                break;

            case R.Id.nav_reload:
                reloadService(false);
                break;
            }
            if (frag != null)
            {
                var    title          = itemId == R.Id.nav_home ? JavaAppName : menuItem.TitleFormatted;
                string titleClrString = null;
                SetTitle(title);
                frag.InfoStrChanged += (str) => {
                    if (str == null)
                    {
                        SetTitle(title);
                    }
                    else
                    {
                        if (titleClrString == null)
                        {
                            titleClrString = title.ToString();
                        }
                        SetTitle(titleClrString + " " + str);
                    }
                };

                ReplaceFragment(frag);

                menuItem.SetChecked(true);
            }
            drawer.CloseDrawers();
        }