Java 类android.widget.Chronometer 实例源码

项目:quickblox-android    文件:AudioConversationFragment.java   
@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);
}
项目:Life-Preserver-Diet    文件:Splash.java   
/**
 * 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();
}
项目:RunHDU    文件:RunningActivity.java   
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);
}
项目:MinimalismJotter    文件:RecoderManager.java   
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;
    }
}
项目:decoy    文件:AVChatVideo.java   
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;
}
项目:android-lifecycles    文件:ChronoActivity2.java   
@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();
}
项目:TaskApp    文件:TimerControlSet.java   
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();
    }
}
项目:ChatMessagesAdapter-android    文件:ChatActivity.java   
@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);
}
项目:elasticity    文件:MiscViewsDemoFragment.java   
@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;
}
项目:BigApp_WordPress_Android    文件:MediaShootActivity.java   
@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);
}
项目:mapmap    文件:CaptureActivity.java   
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();
    }
}
项目:intellij-ce-playground    文件:Basic.java   
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
}
项目:overscroll-decor    文件:MiscViewsDemoFragment.java   
@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;
}
项目:bachamada    文件:MeasurementFragment.java   
@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;
}
项目:iMobile_MessageQueue_Android    文件:AudioRecordPopup.java   
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);

}
项目:moveon    文件:Main.java   
private void showCalculatedData(TextView tv, int option, Chronometer arg0) {
    DisplayTypes whichDisplay = DisplayTypes.values()[option];
    switch (whichDisplay) {
    case TIME:
        tv.setText(FunctionUtils.longFormatTime((SystemClock.elapsedRealtime() - arg0.getBase()) / 1000));
        break;
    case AVG_SPEED:
        tv.setText(FunctionUtils.calculateAvg(mContext,
                ((SystemClock.elapsedRealtime() - arg0.getBase()) / 1000), mDistance, isMetric));
        break;
    case RITM:
        tv.setText(FunctionUtils.calculateRitm(mContext,
                ((SystemClock.elapsedRealtime() - arg0.getBase()) / 1000), mDistance, isMetric, false));
        break;
    case KCAL:
        tv.setText(String.valueOf(MoveOnService.getCalories()));
        break;
    default:
        break;
    }
}
项目:ApkLauncher    文件:ChronometerDemo.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.chronometer);

    Button button;

    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    // Watch for button clicks.
    button = (Button) findViewById(R.id.start);
    button.setOnClickListener(mStartListener);

    button = (Button) findViewById(R.id.stop);
    button.setOnClickListener(mStopListener);

    button = (Button) findViewById(R.id.reset);
    button.setOnClickListener(mResetListener);

    button = (Button) findViewById(R.id.set_format);
    button.setOnClickListener(mSetFormatListener);

    button = (Button) findViewById(R.id.clear_format);
    button.setOnClickListener(mClearFormatListener);
}
项目:binea_project_for_android    文件:BluetoothChatFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    mConversationView = (ListView) view.findViewById(R.id.in);
    mOutEditText = (EditText) view.findViewById(R.id.edit_text_out);
    mStartDribblingButton = (Button) view.findViewById(R.id.btn_start_dribbling);
    tv_shoot_count = (TextView) view.findViewById(R.id.tv_shoot_count);
    mStartShootingButton = (Button) view.findViewById(R.id.btn_start_shooting);
    mStartRawStream = (Button) view.findViewById(R.id.btn_start_raw_stream);
    time = (Chronometer) view.findViewById(R.id.time);
    et_ip = (EditText) view.findViewById(R.id.et_ip);
    et_ip.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override public void onFocusChange(View v, boolean hasFocus) {
            if(!hasFocus){
                GlobalVar.SERVER_ADDRESS = et_ip.getText().toString();
            }
        }
    });
    et_ip.setText(GlobalVar.SERVER_ADDRESS);
    time.setText("00:00:00");
    time.setFormat("计时:%s");
}
项目:ApiDemos    文件:ChronometerDemo.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.chronometer);

    Button button;

    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    // Watch for button clicks.
    button = (Button) findViewById(R.id.start);
    button.setOnClickListener(mStartListener);

    button = (Button) findViewById(R.id.stop);
    button.setOnClickListener(mStopListener);

    button = (Button) findViewById(R.id.reset);
    button.setOnClickListener(mResetListener);

    button = (Button) findViewById(R.id.set_format);
    button.setOnClickListener(mSetFormatListener);

    button = (Button) findViewById(R.id.clear_format);
    button.setOnClickListener(mClearFormatListener);
}
项目:SpeechTimer    文件:MainActivity.java   
@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();
       }
}
项目:felix-on-android    文件:ChronometerDemo.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.chronometer);

    Button button;

    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    // Watch for button clicks.
    button = (Button) findViewById(R.id.start);
    button.setOnClickListener(mStartListener);

    button = (Button) findViewById(R.id.stop);
    button.setOnClickListener(mStopListener);

    button = (Button) findViewById(R.id.reset);
    button.setOnClickListener(mResetListener);

    button = (Button) findViewById(R.id.set_format);
    button.setOnClickListener(mSetFormatListener);

    button = (Button) findViewById(R.id.clear_format);
    button.setOnClickListener(mClearFormatListener);
}
项目:MEng    文件:ChronometerDemo.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.chronometer);

    Button button;

    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    // Watch for button clicks.
    button = (Button) findViewById(R.id.start);
    button.setOnClickListener(mStartListener);

    button = (Button) findViewById(R.id.stop);
    button.setOnClickListener(mStopListener);

    button = (Button) findViewById(R.id.reset);
    button.setOnClickListener(mResetListener);

    button = (Button) findViewById(R.id.set_format);
    button.setOnClickListener(mSetFormatListener);

    button = (Button) findViewById(R.id.clear_format);
    button.setOnClickListener(mClearFormatListener);
}
项目:connect64    文件:Connect64.java   
/** Gets references to views, hooks up the context listeners. */
private void setupViews() {
    this.boardState = new SparseIntArray(BOARD_MAX);
    this.gameBoard = (LinearLayout) findViewById(R.id.connect64);
    this.setupContextClicks();
    this.puzzleLabel = (TextView) findViewById(R.id.puzzleLabel);
    this.rangeSpinner = (Spinner) findViewById(R.id.rangeSpinner);
    this.pauseResume = (ImageButton) findViewById(R.id.pauseResumeButton);
    this.timer = (Chronometer) findViewById(R.id.chronometer);
    final ArrayAdapter<CharSequence> adapter = ArrayAdapter
            .createFromResource(this, R.array.ranges,
                    android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.rangeSpinner.setAdapter(adapter);
    this.rangeSpinner.setOnItemSelectedListener(this);

    final RelativeLayout inputs = (RelativeLayout) findViewById(R.id.inputButtons);
    final Button[] buttons = new Button[NUM_INPUT_BUTTONS];
    for (int i = 0; i < NUM_INPUT_BUTTONS; i++) {
        buttons[i] = (Button) inputs.findViewWithTag("in" + (i + 1));
    }
    this.inputButtons = buttons;
}
项目:codeexamples-android    文件:ChronometerDemo.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.chronometer);

    Button button;

    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    // Watch for button clicks.
    button = (Button) findViewById(R.id.start);
    button.setOnClickListener(mStartListener);

    button = (Button) findViewById(R.id.stop);
    button.setOnClickListener(mStopListener);

    button = (Button) findViewById(R.id.reset);
    button.setOnClickListener(mResetListener);

    button = (Button) findViewById(R.id.set_format);
    button.setOnClickListener(mSetFormatListener);

    button = (Button) findViewById(R.id.clear_format);
    button.setOnClickListener(mClearFormatListener);
}
项目:deview-2013-samples    文件:ChronometerDemo.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.chronometer);

    Button button;

    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    // Watch for button clicks.
    button = (Button) findViewById(R.id.start);
    button.setOnClickListener(mStartListener);

    button = (Button) findViewById(R.id.stop);
    button.setOnClickListener(mStopListener);

    button = (Button) findViewById(R.id.reset);
    button.setOnClickListener(mResetListener);

    button = (Button) findViewById(R.id.set_format);
    button.setOnClickListener(mSetFormatListener);

    button = (Button) findViewById(R.id.clear_format);
    button.setOnClickListener(mClearFormatListener);
}
项目:quickblox-android    文件:VideoConversationFragment.java   
@Override
protected void initFields() {
    super.initFields();
    localViewOnClickListener = new LocalViewOnClickListener();
    amountOpponents = opponents.size();
    allOpponents = Collections.synchronizedList(new ArrayList<QBUser>(opponents.size()));
    allOpponents.addAll(opponents);

    timerChronometer = (Chronometer) getActivity().findViewById(R.id.timer_chronometer_action_bar);

    isPeerToPeerCall = opponents.size() == 1;
}
项目:CSipSimple    文件:InCallCard.java   
private void initControllerView() {
    photo = (ImageView) findViewById(R.id.contact_photo);
    remoteName = (TextView) findViewById(R.id.contact_name_display_name);
    remoteSipAddress = (TextView) findViewById(R.id.contact_name_sip_address);
    elapsedTime = (Chronometer) findViewById(R.id.elapsedTime);
    callStatusText = (TextView) findViewById(R.id.call_status_text);
    callSecureBar = (ViewGroup) findViewById(R.id.call_secure_bar);
    callSecureText = (TextView) findViewById(R.id.call_secure_text);
    endCallBar = (ViewGroup) findViewById(R.id.end_call_bar);


    View btn;
    btn = findViewById(R.id.endButton);
    btn.setOnClickListener(this);

    btnMenuBuilder = new MenuBuilder(getContext());
    btnMenuBuilder.setCallback(this);
    MenuInflater inflater = new MenuInflater(getContext());
    inflater.inflate(R.menu.in_call_card_menu, btnMenuBuilder);

    mActionMenuPresenter = new ActionMenuPresenter(getContext());
    mActionMenuPresenter.setReserveOverflow(true);

    btnMenuBuilder.addMenuPresenter(mActionMenuPresenter);

    updateMenuView();
}
项目:ViewPrinter    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrinterLogger.setLogLevel(PrinterLogger.LEVEL_VERBOSE);
    ZoomLogger.setLogLevel(ZoomLogger.LEVEL_ERROR);

    setContentView(R.layout.activity_main);
    mDocument = findViewById(R.id.pdf_preview);
    mJpegPrinter = new JpegPrinter(mDocument, this);
    mPngPrinter = new PngPrinter(mDocument, this);
    mPdfPrinter = new PdfPrinter(mDocument, this);

    mDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
    mFilename = "my-document-" + System.currentTimeMillis();

    findViewById(R.id.print_jpeg).setOnClickListener(this);
    findViewById(R.id.print_pdf).setOnClickListener(this);
    findViewById(R.id.print_png).setOnClickListener(this);
    findViewById(R.id.edit).setOnClickListener(this);
    findViewById(R.id.logo_prompt).setOnClickListener(this);

    Chronometer chrono = findViewById(R.id.chrono);
    chrono.start();

    mPanel = findViewById(R.id.controls);
    mPanel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            BottomSheetBehavior b = BottomSheetBehavior.from(mPanel);
            b.setState(BottomSheetBehavior.STATE_HIDDEN);
            mPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
    setupControls();
}
项目:MinimalismJotter    文件:RecoderManager.java   
public static void voicePause(MediaPlayer player, Chronometer chronometer) {
    // 判断音乐是否在播放
    if (player != null && player.isPlaying()) {
        setChronometer(chronometer, Constant.CHRONOMETER_STOP);
        // 暂停音乐播放器
        player.pause();
    }
}
项目:TreasureHunting    文件:MapsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    PowerManager mgr = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME);
    mWakeLock.acquire();

    //mCurrentGame = getIntent().getParcelableExtra(IntentNames.SELECTED_GAME);
    mCurrentGame = new Game(this);

    loadState(savedInstanceState);
    mfileManager = new GameFileManager(this, mLanguage);

    setContentView(R.layout.activity_maps2);
    setUpMap();

    startLocationTracking();

    PermissionAndConnectionChecker.checkForPermissions(this, new String[]
            {Manifest.permission.WRITE_EXTERNAL_STORAGE}, PermissionAndConnectionChecker.LocalStorageRequestCode);

    chronometer = (Chronometer) findViewById(R.id.chronometer);
    //mAudioPlayerUi = new AudioPlayerUI(this, mCurrentGame);
    startTimer();

    databaseHelper = new DatabaseHelper(this);
    currentPlayer = getIntent().getStringExtra(IntentNames.CURRENT_PLAYER_USERNAME);
    secretCode = getIntent().getStringExtra(IntentNames.SECRET_CODE);
}
项目:microbit    文件:AudioRecorderActivity.java   
private void create(String action) {
    setContentView(R.layout.activity_audio_recorder);
    filenameTxt = (TextView) findViewById(R.id.filenameTxt);
    chronometer = (Chronometer) findViewById(R.id.chronometer);
    imageMic = (ImageView) findViewById(R.id.imageMic);

    //preallocate to avoid memory leak
    drawable_mic_off = getResources().getDrawable(R.drawable.recording_off);
    drawable_mic_on = getResources().getDrawable(R.drawable.recording);

    backPressed = false;

    notificationLargeIconBitmapRecordingOn = BitmapFactory.decodeResource(getResources(), R.drawable.recording);
    notificationLargeIconBitmapRecordingOff = BitmapFactory.decodeResource(getResources(), R.drawable.recording_off);

    mBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_launcher)
            .setLargeIcon(notificationLargeIconBitmapRecordingOff)
            .setTicker(getString(R.string.audio_recorder_notification))
            .setContentTitle(getString(R.string.audio_recorder_notification));

    Drawable d = getResources().getDrawable(R.drawable.bg);
    if(d != null) {
        d.mutate();//prevent affecting all instances of that drawable with color filter
        d.setColorFilter(Color.argb(187, 0, 0, 0), PorterDuff.Mode.SRC_OVER);
        findViewById(R.id.layout).setBackground(d);
    }
    processIntent(action);
}
项目:AndroidApp-Deploy    文件:Test.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    //widget

    crono = (Chronometer) findViewById(R.id.crono);
    Start = (Button) findViewById(R.id.start);
    Stop = (Button) findViewById(R.id.stop);

    Start.setEnabled(true);
    Stop.setEnabled(false);

}
项目:decoy    文件:AVChatAudio.java   
/**
 * 界面初始化
 */
