android.os.CountDownTimer.start()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中android.os.CountDownTimer.start()方法的一些代码示例,展示了CountDownTimer.start()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CountDownTimer.start()方法的具体详情如下:
包路径:android.os.CountDownTimer
类名称:CountDownTimer
方法名:start

CountDownTimer.start介绍

暂无

代码示例

代码示例来源:origin: guardianproject/haven

private void initTimer() {
  txtTimer.setTextColor(getResources().getColor(R.color.colorAccent));
  cTimer = new CountDownTimer((preferences.getTimerDelay()) * 1000, 1000) {
    public void onTick(long millisUntilFinished) {
      mOnTimerTicking = true;
      txtTimer.setText(getTimerText(millisUntilFinished));
    }
    public void onFinish() {
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
      txtTimer.setText(R.string.status_on);
      initMonitor();
      mOnTimerTicking = false;
    }
  };
  cTimer.start();
}

代码示例来源:origin: multidots/android-app-common-tasks

@Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
    System.out
        .println("001 OauthStart onPostExecute shouldOverrideUrlLoading-->" + url);
    if (url.startsWith(OAUTH_CALLBACK_URL)) {
      System.out
          .println("001 OauthStart onPostExecute shouldOverrideUrlLoading IN IF-->" + url);
      new OauthEnd().execute(url);
      return true;
    }
    System.out.println("view:" + view);
    countDownTimer = new MyCountDownTimer(startTime,
        intervalTime);
    countDownTimer.start();
    return super.shouldOverrideUrlLoading(view, url);
  }
});

代码示例来源:origin: multidots/android-app-common-tasks

@Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
    System.out
        .println("001 OauthStart onPostExecute shouldOverrideUrlLoading-->" + url);
    if (url.startsWith(OAUTH_CALLBACK_URL)) {
      System.out
          .println("001 OauthStart onPostExecute shouldOverrideUrlLoading IN IF-->" + url);
      new OauthEnd().execute(url);
      return true;
    }
    System.out.println("view:" + view);
    countDownTimer = new MyCountDownTimer(startTime,
        intervalTime);
    countDownTimer.start();
    return super.shouldOverrideUrlLoading(view, url);
  }
});

代码示例来源:origin: vilyever/AndroidSocketClient

private void __i__onConnected() {
  if (Looper.myLooper() != Looper.getMainLooper()) {
    getUiHandler().post(new Runnable() {
      @Override
      public void run() {
        self.__i__onConnected();
      }
    });
    return;
  }
  ArrayList<SocketClientDelegate> delegatesCopy =
      (ArrayList<SocketClientDelegate>) getSocketClientDelegates().clone();
  int count = delegatesCopy.size();
  for (int i = 0; i < count; ++i) {
    delegatesCopy.get(i).onConnected(this);
  }
  getSendThread().start();
  getReceiveThread().start();
  getHearBeatCountDownTimer().start();
}

代码示例来源:origin: boredream/DesignResCollection

public void startAutoScroll() {
  if (currentState == STATE_AUTO_SCROLLING) {
    return;
  }
  currentState = STATE_AUTO_SCROLLING;
  countDownTimer.start();
}

代码示例来源:origin: Coinomi/coinomi-android

void onStartTradeCountDown(int secondsLeft) {
  if (countDownTimer != null) return;
  countDownTimer = new CountDownTimer(secondsLeft * 1000, 1000) {
    public void onTick(long millisUntilFinished) {
      handler.sendMessage(handler.obtainMessage(
          UPDATE_TRADE_TIMEOUT, (int) (millisUntilFinished / 1000)));
    }
    public void onFinish() {
      handler.sendEmptyMessage(TRADE_EXPIRED);
    }
  };
  countDownTimer.start();
}

代码示例来源:origin: attentiveness/News

private void init() {
  mTimer = new CountDownTimer(3000, 1000) {
    @Override
    public void onTick(long millisUntilFinished) {
    }
    @Override
    public void onFinish() {
      navigate();
      finish();
    }
  };
  mTimer.start();
}

代码示例来源:origin: openwalletGH/openwallet-android

void onStartTradeCountDown(int secondsLeft) {
  if (countDownTimer != null) return;
  countDownTimer = new CountDownTimer(secondsLeft * 1000, 1000) {
    public void onTick(long millisUntilFinished) {
      handler.sendMessage(handler.obtainMessage(
          UPDATE_TRADE_TIMEOUT, (int) (millisUntilFinished / 1000)));
    }
    public void onFinish() {
      handler.sendEmptyMessage(TRADE_EXPIRED);
    }
  };
  countDownTimer.start();
}

代码示例来源:origin: gearvrf/GearVRf-Demos

