Java Code Examples for android.widget.ToggleButton

The following are top voted examples for showing how to use android.widget.ToggleButton. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: quickblox-android   File: AudioConversationFragment.java   View source code 7 votes vote down vote up
@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);
}
 
Example 2
Project: HighSchoolScienceBowlPractice-Android   File: StudyModeSettingsPage.java   View source code 7 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_study_mode_settings_page);

    biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
    chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
    earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
    energyButton = (ToggleButton) findViewById(R.id.energyButton);
    mathButton = (ToggleButton) findViewById(R.id.mathButton);
    physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
    randomButton = (ToggleButton) findViewById(R.id.randomButton);

    roundNumPicker = (NumberPicker) findViewById(R.id.roundNumPicker);
    roundNumPicker.setMinValue(0);
    roundNumPicker.setMaxValue(roundOptions.length-1);
    roundNumPicker.setWrapSelectorWheel(false);
    roundNumPicker.setDisplayedValues(roundOptions);

    menuButton = (Button) findViewById(R.id.menuButton);
}
 
Example 3
Project: thesis-project   File: StudentViewActivity.java   View source code 7 votes vote down vote up
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.student_recyclerview);
    btnSearch = (ToggleButton)findViewById(R.id.btn_search_student);
    btnSearchOk = (Button)findViewById(R.id.btn_search_ok_student);
    btnBack = (Button) findViewById(R.id.btn_back_student);
    editTextSearch =(EditText)findViewById(R.id.etxt_search_student);
    frameLayoutSearch = (FrameLayout)findViewById(R.id.frame_search_student);
    txtMsgContent = (TextView) findViewById(R.id.message_label_stud);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
 
Example 4
Project: thesis-project   File: ExamInputAdapter.java   View source code 7 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 5
Project: GitHub   File: MockLocationsActivity.java   View source code 6 votes vote down vote up
private void initViews() {
    latitudeInput = (EditText) findViewById(R.id.latitude_input);
    longitudeInput = (EditText) findViewById(R.id.longitude_input);
    mockLocationView = (TextView) findViewById(R.id.mock_location_view);
    updatedLocationView = (TextView) findViewById(R.id.updated_location_view);
    mockModeToggleButton = (ToggleButton) findViewById(R.id.toggle_button);
    setLocationButton = (Button) findViewById(R.id.set_location_button);

    mockModeToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            setMockMode(isChecked);
            setLocationButton.setEnabled(isChecked);
        }
    });
    setLocationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addMockLocation();
        }
    });
}
 
Example 6
Project: GitHub   File: AnimationControlsManager.java   View source code 6 votes vote down vote up
public AnimationControlsManager(
    AnimatedDrawable2 animatedDrawable,
    @Nullable SeekBar seekBar,
    @Nullable ToggleButton playPauseToggleButton,
    @Nullable View resetButton) {
  mAnimatedDrawable = animatedDrawable;
  mSeekBar = seekBar;
  mPlayPauseToggleButton = playPauseToggleButton;
  mResetButton = resetButton;

  setupPlayPauseToggleButton();
  setupResetButton();
  setupSeekBar();

  mAnimatedDrawable.setAnimationListener(mAnimationListener);
  updateBackendData(mAnimatedDrawable.getAnimationBackend());
}
 
Example 7
Project: GitHub   File: MediaControlFragment.java   View source code 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  ImageView imageView = (ImageView) view.findViewById(R.id.animation_container);

  // Create a new animated drawable. The backend will be set by the backend configurator.
  mAnimatedDrawable = new AnimatedDrawable2();

  imageView.setImageDrawable(mAnimatedDrawable);

  mAnimationControlsManager = new AnimationControlsManager(
      mAnimatedDrawable,
      (SeekBar) view.findViewById(R.id.seekbar),
      (ToggleButton) view.findViewById(R.id.playpause),
      view.findViewById(R.id.reset));

  new SampleAnimationBackendConfigurator(
      (Spinner) view.findViewById(R.id.spinner),
      this);
}
 
