Open joyruby opened 5 years ago
我们的app有个启动页,启动页之后会启动首页。但是首页以bundle的方式存在的,所以每次启动页之后都会出现一个默认的loading,请问应该如何去掉?
目前发现一个方式:在调用startActivity之前,先install一下bundle ,代码如下:
/** * 跳转首页 * * @param context */ public static void gotoHome(final Activity context) { final Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClassName(context,""); AtlasBundleUtils.getBundle(AtlasBundleUtils.LITE_HOME_BUNDLE, new AtlasBundleUtils.InstallListener() { @Override public void onFinished(BundleImpl impl) { context.startActivity(intent); context.finish(); } }); } public class AtlasBundleUtils { public final static String LITE_UPPER_BUNDLE = "com.**.**"; public final static String LITE_HOME_BUNDLE = "com.**.**"; public static void initBundle(final String bundle, final InstallListener listener) { BundleImpl impl = (BundleImpl) Atlas.getInstance().getBundle(bundle); if (impl != null && listener != null) { listener.onFinished(impl); } else { initBundle(new String[]{bundle}, new BundleInstaller.InstallListener() { @Override public void onFinished() { BundleImpl impl = (BundleImpl) Atlas.getInstance().getBundle(bundle); if (impl != null) { try { impl.start(); if (listener != null) { listener.onFinished(impl); } } catch (BundleException e) { e.printStackTrace(); } } } }); } } public static void initBundle(String[] bundles, BundleInstaller.InstallListener listener) { Atlas.getInstance().installBundleTransitivelyAsync( bundles, listener); } public static void getBundle(String bundle, InstallListener listener) { initBundle(bundle, listener); } public interface InstallListener { void onFinished(BundleImpl impl); }
求解答:
我们的app有个启动页,启动页之后会启动首页。但是首页以bundle的方式存在的,所以每次启动页之后都会出现一个默认的loading,请问应该如何去掉?
目前发现一个方式:在调用startActivity之前,先install一下bundle ,代码如下:
求解答: