示例#1
0
  public boolean loadIntent(Intent intent) {
    String action = intent.getAction();

    if (Intent.ACTION_RUN.equals(action)) {
      mView.getEngine().runFromBundle(intent.getDataString());
      String route = intent.getStringExtra("route");
      if (route != null) mView.getEngine().pushRoute(route);
      return true;
    }

    return false;
  }
示例#2
0
 @Override
 protected void onPause() {
   super.onPause();
   if (mView != null) {
     mView.getEngine().onActivityPaused();
   }
 }
示例#3
0
  /** Override this function to customize startup behavior. */
  protected void onSkyReady() {
    TraceEvent.instant("SkyActivity.onSkyReady");

    Locale locale = getResources().getConfiguration().locale;
    mView.getEngine().onLocaleChanged(locale.getLanguage(), locale.getCountry());

    if (loadIntent(getIntent())) {
      return;
    }
    File dataDir = new File(PathUtils.getDataDirectory(this));
    File appBundle = new File(dataDir, SkyApplication.APP_BUNDLE);
    if (appBundle.exists()) {
      mView.getEngine().runFromBundle(appBundle.getPath());
      return;
    }
  }
示例#4
0
 @Override
 protected void onPostResume() {
   super.onPostResume();
   if (mView != null) {
     mView.getEngine().onActivityResumed();
   }
 }
示例#5
0
 /** Override this function to customize startup behavior. */
 protected void onSkyReady() {
   if (loadIntent(getIntent())) {
     return;
   }
   File dataDir = new File(PathUtils.getDataDirectory(this));
   File snapshot = new File(dataDir, SkyApplication.SNAPSHOT);
   if (snapshot.exists()) {
     mView.getEngine().runFromSnapshot(snapshot.getPath());
     return;
   }
   File appBundle = new File(dataDir, SkyApplication.APP_BUNDLE);
   if (appBundle.exists()) {
     mView.getEngine().runFromBundle(appBundle.getPath());
     return;
   }
 }
示例#6
0
 @Override
 public void onBackPressed() {
   if (mView != null) {
     mView.getEngine().popRoute();
     return;
   }
   super.onBackPressed();
 }
示例#7
0
 public boolean loadBundleByName(String name) {
   File dataDir = new File(PathUtils.getDataDirectory(this));
   File bundle = new File(dataDir, name);
   if (!bundle.exists()) {
     return false;
   }
   mView.getEngine().runFromBundle(bundle.getPath());
   return true;
 }
示例#8
0
 @Override
 public void onBackPressed() {
   if (mView != null) {
     InputEvent event = new InputEvent();
     event.type = EventType.BACK;
     mView.getEngine().onInputEvent(event);
     return;
   }
   super.onBackPressed();
 }
示例#9
0
  public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    Locale locale = getResources().getConfiguration().locale;
    mView.getEngine().onLocaleChanged(locale.getLanguage(), locale.getCountry());
  }
示例#10
0
 public void loadUrl(String url) {
   mView.getEngine().runFromNetwork(url);
 }