use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.
the class TopicsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ui_fragment_container);
if (savedInstanceState == null) {
if (getIntent() != null && "Previous".equals(getIntent().getAction())) {
ABaseFragment fragment = TimelineTopicsFragment.newInstance(getIntent().getStringExtra("q"));
getFragmentManager().beginTransaction().replace(org.aisen.android.R.id.fragmentContainer, fragment, "TopicsTimelint").commit();
} else {
Uri data = getIntent().getData();
if (data != null) {
String d = data.toString();
int index = d.lastIndexOf("/");
String topicsName = d.substring(index + 1);
topicsName = topicsName.substring(1, topicsName.length() - 1);
ABaseFragment fragment = TimelineTopicsFragment.newInstance(topicsName);
getFragmentManager().beginTransaction().replace(org.aisen.android.R.id.fragmentContainer, fragment, "TopicsTimelint").commit();
} else {
finish();
return;
}
}
}
}
use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.
the class TimelinePicActivity method loadPicture.
private void loadPicture(String pic) {
PicUrls picUrls = new PicUrls();
picUrls.setThumbnail_pic(pic.replace("large", "bmiddle").replace("small", "bmiddle"));
ABaseFragment pictureFragment = PictureFragment.newInstance(picUrls);
getFragmentManager().beginTransaction().replace(R.id.layContainer, pictureFragment, "PicFragment").commit();
}
use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.
the class SinaCommonActivity method onCreate.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void onCreate(Bundle savedInstanceState) {
contentId = savedInstanceState == null ? R.layout.ui_fragment_container : savedInstanceState.getInt("contentId");
overrideTheme = savedInstanceState == null ? -1 : savedInstanceState.getInt("overrideTheme");
Fragment fragment = null;
if (savedInstanceState == null) {
try {
String className = getIntent().getStringExtra("className");
if (TextUtils.isEmpty(className)) {
super.onCreate(savedInstanceState);
finish();
return;
}
FragmentArgs values = (FragmentArgs) getIntent().getSerializableExtra("args");
Class clazz = Class.forName(className);
fragment = (Fragment) clazz.newInstance();
// 设置参数给Fragment
if (values != null) {
try {
Method method = clazz.getMethod("setArguments", new Class[] { Bundle.class });
method.invoke(fragment, FragmentArgs.transToBundle(values));
} catch (Exception e) {
}
}
// 重写Activity的主题
try {
Method method = clazz.getMethod("setActivityTheme");
if (method != null) {
int theme = Integer.parseInt(method.invoke(fragment).toString());
if (theme > 0) {
overrideTheme = theme;
}
}
} catch (Exception e) {
}
// 重写Activity的contentView
try {
Method method = clazz.getMethod("inflateActivityContentView");
if (method != null) {
int fragmentConfigId = Integer.parseInt(method.invoke(fragment).toString());
if (fragmentConfigId > 0) {
contentId = fragmentConfigId;
}
}
} catch (Exception e) {
}
} catch (Exception e) {
e.printStackTrace();
super.onCreate(savedInstanceState);
finish();
return;
}
}
super.onCreate(savedInstanceState);
setContentView(contentId);
if (fragment != null) {
if (!(fragment instanceof ABaseFragment) || ((ABaseFragment) fragment).inflateContentView() > 0) {
getFragmentManager().beginTransaction().add(org.aisen.android.R.id.fragmentContainer, fragment, FRAGMENT_TAG).commit();
} else {
getFragmentManager().beginTransaction().add(fragment, FRAGMENT_TAG).commit();
}
}
if (getSupportActionBar() != null)
getSupportActionBar().setDisplayShowHomeEnabled(false);
BizFragment.createBizFragment(this);
}
use of org.aisen.android.ui.fragment.ABaseFragment in project AisenWeiBo by wangdan.
the class FriendsFragment method newInstance.
public static ABaseFragment newInstance(WeiBoUser user) {
ABaseFragment fragment = new FriendsFragment();
Bundle args = new Bundle();
args.putSerializable("user", user);
args.putBoolean("launch", false);
fragment.setArguments(args);
return fragment;
}
use of org.aisen.android.ui.fragment.ABaseFragment 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);
}
}
Aggregations