コード例 #1
0
  /** Shows the SuperCardToast. */
  public void show() {

    ManagerSuperCardToast.getInstance().add(this);

    if (!isIndeterminate) {

      mHandler = new Handler();
      mHandler.postDelayed(mHideRunnable, mDuration);
    }

    mViewGroup.addView(mToastView);

    if (!showImmediate) {

      final Animation animation = this.getShowAnimation();

      /** Invalidate the ViewGroup after the show animation completes * */
      animation.setAnimationListener(
          new Animation.AnimationListener() {

            @Override
            public void onAnimationEnd(Animation arg0) {

              /** Must use Handler to modify ViewGroup in onAnimationEnd() * */
              Handler mHandler = new Handler();
              mHandler.post(mInvalidateRunnable);
            }

            @Override
            public void onAnimationRepeat(Animation arg0) {

              // Do nothing

            }

            @Override
            public void onAnimationStart(Animation arg0) {

              // Do nothing

            }
          });

      mToastView.startAnimation(animation);
    }
  }
コード例 #2
0
  @Override
  protected void onNewIntent(Intent intent) {
    if (checkLaunchState(LaunchState.GeckoExiting)) {
      // We're exiting and shouldn't try to do anything else just incase
      // we're hung for some reason we'll force the process to exit
      System.exit(0);
      return;
    }
    final String action = intent.getAction();
    if (ACTION_DEBUG.equals(action)
        && checkAndSetLaunchState(LaunchState.Launching, LaunchState.WaitForDebugger)) {

      mMainHandler.postDelayed(
          new Runnable() {
            public void run() {
              Log.i(LOG_FILE_NAME, "Launching from debug intent after 5s wait");
              setLaunchState(LaunchState.Launching);
              launch(null);
            }
          },
          1000 * 5 /* 5 seconds */);
      Log.i(LOG_FILE_NAME, "Intent : ACTION_DEBUG - waiting 5s before launching");
      return;
    }
    if (checkLaunchState(LaunchState.WaitForDebugger) || launch(intent)) return;

    if (Intent.ACTION_MAIN.equals(action)) {
      Log.i(LOG_FILE_NAME, "Intent : ACTION_MAIN");
      GeckoAppShell.sendEventToGecko(new GeckoEvent(""));
    } else if (Intent.ACTION_VIEW.equals(action)) {
      String uri = intent.getDataString();
      GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
      Log.i(LOG_FILE_NAME, "onNewIntent: " + uri);
    } else if (ACTION_WEBAPP.equals(action)) {
      String uri = intent.getStringExtra("args");
      GeckoAppShell.sendEventToGecko(new GeckoEvent(uri));
      Log.i(LOG_FILE_NAME, "Intent : WEBAPP - " + uri);
    } else if (ACTION_BOOKMARK.equals(action)) {
      String args = intent.getStringExtra("args");
      GeckoAppShell.sendEventToGecko(new GeckoEvent(args));
      Log.i(LOG_FILE_NAME, "Intent : BOOKMARK - " + args);
    }
  }