本文整理汇总了Java中com.odoo.core.support.addons.fragment.IBaseFragment类的典型用法代码示例。如果您正苦于以下问题:Java IBaseFragment类的具体用法?Java IBaseFragment怎么用?Java IBaseFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IBaseFragment类属于com.odoo.core.support.addons.fragment包,在下文中一共展示了IBaseFragment类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModels
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
private List<OModel> getModels() {
List<OModel> models = new ArrayList<>();
models.addAll(BaseModels.baseModels(mContext, mUser));
for (OAddon addon : mAddons.getAddons()) {
IBaseFragment fragment = (IBaseFragment) addon.get();
try {
Class<Object> model = fragment.database();
if (model != null) {
OModel dbModel = (OModel) model.getConstructor(Context.class)
.newInstance(mContext);
models.add(dbModel);
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
return models;
}
示例2: onPostCreate
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mSavedInstanceState = savedInstanceState;
if (mDrawerItemContainer != null) {
if (savedInstanceState == null) {
// Loading Default Fragment (if any)
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
IBaseFragment fragment = DrawerUtils.getDefaultDrawerFragment();
if (fragment != null) {
loadDrawerItemInstance(new HomeScreen(), null, false);
}
}
}, DRAWER_ITEM_LAUNCH_DELAY);
} else {
mHasActionBarSpinner = savedInstanceState.getBoolean(KEY_HAS_ACTIONBAR_SPINNER);
mDrawerSelectedIndex = savedInstanceState.getInt(KEY_CURRENT_DRAWER_ITEM);
setTitle(savedInstanceState.getString(KEY_APP_TITLE));
focusOnDrawerItem(mDrawerSelectedIndex);
}
}
}
示例3: getModels
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
private List<OModel> getModels() {
List<OModel> models = new ArrayList<>();
models.addAll(BaseModels.baseModels(mContext, mUser));
for (OAddon addon : mAddons.getAddons()) {
IBaseFragment fragment = (IBaseFragment) addon.get();
try {
Class<Object> model = fragment.database();
if (model != null) {
OModel dbModel = (OModel) model.getConstructor(Context.class, OUser.class)
.newInstance(mContext, mUser);
models.add(dbModel);
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
return models;
}
示例4: getDrawerItems
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
public static List<ODrawerItem> getDrawerItems(Context context) {
List<ODrawerItem> items = new ArrayList<>();
for (OAddon addon : new Addons().getAddons()) {
IBaseFragment frag = (IBaseFragment) addon.get();
if (frag != null) {
List<ODrawerItem> menus = frag.drawerMenus(context);
if (menus != null) {
items.addAll(menus);
}
}
}
items.addAll(DrawerUtils.baseSettingsItems(context));
return items;
}
示例5: getDefaultDrawerFragment
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
public static IBaseFragment getDefaultDrawerFragment() {
OAddon addon = new Addons().getDefaultAddon();
if (addon != null) {
return (IBaseFragment) addon.get();
}
return null;
}
示例6: getStartableObject
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
public static ODrawerItem getStartableObject(Context context, IBaseFragment fragment) {
List<ODrawerItem> items = fragment.drawerMenus(context);
if (items != null) {
for (ODrawerItem item : items) {
if (!item.isGroupTitle() && item.getInstance() != null) {
return item;
}
}
}
return null;
}
示例7: onPostCreate
import com.odoo.core.support.addons.fragment.IBaseFragment; //导入依赖的package包/类
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mSavedInstanceState = savedInstanceState;
if (savedInstanceState == null) {
// Loading Default Fragment (if any)
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
IBaseFragment fragment = DrawerUtils.getDefaultDrawerFragment();
if (fragment != null) {
ODrawerItem item = DrawerUtils.getStartableObject(OdooActivity.this, fragment);
setTitle(item.getTitle());
loadDrawerItemInstance(item.getInstance(), item.getExtra());
int selected_item = DrawerUtils.findItemIndex(item, mDrawerItemContainer);
if (selected_item > -1) {
focusOnDrawerItem(selected_item);
}
}
}
}, DRAWER_ITEM_LAUNCH_DELAY);
} else {
mHasActionBarSpinner = savedInstanceState.getBoolean(KEY_HAS_ACTIONBAR_SPINNER);
mDrawerSelectedIndex = savedInstanceState.getInt(KEY_CURRENT_DRAWER_ITEM);
setTitle(savedInstanceState.getString(KEY_APP_TITLE));
focusOnDrawerItem(mDrawerSelectedIndex);
}
}