Example 8
Project: LiveNotes   File: KeySigDialogFragment.java   View source code 6 votes vote down vote up
private void initializeViews(Dialog dialog) {
    major = (ToggleButton) dialog.findViewById(R.id.major);
    minor = (ToggleButton) dialog.findViewById(R.id.minor);
    dialog.findViewById(R.id.major_parent).setOnClickListener(__ -> onMajorClicked());
    dialog.findViewById(R.id.minor_parent).setOnClickListener(__ -> onMinorClicked());

    keySigImage = (ImageView) dialog.findViewById(R.id.key_sig_image);

    key = (NumberPicker) dialog.findViewById(R.id.key);
    key.setWrapSelectorWheel(false);
    key.setMinValue(0);
    key.setMaxValue(KeySigHandler.FIFTHS.length - 1);

    major.setChecked(false);
    onMajorClicked();
    key.setOnValueChangedListener(this);
    key.setValue(6);
}
 
Example 9
Project: mousetodon   File: MouseApp.java   View source code 6 votes vote down vote up
public void mute(final View v) {
    final NextAction dumbaction = new NextAction() {
        public void run(String res) {}
    };
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            ToggleButton tb = (ToggleButton)v;
            if (tb.isChecked()) {
                connect.muteUser(VisuUser.curuserid, dumbaction);
                message("muting user "+VisuUser.curuserid);
            } else {
                connect.unmuteUser(VisuUser.curuserid, dumbaction);
                message("unmuting user "+VisuUser.curuserid);
            }
        }
    });
}
 
Example 10
Project: LocationProvider   File: LocationTrackActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_track);
    tbTrack = (ToggleButton) findViewById(R.id.tb_track);
    tvMessage = (TextView) findViewById(R.id.tv_location_message);

    tbTrack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startTrack();
            } else {
                stopTrack();
            }
        }

    });
}
 
Example 11
Project: mousetodon   File: MouseApp.java   View source code 6 votes vote down vote up
public void follow(final View v) {
    final NextAction dumbaction = new NextAction() {
        public void run(String res) {}
    };
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            ToggleButton tb = (ToggleButton)v;
            if (tb.isChecked()) {
                connect.followUser(VisuUser.curuserid, dumbaction);
                message("following user "+VisuUser.curuserid);
            } else {
                connect.unfollowUser(VisuUser.curuserid, dumbaction);
                message("unfollowing user "+VisuUser.curuserid);
            }
        }
    });
}
 
Example 12
Project: FakeLock   File: MyItemRecyclerViewAdapter.java   View source code 6 votes vote down vote up
public ViewHolder(View view) {
    super(view);
    mView = view;
    appNameTextView = (TextView) view.findViewById(R.id.appNameTextView);
    appPackageNameTextView = (TextView) view.findViewById(R.id.appPackageNameTextView);
    appIconImageView = (ImageView) view.findViewById(R.id.appIconImageView);
    hideAppToggleButton = (ToggleButton) view.findViewById(R.id.hideAppToggleButton);

    hideAppToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            String packageName = appPackageNameTextView.getText().toString();
            if (isChecked) {
                hideAppsPreferenceUtility.addAppToHiddenAppsList(packageName);
            } else {
                hideAppsPreferenceUtility.removeAppToHiddenAppsList(packageName);
            }
        }
    });
}
 
Example 13
Project: Hexis   File: ModifyItemDialogFragment.java   View source code 6 votes vote down vote up
/**
 * Select a Quadrant, and update the ToggleButtons to reflect user choice.
 *
 * @param n Selected Quadrant
 */
protected void selectQuadrant(int n) {
  // Set selectedQuadrant to what the user chose
  selectedQuadrant = n;

  // Create an array of the ToggleButtons for easy updating
  ToggleButton[] arr = {quadOne, quadTwo, quadThree, quadFour};

  // Update the ToggleButtons based on if they were selected or not
  for (int i = 0; i < arr.length; i++) {
    if (i == selectedQuadrant) {
      arr[i].setChecked(true);
    } else {
      arr[i].setChecked(false);
    }
  }
}
 
Example 14
Project: HighSchoolScienceBowlPractice-Android   File: QuizModeSettingsPage.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quiz_mode_settings);

    biologyButton = (ToggleButton) findViewById(R.id.biologyButton);
    chemistryButton = (ToggleButton) findViewById(R.id.chemistryButton);
    earthAndSpaceButton = (ToggleButton) findViewById(R.id.earthAndSpaceButton);
    energyButton = (ToggleButton) findViewById(R.id.energyButton);
    mathButton = (ToggleButton) findViewById(R.id.mathButton);
    physicsButton = (ToggleButton) findViewById(R.id.physicsButton);
    randomButton = (ToggleButton) findViewById(R.id.randomButton);

    tossupTimeSpinner = (Spinner) findViewById(R.id.tossupTimeSelector);
    bonusTimeSpinner = (Spinner) findViewById(R.id.bonusTimeSelector);

    menuButton = (Button) findViewById(R.id.menuButton);
}
 
