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


Java Chronometer類代碼示例

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


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

示例1: onCreate

import android.widget.Chronometer; //導入依賴的package包/類
/**
 * Called on create of the Activity. Sets up the activity
 * with its layout. Also sets up and starts the chronometer to tick
 * and check the time. If it's over 3 seconds it'll close.
 */
public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	setContentView(R.layout.page_splash);
	this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
	
	Chronometer chrono = (Chronometer) findViewById(R.id.chronometer_splash_chrono);
	chrono.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
		
		public void onChronometerTick(Chronometer chronometer) {
			counter++;
			if(counter > 2) {
				Intent intent = new Intent(Splash.this, Main.class);
				Splash.this.startActivity(intent);
				Splash.this.finish();
			}
		}
	});
	chrono.start();
}
 
開發者ID:lsissoko,項目名稱:Life-Preserver-Diet,代碼行數:25,代碼來源:Splash.java

示例2: initViews

import android.widget.Chronometer; //導入依賴的package包/類
@Override
protected void initViews(View view) {
    super.initViews(view);
    timerChronometer = (Chronometer) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.chronometer_timer_audio_call);

    ImageView firstOpponentAvatarImageView = (ImageView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.image_caller_avatar);
    firstOpponentAvatarImageView.setBackgroundDrawable(UiUtils.getColorCircleDrawable(opponents.get(0).getId()));

    alsoOnCallText = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_also_on_call);
    setVisibilityAlsoOnCallTextView();

    firstOpponentNameTextView = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_caller_name);
    firstOpponentNameTextView.setText(opponents.get(0).getFullName());

    otherOpponentsTextView = (TextView) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.text_other_inc_users);
    otherOpponentsTextView.setText(getOtherOpponentsNames());

    audioSwitchToggleButton = (ToggleButton) view.findViewById(com.mobilemaster.quickblox.groupchatwebrtc.R.id.toggle_speaker);
    audioSwitchToggleButton.setVisibility(View.VISIBLE);

    actionButtonsEnabled(false);
}
 
開發者ID:mobilemaster128,項目名稱:quickblox-android,代碼行數:23,代碼來源:AudioConversationFragment.java

示例3: 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

示例4: initView

import android.widget.Chronometer; //導入依賴的package包/類
private void initView() {
    client = new LocationClient(getApplicationContext());
    client.registerLocationListener(new RunningActivity.MyLocationListener());
    rootLayout = (LinearLayout) findViewById(R.id.running_root_layout);
    mapView = (MapView) findViewById(R.id.bmapView);
    startButton = (CircularProgressButton) findViewById(R.id.cpb_button);
    latLngText = (TextView) findViewById(R.id.lat_lng_text);
    speedNumber = (TextView) findViewById(R.id.speed_text);
    distanceNumber = (ImageNumberDisplayView) findViewById(R.id.distance_text);
    stepNumber = (ImageNumberDisplayView) findViewById(R.id.running_step);
    energyNumber = (ImageNumberDisplayView) findViewById(R.id.running_energy);
    setToolbar(R.id.running_toolbar, true);

    timer = (Chronometer) findViewById(R.id.timer);
    baiduMap = mapView.getMap();
    startButton.setClickable(false);
    startButton.setIndeterminateProgressMode(true);
}
 
開發者ID:SailFlorve,項目名稱:RunHDU,代碼行數:19,代碼來源:RunningActivity.java

示例5: findViews

