Search in sources :

Example 16 with Checkable

use of android.widget.Checkable in project platform_frameworks_base by android.

the class CheckBoxPreference method onBindView.

@Override
protected void onBindView(View view) {
    super.onBindView(view);
    View checkboxView = view.findViewById(com.android.internal.R.id.checkbox);
    if (checkboxView != null && checkboxView instanceof Checkable) {
        ((Checkable) checkboxView).setChecked(mChecked);
    }
    syncSummaryView(view);
}
Also used : Checkable(android.widget.Checkable) View(android.view.View)

Example 17 with Checkable

use of android.widget.Checkable in project platform_frameworks_base by android.

the class SwitchPreference method onBindView.

@Override
protected void onBindView(View view) {
    super.onBindView(view);
    View checkableView = view.findViewById(com.android.internal.R.id.switch_widget);
    if (checkableView != null && checkableView instanceof Checkable) {
        if (checkableView instanceof Switch) {
            final Switch switchView = (Switch) checkableView;
            switchView.setOnCheckedChangeListener(null);
        }
        ((Checkable) checkableView).setChecked(mChecked);
        if (checkableView instanceof Switch) {
            final Switch switchView = (Switch) checkableView;
            switchView.setTextOn(mSwitchOn);
            switchView.setTextOff(mSwitchOff);
            switchView.setOnCheckedChangeListener(mListener);
        }
    }
    syncSummaryView(view);
}
Also used : Switch(android.widget.Switch) Checkable(android.widget.Checkable) View(android.view.View)

Example 18 with Checkable

use of android.widget.Checkable in project platform_frameworks_base by android.

the class View method onProvideStructure.

/**
     * Called when assist structure is being retrieved from a view as part of
     * {@link android.app.Activity#onProvideAssistData Activity.onProvideAssistData}.
     * @param structure Fill in with structured view data.  The default implementation
     * fills in all data that can be inferred from the view itself.
     */
public void onProvideStructure(ViewStructure structure) {
    final int id = mID;
    if (id > 0 && (id & 0xff000000) != 0 && (id & 0x00ff0000) != 0 && (id & 0x0000ffff) != 0) {
        String pkg, type, entry;
        try {
            final Resources res = getResources();
            entry = res.getResourceEntryName(id);
            type = res.getResourceTypeName(id);
            pkg = res.getResourcePackageName(id);
        } catch (Resources.NotFoundException e) {
            entry = type = pkg = null;
        }
        structure.setId(id, pkg, type, entry);
    } else {
        structure.setId(id, null, null, null);
    }
    structure.setDimens(mLeft, mTop, mScrollX, mScrollY, mRight - mLeft, mBottom - mTop);
    if (!hasIdentityMatrix()) {
        structure.setTransformation(getMatrix());
    }
    structure.setElevation(getZ());
    structure.setVisibility(getVisibility());
    structure.setEnabled(isEnabled());
    if (isClickable()) {
        structure.setClickable(true);
    }
    if (isFocusable()) {
        structure.setFocusable(true);
    }
    if (isFocused()) {
        structure.setFocused(true);
    }
    if (isAccessibilityFocused()) {
        structure.setAccessibilityFocused(true);
    }
    if (isSelected()) {
        structure.setSelected(true);
    }
    if (isActivated()) {
        structure.setActivated(true);
    }
    if (isLongClickable()) {
        structure.setLongClickable(true);
    }
    if (this instanceof Checkable) {
        structure.setCheckable(true);
        if (((Checkable) this).isChecked()) {
            structure.setChecked(true);
        }
    }
    if (isContextClickable()) {
        structure.setContextClickable(true);
    }
    structure.setClassName(getAccessibilityClassName().toString());
    structure.setContentDescription(getContentDescription());
}
Also used : Resources(android.content.res.Resources) Checkable(android.widget.Checkable) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 19 with Checkable

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

the class SwitchPreference method onBindView.

@Override
protected void onBindView(View view) {
    super.onBindView(view);
    View checkableView = view.findViewById(com.android.internal.R.id.switch_widget);
    if (checkableView != null && checkableView instanceof Checkable) {
        if (checkableView instanceof Switch) {
            final Switch switchView = (Switch) checkableView;
            switchView.setOnCheckedChangeListener(null);
        }
        ((Checkable) checkableView).setChecked(mChecked);
        if (checkableView instanceof Switch) {
            final Switch switchView = (Switch) checkableView;
            switchView.setTextOn(mSwitchOn);
            switchView.setTextOff(mSwitchOff);
            switchView.setOnCheckedChangeListener(mListener);
        }
    }
    syncSummaryView(view);
}
Also used : Switch(android.widget.Switch) Checkable(android.widget.Checkable) View(android.view.View)

Example 20 with Checkable

use of android.widget.Checkable in project android_frameworks_base by AOSPA.

the class CheckBoxPreference method onBindView.

@Override
protected void onBindView(View view) {
    super.onBindView(view);
    View checkboxView = view.findViewById(com.android.internal.R.id.checkbox);
    if (checkboxView != null && checkboxView instanceof Checkable) {
        ((Checkable) checkboxView).setChecked(mChecked);
    }
    syncSummaryView(view);
}
Also used : Checkable(android.widget.Checkable) View(android.view.View)

Aggregations

Checkable (android.widget.Checkable)80 View (android.view.View)47 TextView (android.widget.TextView)18 ViewGroup (android.view.ViewGroup)9 OnClickListener (android.view.View.OnClickListener)7 ImageView (android.widget.ImageView)7 Switch (android.widget.Switch)7 ResourceReference (com.android.ide.common.rendering.api.ResourceReference)6 Resources (android.content.res.Resources)5 Paint (android.graphics.Paint)5 Point (android.graphics.Point)4 SuppressLint (android.annotation.SuppressLint)3 AdapterView (android.widget.AdapterView)3 CheckBox (android.widget.CheckBox)3 ListView (android.widget.ListView)3 Spinner (android.widget.Spinner)3 Map (java.util.Map)3 Switch (org.holoeverywhere.widget.Switch)3 SimpleArrayMap (android.support.v4.util.SimpleArrayMap)2 AlertDialog (android.support.v7.app.AlertDialog)2