Example 15
Project: thesis-project   File: ScheduleViewActivity.java   View source code 6 votes vote down vote up
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.teacher_schedule_recyclerview);
    btnSearch = (ToggleButton) findViewById(R.id._btn_search_schedule);
    btnSearchOk = (Button) findViewById(R.id._btn_search_ok_schedule);
    btnBack = (Button) findViewById(R.id.btn_back_schedule);
    editTextSearch = (EditText) findViewById(R.id.etxt_search_schedule);
    frameLayoutSearch = (FrameLayout) findViewById(R.id.frame_search_schedule);
    txtMsgContent = (TextView) findViewById(R.id.message_label_sc1);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
 
Example 16
Project: thesis-project   File: ProjectInputAdapter.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 17
Project: thesis-project   File: ActivityInputAdapter.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 18
Project: thesis-project   File: AssignmentInputAdapterF.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 19
Project: thesis-project   File: QuizInputAdapter.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 20
Project: thesis-project   File: ExamInputAdapterF.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 21
Project: thesis-project   File: AssignmentInputAdapter.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 22
Project: thesis-project   File: QuizInputAdapterF.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 23
Project: thesis-project   File: ActivityInputAdapterF.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 24
Project: thesis-project   File: ProjectInputAdapterF.java   View source code 6 votes vote down vote up
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
Example 25
Project: thesis-project   File: MainActivity2.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btnSearch = (ToggleButton) findViewById(R.id.btn_search_class);
    btnSearchOk = (Button) findViewById(R.id._btn_search_ok_class);
    btnBack = (Button) findViewById(R.id.btn_back_student);

    editTextSearch = (EditText) findViewById(R.id.etxt_search_class);
    frameLayoutSearch = (FrameLayout) findViewById(R.id.frame_search_class);
    tabLayout = (TabLayout) findViewById(R.id.tabs);
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);
    tabLayout.setupWithViewPager(viewPager);
    setupTabIcons();

    frameLayoutSearch.setVisibility(View.GONE);
    btnSearch.setOnCheckedChangeListener(this);


}
 
Example 26
Project: buildAPKsSamples   File: WalkieTalkieActivity.java   View source code 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.walkietalkie);

    ToggleButton pushToTalkButton = (ToggleButton) findViewById(R.id.pushToTalk);
    pushToTalkButton.setOnTouchListener(this);

    // Set up the intent filter.  This will be used to fire an
    // IncomingCallReceiver when someone calls the SIP address used by this
    // application.
    IntentFilter filter = new IntentFilter();
    filter.addAction("android.SipDemo.INCOMING_CALL");
    callReceiver = new IncomingCallReceiver();
    this.registerReceiver(callReceiver, filter);

    // "Push to talk" can be a serious pain when the screen keeps turning off.
    // Let's prevent that.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    initializeManager();
}
 
Example 27
Project: CustomAndroidOneSheeld   File: ShieldFragmentParent.java   View source code 6 votes vote down vote up
@Override
    public void onResume() {
        super.onResume();
//        if (getApplication().getAppFirmata().isOpen() == false && !getApplication().getIsDemoMode()) return;
        if (getApplication().getRunningShields().get(getControllerTag()) == null) {
            if (!reInitController())
                return;
        }
        if (activity == null || activity.findViewById(R.id.shieldStatus) == null)
            return;
        MainActivity.currentShieldTag = getControllerTag();
        // restore the staus of shield interaction toggle button
        if (getApplication().getRunningShields().get(getControllerTag()) != null)
            ((ToggleButton) activity.findViewById(R.id.shieldStatus))
                    .setChecked(getApplication().getRunningShields().get(
                            getControllerTag()).isInteractive);
        // Google analytics tracking
        getApplication().getTracker().setScreenName(getControllerTag());
        getApplication().getTracker().send(
                new HitBuilders.ScreenViewBuilder().build());
        // Logging current view for crashlytics
        CrashlyticsUtils.setString("Current View", getTag());
        ((T) this).doOnResume();
    }
 
