private static void OnRemoveTab(Action<TabHostItemsSourceGenerator, TabHostItemsSourceGenerator.TabInfo> baseAction, TabHostItemsSourceGenerator generator, TabHostItemsSourceGenerator.TabInfo tab)
 {
     var fragment = tab.Content as Fragment;
     if (fragment == null)
     {
         baseAction(generator, tab);
         return;
     }
     var fragmentManager = generator.TabHost.GetFragmentManager();
     if (fragmentManager == null)
         return;
     fragmentManager.BeginTransaction()
         .Remove(fragment)
         .Commit();
     fragmentManager.ExecutePendingTransactions();
 }
 private static void OnTabChanged(Action<TabHostItemsSourceGenerator, object, object, bool, bool> baseAction, TabHostItemsSourceGenerator generator, object oldValue, object newValue, bool clearOldValue, bool setNewValue)
 {
     FragmentManager fragmentManager = null;
     FragmentTransaction ft = null;
     if (clearOldValue)
     {
         var fragment = oldValue as Fragment;
         if (fragment == null)
             baseAction(generator, oldValue, newValue, true, false);
         else if (fragment.IsAlive())
         {
             fragmentManager = generator.TabHost.GetFragmentManager();
             if (fragmentManager != null)
                 ft = fragmentManager.BeginTransaction().Detach(fragment);
         }
     }
     if (setNewValue)
     {
         var fragment = newValue as Fragment;
         if (fragment == null)
             baseAction(generator, oldValue, newValue, false, true);
         else
         {
             if (ft == null)
             {
                 fragmentManager = generator.TabHost.GetFragmentManager();
                 if (fragmentManager != null)
                     ft = fragmentManager.BeginTransaction();
             }
             if (ft != null)
             {
                 ft = fragment.IsDetached
                     ? ft.Attach(fragment)
                     : ft.Replace(generator.TabHost.TabContentView.Id, fragment);
             }
         }
     }
     if (ft != null)
         ft.CommitAllowingStateLoss();
     if (fragmentManager != null)
         fragmentManager.ExecutePendingTransactions();
 }
 private static void TabChanged(TabHostItemsSourceGenerator generator, object oldValue, object newValue, bool clearOldValue, bool setNewValue)
 {
     if (clearOldValue)
     {
         var view = oldValue as View;
         if (view != null)
         {
             generator.TabHost.TabContentView.RemoveView(view);
         }
     }
     if (setNewValue)
     {
         var view = newValue as View;
         if (view == null)
         {
             generator.TabHost.TabContentView.RemoveAllViews();
         }
         else
         {
             generator.TabHost.TabContentView.AddView(view);
         }
     }
 }
 private static void RemoveTab(TabHostItemsSourceGenerator generator, TabInfo tab)
 {
 }
 public TabFactory([NotNull] TabHostItemsSourceGenerator generator)
 {
     Should.NotBeNull(generator, "generator");
     _generator = generator;
 }
 public TabFactory([NotNull] TabHostItemsSourceGenerator generator)
 {
     Should.NotBeNull(generator, "generator");
     _generator = generator;
 }
 private static void RemoveTab(TabHostItemsSourceGenerator generator, TabInfo tab)
 {
     var view = tab.Content as View;
     if (view != null)
         view.ClearBindingsRecursively(true, true);
 }
 private static void TabChanged(TabHostItemsSourceGenerator generator, object oldValue, object newValue, bool clearOldValue, bool setNewValue)
 {
     if (clearOldValue)
     {
         var view = oldValue as View;
         if (view != null)
             generator.TabHost.TabContentView.RemoveView(view);
     }
     if (setNewValue)
     {
         var view = newValue as View;
         if (view == null)
             generator.TabHost.TabContentView.RemoveAllViews();
         else
             generator.TabHost.TabContentView.AddView(view);
     }
 }
 private static void RemoveTab(TabHostItemsSourceGenerator generator, TabInfo tab)
 {
 }