예제 #1
1
  public void alarmFacebookUserComming(Message callbackMessage) {
    Log.d(TAG, "alarmFacebookUserComming");

    Message msg = handler.obtainMessage(FACEBOOK_FRIENDS_GET);
    if (callbackMessage != null) {
      msg.getData().putParcelable(CALLBACK, callbackMessage);
      msg.getData().putLong("hisuid", callbackMessage.getData().getLong("hisuid", -1));
    }
    handler.sendMessageDelayed(msg, 1 * 1000);

    long nexttime = System.currentTimeMillis() + getFriendsTimeout() * 1000L;

    if (SNSService.TEST_LOOP) {
      nexttime = System.currentTimeMillis() + 90 * 1000;
    }

    AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);

    Intent i = new Intent();
    i.setClassName("com.ast.free", "com.ast.free.service.SNSService");
    i.setAction("com.ast.free.intent.action.FACEBOOK_USER");
    PendingIntent userpi =
        PendingIntent.getService(
            mContext.getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT);
    alarmMgr.set(AlarmManager.RTC_WAKEUP, nexttime, userpi);
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set up the "dialog"
    final Intent intent = getIntent();
    final AlertController.AlertParams p = mAlertParams;
    Context context = getApplicationContext();
    p.mTitle = intent.getStringExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_TITLE);
    p.mMessage = intent.getStringExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_MESSAGE);
    p.mPositiveButtonText = String.format(context.getString(R.string.gpsVerifYes));
    p.mPositiveButtonListener = this;
    p.mNegativeButtonText = String.format(context.getString(R.string.gpsVerifNo));
    p.mNegativeButtonListener = this;

    notificationId = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_NOTIF_ID, -1);
    timeout =
        intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_TIMEOUT, default_response_timeout);
    default_response =
        intent.getIntExtra(
            GpsNetInitiatedHandler.NI_INTENT_KEY_DEFAULT_RESPONSE,
            GpsNetInitiatedHandler.GPS_NI_RESPONSE_ACCEPT);
    if (DEBUG)
      Log.d(
          TAG,
          "onCreate() : notificationId: "
              + notificationId
              + " timeout: "
              + timeout
              + " default_response:"
              + default_response);

    mHandler.sendMessageDelayed(mHandler.obtainMessage(GPS_NO_RESPONSE_TIME_OUT), (timeout * 1000));
    setupAlert();
  }
        public boolean connectHeadsetInternal(BluetoothDevice device) {
          synchronized (BluetoothHeadsetService.this) {
            BluetoothDevice currDevice = getCurrentDevice();
            if (currDevice == null) {
              BluetoothRemoteHeadset headset = new BluetoothRemoteHeadset();
              mRemoteHeadsets.put(device, headset);

              setState(device, BluetoothHeadset.STATE_CONNECTING);
              if (device.getUuids() == null) {
                // We might not have got the UUID change notification from
                // Bluez yet, if we have just paired. Try after 1.5 secs.
                Message msg = new Message();
                msg.what = CONNECT_HEADSET_DELAYED;
                msg.obj = device;
                mHandler.sendMessageDelayed(msg, 1500);
              } else {
                getSdpRecordsAndConnect(device);
              }
              return true;
            } else {
              Log.w(
                  TAG,
                  "connectHeadset("
                      + device
                      + "): failed: already in state "
                      + mRemoteHeadsets.get(currDevice).mState
                      + " with headset "
                      + currDevice);
            }
            return false;
          }
        }
예제 #4
0
 void dispatchResumeTag(Object tag, long millis) {
   if (millis > 0) {
     handler.sendMessageDelayed(handler.obtainMessage(TAG_RESUME, tag), millis);
   } else {
     handler.sendMessage(handler.obtainMessage(TAG_RESUME, tag));
   }
 }
예제 #5
0
 void dispatchSubmit(Action<?> action, long delayMillis) {
   if (delayMillis > 0) {
     handler.sendMessageDelayed(handler.obtainMessage(REQUEST_SUBMIT, action), delayMillis);
   } else {
     handler.sendMessage(handler.obtainMessage(REQUEST_SUBMIT, action));
   }
 }
