List of usage examples for android.os SystemClock uptimeMillis
@CriticalNative native public static long uptimeMillis();
From source file:com.adafruit.bluefruit.le.connect.app.MainActivity.java
private void startScan(final UUID[] servicesToScan) { Log.d(TAG, "startScan"); // Stop current scanning (if needed) stopScanning();/*from w w w . j a v a 2s . c o m*/ // Configure scanning BluetoothAdapter bluetoothAdapter = BleUtils.getBluetoothAdapter(getApplicationContext()); if (BleUtils.getBleStatus(this) != BleUtils.STATUS_BLE_ENABLED) { Log.w(TAG, "startScan: BluetoothAdapter not initialized or unspecified address."); } else { mScanner = new BleDevicesScanner(bluetoothAdapter, servicesToScan, new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) { //final String deviceName = device.getName(); //Log.d(TAG, "Discovered device: " + (deviceName != null ? deviceName : "<unknown>")); BluetoothDeviceData previouslyScannedDeviceData = null; if (mScannedDevices == null) mScannedDevices = new ArrayList<>(); // Safeguard // Check that the device was not previously found for (BluetoothDeviceData deviceData : mScannedDevices) { if (deviceData.device.getAddress().equals(device.getAddress())) { previouslyScannedDeviceData = deviceData; break; } } BluetoothDeviceData deviceData; if (previouslyScannedDeviceData == null) { // Add it to the mScannedDevice list deviceData = new BluetoothDeviceData(); mScannedDevices.add(deviceData); } else { deviceData = previouslyScannedDeviceData; } deviceData.device = device; deviceData.rssi = rssi; deviceData.scanRecord = scanRecord; decodeScanRecords(deviceData); // Update device data long currentMillis = SystemClock.uptimeMillis(); if (previouslyScannedDeviceData == null || currentMillis - mLastUpdateMillis > kMinDelayToUpdateUI) { // Avoid updating when not a new device has been found and the time from the last update is really short to avoid updating UI so fast that it will become unresponsive mLastUpdateMillis = currentMillis; runOnUiThread(new Runnable() { @Override public void run() { updateUI(); } }); } } }); // Start scanning mScanner.start(); } // Update UI updateUI(); }
From source file:com.inmobi.ultrapush.AnalyzeActivity.java
public void invalidateGraphView(int viewMask) { if (isInvalidating) { return;//from ww w . j av a2s. c o m } isInvalidating = true; long frameTime; // time delay for next frame if (graphView.getShowMode() != 0) { frameTime = 1000 / 8; // use a much lower frame rate for spectrogram } else { frameTime = 1000 / 60; } long t = SystemClock.uptimeMillis(); // && !graphView.isBusy() if (t >= timeToUpdate) { // limit frame rate timeToUpdate += frameTime; if (timeToUpdate < t) { // catch up current time timeToUpdate = t + frameTime; } idPaddingInvalidate = false; // Take care of synchronization of graphView.spectrogramColors and spectrogramColorsPt, // and then just do invalidate() here. if ((viewMask & VIEW_MASK_graphView) != 0) graphView.invalidate(); // RMS if ((viewMask & VIEW_MASK_textview_RMS) != 0) refreshRMSLabel(); // peak frequency if ((viewMask & VIEW_MASK_textview_peak) != 0) refreshPeakLabel(); if ((viewMask & VIEW_MASK_CursorLabel) != 0) refreshCursorLabel(); if ((viewMask & VIEW_MASK_RecTimeLable) != 0) refreshRecTimeLable(); } else { if (idPaddingInvalidate == false) { idPaddingInvalidate = true; paddingViewMask = viewMask; paddingInvalidateHandler.postDelayed(paddingInvalidateRunnable, timeToUpdate - t + 1); } else { paddingViewMask |= viewMask; } } isInvalidating = false; }
From source file:com.obviousengine.android.focus.ZslFocusCamera.java
private void startAFCycle() { // Clean up any existing AF cycle's pending callbacks. cameraHandler.removeCallbacksAndMessages(FOCUS_RESUME_CALLBACK_TOKEN); // Send a single CONTROL_AF_TRIGGER_START capture request. sendAutoFocusTriggerRequest();/*from ww w . j ava 2 s .co m*/ // Immediately send a request for a regular preview stream, but with // CONTROL_AF_MODE_AUTO set so that the focus remains constant after the // AF cycle completes. sendAutoFocusHoldRequest(); // Waits Settings3A.getFocusHoldMillis() milliseconds before sending // a request for a regular preview stream to resume. cameraHandler.postAtTime(new Runnable() { @Override public void run() { aERegions = ZERO_WEIGHT_3A_REGION; aFRegions = ZERO_WEIGHT_3A_REGION; sendRepeatingCaptureRequest(); } }, FOCUS_RESUME_CALLBACK_TOKEN, SystemClock.uptimeMillis() + Settings3A.getFocusHoldMillis()); }
From source file:com.corporatetaxi.TaxiArrived_Acitivity.java
private void animateMarker(final Marker marker, final LatLng toPosition, final boolean hideMarker) { final Handler handler = new Handler(); final long start = SystemClock.uptimeMillis(); Projection proj = map.getProjection(); Point startPoint = proj.toScreenLocation(marker.getPosition()); final LatLng startLatLng = proj.fromScreenLocation(startPoint); final long duration = 1000; final Interpolator interpolator = new LinearInterpolator(); handler.post(new Runnable() { @Override/* ww w .j a va 2 s.c o m*/ public void run() { long elapsed = SystemClock.uptimeMillis() - start; float t = interpolator.getInterpolation((float) elapsed / duration); double lng = t * toPosition.longitude + (1 - t) * startLatLng.longitude; double lat = t * toPosition.latitude + (1 - t) * startLatLng.latitude; marker.setPosition(new LatLng(lat, lng)); if (t < 1.0) { // Post again 16ms later. handler.postDelayed(this, 16); } else { if (hideMarker) { marker.setVisible(false); } else { marker.setVisible(true); } } map.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(lat, lng))); } }); }
From source file:org.sipdroid.sipua.ui.Receiver.java
@Override public void onReceive(Context context, Intent intent) { String intentAction = intent.getAction(); if (!Sipdroid.on(context)) return;//from ww w . j a v a2s .com if (!Sipdroid.release) Log.i("SipUA:", intentAction); if (mContext == null) mContext = context; if (intentAction.equals(Intent.ACTION_BOOT_COMPLETED)) { on_vpn(false); engine(context).register(); } else if (intentAction.equals(ConnectivityManager.CONNECTIVITY_ACTION) || intentAction.equals(ACTION_EXTERNAL_APPLICATIONS_AVAILABLE) || intentAction.equals(ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE) || intentAction.equals(Intent.ACTION_PACKAGE_REPLACED)) { engine(context).register(); } else if (intentAction.equals(ACTION_VPN_CONNECTIVITY) && intent.hasExtra("connection_state")) { String state = intent.getSerializableExtra("connection_state").toString(); if (state != null && on_vpn() != state.equals("CONNECTED")) { on_vpn(state.equals("CONNECTED")); for (SipProvider sip_provider : engine(context).sip_providers) if (sip_provider != null) sip_provider.haltConnections(); engine(context).register(); } } else if (intentAction.equals(ACTION_DATA_STATE_CHANGED)) { engine(context).registerMore(); } else if (intentAction.equals(ACTION_PHONE_STATE_CHANGED) && !intent.getBooleanExtra(context.getString(R.string.app_name), false)) { stopRingtone(); pstn_state = intent.getStringExtra("state"); pstn_time = SystemClock.elapsedRealtime(); if (pstn_state.equals("IDLE") && call_state != UserAgent.UA_STATE_IDLE) broadcastCallStateChanged(null, null); if (!pstn_state.equals("IDLE") && call_state == UserAgent.UA_STATE_INCALL) mHandler.sendEmptyMessageDelayed(MSG_HOLD, 5000); else if (!pstn_state.equals("IDLE") && (call_state == UserAgent.UA_STATE_INCOMING_CALL || call_state == UserAgent.UA_STATE_OUTGOING_CALL)) mHandler.sendEmptyMessageDelayed(MSG_HANGUP, 5000); else if (pstn_state.equals("IDLE")) { mHandler.removeMessages(MSG_HOLD); mHandler.removeMessages(MSG_HANGUP); if (call_state == UserAgent.UA_STATE_HOLD) mHandler.sendEmptyMessageDelayed(MSG_HOLD, 1000); } } else if (intentAction.equals(ACTION_DOCK_EVENT)) { docked = intent.getIntExtra(EXTRA_DOCK_STATE, -1) & 7; if (call_state == UserAgent.UA_STATE_INCALL) engine(mContext).speaker(speakermode()); } else if (intentAction.equals(ACTION_SCO_AUDIO_STATE_CHANGED)) { bluetooth = intent.getIntExtra(EXTRA_SCO_AUDIO_STATE, -1); progress(); RtpStreamSender.changed = true; } else if (intentAction.equals(Intent.ACTION_HEADSET_PLUG)) { headset = intent.getIntExtra("state", -1); if (call_state == UserAgent.UA_STATE_INCALL) engine(mContext).speaker(speakermode()); } else if (intentAction.equals(Intent.ACTION_SCREEN_ON)) { if (!PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean( org.sipdroid.sipua.ui.Settings.PREF_OWNWIFI, org.sipdroid.sipua.ui.Settings.DEFAULT_OWNWIFI)) alarm(0, OwnWifi.class); } else if (intentAction.equals(Intent.ACTION_USER_PRESENT)) { mHandler.sendEmptyMessageDelayed(MSG_ENABLE, 3000); } else if (intentAction.equals(Intent.ACTION_SCREEN_OFF)) { if (PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean( org.sipdroid.sipua.ui.Settings.PREF_OWNWIFI, org.sipdroid.sipua.ui.Settings.DEFAULT_OWNWIFI)) { WifiManager wm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); WifiInfo wi = wm.getConnectionInfo(); if (wm.getWifiState() != WifiManager.WIFI_STATE_ENABLED || wi == null || wi.getSupplicantState() != SupplicantState.COMPLETED || wi.getIpAddress() == 0) alarm(2 * 60, OwnWifi.class); else alarm(15 * 60, OwnWifi.class); } if (SipdroidEngine.pwl != null) for (PowerManager.WakeLock pwl : SipdroidEngine.pwl) if (pwl != null && pwl.isHeld()) { pwl.release(); pwl.acquire(); } } else if (intentAction.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) { if (PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean( org.sipdroid.sipua.ui.Settings.PREF_SELECTWIFI, org.sipdroid.sipua.ui.Settings.DEFAULT_SELECTWIFI)) mHandler.sendEmptyMessageDelayed(MSG_SCAN, 3000); } else if (intentAction.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { if (SystemClock.uptimeMillis() > lastscan + 45000 && PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean( org.sipdroid.sipua.ui.Settings.PREF_SELECTWIFI, org.sipdroid.sipua.ui.Settings.DEFAULT_SELECTWIFI)) { WifiManager wm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); WifiInfo wi = wm.getConnectionInfo(); String activeSSID = null; if (wi != null) activeSSID = wi.getSSID(); if (activeSSID != null && (activeSSID.length() == 0 || activeSSID.equals("0x"))) activeSSID = null; List<ScanResult> mScanResults = wm.getScanResults(); List<WifiConfiguration> configurations = wm.getConfiguredNetworks(); if (configurations != null) { WifiConfiguration bestconfig = null, maxconfig = null, activeconfig = null; for (final WifiConfiguration config : configurations) { if (maxconfig == null || config.priority > maxconfig.priority) { maxconfig = config; } if (config.SSID != null && (config.SSID.equals("\"" + activeSSID + "\"") || config.SSID.equals(activeSSID))) activeconfig = config; } ScanResult bestscan = null, activescan = null; if (mScanResults != null) for (final ScanResult scan : mScanResults) { for (final WifiConfiguration config : configurations) { if (config.SSID != null && config.SSID.equals("\"" + scan.SSID + "\"")) { if (bestscan == null || scan.level > bestscan.level) { bestscan = scan; bestconfig = config; } if (config == activeconfig) activescan = scan; } } } if (activescan != null) System.out.println("debug wifi asu(active)" + asu(activescan)); if (bestconfig != null && (activeconfig == null || bestconfig.priority != activeconfig.priority) && asu(bestscan) > asu(activescan) * 1.5 && /* (activeSSID == null || activescan != null) && */ asu(bestscan) > 22) { if (!Sipdroid.release) Log.i("SipUA:", "changing to " + bestconfig.SSID); if (activeSSID == null || !activeSSID.equals(bestscan.SSID)) wm.disconnect(); bestconfig.priority = maxconfig.priority + 1; wm.updateNetwork(bestconfig); wm.enableNetwork(bestconfig.networkId, true); wm.saveConfiguration(); if (activeSSID == null || !activeSSID.equals(bestscan.SSID)) wm.reconnect(); lastscan = SystemClock.uptimeMillis(); } else if (activescan != null && asu(activescan) < 15) { wm.disconnect(); wm.disableNetwork(activeconfig.networkId); wm.saveConfiguration(); } } } } }
From source file:com.winneredge.stockly.wcommons.floatingactionwidget.FloatingActionButton.java
/** * <p>Change the indeterminate mode for the progress bar. In indeterminate * mode, the progress is ignored and the progress bar shows an infinite * animation instead.</p>/*from w w w. ja v a 2 s . c om*/ * * @param indeterminate true to enable the indeterminate mode */ public synchronized void setIndeterminate(boolean indeterminate) { if (!indeterminate) { mCurrentProgress = 0.0f; } mProgressBarEnabled = indeterminate; mShouldUpdateButtonPosition = true; mProgressIndeterminate = indeterminate; mLastTimeAnimated = SystemClock.uptimeMillis(); setupProgressBounds(); saveButtonOriginalPosition(); updateBackground(); }
From source file:com.winneredge.stockly.wcommons.floatingactionwidget.FloatingActionButton.java
public synchronized void setProgress(int progress, boolean animate) { if (mProgressIndeterminate) return;/*from ww w . ja va 2 s . co m*/ mProgress = progress; mAnimateProgress = animate; if (!mButtonPositionSaved) { mShouldSetProgress = true; return; } mProgressBarEnabled = true; mShouldUpdateButtonPosition = true; setupProgressBounds(); saveButtonOriginalPosition(); updateBackground(); if (progress < 0) { progress = 0; } else if (progress > mProgressMax) { progress = mProgressMax; } if (progress == mTargetProgress) { return; } mTargetProgress = mProgressMax > 0 ? (progress / (float) mProgressMax) * 360 : 0; mLastTimeAnimated = SystemClock.uptimeMillis(); if (!animate) { mCurrentProgress = mTargetProgress; } invalidate(); }
From source file:com.ferdi2005.secondgram.NotificationsController.java
public void processLoadedUnreadMessages(final HashMap<Long, Integer> dialogs, final ArrayList<TLRPC.Message> messages, final ArrayList<TLRPC.User> users, final ArrayList<TLRPC.Chat> chats, final ArrayList<TLRPC.EncryptedChat> encryptedChats) { MessagesController.getInstance().putUsers(users, true); MessagesController.getInstance().putChats(chats, true); MessagesController.getInstance().putEncryptedChats(encryptedChats, true); notificationsQueue.postRunnable(new Runnable() { @Override/*from www . j a v a 2s .c o m*/ public void run() { pushDialogs.clear(); pushMessages.clear(); pushMessagesDict.clear(); total_unread_count = 0; personal_count = 0; SharedPreferences preferences = ApplicationLoader.applicationContext .getSharedPreferences("Notifications", Context.MODE_PRIVATE); HashMap<Long, Boolean> settingsCache = new HashMap<>(); if (messages != null) { for (int a = 0; a < messages.size(); a++) { TLRPC.Message message = messages.get(a); long mid = message.id; if (message.to_id.channel_id != 0) { mid |= ((long) message.to_id.channel_id) << 32; } if (pushMessagesDict.containsKey(mid)) { continue; } MessageObject messageObject = new MessageObject(message, null, false); if (isPersonalMessage(messageObject)) { personal_count++; } long dialog_id = messageObject.getDialogId(); long original_dialog_id = dialog_id; if (messageObject.messageOwner.mentioned) { dialog_id = messageObject.messageOwner.from_id; } Boolean value = settingsCache.get(dialog_id); if (value == null) { int notifyOverride = getNotifyOverride(preferences, dialog_id); value = !(notifyOverride == 2 || (!preferences.getBoolean("EnableAll", true) || ((int) dialog_id < 0) && !preferences.getBoolean("EnableGroup", true)) && notifyOverride == 0); settingsCache.put(dialog_id, value); } if (!value || dialog_id == opened_dialog_id && ApplicationLoader.isScreenOn) { continue; } pushMessagesDict.put(mid, messageObject); pushMessages.add(0, messageObject); if (original_dialog_id != dialog_id) { pushDialogsOverrideMention.put(original_dialog_id, 1); } } } for (HashMap.Entry<Long, Integer> entry : dialogs.entrySet()) { long dialog_id = entry.getKey(); Boolean value = settingsCache.get(dialog_id); if (value == null) { int notifyOverride = getNotifyOverride(preferences, dialog_id); Integer override = pushDialogsOverrideMention.get(dialog_id); if (override != null && override == 1) { pushDialogsOverrideMention.put(dialog_id, 0); notifyOverride = 1; } value = !(notifyOverride == 2 || (!preferences.getBoolean("EnableAll", true) || ((int) dialog_id < 0) && !preferences.getBoolean("EnableGroup", true)) && notifyOverride == 0); settingsCache.put(dialog_id, value); } if (!value) { continue; } int count = entry.getValue(); pushDialogs.put(dialog_id, count); total_unread_count += count; } if (total_unread_count == 0) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { popupMessages.clear(); NotificationCenter.getInstance() .postNotificationName(NotificationCenter.pushMessagesUpdated); } }); } showOrUpdateNotification(SystemClock.uptimeMillis() / 1000 < 60); if (preferences.getBoolean("badgeNumber", true)) { setBadge(total_unread_count); } } }); }
From source file:org.chromium.chrome.browser.tabmodel.TabPersistentStore.java
/** * Extracts the tab information from a given tab state stream. * * @param stream The stream pointing to the tab state file to be parsed. * @param callback A callback to be streamed updates about the tab state information being read. * @param tabIds A mapping of tab ID to whether the tab is an off the record tab. * @param forMerge Whether this state file was read as part of a merge. * @return The next available tab ID based on the maximum ID referenced in this state file. */// w w w .j a v a 2 s .c om public static int readSavedStateFile(DataInputStream stream, @Nullable OnTabStateReadCallback callback, @Nullable SparseBooleanArray tabIds, boolean forMerge) throws IOException { if (stream == null) return 0; long time = SystemClock.uptimeMillis(); int nextId = 0; boolean skipUrlRead = false; boolean skipIncognitoCount = false; final int version = stream.readInt(); if (version != SAVED_STATE_VERSION) { // We don't support restoring Tab data from before M18. if (version < 3) return 0; // Older versions are missing newer data. if (version < 5) skipIncognitoCount = true; if (version < 4) skipUrlRead = true; } final int count = stream.readInt(); final int incognitoCount = skipIncognitoCount ? -1 : stream.readInt(); final int incognitoActiveIndex = stream.readInt(); final int standardActiveIndex = stream.readInt(); if (count < 0 || incognitoActiveIndex >= count || standardActiveIndex >= count) { throw new IOException(); } for (int i = 0; i < count; i++) { int id = stream.readInt(); String tabUrl = skipUrlRead ? "" : stream.readUTF(); if (id >= nextId) nextId = id + 1; if (tabIds != null) tabIds.append(id, true); Boolean isIncognito = (incognitoCount < 0) ? null : i < incognitoCount; if (callback != null) { callback.onDetailsRead(i, id, tabUrl, isIncognito, i == standardActiveIndex, i == incognitoActiveIndex); } } if (forMerge) { logExecutionTime("ReadMergedStateTime", time); int tabCount = count + ((incognitoCount > 0) ? incognitoCount : 0); RecordHistogram.recordLinearCountHistogram("Android.TabPersistentStore.MergeStateTabCount", tabCount, 1, 200, 200); } logExecutionTime("ReadSavedStateTime", time); return nextId; }
From source file:com.fishstix.dosboxfree.DBGLSurfaceView.java
@Override public boolean onTouchEvent(final MotionEvent event) { final int pointerIndex = MotionEventCompat.getActionIndex(event); final int pointCnt = mWrap.getPointerCount(event); final int pointerId = MotionEventCompat.getPointerId(event, pointerIndex); if (pointCnt < MAX_POINT_CNT) { //if (pointerIndex <= MAX_POINT_CNT - 1){ {//from ww w . ja v a 2 s .c o m for (int i = 0; i < pointCnt; i++) { int id = MotionEventCompat.getPointerId(event, i); if (id < MAX_POINT_CNT) { x_last[id] = x[id]; y_last[id] = y[id]; x[id] = mWrap.getX(event, i); y[id] = mWrap.getY(event, i); } } switch (MotionEventCompat.getActionMasked(event)) { case MotionEvent.ACTION_DOWN: case MotionEventCompat.ACTION_POINTER_DOWN: int button = -1; // Save the ID of this pointer if (mInputMode == INPUT_MODE_MOUSE) { } else if (mInputMode == INPUT_MODE_REAL_JOYSTICK) { int buttonState = mWrap.getButtonState(event); if ((buttonState & TouchEventWrapper.BUTTON_PRIMARY) != 0) { button = BTN_A; } else if ((buttonState & TouchEventWrapper.BUTTON_SECONDARY) != 0) { button = BTN_B; } DosBoxControl.nativeJoystick(0, 0, ACTION_DOWN, button); } else if (mInputMode == INPUT_MODE_REAL_MOUSE) { int buttonState = mWrap.getButtonState(event); if ((buttonState & TouchEventWrapper.BUTTON_PRIMARY) != 0) { button = BTN_A; } else if ((buttonState & TouchEventWrapper.BUTTON_SECONDARY) != 0) { button = BTN_B; } else if (buttonState == 0) { // handle trackpad presses as button clicks button = BTN_A; } DosBoxControl.nativeMouse(0, 0, 0, 0, ACTION_DOWN, button); } mButtonDown[pointerId] = button; break; case MotionEvent.ACTION_UP: case MotionEventCompat.ACTION_POINTER_UP: if (mInputMode == INPUT_MODE_MOUSE) { if (mLongClick) { // single tap long click release DosBoxControl.nativeMouse(0, 0, 0, 0, ACTION_UP, mGestureSingleClick - GESTURE_LEFT_CLICK); mLongClick = false; Log.i("DosBoxTurbo", "SingleTap Long Click Release"); return true; } else if (mDoubleLong) { // double tap long click release try { Thread.sleep(CLICK_DELAY); } catch (InterruptedException e) { } DosBoxControl.nativeMouse(0, 0, -1, -1, ACTION_UP, mGestureDoubleClick - GESTURE_LEFT_CLICK); Log.i("DosBoxTurbo", "DoubleTap Long Click Release"); mDoubleLong = false; //return true; } else if (pointCnt == 2) { // handle 2 finger tap gesture if (mLongPress) { if (!mTwoFingerAction) { // press button down Log.i("DosBoxTurbo", "2-Finger Long Click Down"); DosBoxControl.nativeMouse(0, 0, -1, -1, ACTION_DOWN, mGestureTwoFinger - GESTURE_LEFT_CLICK); mTwoFingerAction = true; } else { // already pressing button - release and press again Log.i("DosBoxTurbo", "2-Finger Long Click - AGAIN"); DosBoxControl.nativeMouse(0, 0, -1, -1, ACTION_UP, mGestureTwoFinger - GESTURE_LEFT_CLICK); try { Thread.sleep(CLICK_DELAY); } catch (InterruptedException e) { } DosBoxControl.nativeMouse(0, 0, -1, -1, ACTION_DOWN, mGestureTwoFinger - GESTURE_LEFT_CLICK); } } else { Log.i("DosBoxTurbo", "2-Finger Long Click Down-UP"); mouseClick(mGestureTwoFinger - GESTURE_LEFT_CLICK); } return true; } else if ((pointCnt == 1) && mTwoFingerAction) { // release two finger gesture Log.i("DosBoxTurbo", "2-Finger Long Click Release"); DosBoxControl.nativeMouse(0, 0, -1, -1, ACTION_UP, mGestureTwoFinger - GESTURE_LEFT_CLICK); mTwoFingerAction = false; //return true; } } else if (mInputMode == INPUT_MODE_REAL_MOUSE) { //Log.v("Mouse","BUTTON UP: " + (mButtonDown[pointerId])); DosBoxControl.nativeMouse(0, 0, 0, 0, ACTION_UP, mButtonDown[pointerId]); if (mWrap.getButtonState(event) > 0) { return true; // capture button touches, pass screen touches through to gesture detetor } } else if (mInputMode == INPUT_MODE_REAL_JOYSTICK) { DosBoxControl.nativeJoystick(0, 0, ACTION_UP, (mButtonDown[pointerId])); if (mWrap.getButtonState(event) > 0) { return true; } } break; case MotionEvent.ACTION_MOVE: //isTouch[pointerId] = true; switch (mInputMode) { case INPUT_MODE_SCROLL: mScroll_x += (int) (x[pointerId] - x_last[pointerId]); mScroll_y += (int) (y[pointerId] - y_last[pointerId]); forceRedraw(); break; case INPUT_MODE_MOUSE: case INPUT_MODE_REAL_MOUSE: if (event.getEventTime() + EVENT_THRESHOLD_DECAY < SystemClock.uptimeMillis()) { Log.i("DosBoxTurbo", "eventtime: " + event.getEventTime() + " systemtime: " + SystemClock.uptimeMillis()); return true; // get rid of old events } int idx = (!virtButton[0]) ? 0 : 1; if (mAbsolute) { DosBoxControl.nativeMouseWarp(x[idx], y[idx], mRenderer.x, mRenderer.y, mRenderer.width, mRenderer.height); } else { DosBoxControl.nativeMouse((int) (x[idx] * mMouseSensitivityX), (int) (y[idx] * mMouseSensitivityY), (int) (x_last[idx] * mMouseSensitivityX), (int) (y_last[idx] * mMouseSensitivityY), ACTION_MOVE, -1); } if (mDebug) { Log.d("DosBoxTurbo", "mAbsolute=" + mAbsolute + " MotionEvent MOVE(" + pointerId + ")" + " x[idx]=" + x[idx] + " y[idx]" + y[idx] + " mRenderer.x=" + mRenderer.x + " mRenderer.y=" + mRenderer.y + " mRenderer.width=" + mRenderer.width + " mRenderer.height=" + mRenderer.height); } try { if (!mInputLowLatency) Thread.sleep(95); else Thread.sleep(65); } catch (InterruptedException e) { } break; default: } break; } } } try { Thread.sleep(15); } catch (InterruptedException e) { e.printStackTrace(); } //Thread.yield(); return gestureScanner.onTouchEvent(event); }