use of org.aisen.android.ui.activity.container.FragmentArgs in project AisenWeiBo by wangdan.
the class SinaCommonActivity method onCreate.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void onCreate(Bundle savedInstanceState) {
contentId = savedInstanceState == null ? org.aisen.android.R.layout.comm_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.activity.container.FragmentArgs in project AisenWeiBo by wangdan.
the class WebLoginFragment method launch.
public static void launch(Fragment from, Client client, String account, String password, int requestCode) {
FragmentArgs args = new FragmentArgs();
args.add("client", client.toString());
if (!TextUtils.isEmpty(account) && !TextUtils.isEmpty(password)) {
args.add("account", account);
args.add("password", password);
}
SinaCommonActivity.launchForResult(from, WebLoginFragment.class, args, requestCode);
}
use of org.aisen.android.ui.activity.container.FragmentArgs in project AisenWeiBo by wangdan.
the class WebLoginFragment method launch.
public static void launch(Activity from, Client client, String account, String password, int requestCode) {
FragmentArgs args = new FragmentArgs();
args.add("client", client.toString());
if (!TextUtils.isEmpty(account) && !TextUtils.isEmpty(password)) {
args.add("account", account);
args.add("password", password);
}
SinaCommonActivity.launchForResult(from, WebLoginFragment.class, args, requestCode);
}
use of org.aisen.android.ui.activity.container.FragmentArgs in project AisenWeiBo by wangdan.
the class ProfilePagerFragment method launch.
public static void launch(Activity from, WeiBoUser user) {
FragmentArgs args = new FragmentArgs();
args.add("mUser", user);
args.add(SET_INDEX, String.valueOf(1));
SinaCommonActivity.launch(from, ProfilePagerFragment.class, args);
}
use of org.aisen.android.ui.activity.container.FragmentArgs in project AisenWeiBo by wangdan.
the class TimelineDetailPagerFragment method launch.
public static void launch(Activity from, StatusContent status) {
FragmentArgs args = new FragmentArgs();
args.add("status", status);
SinaCommonActivity.launch(from, TimelineDetailPagerFragment.class, args);
}
Aggregations