Exemple #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var match_parent = ViewGroup.LayoutParams.MatchParent;

            pad = DpInt(4);

            rootLayout             = new LinearLayout(Context);
            rootLayout.Orientation = Orientation.Vertical;
            rootLayout.SetPadding(pad, 0, pad, 0);

            var itemsOuter = new ScrollView(Context);

            itemsOuter.LayoutParameters = new LinearLayout.LayoutParams(match_parent, 0, 1);

            itemsLayout             = new LinearLayout(Context);
            itemsLayout.Orientation = Orientation.Vertical;
            itemsLayout.SetPadding(0, pad, 0, pad);

            itemsOuter.AddView(itemsLayout);
            rootLayout.AddView(itemsOuter);

            CreateDataItems();

            TextView logTitleView = CreateDataTitleView("Log");

            rootLayout.AddView(logTitleView);
            var frame = new FrameLayout(Context);

            frame.Id = 233;
            frame.LayoutParameters = new LinearLayout.LayoutParams(match_parent, 0, 1);
            rootLayout.AddView(frame);
            var logView = new FragmentLogs()
            {
                InHome = true
            };

            logView.InfoStrChanged += (str) => {
                if (str == null)
                {
                    logTitleView.Text = "Log";
                }
                else
                {
                    logTitleView.Text = "Log " + str;
                }
            };
            ChildFragmentManager.BeginTransaction()
            .Replace(frame.Id, logView)
            .Commit();

            return(rootLayout);
        }
Exemple #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();
        }
Exemple #3
0
 public ScrollListenr(FragmentLogs fragment)
 {
     Fragment = fragment;
 }