Example 28
Project: mao-android   File: Camera2Fragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    log.i("onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_camera, container, false);

    mCameraManager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);

    mHandlerThread = new HandlerThread("CameraFragment_HandlerThread");
    mHandlerThread.start();
    mHandler = new Handler(mHandlerThread.getLooper());

    ttv_camera = (AutoFitTextureView) rootView.findViewById(R.id.ttv_camera);
    ttv_camera.setSurfaceTextureListener(this);

    tbtn_camera = (ToggleButton) rootView.findViewById(R.id.tbtn_camera);
    tbtn_camera.setOnCheckedChangeListener(this);

    return rootView;
}
 
Example 29
Project: boohee_v5.6   File: AddCameraRecordActivity$$ViewInjector.java   View source code 6 votes vote down vote up
public void inject(Finder finder, final T target, Object source) {
    target.toggle_bingo = (ToggleButton) finder.castView((View) finder.findRequiredView
            (source, R.id.toggle_bingo, "field 'toggle_bingo'"), R.id.toggle_bingo, "field " +
            "'toggle_bingo'");
    target.et_calory = (EditText) finder.castView((View) finder.findRequiredView(source, R.id
            .et_calory, "field 'et_calory'"), R.id.et_calory, "field 'et_calory'");
    target.et_name = (EditText) finder.castView((View) finder.findRequiredView(source, R.id
            .et_name, "field 'et_name'"), R.id.et_name, "field 'et_name'");
    target.iv_photo = (PhotoView) finder.castView((View) finder.findRequiredView(source, R.id
            .iv_photo, "field 'iv_photo'"), R.id.iv_photo, "field 'iv_photo'");
    ((View) finder.findRequiredView(source, R.id.ll_invite_bingo, "method 'onClick'"))
            .setOnClickListener(new DebouncingOnClickListener() {
        public void doClick(View p0) {
            target.onClick(p0);
        }
    });
}
 
Example 30
Project: boohee_v5.6   File: CopyRecordActivity.java   View source code 6 votes vote down vote up
@OnClick({2131427582, 2131427584})
public void onClick(View v) {
    boolean z = false;
    switch (v.getId()) {
        case R.id.ll_check_all:
            ToggleButton toggleButton = this.tb_check_all;
            if (!this.tb_check_all.isChecked()) {
                z = true;
            }
            toggleButton.setChecked(z);
            checkAll(this.tb_check_all.isChecked());
            return;
        case R.id.rl_copy:
            if (this.copyCount == 0) {
                Helper.showToast((CharSequence) "请选择复制内容");
                return;
            }
            this.copyFlag = 0;
            copyEating();
            copyActivity();
            return;
        default:
            return;
    }
}
 
Example 31
Project: boohee_v5.6   File: BooheeNoticeActivity.java   View source code 6 votes vote down vote up
void initNotice(int type, ToggleButton toggleButton, TextView textView) {
    ArrayList<Alarm> alarms = this.alarm_dao.getAlarmsByNoticeType(type);
    if (alarms != null && alarms.size() != 0) {
        String timeString = "";
        for (int i = 0; i < alarms.size(); i++) {
            Alarm alarm = (Alarm) alarms.get(i);
            if (alarm.is_open()) {
                timeString = timeString + " " + ((Alarm) alarms.get(i)).formatTime();
                this.alarm_dao.update(alarm);
                RemindService.start(alarm, this.ctx);
            }
        }
        if (TextUtils.isEmpty(timeString)) {
            toggleButton.setChecked(false);
            textView.setText(R.string.ft);
            return;
        }
        toggleButton.setChecked(true);
        textView.setText("每天 " + timeString);
    }
}
 
