Exemplo n.º 1
0
        public static void AddView(DroidVariable widget, bool alreadyExists)
        {
            var location   = widget.Location;
            var view       = widget.ViewX;
            var parentView = location.ParentView as DroidVariable;
            var parent     = parentView?.ViewLayout;

            //Console.WriteLine("--ADDING {0} {1}, text: {2}, parent: {3}, exists: {4}",
            //                  varName, widgetType, text, parentView == null, alreadyExists);
            //MainActivity.AddView(widget, parentView?.ViewLayout);
            ScriptingFragment.AddView(widget, parent);
            if (parent != null)
            {
                parent.AddView(view);
            }
            else
            {
                TheLayout.AddView(view);
            }
            if (alreadyExists)
            {
                MainActivity.TheLayout.Invalidate();
                MainActivity.TheLayout.RefreshDrawableState();
                view.Invalidate();
                view.RefreshDrawableState();
                //if (parentView != null) {
                parentView?.ViewLayout.Invalidate();
                //}
            }
        }
Exemplo n.º 2
0
        /*public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
         * {
         *  m_view = inflater.Inflate(Resource.Layout.fragment, null);
         *  //m_view.FindViewById<TextView>(Resource.Id.textView1).SetText(Resource.String.quiz);
         *  m_view.FindViewById<ImageView>(Resource.Id.imageView1).SetImageResource(GetViewImage(false));
         *  return m_view;
         * }*/
        public static ScriptingFragment AddFragment(string text, string imageNameActive, string imageNameInactive)
        {
            ScriptingFragment fragment = new ScriptingFragment(text, imageNameActive, imageNameInactive);

            m_fragments.Add(fragment);
            m_activeFragment = fragment;
            return(fragment);
        }
Exemplo n.º 3
0
 public static void ShowView(View view, bool showIt)
 {
     ScriptingFragment.ShowView(view, showIt, false);
     if (view is TextView || view is EditText)
     {
         TheView.ShowHideKeyboard(view, showIt);
     }
 }
Exemplo n.º 4
0
 public static void RemoveView(DroidVariable viewVar)
 {
     if (viewVar == null || viewVar.ViewX == null)
     {
         return;
     }
     ScriptingFragment.RemoveView(viewVar);
 }
Exemplo n.º 5
0
 public static void ShowFragment(ScriptingFragment fragment, bool showIt, bool tabChange)
 {
     for (int i = 0; i < fragment.m_widgets.Count; i++)
     {
         var widget = fragment.m_widgets[i];
         var view   = widget.ViewX;
         widget.ShowView(showIt);
         ShowView(view, showIt, tabChange);
     }
 }
Exemplo n.º 6
0
        public static void SelectTab(int activeTab)
        {
            ScriptingFragment.ShowFragments(activeTab);

            for (int i = 0; i < m_actionBars.Count; i++)
            {
                SetTabIcon(i, activeTab == i);
            }
            CurrentTabId = activeTab;
        }
Exemplo n.º 7
0
 public static void SetTabIcon(int tab, bool active = true)
 {
     if (m_actionBars.Count > tab)
     {
         ActionBar.Tab     curr     = m_actionBars[tab];
         ScriptingFragment fragment = ScriptingFragment.GetFragment(tab);
         int resourceId             = fragment.GetViewImage(active);
         curr.SetIcon(resourceId);
     }
 }
Exemplo n.º 8
0
        public static void AddTab(string text, string selectedImageName, string notSelectedImageName = null)
        {
            ScriptingFragment fragment = ScriptingFragment.AddFragment(text, selectedImageName, notSelectedImageName);

            ActionBar.Tab tab = MainActivity.TheView.AddTabToActionBar(fragment, ScriptingFragment.Count() == 1);

            m_actionBars.Add(tab);
            m_allTabs[text] = m_actionBars.Count - 1;
            SelectTab(m_actionBars.Count - 1);
        }
Exemplo n.º 9
0
 public static void TranslateTabs()
 {
     Localization.CheckCode();
     for (int i = 0; i < m_actionBars.Count; i++)
     {
         ActionBar.Tab     tab        = m_actionBars[i];
         ScriptingFragment fragment   = ScriptingFragment.GetFragment(i);
         string            translated = Localization.GetText(fragment.GetText());
         tab.SetText(translated);
     }
 }
Exemplo n.º 10
0
        public ActionBar.Tab AddTabToActionBar(ScriptingFragment fragment, bool setActive = false)
        {
            ActionBar.Tab tab = ActionBar.NewTab()
                                .SetText(fragment.Text)
                                .SetIcon(setActive ? fragment.ActiveIcon : fragment.InactiveIcon)
                                .SetTag(fragment.Text)
                                .SetTabListener(this);
            ActionBar.AddTab(tab);

            //tv.All .setAllCaps(false);
            return(tab);
        }
Exemplo n.º 11
0
 public static void SetActive(int index)
 {
     m_activeFragment = index < m_fragments.Count ? m_fragments[index] : null;
 }
Exemplo n.º 12
0
 public static void RemoveTabViews(int tabId)
 {
     ScriptingFragment.RemoveTabViews(tabId);
 }
Exemplo n.º 13
0
 public static void RemoveAll()
 {
     ScriptingFragment.RemoveAll();
 }