Search in sources :

Example 1 with SinaCommonActivity

use of org.aisen.weibo.sina.ui.activity.base.SinaCommonActivity in project AisenWeiBo by wangdan.

the class AisenUtils method setTabsText.

public static void setTabsText(Fragment fragment, int index, String text) {
    if (fragment.getActivity() == null)
        return;
    ABaseFragment aFragment = null;
    if (fragment.getActivity() instanceof SinaCommonActivity) {
        aFragment = (ABaseFragment) fragment.getActivity().getFragmentManager().findFragmentByTag(SinaCommonActivity.FRAGMENT_TAG);
    } else if (fragment.getActivity() instanceof MainActivity) {
        aFragment = (ABaseFragment) fragment.getActivity().getFragmentManager().findFragmentByTag("MainFragment");
    }
    if (aFragment != null && aFragment instanceof ATabsTabLayoutFragment) {
        ATabsTabLayoutFragment tabsFragment = (ATabsTabLayoutFragment) aFragment;
        tabsFragment.getTablayout().getTabAt(index).setText(text);
    }
}
Also used : ABaseFragment(org.aisen.android.ui.fragment.ABaseFragment) ATabsTabLayoutFragment(org.aisen.android.ui.fragment.ATabsTabLayoutFragment) MainActivity(org.aisen.weibo.sina.ui.activity.base.MainActivity) SinaCommonActivity(org.aisen.weibo.sina.ui.activity.base.SinaCommonActivity)

Aggregations

ABaseFragment (org.aisen.android.ui.fragment.ABaseFragment)1 ATabsTabLayoutFragment (org.aisen.android.ui.fragment.ATabsTabLayoutFragment)1 MainActivity (org.aisen.weibo.sina.ui.activity.base.MainActivity)1 SinaCommonActivity (org.aisen.weibo.sina.ui.activity.base.SinaCommonActivity)1