예제 #6
0
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   AlertDialog alertDialog = (AlertDialog) dialog;
   switch (id) {
     case DialogId.DIALOG_ALERT_FREQUENCY:
       alertDialog.setMessage(getResources().getString(R.string.frequency_out_of_range));
       break;
     case DialogId.DIALOG_ALERT_FREQUENCY_NULL:
       alertDialog.setMessage(getResources().getString(R.string.frequency_null));
       break;
       /*case DialogId.DIALOG_ALERT_SYMBOL:
       alertDialog.setMessage(getResources().getString(R.string.symbol_rate_out_of_range));
       break;*/
     case DialogId.DIALOG_ALERT_SYMBOL_NULL:
       alertDialog.setMessage(getResources().getString(R.string.symbol_rate_null));
       break;
     case DialogId.DIALOG_ALERT_SYMBOL_OUT:
       alertDialog.setMessage(getResources().getString(R.string.symbol_rate_out_range));
       break;
   }
   Message msg = new Message();
   msg.what = DIALOG_ALERT_DISMISS;
   msg.arg1 = id;
   mainHandler.sendMessageDelayed(msg, 3000);
   log.D("message: dismiss dialog" + msg.arg1);
   super.onPrepareDialog(id, dialog);
 }
예제 #7
0
 public boolean handleMessage(Message msg) {
   switch (msg.what) {
     case MSG_CLEANUP:
       cleanup();
       mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEANUP), DELAY_CLEANUP);
       return true;
     case MSG_QUIT:
       Looper.myLooper().quit();
       return true;
     case MSG_LOAD:
       return true;
     case MSG_AJAX:
       V8AjaxRequest req = (V8AjaxRequest) msg.obj;
       if (req != null) {
         req.doCallBack();
       }
       return true;
     case MSG_READY:
       mReady = true;
       if (mHandlers != null) {
         for (V8EngineHandler h : mHandlers) {
           h.onReady();
         }
       }
       return true;
   }
   return false;
 }
예제 #8
0
  @Override
  public void run() {
    this.setName("V8Engine");

    System.loadLibrary("bgjs");

    if (BuildConfig.DEBUG) {
      try {
        sleep(30);
        if (DEBUG) {
          Log.d(TAG, "Debugger can connect now");
        }
      } catch (InterruptedException e) {
        Log.e(TAG, "Cannot sleep while waiting for debugger to settle", e);
      }
    }

    Looper.prepare();
    mHandler = new Handler(this);
    initializeV8(assetManager);

    assetManager = null;
    ClientAndroid.load(mNativePtr, scriptPath);
    ClientAndroid.run(mNativePtr);

    mHandler.sendMessageAtFrontOfQueue(mHandler.obtainMessage(MSG_READY));
    mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEANUP), DELAY_CLEANUP);
    Looper.loop();
  }
예제 #9
0
  boolean next() {
    if (mBubbleIndex >= 0) {
      if (!mBubbles.get(mBubbleIndex).isShowing()) {
        return true;
      }
      for (int i = 0; i <= mBubbleIndex; i++) {
        mBubbles.get(i).hide();
      }
    }
    mBubbleIndex++;
    if (mBubbleIndex >= mBubbles.size()) {
      mEnableKeyTouch = true;
      mIme.sendDownUpKeyEvents(-1);
      mIme.tutorialDone();
      return false;
    }

    if ((6 <= mBubbleIndex) && (mBubbleIndex <= 8)) {
      mInputManager.nextKeyMode();
    }

    if (mBubbleIndex == LONG_PRESS_INDEX) {
      mEnableKeyTouch = true;
    } else if (LONG_PRESS_INDEX < mBubbleIndex) {
      mEnableKeyTouch = false;
    }

    mHandler.sendMessageDelayed(
        mHandler.obtainMessage(MSG_SHOW_BUBBLE, mBubbles.get(mBubbleIndex)), 500);
    return true;
  }
예제 #10
0
  /* Description:Disconnect MAS connection if exist*/
  private synchronized int disconnectServer() {
    log("disconnectServer()");
    int index;
    ArrayList<Instance> instances = mManager.getAllInstances();

    clearAuthorizingDevices();

    if (instances == null || instances.size() == 0) {
      return SUCCESS;
    }
    for (index = 0; index < instances.size(); index++) {
      if (instances.get(index).isMasConnected()) {
        if (PENDING == disconnectMasSession(instances.get(index))) {
          mHandler.sendMessageDelayed(
              mHandler.obtainMessage(MAP_DISCONNECT_INSTANCE_TIMEOUT, instances.get(index)),
              DISCONNECT_INSTANCE_DELAY_DURATION);
          return PENDING;
        }
      }
    }

    /*wait MNS connection is disconnected*/
    for (index = 0; index < instances.size(); index++) {
      if (instances.get(index).isMnsConnected()) {
        return PENDING;
      }
    }

    return SUCCESS;
  }
