Java Code Examples for android.widget.ImageButton#setSelected()

The following examples show how to use android.widget.ImageButton#setSelected() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PagerSlidingTabStripEmoji.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setFocusable(true);
        tab.setImageResource(resId);

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                pager.setCurrentItem(position);
            }
        });

        tabsContainer.addView(tab);
        tab.setSelected(position == currentPosition);
    }
 
Example 2
Source File: CreateRoomActivity.java    From yiim_v2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void initViews() {
	// TODO Auto-generated method stub
	mIcon1 = (ImageButton) findViewById(R.id.create_room_icon1);
	mIcon1.setSelected(false);
	mIcon2 = (ImageButton) findViewById(R.id.create_room_icon2);
	mIcon2.setSelected(true);
	mIcon3 = (ImageButton) findViewById(R.id.create_room_icon3);
	mIcon3.setSelected(true);
	mIcon4 = (ImageButton) findViewById(R.id.create_room_icon4);
	mIcon4.setSelected(true);

	mLastSelectedIcon = mIcon1;

	mRoomNameEditText = (EditText) findViewById(R.id.create_room_room_name);
	mRoomSignEditText = (EditText) findViewById(R.id.create_room_room_sign);
}
 
Example 3
Source File: InfoActivity.java    From Bluefruit_LE_Connect_Android with MIT License 6 votes vote down vote up
public void onClickNotifyCharacteristic(View view) {
    ElementPath elementPath = (ElementPath) view.getTag();

    if (elementPath != null) {
        // Check if is a characteristic
        if (elementPath.characteristicUUID != null && elementPath.descriptorUUID == null) {
            BluetoothGattService service = mBleManager.getGattService(elementPath.serviceUUID, elementPath.serviceInstance);
            if (mBleManager.isCharacteristicNotifiable(service, elementPath.characteristicUUID)) {
                Log.d(TAG, "Notify char");
                ImageButton imageButton = (ImageButton) view;
                final boolean selected = !imageButton.isSelected();
                imageButton.setSelected(selected);
                mBleManager.enableNotification(service, elementPath.characteristicUUID, selected);

                // Button color effect when pressed
                imageButton.setImageResource(selected ? R.drawable.ic_sync_white_24dp : R.drawable.ic_sync_black_24dp);
            }
        }
    }
}
 
Example 4
Source File: ReadingActivity.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setBookmarkState(boolean Checked) {
    if (is_nav_view_inflated) {
        ImageButton bookmarkImageButton = mControlsView.findViewById(R.id.action_bookmark_this_page);
        if (bookmarkImageButton.isSelected() != Checked)
            bookmarkImageButton.setSelected(Checked);
    }
}
 
Example 5
Source File: DialogBase.java    From microMathematics with GNU General Public License v3.0 5 votes vote down vote up
protected void setButtonSelected(ImageButton b, boolean isSelected)
{
    b.setSelected(isSelected);
    if (b.isSelected())
    {
        b.setBackgroundResource(R.drawable.formula_term_border);
        CompatUtils.setDrawableColorAttr(getContext(), b.getBackground(), R.attr.colorAccent);
    }
    else
    {
        b.setBackgroundResource(android.R.color.transparent);
    }
    ViewUtils.setImageButtonColorAttr(getContext(), b,
            b.isSelected() ? R.attr.colorAccent : R.attr.colorDialogContent);
}
 
Example 6
Source File: PagerSlidingTabStrip.java    From KitKatEmoji with MIT License 5 votes vote down vote up
private void addIconTab(final int position, int resId) {

        ImageButton tab = new ImageButton(getContext());
        tab.setImageResource(resId);
        tab.setFocusable(true);
        addTab(position, tab);
        tab.setSelected(position == currentPosition);
    }
 
Example 7
Source File: AudioMixActivity.java    From sealrtc-android with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_audio_mix);

    AudioMixActivity.alive = true;

    img_btn_play_pause = (ImageButton) findViewById(R.id.img_btn_play_pause);
    img_btn_stop = (ImageButton) findViewById(R.id.img_btn_stop);
    btn_select_music = (Button) findViewById(R.id.btn_select_music);
    btn_change_mode = (Button) findViewById(R.id.btn_change_mode);
    sb_mix_local_vol = (SeekBar) findViewById(R.id.sb_mix_local_vol);
    sb_mix_remote_vol = (SeekBar) findViewById(R.id.sb_mix_remote_vol);
    sb_mic_vol = (SeekBar) findViewById(R.id.sb_mic_vol);
    tv_mix_local_vol = (TextView) findViewById(R.id.tv_mix_local_vol);
    tv_mix_remote_vol = (TextView) findViewById(R.id.tv_mix_remote_vol);
    tv_mic_vol = (TextView) findViewById(R.id.tv_mic_vol);

    img_btn_stop.setEnabled(mixing);
    img_btn_play_pause.setSelected(mixing);

    sb_mic_vol.setOnSeekBarChangeListener(this);
    sb_mix_remote_vol.setOnSeekBarChangeListener(this);
    sb_mix_local_vol.setOnSeekBarChangeListener(this);

    tv_mic_vol.setText("0");
    int mixRemoteVol = RCRTCAudioMixer.getInstance().getMixingVolume();
    tv_mix_remote_vol.setText(String.valueOf(mixRemoteVol));
    sb_mix_remote_vol.setProgress(mixRemoteVol);

    int mixLocalVol = RCRTCAudioMixer.getInstance().getPlaybackVolume();
    tv_mix_local_vol.setText(String.valueOf(mixLocalVol));
    sb_mix_local_vol.setProgress(mixLocalVol);

    int recordingVol = RongRTCCapture.getInstance().getRecordingVolume();
    tv_mic_vol.setText(String.valueOf(recordingVol));
    sb_mic_vol.setProgress(recordingVol);

    mixModes[0] = getResources().getString(R.string.mix_mode_play_mix);
    mixModes[1] = getResources().getString(R.string.mix_mode_mix_only);
    mixModes[2] = getResources().getString(R.string.mix_mode_play_only);
    mixModes[3] = getResources().getString(R.string.mix_mode_replace);

    btn_select_music.setText(getFileName(audioPath));
    btn_change_mode.setText(mixModes[mixMode]);
}