Search in sources :

Example 31 with ToggleButton

use of android.widget.ToggleButton in project mobile-android by photo.

the class FeatherActivity method hideInfoScreen.

/**
	 * Hide info screen.
	 */
private void hideInfoScreen() {
    createInfoScreenAnimations(false);
    mViewFlipper.setDisplayedChild(0);
    View convertView = mWorkspace.getChildAt(mWorkspace.getChildCount() - 1);
    if (null != convertView) {
        View button = convertView.findViewById(R.id.tool_image);
        if (button != null && button instanceof ToggleButton) {
            ((ToggleButton) button).setChecked(false);
        }
    }
}
Also used : ToggleButton(android.widget.ToggleButton) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ToolbarView(com.aviary.android.feather.widget.ToolbarView)

Example 32 with ToggleButton

use of android.widget.ToggleButton in project android_frameworks_base by ResurrectionRemix.

the class ElementLayoutActivity method createToggleButton.

private void createToggleButton() {
    ToggleButton button = new ToggleButton(this);
    button.setChecked(mRandom.nextBoolean());
    mLayout.addView(button);
}
Also used : ToggleButton(android.widget.ToggleButton)

Example 33 with ToggleButton

use of android.widget.ToggleButton in project JustAndroid by chinaltz.

the class AbExpandTabView method setData.

/**
     * 设置tab item默认标题和内容View
     */
public void setData(List<String> tabTexts, List<View> contentViews) {
    for (int i = 0; i < contentViews.size(); i++) {
        View view = contentViews.get(i);
        int maxHeight = (int) (displayHeight * 0.6);
        RelativeLayout parentLayout = new RelativeLayout(context);
        parentLayout.setBackgroundColor(Color.parseColor("#b0000000"));
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, maxHeight);
        layoutParams.leftMargin = 0;
        layoutParams.rightMargin = 0;
        parentLayout.addView(view, layoutParams);
        tabContentViews.add(parentLayout);
        final ToggleButton tabButton = new ToggleButton(context);
        tabButton.setGravity(Gravity.CENTER);
        tabButton.setTextOn(null);
        tabButton.setTextOff(null);
        tabButton.setBackgroundResource(R.drawable.bg_tab_button);
        tabButton.setTextColor(context.getResources().getColor(R.color.gray_content));
        tabButton.setSingleLine(true);
        //默认标题
        tabButton.setText(tabTexts.get(i));
        AbViewUtil.setTextSize(tabButton, 28);
        addView(tabButton, new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        View line = new View(context);
        line.setBackgroundResource(R.color.gray_line);
        LayoutParams layoutParamsLine = new LayoutParams(1, LayoutParams.MATCH_PARENT);
        layoutParamsLine.setMargins(0, 5, 0, 5);
        if (i < contentViews.size() - 1) {
            addView(line, layoutParamsLine);
        }
        //添加到列表
        tabButtons.add(tabButton);
        //用于判断位置
        tabButton.setTag(i);
        tabButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                if (popupWindow == null || !popupWindow.isShowing()) {
                    currentTabButton = tabButton;
                    currentPosition = (Integer) currentTabButton.getTag();
                    showPopup(currentPosition);
                } else {
                    dismissPopup();
                }
            }
        });
        tabButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (onCheckedChangedListener != null) {
                    onCheckedChangedListener.onCheckedChanged(currentPosition, isChecked);
                }
            }
        });
    }
}
Also used : ToggleButton(android.widget.ToggleButton) RelativeLayout(android.widget.RelativeLayout) View(android.view.View) CompoundButton(android.widget.CompoundButton)

Example 34 with ToggleButton

use of android.widget.ToggleButton in project android_frameworks_base by crdroidandroid.

the class ElementLayoutActivity method createToggleButton.

private void createToggleButton() {
    ToggleButton button = new ToggleButton(this);
    button.setChecked(mRandom.nextBoolean());
    mLayout.addView(button);
}
Also used : ToggleButton(android.widget.ToggleButton)

Example 35 with ToggleButton

use of android.widget.ToggleButton in project little-bear-dictionary by daimajia.

the class OfflineListCursorAdapter method bindView.

@Override
public void bindView(View convertView, Context context, Cursor cursor) {
    TextView dictionary_name_textView = (TextView) convertView.findViewById(R.id.item_dictionary_name);
    TextView dictionary_size = (TextView) convertView.findViewById(R.id.item_dictionary_size);
    ToggleButton toggleButton = (ToggleButton) convertView.findViewById(R.id.item_hide);
    Boolean isShow = cursor.getInt(cursor.getColumnIndex("dictionary_show")) == 1 ? true : false;
    toggleButton.setChecked(isShow);
    toggleButton.setContentDescription(cursor.getString(cursor.getColumnIndex("_id")));
    toggleButton.setOnCheckedChangeListener(this);
    dictionary_name_textView.setText(cursor.getString(cursor.getColumnIndex("dictionary_name")));
    dictionary_size.setText(cursor.getString(cursor.getColumnIndex("dictionary_size")));
}
Also used : ToggleButton(android.widget.ToggleButton) TextView(android.widget.TextView)

Aggregations

ToggleButton (android.widget.ToggleButton)35 View (android.view.View)16 TextView (android.widget.TextView)16 ImageView (android.widget.ImageView)12 SeekBar (android.widget.SeekBar)10 Button (android.widget.Button)8 CompoundButton (android.widget.CompoundButton)7 ViewGroup (android.view.ViewGroup)4 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)4 OnClickListener (android.view.View.OnClickListener)3 AdapterView (android.widget.AdapterView)3 LinearLayout (android.widget.LinearLayout)3 SuppressLint (android.annotation.SuppressLint)2 RecyclerView (android.support.v7.widget.RecyclerView)2 KeyEvent (android.view.KeyEvent)2 EditText (android.widget.EditText)2 RadioButton (android.widget.RadioButton)2 RelativeLayout (android.widget.RelativeLayout)2 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)2 Spinner (android.widget.Spinner)2