예제 #11
0
 @Override
 public void handleMessage(Message msg) {
   super.handleMessage(msg);
   switch (msg.what) {
     case -10086:
       if (lastX == getScrollX()) {
         resetView();
       } else {
         if (Math.abs(getScrollX() - lastX) <= MINSPEED) {
           stopScroll();
         } else {
           handler.sendMessageDelayed(handler.obtainMessage(ViewScrollTag), SpaceTime);
         }
         lastX = getScrollX();
       }
       break;
     case 1: // 自动滚动
       int add = distance > 0 ? 1 : -1;
       if (Math.abs(distance) > speed) {
         scrollTo(speed * add + getScrollX(), 0);
         sendEmptyMessageDelayed(autoScroll, SpaceTime);
         distance -= speed * add;
       } else {
         scrollTo(distance * add + getScrollX(), 0);
         distance = 0;
         nowPage = getScrollX() / ScreenUtils.getScreenW();
         Log.e(TAG, nowPage + "");
         if (onPageSelectItem != null) {
           onPageSelectItem.onSelect(pageViews.get(nowPage));
         }
       }
       break;
   }
 }
예제 #12
0
  /**
   * Performs the appropriate action for a post-dial char, but does not notify application. returns
   * false if the character is invalid and should be ignored
   */
  private boolean processPostDialChar(char c) {
    if (PhoneNumberUtils.is12Key(c)) {
      owner.cm.sendDtmf(c, h.obtainMessage(EVENT_DTMF_DONE));
    } else if (c == PhoneNumberUtils.PAUSE) {
      setPostDialState(PostDialState.PAUSE); // TBD check why it is not in Gsm
      /*
       * From TS 22.101: It continues... Upon the called party answering
       * the UE shall send the DTMF digits automatically to the network
       * after a delay of 3 seconds(plus/minus 20 %). The digits shall be
       * sent according to the procedures and timing specified in 3GPP TS
       * 24.008 [13]. The first occurrence of the
       * "DTMF Control Digits Separator" shall be used by the ME to
       * distinguish between the addressing digits (i.e. the phone number)
       * and the DTMF digits. Upon subsequent occurrences of the
       * separator, the UE shall pause again for 3 seconds before sending
       * any further DTMF digits.
       */

      // TBD 3s for gsm n 2s for cdma check specs
      h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE), PAUSE_DELAY_MILLIS);
    } else if (c == PhoneNumberUtils.WAIT) {
      setPostDialState(PostDialState.WAIT);
    } else if (c == PhoneNumberUtils.WILD) {
      setPostDialState(PostDialState.WILD);
    } else {
      return false;
    }

    return true;
  }
    /**
     * Cancel the current command.
     *
     * @param force If set, does not wait for the {@link PrintDocumentAdapter} to cancel. This
     *     should only be used if this is the last command send to the as otherwise the {@link
     *     PrintDocumentAdapter adapter} might get commands while it is still running the old one.
     */
    public final void cancel(boolean force) {
      if (isRunning()) {
        canceling();
        if (mCancellation != null) {
          try {
            mCancellation.cancel();
          } catch (RemoteException re) {
            Log.w(LOG_TAG, "Error while canceling", re);
          }
        }
      }

      if (isCanceling()) {
        if (force) {
          if (DEBUG) {
            Log.i(LOG_TAG, "[FORCE CANCEL] queued");
          }
          mHandler.sendMessageDelayed(
              mHandler.obtainMessage(AsyncCommandHandler.MSG_FORCE_CANCEL), FORCE_CANCEL_TIMEOUT);
        }

        return;
      }

      canceled();

      // Done.
      mDoneCallback.onDone();
    }
 /**
  * Queues up a delayed request to search the specified directory. Since directory search will
  * likely introduce a lot of network traffic, we want to wait for a pause in the user's typing
  * before sending a directory request.
  */
 private void loadDirectoryPartitionDelayed(int partitionIndex, DirectoryPartition partition) {
   mDelayedDirectorySearchHandler.removeMessages(DIRECTORY_SEARCH_MESSAGE, partition);
   Message msg =
       mDelayedDirectorySearchHandler.obtainMessage(
           DIRECTORY_SEARCH_MESSAGE, partitionIndex, 0, partition);
   mDelayedDirectorySearchHandler.sendMessageDelayed(msg, DIRECTORY_SEARCH_DELAY_MILLIS);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState, R.layout.splatch);
   Message msg = new Message();
   msg.what = STOPSPLASH;
   splashHandler.sendMessageDelayed(msg, SPLASHTIME);
 }