private void findViews() {
    if(init || rootView == null){
        return;
    }
    switchVideo = rootView.findViewById(R.id.avchat_audio_switch_video);
    switchVideo.setOnClickListener(this);

    headImg = (HeadImageView) rootView.findViewById(R.id.avchat_audio_head);
    nickNameTV = (TextView) rootView.findViewById(R.id.avchat_audio_nickname);
    time = (Chronometer) rootView.findViewById(R.id.avchat_audio_time);
    wifiUnavailableNotifyTV = (TextView) rootView.findViewById(R.id.avchat_audio_wifi_unavailable);
    notifyTV = (TextView) rootView.findViewById(R.id.avchat_audio_notify);
    netUnstableTV = (TextView) rootView.findViewById(R.id.avchat_audio_netunstable);

    mute_speaker_hangup = rootView.findViewById(R.id.avchat_audio_mute_speaker_huangup);
    View mute = mute_speaker_hangup.findViewById(R.id.avchat_audio_mute);
    muteToggle = new ToggleView(mute, ToggleState.OFF, this);
    View speaker = mute_speaker_hangup.findViewById(R.id.avchat_audio_speaker);
    speakerToggle = new ToggleView(speaker, ToggleState.OFF, this);
    recordToggle = mute_speaker_hangup.findViewById(R.id.avchat_audio_record);
    recordToggleButton = (Button) mute_speaker_hangup.findViewById(R.id.avchat_audio_record_button);

    hangup = mute_speaker_hangup.findViewById(R.id.avchat_audio_hangup);
    hangup.setOnClickListener(this);
    recordToggle.setOnClickListener(this);
    recordToggle.setEnabled(false);

    refuse_receive = rootView.findViewById(R.id.avchat_audio_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 = rootView.findViewById(R.id.avchat_record_layout);
    recordTip = rootView.findViewById(R.id.avchat_record_tip);
    recordWarning = rootView.findViewById(R.id.avchat_record_warning);

    init = true;
}
项目:decoy    文件:InputPanel.java   
private void initViews() {
    // input bar
    messageActivityBottomLayout = (LinearLayout) view.findViewById(R.id.messageActivityBottomLayout);
    messageInputBar = view.findViewById(R.id.textMessageLayout);
    switchToTextButtonInInputBar = view.findViewById(R.id.buttonTextMessage);
    switchToAudioButtonInInputBar = view.findViewById(R.id.buttonAudioMessage);
    moreFuntionButtonInInputBar = view.findViewById(R.id.buttonMoreFuntionInText);
    emojiButtonInInputBar = view.findViewById(R.id.emoji_button);
    sendMessageButtonInInputBar = view.findViewById(R.id.buttonSendMessage);
    messageEditText = (EditText) view.findViewById(R.id.editTextMessage);

    // 语音
    audioRecordBtn = (Button) view.findViewById(R.id.audioRecord);
    audioAnimLayout = view.findViewById(R.id.layoutPlayAudio);
    time = (Chronometer) view.findViewById(R.id.timer);
    timerTip = (TextView) view.findViewById(R.id.timer_tip);
    timerTipContainer = (LinearLayout) view.findViewById(R.id.timer_tip_container);

    // 表情
    emoticonPickerView = (EmoticonPickerView) view.findViewById(R.id.emoticon_picker_view);

    // 显示录音按钮
    switchToTextButtonInInputBar.setVisibility(View.GONE);
    switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);

    // 文本录音按钮切换布局
    textAudioSwitchLayout = (FrameLayout) view.findViewById(R.id.switchLayout);
    if (isTextAudioSwitchShow) {
        textAudioSwitchLayout.setVisibility(View.VISIBLE);
    } else {
        textAudioSwitchLayout.setVisibility(View.GONE);
    }
}
项目:GCSApp    文件:RecorderVideoActivity.java   
private void initViews() {
    btn_switch = (Button) findViewById(R.id.switch_btn);
    btn_switch.setOnClickListener(this);
    btn_switch.setVisibility(View.VISIBLE);
    mVideoView = (VideoView) findViewById(R.id.mVideoView);
    btnStart = (ImageView) findViewById(R.id.recorder_start);
    btnStop = (ImageView) findViewById(R.id.recorder_stop);
    btnStart.setOnClickListener(this);
    btnStop.setOnClickListener(this);
    mSurfaceHolder = mVideoView.getHolder();
    mSurfaceHolder.addCallback(this);
    mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    chronometer = (Chronometer) findViewById(R.id.chronometer);
}
项目:BoundService    文件:BoundService.java   
@Override
public void onCreate() {
    super.onCreate();
    Log.v(LOG_TAG, "in onCreate");
    mChronometer = new Chronometer(this);
    mChronometer.setBase(SystemClock.elapsedRealtime());
    mChronometer.start();
}
项目:android-lifecycles    文件:ChronoActivity1.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Chronometer chronometer = findViewById(R.id.chronometer);

    chronometer.start();
}
项目:video-quickstart-android    文件:CustomCapturerVideoActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_capturer);

    capturedView = (LinearLayout) findViewById(R.id.captured_view);
    videoView = (VideoView) findViewById(R.id.video_view);
    timerView = (Chronometer) findViewById(R.id.timer_view);
    timerView.start();

    // Once added we should see our linear layout rendered live below
    localVideoTrack = LocalVideoTrack.create(this, true, new ViewCapturer(capturedView));
    localVideoTrack.addRenderer(videoView);
}
项目:MyTravelingDiary    文件:InputPanel.java   
private void initViews() {
    // input bar
    messageActivityBottomLayout = (LinearLayout) view.findViewById(R.id.messageActivityBottomLayout);
    messageInputBar = view.findViewById(R.id.textMessageLayout);
    switchToTextButtonInInputBar = view.findViewById(R.id.buttonTextMessage);
    switchToAudioButtonInInputBar = view.findViewById(R.id.buttonAudioMessage);
    moreFuntionButtonInInputBar = view.findViewById(R.id.buttonMoreFuntionInText);
    emojiButtonInInputBar = view.findViewById(R.id.emoji_button);
    sendMessageButtonInInputBar = view.findViewById(R.id.buttonSendMessage);
    messageEditText = (EditText) view.findViewById(R.id.editTextMessage);

    // 语音
    audioRecordBtn = (Button) view.findViewById(R.id.audioRecord);
    audioAnimLayout = view.findViewById(R.id.layoutPlayAudio);
    time = (Chronometer) view.findViewById(R.id.timer);
    timerTip = (TextView) view.findViewById(R.id.timer_tip);
    timerTipContainer = (LinearLayout) view.findViewById(R.id.timer_tip_container);

    // 表情
    emoticonPickerView = (EmoticonPickerView) view.findViewById(R.id.emoticon_picker_view);

    // 显示录音按钮
    switchToTextButtonInInputBar.setVisibility(View.GONE);
    switchToAudioButtonInInputBar.setVisibility(View.VISIBLE);

    // 文本录音按钮切换布局
    textAudioSwitchLayout = (FrameLayout) view.findViewById(R.id.switchLayout);
    if (isTextAudioSwitchShow) {
        textAudioSwitchLayout.setVisibility(View.VISIBLE);
    } else {
        textAudioSwitchLayout.setVisibility(View.GONE);
    }
}
项目:videorecord    文件:VideoPlayerActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 防止锁屏
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        mPath = getIntent().getStringExtra(VConstant.RECORD_VIDEO_PATH);

        mCoverPath = getIntent().getStringExtra(VConstant.RECORD_VIDEO_CAPTURE);
        if (StringUtils.isEmpty(mPath)) {
            finish();
            return;
        }
        setContentView(R.layout.activity_video_player);

        mLoadingCircleView = (LoadingCircleView) findViewById(R.id.loadingView);
        mLoadingCircleView.setProgerss(1, true);
        mVideoView = (SurfaceVideoView) findViewById(R.id.videoview);
        mPlayerStatus = findViewById(R.id.play_status);
//      mLoading = findViewById(R.id.loading);
        mChronometer = (Chronometer) findViewById(R.id.chronometer);
        mChronometer.setOnChronometerTickListener(this);

        mVideoView.setOnPreparedListener(this);
        mVideoView.setOnPlayStateListener(this);
        mVideoView.setOnErrorListener(this);
        mVideoView.setOnClickListener(this);
        mVideoView.setOnInfoListener(this);
        mVideoView.setOnCompletionListener(this);

        mVideoView.getLayoutParams().height = DeviceUtils.getScreenWidth(this);

        findViewById(R.id.root).setOnClickListener(this);
        if (mPath.startsWith("http")) {
            downloadVideo(mPath);
        } else {
            mVideoView.setVideoPath(mPath);
        }
    }