import android.widget.Chronometer; //導入依賴的package包/類
private void findViews() {
    if (init || root == null)
        return;
    topRoot = root.findViewById(R.id.avchat_video_top_control);
    switchAudio = topRoot.findViewById(R.id.avchat_video_switch_audio);
    switchAudio.setOnClickListener(this);
    time = (Chronometer) topRoot.findViewById(R.id.avchat_video_time);
    netUnstableTV = (TextView) topRoot.findViewById(R.id.avchat_video_netunstable);

    middleRoot = root.findViewById(R.id.avchat_video_middle_control);
    headImg = (HeadImageView) middleRoot.findViewById(R.id.avchat_video_head);
    nickNameTV = (TextView) middleRoot.findViewById(R.id.avchat_video_nickname);
    notifyTV = (TextView) middleRoot.findViewById(R.id.avchat_video_notify);

    refuse_receive = middleRoot.findViewById(R.id.avchat_video_refuse_receive);
    refuseTV = (TextView) refuse_receive.findViewById(R.id.refuse);
    receiveTV = (TextView) refuse_receive.findViewById(R.id.receive);
    refuseTV.setOnClickListener(this);
    receiveTV.setOnClickListener(this);

    recordView = root.findViewById(R.id.avchat_record_layout);
    recordTip = recordView.findViewById(R.id.avchat_record_tip);
    recordWarning = recordView.findViewById(R.id.avchat_record_warning);

    bottomRoot = root.findViewById(R.id.avchat_video_bottom_control);
    faceUnityRoot = root.findViewById(R.id.avchat_video_face_unity);

    switchCameraToggle = new ToggleView(bottomRoot.findViewById(R.id.avchat_switch_camera), ToggleState.DISABLE, this);
    closeCameraToggle = new ToggleView(bottomRoot.findViewById(R.id.avchat_close_camera), ToggleState.DISABLE, this);
    muteToggle = new ToggleView(bottomRoot.findViewById(R.id.avchat_video_mute), ToggleState.DISABLE, this);
    recordToggle = (ImageView) bottomRoot.findViewById(R.id.avchat_video_record);
    recordToggle.setEnabled(false);
    recordToggle.setOnClickListener(this);
    hangUpImg = (ImageView) bottomRoot.findViewById(R.id.avchat_video_logout);
    hangUpImg.setOnClickListener(this);

    permissionRoot = root.findViewById(R.id.avchat_video_permission_control);
    init = true;
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:40,代碼來源:AVChatVideo.java

示例6: 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

示例7: updateChronometer

import android.widget.Chronometer; //導入依賴的package包/類
private void updateChronometer() {
    timerButton.setImageResource(timerActive()
            ? R.drawable.ic_pause_24dp
            : R.drawable.ic_play_arrow_24dp);

    long elapsed = this.elapsed.getTimeDurationInSeconds() * 1000L;
    if (timerActive()) {
        chronometer.setVisibility(View.VISIBLE);
        elapsed += DateUtilities.now() - timerStarted;
        chronometer.setBase(SystemClock.elapsedRealtime() - elapsed);
        if (elapsed > DateUtilities.ONE_DAY) {
            chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
                @Override
                public void onChronometerTick(Chronometer cArg) {
                    long t = SystemClock.elapsedRealtime() - cArg.getBase();
                    cArg.setText(DateFormat.format("d'd' h:mm", t)); //$NON-NLS-1$
                }
            });

        }
        chronometer.start();
    } else {
        chronometer.setVisibility(View.GONE);
        chronometer.stop();
    }
}
 
開發者ID:andyCano,項目名稱:TaskApp,代碼行數:27,代碼來源:TimerControlSet.java

示例8: onCreate

import android.widget.Chronometer; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    ArrayList<QBUser> qbUsers = (ArrayList<QBUser>) getIntent().getExtras().getSerializable(EXTRA_QB_USERS);
    chatDialog = new QBChatDialog(DIALOG_ID);

    messagesListView = (RecyclerView) findViewById(R.id.list_chat_messages);
    progressBar = (ProgressBar) findViewById(R.id.progress_chat);
    audioLayout = (LinearLayout) findViewById(R.id.layout_chat_audio_container);
    recordButton = (QBRecordAudioButton) findViewById(R.id.button_chat_record_audio);
    recordChronometer = (Chronometer) findViewById(R.id.chat_audio_record_chronometer);
    bucketView = (ImageView) findViewById(R.id.chat_audio_record_bucket_imageview);
    audioRecordTextView = (TextView) findViewById(R.id.chat_audio_record_textview);
    vibro = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

    requestPermission();
    initAudioRecorder();
    recordButton.setRecordTouchListener(new RecordTouchListenerImpl());

    loadChatHistory(qbUsers);
}
 
開發者ID:QuickBlox,項目名稱:ChatMessagesAdapter-android,代碼行數:24,代碼來源:ChatActivity.java

示例9: 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

示例10: onCreate

import android.widget.Chronometer; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
			WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.zg_activity_video_shoot);
	mFacing = (TextView) findViewById(R.id.tv_facing);
	mSurfaceView = (SurfaceView) findViewById(R.id.surfaceview_shoot);
	mShoot = (ImageView) findViewById(R.id.img_shoot);
	mChronometer = (Chronometer) findViewById(R.id.video_chronometer);
	mFacing.setOnClickListener(this);
	mShoot.setOnClickListener(this);

	initToggle();
	findViewById(R.id.iv_left).setOnClickListener(this);

	SurfaceHolder mHolder = mSurfaceView.getHolder();
	mHolder.addCallback(this);
	mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
 
