Chronometer setOnChronometerTickListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Chronometer setOnChronometerTickListener method.

This code example shows how to use the following methods:setOnChronometerTickListener, getGravity
        super.addView(child, index, params);
         
        int childId = child.getId();
        if (childId == CHRONOMETER_ID && child instanceof Chronometer) {
            mChronometer = (Chronometer) child;
            mChronometer.setOnChronometerTickListener(this);
             
            // Check if Chronometer should move with with ProgressBar  
            mChronometerFollow = (params.width == ViewGroup.LayoutParams.WRAP_CONTENT);
            mChronometerGravity = (mChronometer.getGravity() &
                    Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK);
             
        } else if (childId == PROGRESSBAR_ID && child instanceof ProgressBar) {
            mProgressBar = (ProgressBar) child;
        } 
    } 
 
    /** 
     * Set the expected termination time of the running {@link Chronometer}. 
     * This value is used to adjust the {@link ProgressBar} against the elapsed 
8
CodeRank
This code example shows how to use the following methods:setOnChronometerTickListener, getGravity
        super.addView(child, index, params);
         
        int childId = child.getId();
        if (childId == CHRONOMETER_ID && child instanceof Chronometer) {
            mChronometer = (Chronometer) child;
            mChronometer.setOnChronometerTickListener(this);
             
            // Check if Chronometer should move with with ProgressBar  
            mChronometerFollow = (params.width == ViewGroup.LayoutParams.WRAP_CONTENT);
            mChronometerGravity = (mChronometer.getGravity() &
                    Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK);
             
        } else if (childId == PROGRESSBAR_ID && child instanceof ProgressBar) {
            mProgressBar = (ProgressBar) child;
        } 
    } 
 
    /** 
     * Set the expected termination time of the running {@link Chronometer}. 
     * This value is used to adjust the {@link ProgressBar} against the elapsed 
7
CodeRank
This code example shows how to use the following methods:setOnChronometerTickListener, getGravity
		super.addView(child, index, params);
 
		int childId = child.getId();
		if (childId == CHRONOMETER_ID && child instanceof Chronometer) {
			mChronometer = (Chronometer) child;
			mChronometer.setOnChronometerTickListener(this);
 
			// Check if Chronometer should move with with ProgressBar 
			mChronometerFollow = (params.width == ViewGroup.LayoutParams.WRAP_CONTENT);
			mChronometerGravity = (mChronometer.getGravity() & Gravity.HORIZONTAL_GRAVITY_MASK);
 
		} else if (childId == PROGRESSBAR_ID && child instanceof ProgressBar) {
			mProgressBar = (ProgressBar) child;
		} 
	} 
 
	public void setDurationBase(long durationBase) {
		mDurationBase = durationBase;
 
		if (mProgressBar == null || mChronometer == null) {
4
CodeRank
This code example shows how to use the following methods:setOnChronometerTickListener, getGravity
		super.addView(child, index, params);
 
		int childId = child.getId();
		if (childId == CHRONOMETER_ID && child instanceof Chronometer) {
			mChronometer = (Chronometer) child;
			mChronometer.setOnChronometerTickListener(this);
 
			// Check if Chronometer should move with with ProgressBar 
			mChronometerFollow = (params.width == ViewGroup.LayoutParams.WRAP_CONTENT);
			mChronometerGravity = (mChronometer.getGravity() & Gravity.HORIZONTAL_GRAVITY_MASK);
 
		} else if (childId == PROGRESSBAR_ID && child instanceof ProgressBar) {
			mProgressBar = (ProgressBar) child;
		} 
	} 
 
	public void setDurationBase(long durationBase) {
		mDurationBase = durationBase;
 
		if (mProgressBar == null || mChronometer == null) {
4
CodeRank
This code example shows how to use the following methods:setOnChronometerTickListener
	 
	 
	public TimeClock(ComponentContainer container) {
		super(container);
		 
		view = new Chronometer(container.$context());
		view.setOnChronometerTickListener(this);		
		 
		container.$add(this);
		 
		container.$form().registerForOnDestroy(this);
		 
	} 
	 
	public TimeClock(ComponentContainer container, int resourceId) {
		super(container, resourceId);
		 
		view = null;
		Chronometer c = (Chronometer) container.$context().findViewById(resourceId);
		c.setOnChronometerTickListener(this);		
4
CodeRank
This code example shows how to use the following methods:setOnChronometerTickListener
     * @param chronoTimer The hidden Chronometer object in the Activity. Why use a hidden view? Because it's the easiest 
     *                    way to be notified of 1 second clock ticks. 
     */ 
    public TimingHandler(Chronometer chronoTimer) {
        this.chronoTimer = chronoTimer;
        chronoTimer.setOnChronometerTickListener(onChronometerTickListener);
 
    } 
 
    /** 
     * Starts a new game. 
     */ 
    public void startTimerNew() { 
        chronoTimer.stop();
        chronoTimer.setBase(getCurrentTime());
        chronoTimer.start();
        pauseChronoElapsed = 0;
        levelStartTimeLeft = startTime;
 
    } 
4
CodeRank
This code example shows how to use the following methods:setOnChronometerTickListener
	 */ 
	public void editListener() { 
		beepTime = beepTimeArray[Integer.parseInt(prefs.getString("beep_interval", "2"))];
		formats = Integer.parseInt(prefs.getString("format", "2"));
		sound = !prefs.getBoolean("mute" , false);
		global_chrono.setOnChronometerTickListener(new SpecificChronometerTickListener(getBaseContext(), beepTime, sound, formats));
	} 
	 
	public boolean getRealTimeMode() { 
		return realTime;
	} 
	 
	/** 
	 * The initiation of the clock is in real Time 
	 */ 
	public void initiateClock() { 
		Calendar rightNow = Calendar.getInstance();
		rightNow = Calendar.getInstance();
		global_chrono.setBase(SystemClock.elapsedRealtime() - 
				(rightNow.get(Calendar.HOUR_OF_DAY)*3600000 + rightNow.get(Calendar.MINUTE)*60000 + rightNow.get(Calendar.SECOND)*1000));		
4
CodeRank

Related Chronometer setOnChronometerTickListener Questions & Answers:

setOnChronometerTickListener Method Overview
Sets the listener to be called when the chronometer changes.
See Code Examples for other Android Chronometer Methods: