private void notifyChange() { mNotifyHandler.removeCallbacks(mNotifyChange); long ts = System.currentTimeMillis(); if (ts > last_notify + 500) mNotifyChange.run(); else mNotifyHandler.postDelayed(mNotifyChange, 200); last_notify = ts; }
public synchronized void onResume() { super.onResume(); Log.i("JBZL", "onResume"); if (mysocket != null) { if (mysocket.getState() == mySocket.STATE_NONE || mysocket.getState() == mySocket.STATE_LISTEN || mysocket.getState() == mySocket.STATE_FAILE) { mysocket.connect(); } } if (RKScan.mChatService != null) { if (RKScan.mChatService.getState() == BluetoothChatService.STATE_NONE) { // 启动蓝牙聊天服务 RKScan.mChatService.start(); } } if (RKScan.printService != null) { if (RKScan.printService.getState() == BluetoothChatService.STATE_NONE) { // 启动蓝牙聊天服务 RKScan.printService.start(); } } mHandler.postDelayed(btRunnable, 5000); mHandler.postDelayed(socketRunnable, 50); mHandler.postDelayed(socketConnect, 1000 * 60); mHandler.postDelayed(printRunnable, 5000); }
private void initMaps(UserInterface userInterface) { MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapOverlays = mapView.getOverlays(); hashMapOverlayItem = new HashMap<String, MapOverlayItem>(); mMapsPinOrange = this.getResources().getDrawable(R.drawable.maps_pin_orange); int w = mMapsPinOrange.getIntrinsicWidth(); int h = mMapsPinOrange.getIntrinsicHeight(); mMapsPinOrange.setBounds(-w / 2, -h, w / 2, 0); mMapsPinGreen = this.getResources().getDrawable(R.drawable.maps_pin_green); mMapsPinGreen.setBounds( 0, 0, mMapsPinGreen.getIntrinsicWidth(), mMapsPinGreen.getIntrinsicHeight()); overlay = new MapItemnizedOverlay(mMapsPinGreen, this); mapController = mapView.getController(); mapOverlays.add(overlay); mHandler.postDelayed(addMarker(userInterface), 200); if (UserManager.getInstance().thisUser().getGeoPoint() != null) { mHandler.postDelayed(addMarker(UserManager.getInstance().getThisUser()), 200); } }
@Override public void run() { try { if (end) return; if (evercamCamera.loadingStatus == ImageLoadingStatus.not_started) { if (evercamCamera.isActive()) { // showAndSaveLiveSnapshot(); } } else if (evercamCamera.loadingStatus == ImageLoadingStatus.live_received) { setLayoutForLiveImageReceived(); } else if (evercamCamera.loadingStatus == ImageLoadingStatus.live_not_received) { setLayoutForNoImageReceived(); } } catch (OutOfMemoryError e) { Log.e(TAG, e.toString() + "-::OOM::-" + Log.getStackTraceString(e)); handler.postDelayed(LoadImageRunnable, 5000); } catch (Exception e) { Log.e(TAG, e.toString() + "::" + Log.getStackTraceString(e)); if (!end) { handler.postDelayed(LoadImageRunnable, 5000); } } }
public void updateTabCountAndAnimate(int count) { if (mCount > count) { mTabsCount.setInAnimation(mSlideDownIn); mTabsCount.setOutAnimation(mSlideDownOut); } else if (mCount < count) { mTabsCount.setInAnimation(mSlideUpIn); mTabsCount.setOutAnimation(mSlideUpOut); } else { return; } mTabsCount.setText(String.valueOf(count)); mCount = count; mTabs.setContentDescription(mContext.getString(R.string.num_tabs, count)); mHandler.postDelayed( new Runnable() { public void run() { ((TextView) mTabsCount.getCurrentView()) .setTextColor(mContext.getResources().getColor(R.color.url_bar_text_highlight)); } }, mDuration); mHandler.postDelayed( new Runnable() { public void run() { ((TextView) mTabsCount.getCurrentView()) .setTextColor(mContext.getResources().getColor(R.color.tabs_counter_color)); } }, 2 * mDuration); }
private void startGame(int start_score) { setState(STATE_RUNNING); // Set allowed time m_allowedTime = m_initial_allowedTime; m_allowedTime_millis = m_allowedTime * 1000; m_score = start_score; m_answers.clear(); m_Handler.removeCallbacks(mUpdateTimeTask); m_Handler.removeCallbacks(mBlinkTimeTask); if (mGameMode.equals("demo")) { mDemoState = 0; m_demo_word_i = 0; mBoardGameLogic.startGame("SABONETE"); m_playboard.setClickable(false); m_Handler.postDelayed(mDemoPlayTask, 1000); } else { mBoardGameLogic.startGame(getRandomWord()); m_Handler.postDelayed(mUpdateTimeTask, 1000); m_playboard.setClickable(true); m_word.setClickable(true); } mScoreText.setText(new Integer(m_score).toString()); m_text_status.setVisibility(View.INVISIBLE); m_start_button.setVisibility(View.INVISIBLE); m_word.setText(""); m_word.setEnabled(false); mPlayTime.setVisibility(View.VISIBLE); m_playboard.setKeepScreenOn(true); mStartTime = System.currentTimeMillis(); }
public void run() // quando for automcao ligado aumentar tempo { if (contadorFotos < qtdFotos) { c = Calendar.getInstance(); hourOfDay = c.get(Calendar.HOUR_OF_DAY); // Current Hour minute = c.get(Calendar.MINUTE); // Current Minute second = c.get(Calendar.SECOND); // Current Second capturaFoto(); salvarArquivo(mFileData); // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) if (flagMudancaAutoCamera) { contadorFotos++; handler.postDelayed(this, 700); } else { contadorFotos++; if (cameraEscolhida == idCameras[0]) { handler.postDelayed(this, 500); } else { handler.postDelayed(this, 300); } } } else { showToast("Sessão de fotos finalizada"); contadorFotos = 0; handler.removeCallbacks(runnable); editorPrefSessao.putInt( "indice_foto", indice); // coloco o indice pra nao sobrescrever as fotos que ja tem editorPrefSessao.commit(); } }
@Override protected void onResume() { super.onResume(); mTimer1 = new Runnable() { @Override public void run() { exampleSeries1.resetData( new GraphViewData[] { new GraphViewData(1, getRandom()), new GraphViewData(2, getRandom()), new GraphViewData(2.5, getRandom()) // another frequency , new GraphViewData(3, getRandom()), new GraphViewData(4, getRandom()), new GraphViewData(5, getRandom()) }); mHandler.postDelayed(this, 300); } }; mHandler.postDelayed(mTimer1, 300); mTimer2 = new Runnable() { @Override public void run() { graph2LastXValue += 1d; exampleSeries2.appendData(new GraphViewData(graph2LastXValue, getRandom()), true); mHandler.postDelayed(this, 1000); } }; mHandler.postDelayed(mTimer2, 1000); }
public void run() { long millis = System.currentTimeMillis() - mStartTime; if (millis < 0) millis = 0; // Log.d(TAG, "millis = "+ millis); int seconds = m_allowedTime - (int) (millis / 1000); // Log.i("DEMO", "Elapsed seconds:" + seconds); int minutes = seconds / 60; seconds = seconds % 60; if (seconds < 10) { mPlayTime.setText("" + minutes + ":0" + seconds); } else { mPlayTime.setText("" + minutes + ":" + seconds); } if (m_allowedTime_millis - millis < 0) { // Game over setState(STATE_GAMEOVER); } else m_Handler.postDelayed(this, 1000); if (minutes == 0 && seconds == 10) { mTimeIsBlinking = true; m_Handler.postDelayed(mBlinkTimeTask, 200); } else if (minutes > 0 || seconds > 10) { if (mTimeIsBlinking) { m_Handler.removeCallbacks(mBlinkTimeTask); mPlayTime.setVisibility(View.VISIBLE); } mTimeIsBlinking = false; } }
@Override public void callback(final MediaPlayer player, final String url) { Trace.e(tag, "callback:" + url); if (init) { init = false; if (!TextUtils.isEmpty(url)) { mUrl = url; } mHandler.removeCallbacks(runnable); mHandler.postDelayed(runnable, 800); return; } mHandler.removeCallbacks(runnable); if (!TextUtils.isEmpty(url) && player != null && (mUrl == null || !mUrl.equals(url))) { mUrl = url; player.reset(); Intent intent = VideoActivity.getIntent(context, mUrl, title); intent.putExtra(IS_FROM_PLAYER_ON_LINE_VIDEO_ACTIVITY, true); startActivityForResult(intent, REQUEST_PLAYER_ONLINE_VIDEO_ACTIVITY); finish(); } else { mHandler.postDelayed(runnable, 800); } }
public void run() { int remainingSec = (int) Math.max( 0, (UIUtils.CONFERENCE_START_MILLIS - System.currentTimeMillis()) / 1000); final boolean conferenceStarted = remainingSec == 0; if (conferenceStarted) { // Conference started while in countdown mode, switch modes and // bail on future countdown updates. mMessageHandler.postDelayed( new Runnable() { public void run() { refresh(); } }, 100); return; } final int secs = remainingSec % 86400; final int days = remainingSec / 86400; final String str = getResources() .getQuantityString( R.plurals.whats_on_countdown_title, days, days, DateUtils.formatElapsedTime(secs)); mCountdownTextView.setText(str); // Repost ourselves to keep updating countdown mMessageHandler.postDelayed(mCountdownRunnable, 1000); }
public void updateTimer() { // // Check if the time since the last scan has been 60 secs // If Not just reset the time since last scan to 60 secs // else // Request a scan // try { currentTime = System.currentTimeMillis(); long timeSinceLastScan = currentTime - lastScanTime; if (timeSinceLastScan >= 60000) { if (!wifiMgr.isWifiEnabled() || !wifiMgr.startScan()) { Log.v(TAG, "startScan() returned error"); lastScanTime = System.currentTimeMillis(); } tHandler.postDelayed(tUpdateTimerRunnable, 60000); } else { tHandler.postDelayed(tUpdateTimerRunnable, 60000 - timeSinceLastScan); } } catch (SecurityException se) { Log.e( TAG, "Possible missing permissions needed to run ICE over AllJoyn. Discovery over ICE in AllJoyn may not work due to this"); se.printStackTrace(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cpsdwelcome); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); if (preferences.getString("password", null) != null) { Runnable r = new Runnable() { @Override public void run() { onPostAgain(); } }; Handler h = new Handler(); h.postDelayed(r, 1000); // <-- the "1000" is the delay time in miliseconds. } else { Runnable r = new Runnable() { @Override public void run() { onPost(); // <-- put your code in here. } }; Handler h = new Handler(); h.postDelayed(r, 1000); // <-- the "1000" is the delay time in miliseconds. } }
@Override public boolean onMenuItemClicked( MenuScene pMenuScene, IMenuItem pMenuItem, float pMenuItemLocalX, float pMenuItemLocalY) { // TODO Auto-generated method stub switch (pMenuItem.getID()) { case MENU_PLAY: mainMenuScene.registerEntityModifier(new ScaleModifier(1.0f, 1.0f, 0.0f)); mStaticMenuScene.registerEntityModifier(new ScaleModifier(1.0f, 1.0f, 0.0f)); mHandler.postDelayed(mLaunchLevel1Task, 1000); return true; case MENU_OPTIONS: mainMenuScene.registerEntityModifier(new ScaleModifier(1.0f, 1.0f, 0.0f)); mStaticMenuScene.registerEntityModifier(new ScaleModifier(1.0f, 1.0f, 0.0f)); mHandler.postDelayed(mLaunchOptionsTask, 1000); return true; case MENU_HELP: mHandler.postDelayed(mLaunchHelp, 1000); return true; default: return false; } }
@Override public void onClick(View v) { if (v.getId() == R.id.showLoading) { ActivityLoading.showLoading(this, R.layout.activity_loading_simple); handler.postDelayed( new Runnable() { @Override public void run() { ActivityLoading.dismiss(MainActivity.this); Toast.makeText(MainActivity.this, "Loading success", Toast.LENGTH_SHORT).show(); } }, 1500); } else if (v.getId() == R.id.showLoadingMulti) { View view = ActivityLoading.showLoading(this, R.layout.activity_loading_withtext, false, true, null); view.setBackgroundResource(R.drawable.loading_9); handler.postDelayed( new Runnable() { @Override public void run() { ActivityLoading.dismiss(MainActivity.this); Toast.makeText(MainActivity.this, "Loading success", Toast.LENGTH_SHORT).show(); } }, 1500); } else if (v.getId() == R.id.showLoading4ViewPager) { startActivity(new Intent(this, ViewPagerActivity.class)); } }
@Override public void onLoadMore() { switch (slideSource) { case 1: attentionCompanyHandler.postDelayed( new Runnable() { @Override public void run() { getIndividualAttentionDate(); AppUtil.onLoad(xlv_my_company); } }, 2000); break; case 2: individualAttentionHandler.postDelayed( new Runnable() { @Override public void run() { getIndividualAttentionDate(); AppUtil.onLoad(xlv_my_position); } }, 2000); break; default: break; } }
@Override public void onClick(View v) { Button guessButton = ((Button) v); String guess = guessButton.getText().toString(); String answer = getStateName(correctAnswer); ++totalGuesses; ++questionNumber; if (guess.equals(answer)) { // rightAnswer = true; finalScore += questionScore; answerTextView.setText(answer + "!"); answerTextView.setTextColor(getResources().getColor(R.color.correct)); disableButtons(); if (questionNumber == NUMBER_OF_QUESTIONS) { finalScore += questionScore; // scoreHandler.removeCallbacks(scoreRunnable); // handler.removeCallbacks(guessRunnable); scoreHandler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null); // Toast.makeText(getContext(), "Quiz is over!", // Toast.LENGTH_LONG).show(); // Toast.makeText(getContext(), "Final Score = " + // Integer.toString(finalScore), Toast.LENGTH_LONG).show(); Intent k = new Intent(getActivity(), ScoreSubmission.class); k.putExtra("quiz", "Flag Quiz"); k.putExtra("score", finalScore); startActivity(k); } else { scoreHandler.removeCallbacks(scoreRunnable); handler.postDelayed(guessRunnable, 2000); } } else { // flagView.startAnimation(shakeAnimation); answerTextView.setText(answer); answerTextView.setTextColor(getResources().getColor(R.color.incorrect)); guessButton.setEnabled(false); disableButtons(); if (questionNumber == NUMBER_OF_QUESTIONS) { finalScore += questionScore; // scoreHandler.removeCallbacks(scoreRunnable); // handler.removeCallbacks(guessRunnable); scoreHandler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null); // Toast.makeText(getContext(), "Quiz is over!", // Toast.LENGTH_LONG).show(); // Toast.makeText(getContext(), "Final Score = " + // Integer.toString(finalScore), Toast.LENGTH_LONG).show(); Intent k = new Intent(getActivity(), ScoreSubmission.class); k.putExtra("quiz", "Flag Quiz"); k.putExtra("score", finalScore); startActivity(k); } else { scoreHandler.removeCallbacks(scoreRunnable); handler.postDelayed(guessRunnable, 2000); } } }
/** * 描述:TODO. * * @param e the e * @return true, if successful * @see android.view.GestureDetector.OnGestureListener#onSingleTapUp(android.view.MotionEvent) * @author: zhaoqp * @date:2013-6-17 上午9:04:46 * @version v1.0 */ @Override public boolean onSingleTapUp(MotionEvent e) { if (isAimationMoving) { return true; } if (isChecked) { a = 0; mHandler.postDelayed( new Runnable() { @Override public void run() { if (a < moveWidth) { isAimationMoving = true; mHandler.sendEmptyMessage(0); mHandler.postDelayed(this, 0); } else if (a == moveWidth) { isAimationMoving = true; mHandler.sendEmptyMessage(3); mHandler.removeCallbacks(this); // 关 mSwitcherChangeListener.onChange(0); } else { isAimationMoving = false; state = 0; } a += movePDis; } }, 0); } else { a = 0; mHandler.postDelayed( new Runnable() { @Override public void run() { if (a < moveWidth) { isAimationMoving = true; mHandler.sendEmptyMessage(1); mHandler.postDelayed(this, 0); } else if (a == moveWidth) { isAimationMoving = true; mHandler.sendEmptyMessage(4); mHandler.removeCallbacks(this); // 开 mSwitcherChangeListener.onChange(1); } else { isAimationMoving = false; state = 1; } a += movePDis; } }, 0); } return true; }
public void run() { if (mIncrement) { changeCurrent(mCurrent + 1); mHandler.postDelayed(this, mSpeed); } else if (mDecrement) { changeCurrent(mCurrent - 1); mHandler.postDelayed(this, mSpeed); } }
private synchronized void reiniciarRespuestasYAvanzar() throws InterruptedException { Handler handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { ImageView blancoA = (ImageView) findViewById(R.id.blancoDosA); ImageView blancoB = (ImageView) findViewById(R.id.blancoDosB); ImageView blancoC = (ImageView) findViewById(R.id.blancoDosC); ImageView blancoD = (ImageView) findViewById(R.id.blancoDosD); blancoA.setImageResource(R.drawable.blanco2); blancoB.setImageResource(R.drawable.blanco2); blancoC.setImageResource(R.drawable.blanco2); blancoD.setImageResource(R.drawable.blanco2); } }, 500); indicePrguntaActual++; if (indicePrguntaActual < preguntasLenguajeGradoTres.size()) { Pregunta pregunta = preguntasLenguajeGradoTres.get(indicePrguntaActual); String proximaLectura = pregunta.getLectura(); if (proximaLectura.equals(lecturaPregunta) || proximaLectura.equals("NA")) { inicializarQuiz(); } else { handler.postDelayed( new Runnable() { @Override public void run() { Intent intent = new Intent(PreguntasLenguajeGrado3.this, LenguajeIntroduccionGradoTres.class); intent.putExtra( Constantes.INDICE_PREGUNTA_PARAMETRO, String.valueOf(indicePrguntaActual)); startActivity(intent); } }, 1000); } } else { handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { Intent intent = new Intent(PreguntasLenguajeGrado3.this, PreguntasCienciasGrado3.class); startActivity(intent); } }, 500); } }
@Override protected void onResume() { super.onResume(); Log.d(TAG, "onResume()"); if (mPlayState == STATE_RUNNING && mPlayedTime > -1) { mStartTime = System.currentTimeMillis() - mPlayedTime; m_Handler.postDelayed(mUpdateTimeTask, 1000); } if (mTimeIsBlinking) m_Handler.postDelayed(mBlinkTimeTask, 200); }
@Override public void bindView(View view, final Context context, Cursor cursor) { final ViewHolder holder = (ViewHolder) view.getTag(); final String name = cursor.getString(cursor.getColumnIndex(FavoriteUsersSQLiteHelper.COLUMN_NAME)); final String screenName = cursor.getString(cursor.getColumnIndex(FavoriteUsersSQLiteHelper.COLUMN_SCREEN_NAME)); final String url = cursor.getString(cursor.getColumnIndex(FavoriteUsersSQLiteHelper.COLUMN_PRO_PIC)); final long id = cursor.getLong(cursor.getColumnIndex(FavoriteUsersSQLiteHelper.COLUMN_ID)); holder.userId = id; holder.name.setText(name); holder.screenName.setText("@" + screenName); if (settings.roundContactImages) { mHandler.postDelayed( new Runnable() { @Override public void run() { if (holder.userId == id) { loadCircleImage(context, holder, url, mCache, id); } } }, 500); } else { mHandler.postDelayed( new Runnable() { @Override public void run() { if (holder.userId == id) { loadImage(context, holder, url, mCache, id); } } }, 500); } holder.background.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent viewProfile = new Intent(context, ProfilePager.class); viewProfile.putExtra("name", name); viewProfile.putExtra("screenname", screenName); viewProfile.putExtra("proPic", url); viewProfile.putExtra("retweet", false); context.startActivity(viewProfile); } }); }
private void odun(String userSymbol1, String currWord) { int delay = 500; final String userSymbol = userSymbol1; final String currentWord = currWord; // chekau final Handler handlerx = new Handler(); handlerx.postDelayed( new Runnable() { @Override public void run() { // nothin but delay here String fff = game.getWord(); } }, delay); // kladu usersymbol text_word_view.setText(currentWord); final Handler handlerx1 = new Handler(); handlerx1.postDelayed( new Runnable() { @Override public void run() { // nothin but delay here last_symbol_view.setText(userSymbol); } }, delay); // chekau final Handler handlerwx = new Handler(); handlerwx.postDelayed( new Runnable() { @Override public void run() { // nothin but delay here String fff = game.getWord(); } }, delay); // kladu ves text text_word_view.setText(currentWord + userSymbol); final Handler handlerxy = new Handler(); handlerxy.postDelayed( new Runnable() { @Override public void run() { // nothin but delay here last_symbol_view.setText(""); } }, delay); }
@Override public void run() { try { setPicAnimation('R'); if (index != NUMPIC - 1) { handler.postDelayed(this, DELAY); // start an new cycle } else { handler.postDelayed(this, DELAY * 3); } } catch (Exception e) { e.printStackTrace(); } }
/** * @param userSymbol * @param compSymbol */ private void showSymbols(String userSmbl, String compSymbol, String currWord) { int delay = 500; final String userSymbol = userSmbl; final String currentWord = currWord; text_word_view.setText(currWord); last_symbol_view.setText(userSymbol); final Handler handlerxy = new Handler(); handlerxy.postDelayed( new Runnable() { @Override public void run() { // nothin but delay here } }, delay); final String sym = new String(userSymbol); final Handler handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { last_symbol_view.setText(""); text_word_view.setText(currentWord + userSymbol); } }, delay); final Handler handlerx = new Handler(); handlerx.postDelayed( new Runnable() { @Override public void run() { // nothin but delay here } }, delay); final String sym2 = compSymbol; last_symbol_view.setText(sym2 + ""); final Handler handler2 = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { last_symbol_view.setText(""); text_word_view.setText(game.getWord()); } }, delay); }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); try { setExtraKeysVisibility(View.GONE, false); // Correct a few times just in case. There is no visual effect. handler.postDelayed(rotationCorrector, 300); handler.postDelayed(rotationCorrector, 600); handler.postDelayed(rotationCorrector, 1200); } catch (NullPointerException e) { } }
/** Start the url playback by the Android media player. */ private void playUrl(String url) { if (playbackInfo.getSong() == null || !playbackInfo.getSong().getUrl().equals(url)) { SongInfo song = mSongMap.get(url); playbackInfo.setSong(song); prepareFromUrl(url); player.start(); updateSoundSystemInfo(); soundSystemHandler.postDelayed(progressChangeTracker, PROGRESS_UPDATE_DELAY); } else if (!player.isPlaying()) { player.start(); updateSoundSystemInfo(); soundSystemHandler.postDelayed(progressChangeTracker, PROGRESS_UPDATE_DELAY); } }
/** * Calculates average tempo of touches, sets it and starts metronome. Calculates tempo from 57 to * 200 bpm. Re-calculate after 1100 ms pause* */ private void tapTempo() { int hp = metronome.headPosition(); bpmf = bpm; playStatePrevious = metronome.getPlayState(); // If tapped while playing, just after the previous click, it doesn't click again, just delays // next click. if (playStatePrevious == 3) { if (hp < 8820) { metronome.setDelay(hp / 44100 * 1000); } } else { flasher(); metronome.play(); startDelayHandler.postDelayed(startDelay, 20000 / bpm); // } if (tapCount == 0) { // On the first tap it only records time timeFirstTap = System.currentTimeMillis(); timeLastTap = timeFirstTap; tapCount++; } else if ((System.currentTimeMillis() - timeLastTap) < 1050) { // Maximum time between taps is set to 1050 ms (57 bpm) if (hp > 8820) { // If tapped while playing, after less than 8820 samples from the previous // click, it doesn't stop, just delays next click. metronome.stop(); } timeLastTap = System.currentTimeMillis(); exactBpmMs = (double) (timeLastTap - timeFirstTap) / tapCount; exactBpm = 60000 / exactBpmMs; tapBpm = (int) Math.round(exactBpm); Log.i("exactBpm", "" + exactBpm); Log.i("tapBpm", "" + tapBpm); if (tapBpm > 200) tapBpm = 200; metronome.setTempo(tapBpm); bpm = tapBpm; bpmTextView.setText(String.valueOf(tapBpm)); tapCount++; if (hp > 7340) { metronome.play(); startDelayHandler.postDelayed(startDelay, (20000 / bpm)); } } else { tapCount = 1; timeFirstTap = System.currentTimeMillis(); timeLastTap = timeFirstTap; } }
public boolean execute(Runnable r, long delayMillis) { if (handler != null) { Log.i("CommonWorkingThread", ">>> working thread execute delayMillis " + delayMillis); return handler.postDelayed(r, delayMillis); } return false; }
@Override public void onLoadPatchListenerReceiveFail( final File patchFile, int errorCode, final boolean isUpgrade) { super.onLoadPatchListenerReceiveFail(patchFile, errorCode, isUpgrade); switch (errorCode) { case ShareConstants.ERROR_PATCH_NOTEXIST: Toast.makeText(context, "patch file is not exist", Toast.LENGTH_LONG).show(); break; case ShareConstants.ERROR_PATCH_RUNNING: // try later // only retry for upgrade patch if (isUpgrade) { handler.postDelayed( new Runnable() { @Override public void run() { TinkerInstaller.onReceiveUpgradePatch(context, patchFile.getAbsolutePath()); } }, 60 * 1000); } break; case Utils.ERROR_PATCH_ROM_SPACE: Toast.makeText(context, "rom space is not enough", Toast.LENGTH_LONG).show(); break; } SampleTinkerReport.onTryApplyFail(errorCode); }