Example 32
Project: boohee_v5.6   File: BooheeNoticeActivity.java   View source code 6 votes vote down vote up
private void findView() {
    this.txt_notice_good_morning_sub_title = (TextView) findViewById(R.id
            .txt_notice_good_morning_sub_title);
    this.txt_notice_diet_sub_title = (TextView) findViewById(R.id.txt_notice_diet_sub_title);
    this.txt_notice_sport_sub_title = (TextView) findViewById(R.id.txt_notice_sport_sub_title);
    this.txt_notice_water_sub_title = (TextView) findViewById(R.id.txt_notice_water_sub_title);
    this.txt_notice_box_count = (TextView) findViewById(R.id.txt_notice_box_count);
    this.txt_notice_good_morning_sub_title.setEllipsize(TruncateAt.END);
    this.txt_notice_diet_sub_title.setEllipsize(TruncateAt.END);
    this.txt_notice_sport_sub_title.setEllipsize(TruncateAt.END);
    this.txt_notice_water_sub_title.setEllipsize(TruncateAt.END);
    this.tb_notice_good_morning = (ToggleButton) findViewById(R.id.tb_notice_good_morning);
    this.tb_notice_diet = (ToggleButton) findViewById(R.id.tb_notice_diet);
    this.tb_notice_sport = (ToggleButton) findViewById(R.id.tb_notice_sport);
    this.tb_notice_water = (ToggleButton) findViewById(R.id.tb_notice_water);
}
 
Example 33
Project: boohee_v5.6   File: WaterNoticeActivity.java   View source code 6 votes vote down vote up
private void findView() {
    this.txt_notice_water_time_one = (TextView) findViewById(R.id.txt_notice_water_time_one);
    this.txt_notice_water_time_two = (TextView) findViewById(R.id.txt_notice_water_time_two);
    this.txt_notice_water_time_three = (TextView) findViewById(R.id
            .txt_notice_water_time_three);
    this.txt_notice_water_time_four = (TextView) findViewById(R.id.txt_notice_water_time_four);
    this.txt_notice_water_time_five = (TextView) findViewById(R.id.txt_notice_water_time_five);
    this.txt_notice_water_time_six = (TextView) findViewById(R.id.txt_notice_water_time_six);
    this.txt_notice_water_time_seven = (TextView) findViewById(R.id
            .txt_notice_water_time_seven);
    this.txt_notice_water_time_eight = (TextView) findViewById(R.id
            .txt_notice_water_time_eight);
    this.tb_notice_water_one = (ToggleButton) findViewById(R.id.tb_notice_water_one);
    this.tb_notice_water_two = (ToggleButton) findViewById(R.id.tb_notice_water_two);
    this.tb_notice_water_three = (ToggleButton) findViewById(R.id.tb_notice_water_three);
    this.tb_notice_water_four = (ToggleButton) findViewById(R.id.tb_notice_water_four);
    this.tb_notice_water_five = (ToggleButton) findViewById(R.id.tb_notice_water_five);
    this.tb_notice_water_six = (ToggleButton) findViewById(R.id.tb_notice_water_six);
    this.tb_notice_water_seven = (ToggleButton) findViewById(R.id.tb_notice_water_seven);
    this.tb_notice_water_eight = (ToggleButton) findViewById(R.id.tb_notice_water_eight);
}
 
Example 34
Project: MobiRNN-EMDL17   File: PhoneActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    controlToggle = (ToggleButton) findViewById(R.id.toggle_control);

    mStatusTextView = (TextView) findViewById(R.id.tv_status);
    mStatusTextView.setMovementMethod(new ScrollingMovementMethod());
    mResultProgress = (ProgressBar) findViewById(R.id.progress);
    mResultProgress.setMax(100);

    NumberPicker picker = (NumberPicker) findViewById(R.id.number_picker);
    picker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    picker.setOnValueChangedListener(this);
    picker.setDisplayedValues(mSampleSizes);
    picker.setMinValue(0);
    picker.setMaxValue(mSampleSizes.length - 1);
    picker.setWrapSelectorWheel(true);
    picker.setValue(0);
    mSampleSize = 1;
    Logger.i("Sample size initial value: %s", mSampleSize);

    checkPermissions();

}
 
Example 35
Project: BarcodeReaderView   File: ScannerActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scanner);

    ((ToggleButton) findViewById(R.id.tb_torch)).setOnCheckedChangeListener(this);
    ((ToggleButton) findViewById(R.id.tb_sound)).setOnCheckedChangeListener(this);
    ((ToggleButton) findViewById(R.id.tb_vibrate)).setOnCheckedChangeListener(this);


    //Step 1 : xml布局,监听器
    brvScanner = (BarcodeReaderView) findViewById(R.id.brv_scanner);
    brvScanner.setOnBarcodeReadListener(this);

    //Step 2 : 设置参数(可选)
    List<BarcodeFormat> barcodeFormats = new ArrayList<>();
    barcodeFormats.add(BarcodeFormat.QR_CODE);
    barcodeFormats.add(BarcodeFormat.CODE_128);
    brvScanner.setDecodeFormats(barcodeFormats);
}
 
Example 36
Project: oneM2M-Application-AndroidSample   File: MainActivity.java   View source code 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btnRetrieve = (Button) findViewById(R.id.btnRetrieve);
    Switch_MQTT = (Switch) findViewById(R.id.switch_mqtt);
    btnControl_Green = (ToggleButton) findViewById(R.id.btnControl_Green);
    btnControl_Blue = (ToggleButton) findViewById(R.id.btnControl_Blue);
    textViewData = (TextView) findViewById(R.id.textViewData);

    btnRetrieve.setOnClickListener(this);
    Switch_MQTT.setOnCheckedChangeListener(this);
    btnControl_Green.setOnClickListener(this);
    btnControl_Blue.setOnClickListener(this);
    // Create AE and Get AEID

    GetAEInfo();
}
 
Example 37
Project: smartswitch   File: SwitchesAdapter.java   View source code 5 votes vote down vote up
public SwitchViewHolder(View itemView) {
    super(itemView);

    mSwitchTextView = (AppCompatTextView) itemView.findViewById(R.id.switch_name_tv);
    mSwitchToggel = (ToggleButton) itemView.findViewById(R.id.switch_status_toggel);

    ViewGroup.LayoutParams params = mSwitchToggel.getLayoutParams();
    int square = Resources.getSystem().getDisplayMetrics().widthPixels / 2;
    params.width = square;
    params.height = square - 50;
    mSwitchToggel.setLayoutParams(params);

}
 
Example 38
Project: GitHub   File: BitmapAnimationDebugFragment.java   View source code 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

  // Get the animation container
  final ImageView imageView = (ImageView) view.findViewById(R.id.animation_container);

  mFrameInformationContainer = (LinearLayout) view.findViewById(R.id.frame_information);

  mAnimatedDrawable = new AnimatedDrawable2();
  mAnimatedDrawable.setDrawListener(new AnimatedDrawable2DebugDrawListener());

  view.findViewById(R.id.invalidate_button).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      imageView.invalidate();
    }
  });

  mAnimationControlsManager = new AnimationControlsManager(
      mAnimatedDrawable,
      (SeekBar) getView().findViewById(R.id.seekbar),
      (ToggleButton) getView().findViewById(R.id.playpause),
      getView().findViewById(R.id.reset));

  new BitmapAnimationCacheSelectorConfigurator(
      (Spinner) view.findViewById(R.id.spinner),
      mBitmapFrameCacheChangedListener,
      mFrameCacheListener);

  imageView.setImageDrawable(mAnimatedDrawable);
}
 
Example 39
Project: Ships   File: ShowMapFragment.java   View source code 5 votes vote down vote up
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final View rootView = inflater.inflate(R.layout.fragment_map, container, false);

    logTextView = (TextView) rootView.findViewById(R.id.textView1);

    final File filesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    fileMap = new File(filesDirectory, FILE_MAP);

    Utils.loadAd(rootView);
    setHasOptionsMenu(true);
    setupWebView(rootView);
    setupNmeaClientService();

    startStopButton = (ToggleButton) rootView.findViewById(R.id.startStopAisButton);
    startStopButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startReceivingAisFromAntenna();
            } else {
                stopReceivingAisFromAntenna();
            }
        }
    });

    // TODO: Not possible to stop. Will start automatically when valid PPM exists and hide (stop) button for now
    startStopButton.setVisibility(View.GONE);
    return rootView;
}
 
Example 40
Project: quickblox-android   File: BaseConversationFragment.java   View source code 5 votes vote down vote up
protected void initViews(View view) {
    micToggleVideoCall = (ToggleButton) view.findViewById(R.id.toggle_mic);
    handUpVideoCall = (ImageButton) view.findViewById(R.id.button_hangup_call);
    outgoingOpponentsRelativeLayout = view.findViewById(R.id.layout_background_outgoing_screen);
    allOpponentsTextView = (TextView) view.findViewById(R.id.text_outgoing_opponents_names);
    ringingTextView = (TextView) view.findViewById(R.id.text_ringing);

    if (isIncomingCall) {
        hideOutgoingScreen();
    }
}