List of usage examples for android.widget Chronometer stop
public void stop()
From source file:hku.fyp14017.blencode.ui.controller.SoundController.java
private void stopPlayingSound(SoundInfo soundInfo, Chronometer chronometer, final SoundBaseAdapter soundAdapter) { chronometer.stop(); soundAdapter.setCurrentPlayingPosition(Constants.NO_POSITION); soundInfo.isPlaying = false;//from www. ja v a2 s .c o m }
From source file:kr.ac.kpu.wheeling.blackbox.Camera2VideoFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { mTextureView = (AutoFitTextureView) view.findViewById(kr.ac.kpu.wheeling.R.id.texture); //------------------------------------------- tracker_layout = (LinearLayout) view.findViewById(R.id.tracker_layout); mButtonVisible = (Button) view.findViewById(R.id.btn_visible); mButtonVisible.setOnClickListener(this); mButtonRiding = (Button) view.findViewById(R.id.btn_visible_riding); mButtonRiding.setOnClickListener(this); btn_btest = (Button) view.findViewById(R.id.btn_btest); btn_btest.setOnClickListener(this); sqLiteHandler = new SQLiteHandler(getActivity()); //---------------------------------------------- mButtonVideo = (Button) view.findViewById(kr.ac.kpu.wheeling.R.id.video); mButtonVideo.setOnClickListener(this); mButtonSetting = (Button) view.findViewById(kr.ac.kpu.wheeling.R.id.interval); mButtonSetting.setOnClickListener(this); //view.findViewById(R.id.info).setOnClickListener(this); chronometer = (Chronometer) view.findViewById(kr.ac.kpu.wheeling.R.id.chronometer); sensorManager.registerListener(gyroListener, sensor, SensorManager.SENSOR_DELAY_NORMAL); mButtonGallery = (Button) view.findViewById(kr.ac.kpu.wheeling.R.id.menu); mButtonGallery.setOnClickListener(this); galleryActivity = new Intent(getActivity(), GalleryActivity.class); chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { @Override//w ww. j a va 2 s .co m public void onChronometerTick(Chronometer chronometer) { if ((int) (((SystemClock.elapsedRealtime() - chronometer.getBase()))) > 10500) { try { stopRecordingVideo(); mIsSensorChanged = false; } catch (Exception e) { } chronometer.stop(); } } }); }
From source file:com.ichi2.anki.AbstractFlashcardViewer.java
protected void initTimer() { final TypedValue typedValue = new TypedValue(); mShowTimer = mCurrentCard.showTimer(); if (mShowTimer && mCardTimer.getVisibility() == View.INVISIBLE) { mCardTimer.setVisibility(View.VISIBLE); } else if (!mShowTimer && mCardTimer.getVisibility() != View.INVISIBLE) { mCardTimer.setVisibility(View.INVISIBLE); }/*from w ww .jav a 2 s . co m*/ // Set normal timer color getTheme().resolveAttribute(android.R.attr.textColor, typedValue, true); mCardTimer.setTextColor(typedValue.data); mCardTimer.setBase(SystemClock.elapsedRealtime()); mCardTimer.start(); // Stop and highlight the timer if it reaches the time limit. getTheme().resolveAttribute(R.attr.maxTimerColor, typedValue, true); final int limit = mCurrentCard.timeLimit(); mCardTimer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { @Override public void onChronometerTick(Chronometer chronometer) { long elapsed = SystemClock.elapsedRealtime() - chronometer.getBase(); if (elapsed >= limit) { chronometer.setTextColor(typedValue.data); chronometer.stop(); } } }); }