開發者ID:BigAppOS,項目名稱:BigApp_WordPress_Android,代碼行數:22,代碼來源:MediaShootActivity.java

示例11: startCapture

import android.widget.Chronometer; //導入依賴的package包/類
private void startCapture() {
	
	if(captureService != null)
	{
		try { 
			captureService.startCapture();
		} catch(NoCurrentCaptureException e) {
			Intent settingsIntent = new Intent(CaptureActivity.this, NewActivity.class);
			startActivity(settingsIntent);
			return;
		}
		
		vibratorService.vibrate(100);
		
		Toast.makeText(CaptureActivity.this, "Iniciar Trazado..." ,Toast.LENGTH_SHORT).show();
		
		((Chronometer) findViewById(R.id.captureChronometer)).setBase(SystemClock.elapsedRealtime());
		((Chronometer) findViewById(R.id.captureChronometer)).start();
		
		initButtons();
	}
}
 
開發者ID:codeandoxalapa,項目名稱:mapmap,代碼行數:23,代碼來源:CaptureActivity.java

示例12: method

import android.widget.Chronometer; //導入依賴的package包/類
public void method(Chronometer chronometer) {
    // Method call
    chronometer.<error descr="Call requires API level 3 (current min is 1): android.widget.Chronometer#getOnChronometerTickListener">getOnChronometerTickListener</error>(); // API 3

    // Inherited method call (from TextView
    chronometer.<error descr="Call requires API level 11 (current min is 1): android.widget.TextView#setTextIsSelectable">setTextIsSelectable</error>(true); // API 11

    // Field access
    int fillParent = LayoutParams.FILL_PARENT; // API 1
    // This is a final int, which means it gets inlined
    int matchParent = LayoutParams.MATCH_PARENT; // API 8
    // Field access: non final
    BatteryInfo batteryInfo = <error descr="Field requires API level 14 (current min is 1): android.app.ApplicationErrorReport#batteryInfo">getReport().batteryInfo</error>;

    // Enum access
    Mode mode = <error descr="Field requires API level 11 (current min is 1): android.graphics.PorterDuff.Mode#OVERLAY">PorterDuff.Mode.OVERLAY</error>; // API 11
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:Basic.java

示例13: 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

示例14: onCreateView

import android.widget.Chronometer; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    SharedPreferences sharedPref = getActivity().getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
    mTime = sharedPref.getInt(getString(R.string.value_timer), mTime);
    View rootView = inflater.inflate(R.layout.fragment_layout_measurement, container, false);

    mStopWatch = (CustomStopwatch) rootView.findViewById(R.id.stopwatch);

    mStopWatch.setTime(mTime);
    mStopWatch.setOnChronometerTickListener(new OnChronometerTickListener() {

                                                public void onChronometerTick(Chronometer arg0) {
                                                    boolean isAlert = false;
                                                    if (mStopWatch.measurementIsFinished() && !isAlert) {
                                                        mCallback.onTimerEnd(mTime);
                                                        stopTimer();
                                                        isAlert = true;
                                                    }
                                                }
                                            }
    );
    return rootView;
}
 
開發者ID:chillcoding-at-the-beach,項目名稱:bachamada,代碼行數:26,代碼來源:MeasurementFragment.java

示例15: initView

import android.widget.Chronometer; //導入依賴的package包/類
private void initView() {
	m_ContentView = m_LayoutInflater.inflate(R.layout.audio_capture, null);
	setContentView(m_ContentView);
	
	btnStartRecord = (Button)m_ContentView.findViewById(R.id.start_record);
	btnStopRecord = (Button)m_ContentView.findViewById(R.id.stop_record);
	btnOk = (Button)m_ContentView.findViewById(R.id.audio_record_ok);
	btnBackUp = (Button)m_ContentView.findViewById(R.id.audio_cancel);
	
	btnStartRecord.setOnClickListener(this);
	btnStopRecord.setOnClickListener(this);
	btnBackUp.setOnClickListener(this);
	btnOk.setOnClickListener(this);
	
	mTimer = (Chronometer)m_ContentView.findViewById(R.id.chronometer1);
	
}
 
開發者ID:SuperMap,項目名稱:iMobile_MessageQueue_Android,代碼行數:18,代碼來源:AudioRecordPopup.java


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