예제 #16
0
  /**
   * Show the controller on screen. It will go away automatically after 'timeout' milliseconds of
   * inactivity.
   *
   * @param timeout The timeout in milliseconds. Use 0 to show the controller until hide() is
   *     called.
   */
  public void show(int timeout) {
    if (!mShowing && mAnchor != null && mAnchor.getWindowToken() != null) {
      if (mPauseButton != null) mPauseButton.requestFocus();

      if (mFromXml) {
        setVisibility(View.VISIBLE);
      } else {
        int[] location = new int[2];

        mAnchor.getLocationOnScreen(location);
        Rect anchorRect =
            new Rect(
                location[0],
                location[1],
                location[0] + mAnchor.getWidth(),
                location[1] + mAnchor.getHeight());

        mWindow.setAnimationStyle(mAnimStyle);
        setWindowLayoutType();
        mWindow.showAtLocation(mAnchor, Gravity.NO_GRAVITY, anchorRect.left, anchorRect.bottom);
      }
      mShowing = true;
      if (mShownListener != null) mShownListener.onShown();
    }
    updatePausePlay();
    mHandler.sendEmptyMessage(SHOW_PROGRESS);

    if (timeout != 0) {
      mHandler.removeMessages(FADE_OUT);
      mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), timeout);
    }
  }
 private void r()
 {
   int i1 = 0;
   Object localObject = getIntent().getData();
   try
   {
     if (((Uri)localObject).toString().startsWith("smb://"))
     {
       m.setVideoURI((Uri)localObject);
       new URL(((Uri)localObject).toString()).openStream().close();
       return;
     }
     m.requestFocus();
     localObject = J;
     int i2 = t;
     if (g) {
       i1 = 1;
     }
     localObject = ((Handler)localObject).obtainMessage(2, i2, i1);
     g = false;
     J.sendMessageDelayed((Message)localObject, 500L);
     return;
   }
   catch (Exception localException) {}
 }
예제 #18
0
 @Override
 public void finish() {
   if (handler != null && payMent.getMessage() != null) {
     handler.sendMessageDelayed(payMent.getMessage(), 800);
   }
   super.finish();
 }
 private void h()
 {
   if (!B.p())
   {
     l.e(k, "changeToCastMode error, chromecast is not connected");
     return;
   }
   if (p != null) {
     p.hide();
   }
   m();
   A = 1;
   o.setVisibility(0);
   if (q == null)
   {
     q = new kk(this, this);
     if (r == null)
     {
       r = new kt(this);
       B.a(r);
       B.a(r);
       B.a(r);
     }
     q.setMediaPlayer(r);
     q.setAnchorView(o);
   }
   ((ImageView)z.findViewById(2131624054)).setImageResource(2130838531);
   if ((B.r() > 0) && (B.r() != 2)) {
     b.setVisibility(0);
   }
   J.sendMessageDelayed(J.obtainMessage(5), 1000L);
 }
예제 #20
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_start);
   Message msg = handler.obtainMessage();
   handler.sendMessageDelayed(msg, 1000);
 }
예제 #21
0
 private void updateCurrentStatus(String txt) {
   Message message = handler.obtainMessage();
   Bundle bundle = new Bundle();
   bundle.putString("status", txt);
   message.setData(bundle);
   handler.sendMessageDelayed(message, 0);
 }
예제 #22
0
        @Override
        public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();

          if (action.equalsIgnoreCase(ACTION_SHOW_PROGRESSBAR)) {
            setSupportProgressBarIndeterminateVisibility(true);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
          } else if (action.equalsIgnoreCase(ACTION_HIDE_PROGRESSBAR)) {
            setSupportProgressBarIndeterminateVisibility(false);
            getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
          } else if (action.equalsIgnoreCase(ACTION_SHOW_TEXTINFO)) {
            String info = intent.getStringExtra("info");
            int max = intent.getIntExtra("max", 0);
            int progress = intent.getIntExtra("progress", 100);
            mInfoText.setText(info);
            mInfoProgress.setMax(max);
            mInfoProgress.setProgress(progress);

            if (info == null) {
              /* Cancel any upcoming visibility change */
              mHandler.removeMessages(ACTIVITY_SHOW_INFOLAYOUT);
              mInfoLayout.setVisibility(View.GONE);
            } else {
              /* Slightly delay the appearance of the progress bar to avoid unnecessary flickering */
              if (!mHandler.hasMessages(ACTIVITY_SHOW_INFOLAYOUT)) {
                Message m = new Message();
                m.what = ACTIVITY_SHOW_INFOLAYOUT;
                mHandler.sendMessageDelayed(m, 300);
              }
            }
          }
        }
예제 #23
0
 void requestTimer(boolean on) {
   if (gameWantsTimer && on) return;
   gameWantsTimer = on;
   if (on)
     handler.sendMessageDelayed(handler.obtainMessage(MsgType.TIMER.ordinal()), timerInterval);
   else handler.removeMessages(MsgType.TIMER.ordinal());
 }
 private void processHeadsetHookEvent(Context context, int action, long eventtime) {
   switch (action) {
     case KeyEvent.ACTION_DOWN:
       if (!mPressedDown) {
         mPressedDown = true;
         mFirstTime = eventtime;
         mHandler.sendEmptyMessage(MSG_PRESSED);
       } else if (!mLongPressed) {
         if (eventtime - mFirstTime >= LONG_PRESS_DELAY) {
           mPressedCount = 0;
           mLongPressed = true;
           sendMediaCommand(context, CMDTOGGLEFAVORITE);
           mHandler.removeCallbacksAndMessages(null);
         }
       }
       break;
     case KeyEvent.ACTION_UP:
       if (!mLongPressed) {
         mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_TIMEOUT, context), CLICK_DELAY);
       }
       mPressedDown = false;
       mLongPressed = false;
       break;
     default:
       break;
   }
 }
  /**
   * Show the controller on screen. It will go away automatically after 'timeout' milliseconds of
   * inactivity.
   *
   * @param timeInMilliSeconds The timeout in milliseconds. Use 0 to show the controller until
   *     hide() is called.
   */
  @Override
  public void show(final int timeInMilliSeconds) {
    if (!mShowing) {
      showBottomArea();
      setProgress();
      if (mPauseButton != null) {
        mPauseButton.requestFocus();
      }
      mShowing = true;
      setVisibility(View.VISIBLE);
    }

    updatePausePlay();

    // cause the progress bar to be updated even if mShowing
    // was already true.  This happens, for example, if we're
    // paused with the progress bar showing the user hits play.
    mHandler.sendEmptyMessage(SHOW_PROGRESS);

    Message msg = mHandler.obtainMessage(FADE_OUT);
    if (timeInMilliSeconds != 0) {
      mHandler.removeMessages(FADE_OUT);
      mHandler.sendMessageDelayed(msg, timeInMilliSeconds);
    }

    if (visibilityListener != null) {
      visibilityListener.onControlsVisibilityChange(true);
    }
  }
 public void onAutoFocus(boolean success, Camera camera) {
   if (autoFocusHandler != null) {
     Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
     // request every 1.5 seconds.
     autoFocusHandler.sendMessageDelayed(message, 1500L);
     autoFocusHandler = null;
   }
 }
예제 #27
0
 public void loopDelayed(int endTime) {
   int delayMillis = endTime;
   // if (!isPlaying())
   start();
   mVideoHandler.removeMessages(HANDLER_MESSAGE_LOOP);
   mVideoHandler.sendMessageDelayed(
       mVideoHandler.obtainMessage(HANDLER_MESSAGE_LOOP, 0, delayMillis), delayMillis);
 }
예제 #28
0
  private void postLoadFavicons() {
    if (mHandler == null) return;

    Message msg = mHandler.obtainMessage(MESSAGE_LOAD_FAVICONS, AllPagesTab.this);

    mHandler.removeMessages(MESSAGE_LOAD_FAVICONS);
    mHandler.sendMessageDelayed(msg, 200);
  }
 public void onAutoFocus(boolean success, Camera camera) {
   if (autoFocusHandler != null) {
     Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
     autoFocusHandler.sendMessageDelayed(message, AUTOFOCUS_INTERVAL_MS);
     autoFocusHandler = null;
   } else {
     Log.d(TAG, "Got auto-focus callback, but no handler for it");
   }
 }
예제 #30
0
 /** 区域内循环播放 */
 public void loopDelayed(int startTime, int endTime) {
   int delayMillis = endTime - startTime;
   seekTo(startTime);
   if (!isPlaying()) start();
   mVideoHandler.removeMessages(HANDLER_MESSAGE_LOOP);
   mVideoHandler.sendMessageDelayed(
       mVideoHandler.obtainMessage(HANDLER_MESSAGE_LOOP, getCurrentPosition(), delayMillis),
       delayMillis);
 }