當前位置: 首頁>>代碼示例>>Java>>正文


Java Chronometer.setBase方法代碼示例

本文整理匯總了Java中android.widget.Chronometer.setBase方法的典型用法代碼示例。如果您正苦於以下問題:Java Chronometer.setBase方法的具體用法?Java Chronometer.setBase怎麽用?Java Chronometer.setBase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.Chronometer的用法示例。


在下文中一共展示了Chronometer.setBase方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setChronometer

import android.widget.Chronometer; //導入方法依賴的package包/類
private static void setChronometer(Chronometer chronometer, int mode) {
    switch (mode) {
        case Constant.CHRONOMETER_START:
            if (playTime != 0) {
                chronometer.setBase(chronometer.getBase() +
                        (SystemClock.elapsedRealtime() - playTime));
            } else {
                chronometer.setBase(SystemClock.elapsedRealtime());
            }
            chronometer.start();
            break;
        case Constant.CHRONOMETER_STOP:
            chronometer.stop();
            playTime = SystemClock.elapsedRealtime();
            break;
        case Constant.CHRONOMETER_RESET:
            chronometer.stop();
            chronometer.setBase(SystemClock.elapsedRealtime());
            playTime = 0;
            break;
        default:
            break;
    }
}
 
開發者ID:lpy19930103,項目名稱:MinimalismJotter,代碼行數:25,代碼來源:RecoderManager.java

示例2: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // The ViewModelStore provides a new ViewModel or one previously created.
    ChronometerViewModel chronometerViewModel
            = ViewModelProviders.of(this).get(ChronometerViewModel.class);

    // Get the chronometer reference
    Chronometer chronometer = findViewById(R.id.chronometer);

    if (chronometerViewModel.getStartTime() == null) {
        // If the start date is not defined, it's a new ViewModel so set it.
        long startTime = SystemClock.elapsedRealtime();
        chronometerViewModel.setStartTime(startTime);
        chronometer.setBase(startTime);
    } else {
        // Otherwise the ViewModel has been retained, set the chronometer's base to the original
        // starting time.
        chronometer.setBase(chronometerViewModel.getStartTime());
    }

    chronometer.start();
}
 
開發者ID:googlecodelabs,項目名稱:android-lifecycles,代碼行數:26,代碼來源:ChronoActivity2.java

示例3: onCreateView

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View fragmentView = inflater.inflate(R.layout.misc_overscroll_demo, null, false);

    View textView = fragmentView.findViewById(R.id.demo_text);
    ElasticityHelper.setUpStaticOverScroll(textView, ORIENTATION.HORIZONTAL);

    View imageView = fragmentView.findViewById(R.id.demo_image);
    ElasticityHelper.setUpStaticOverScroll(imageView, ORIENTATION.VERTICAL);

    mChrono = (Chronometer) fragmentView.findViewById(R.id.demo_chronometer);
    if (savedInstanceState != null) {
        mChrono.setBase(savedInstanceState.getLong(CHRONO_TIME_SAVE_ID));
    }
    ElasticityHelper.setUpStaticOverScroll(mChrono, ORIENTATION.HORIZONTAL);
    mChrono.start();

    return fragmentView;
}
 
開發者ID:XanderWang,項目名稱:elasticity,代碼行數:20,代碼來源:MiscViewsDemoFragment.java

示例4: onCreateView

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View fragmentView = inflater.inflate(R.layout.misc_overscroll_demo, null, false);

    View textView = fragmentView.findViewById(R.id.demo_text);
    OverScrollDecoratorHelper.setUpStaticOverScroll(textView, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);

    View imageView = fragmentView.findViewById(R.id.demo_image);
    OverScrollDecoratorHelper.setUpStaticOverScroll(imageView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);

    mChrono = (Chronometer) fragmentView.findViewById(R.id.demo_chronometer);
    if (savedInstanceState != null) {
        mChrono.setBase(savedInstanceState.getLong(CHRONO_TIME_SAVE_ID));
    }
    OverScrollDecoratorHelper.setUpStaticOverScroll(mChrono, OverScrollDecoratorHelper.ORIENTATION_HORIZONTAL);
    mChrono.start();

    return fragmentView;
}
 
開發者ID:EverythingMe,項目名稱:overscroll-decor,代碼行數:20,代碼來源:MiscViewsDemoFragment.java

示例5: onPostCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
protected void onPostCreate(Bundle savedInstanceState) {
	super.onPostCreate(savedInstanceState);

	// Trigger the initial hide() shortly after the activity has been
	// created, to briefly hint to the user that UI controls
	// are available.
       // Set text of quick timer
       Chronometer qt = (Chronometer) findViewById(R.id.quicktimer);
       if (!mQuickTimerRunning) {
       	qt.setText("Quick Timer");
       }
       else {
       	String timeFields[] = mElapsedTime.split(":");
       	qt.setBase(SystemClock.elapsedRealtime() 
       			- Integer.parseInt(timeFields[0])*60000 - Integer.parseInt(timeFields[1])*1000);
       	qt.start();
       }
}
 
開發者ID:sw-devendra,項目名稱:SpeechTimer,代碼行數:20,代碼來源:MainActivity.java

示例6: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    Log.v(LOG_TAG, "in onCreate");
    mChronometer = new Chronometer(this);
    mChronometer.setBase(SystemClock.elapsedRealtime());
    mChronometer.start();
}
 
開發者ID:Truiton,項目名稱:BoundService,代碼行數:9,代碼來源:BoundService.java

示例7: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey5);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.

}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:11,代碼來源:Survey5Activity.java

示例8: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey12);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey12Activity.java

示例9: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey19);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey19Activity.java

示例10: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey17);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey17Activity.java

示例11: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey1);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey1Activity.java

示例12: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey3);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey3Activity.java

示例13: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey16);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey16Activity.java

示例14: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey10);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey10Activity.java

示例15: onCreate

import android.widget.Chronometer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_survey11);

    chron = (Chronometer) findViewById(R.id.chron);
    chron.setBase(SystemClock.elapsedRealtime());   //Set the chronometer time.
    chron.start();                                  //Start time measurement.
}
 
開發者ID:JuKyYoon,項目名稱:Pineapple,代碼行數:10,代碼來源:Survey11Activity.java


注:本文中的android.widget.Chronometer.setBase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。