@Override
  public void run() {
    mCountDownTimer = new CountDownTimer(120000, 1000) {
      public void onTick(long millisUntilFinished) {
        long minutes = TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) -
            TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millisUntilFinished));
        long seconds = TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) -
            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished));
        timeObject.setText("" + String.format(Locale.ENGLISH, FORMAT, minutes, seconds));
      }
      public void onFinish() {
        timeObject.setText("timeout!");
        mIsFinished = true;
      }
    };
    mCountDownTimer.start();
  }
});

代码示例来源:origin: dicodingacademy/a14-made-labs1

@Override
public IBinder onBind(Intent intent) {
  Log.d(TAG, "onBind: ");
  mTimer.start();
  return mBinder;
}

代码示例来源:origin: kevalpatel2106/Prevent-Screen-Off

@Override
public void onSensorChanged(SensorEvent event) {
  mLastIntensity = event.values[0];
  if (mLastIntensity < LIGHT_INTENSITY_THRESHOLD && mCountDownTimer == null) {
    mCountDownTimer = new CountDownTimer(5000, 5000) {
      @Override
      public void onTick(long l) {
      }
      @Override
      public void onFinish() {
        if (mLastIntensity < LIGHT_INTENSITY_THRESHOLD)
          mAnalyserActivity.onLowLightIntensity();
        mCountDownTimer = null;
      }
    };
    mCountDownTimer.start();
  }
  Log.d("light sensor", mLastIntensity + "");
}

代码示例来源:origin: zulip/zulip-android

@Override
  public void onClick(View view) {
    currentList.stopRecyclerViewScroll();
    displayChatBox(true);
    displayFAB(false);
    fabHidder.start();
    showSoftKeyboard();
    checkForChatBoxFocusRequest();
  }
});

代码示例来源:origin: wythe0102/Mall

/**
 * 开始倒计时
 */
public void startDownTimer() {
  createCountDownTimer();// 创建倒计时
  mCountDownTimer.start();
}

代码示例来源:origin: sarveshchavan7/Quiz-Game

@Override
protected void onRestart() {
  super.onRestart();
  countDownTimer.start();
}

代码示例来源:origin: yiwent/Mobike

private void GoforOrorder() {
  mBikeInfoBoard.setVisibility(View.VISIBLE);
  mBikeOrderBoard.setVisibility(View.VISIBLE);
  mConfirm_cancle.setVisibility(View.VISIBLE);
  mLoBikeInfo.setVisibility(View.GONE);
  mBtLoginOrorder.setVisibility(View.GONE);
  bike_code.setText(bInfo.getName());
  countDownTimer.start();
}

代码示例来源:origin: AmazMod/AmazMod

private static void checkSave(final Context context) {
  //Create timer if not already, for 2 seconds. Call save after completion
  if (countDownTimer == null) countDownTimer = new CountDownTimer(2000, 2000) {
    @Override
    public void onTick(long l) {
    }
    @Override
    public void onFinish() {
      save(context);
    }
  };
  //Cancel and start timer. This means that this method must be called ONCE in 2 seconds before save will be called, it prevents save from being called more than once every 2 seconds (buffers moving)
  countDownTimer.cancel();
  countDownTimer.start();
}

代码示例来源:origin: vitas/beaconloc

@Override
public void startScan() {
  mProgressBar.setVisibility(View.VISIBLE);
  mEmpty.setVisibility(View.GONE);
  mBeaconsAdapter.removeAll();
  mTimer.start();
  super.startScan();
}

代码示例来源:origin: wythe0102/Mall

@Override
protected void initView() {
  super.initView();
  super.setNormalTitle(R.string.approval_tip);
  tvCountTimer = (TextView) findViewById(R.id.count_timer);
  createCountDownTimer();
  countDownTimer.start();
}

代码示例来源:origin: geeksonsecurity/android-overlay-protection

@Override
  public void onClick(View v) {
    state.setIgnoreOncePackage(offenderName);
    windowManager.removeViewImmediate(oView);
    CountDownTimer cdt = new CountDownTimer(_settings.getIgnoreOnceTimeoutSeconds() * 1000, _settings.getIgnoreOnceTimeoutSeconds() * 1000) {
      @Override
      public void onTick(long millisUntilFinished) {
      }
      @Override
      public void onFinish() {
        Log.d(TAG, "Ignore once timeout expired, removing flag...");
        state.resetState();
      }
    };
    cdt.start();
  }
});

代码示例来源:origin: sarveshchavan7/Quiz-Game

public void updateQueAndOptions() {
  //This method will setText for que and options
  questionText.setText(currentQuestion.getQuestion());
  buttonA.setText(currentQuestion.getOptA());
  buttonB.setText(currentQuestion.getOptB());
  buttonC.setText(currentQuestion.getOptC());
  buttonD.setText(currentQuestion.getOptD());
  timeValue = 20;
  //Now since the user has ans correct just reset timer back for another que- by cancel and start
  countDownTimer.cancel();
  countDownTimer.start();
  //set the value of coin text
  coinText.setText(String.valueOf(coinValue));
  //Now since user has ans correct increment the coinvalue
  coinValue++;
}

相关文章