Java Code Examples for android.view.View.setActivated()

The following are Jave code examples for showing how to use setActivated() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Android-DFU-App   File: UARTButtonAdapter.java   Source Code and License Vote up 8 votes
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
	View view = convertView;
	if (view == null) {
		final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
		view = inflater.inflate(R.layout.feature_uart_button, parent, false);
	}
	view.setEnabled(isEnabled(position));
	view.setActivated(mEditMode);

	// Update image
	final Command command = (Command) getItem(position);
	final ImageView image = (ImageView) view;
	final boolean active = command != null && command.isActive();
	if (active) {
		final int icon = command.getIconIndex();
		image.setImageResource(R.drawable.uart_button);
		image.setImageLevel(icon);
	} else
		image.setImageDrawable(null);

	return view;
}
 
Example 2
Project: GitHub   File: FreeFlowContainer.java   Source Code and License Vote up 6 votes
/**
 * Perform a quick, in-place update of the checked or activated state on all
 * visible item views. This should only be called when a valid choice mode
 * is active.
 */
private void updateOnScreenCheckedViews() {
	Iterator<?> it = frames.entrySet().iterator();
	View child = null;
	while (it.hasNext()) {
		Map.Entry<?, FreeFlowItem> pairs = (Map.Entry<?, FreeFlowItem>) it
				.next();
		child = pairs.getValue().view;
		boolean isChecked = isChecked(pairs.getValue().itemSection,
				pairs.getValue().itemIndex);
		if (child instanceof Checkable) {
			((Checkable) child).setChecked(isChecked);
		} else {
			child.setActivated(isChecked);
		}
	}
}
 
Example 3
Project: letv   File: AbsHListView.java   Source Code and License Vote up 6 votes
private void updateOnScreenCheckedViews() {
    boolean useActivated;
    int firstPos = this.mFirstPosition;
    int count = getChildCount();
    if (VERSION.SDK_INT >= 11) {
        useActivated = true;
    } else {
        useActivated = false;
    }
    for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        int position = firstPos + i;
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        } else if (useActivated) {
            child.setActivated(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        }
    }
}
 
Example 4
Project: BittrexApi   File: SelectableAdapter.java   Source Code and License Vote up 6 votes
@CallSuper
@Override
public void onFocusChange(View view, boolean isFocused) {
    view.setActivated(isFocused);

    if (isFocused) {
        _selectedItemPosition = getAdapterPosition();
        raiseOnItemSelected(_selectedItemPosition);
    }
}
 
Example 5
Project: exciting-app   File: AbsHListView.java   Source Code and License Vote up 6 votes
/**
 * Perform a quick, in-place update of the checked or activated state on all
 * visible item views. This should only be called when a valid choice mode
 * is active.
 */
private void updateOnScreenCheckedViews() {
	final int firstPos = mFirstPosition;
	final int count = getChildCount();
	final boolean useActivated = android.os.Build.VERSION.SDK_INT >= 11;
	for (int i = 0; i < count; i++) {
		final View child = getChildAt(i);
		final int position = firstPos + i;

		if (child instanceof Checkable) {
			((Checkable) child).setChecked(mCheckStates
					.get(position, false));
		} else if (useActivated) {
			child.setActivated(mCheckStates.get(position, false));
		}
	}
}
 
Example 6
Project: JinsMemeBRIDGE-Android   File: BridgeUIView.java   Source Code and License Vote up 6 votes
@Override
public void onDrawOver(Canvas c, RecyclerView parent, State state) {
  super.onDrawOver(c, parent, state);
  View view = ((BridgeUIView) (parent)).getCurrentCenteredItem();
  if (prev != view) {
    if (prev != null) {
      prev.setActivated(false);
    }
    if (view != null) {
      view.setActivated(true);
    }
    prev = view;
  }
}
 
Example 7
Project: School1-Android   File: TimetableConfigAdapter.java   Source Code and License Vote up 5 votes
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
    final Lesson lesson = (Lesson) getItem(position);
    if (convertView == null)
        convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.timetable_grid_text_view, parent, false);

    TextView textView = (TextView) convertView;
    textView.setText(lesson.title);
    final int day = (position % 5);
    int hourOfDay = (position - day) / 5;

    // Just a boolean to give selector a value
    convertView.setActivated(hourOfDay == 6);
    convertView.setBackgroundResource(R.drawable.timetable_cell_background);

    /*if (groupId > 0)
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new LessonConfigPopup(position, groupId, lesson, changes, TimetableConfigAdapter.this).show();
            }
        });
    else {
        final String title = LessonConfigPopup.getPopupTitle(parent.getContext(), position);
        if ((lesson.flags & Codes.public_) != 0)
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    ArrayList<Group> courses = dataInterface.getCourses();
                    for (Group course : courses) {
                        if (course.id == lesson.groupId) {
                            new TextPopup(title,
                                    lesson.name + parent.getContext().getString(R.string.info_lesson_course) + course.name).show();
                            return;
                        }
                    }
                }
            });
        else
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    new LessonConfigPopup(position, groupId, lesson, changes, TimetableConfigAdapter.this).show();
                }
            });
    }*/
    return convertView;
}
 
Example 8
Project: CSipSimple   File: Utility11.java   Source Code and License Vote up 5 votes
@Override
public void viewSetActivated(View view, boolean activated) {
    view.setActivated(activated);
}
 
Example 9
Project: CSipSimple   File: ActivityChooserView.java   Source Code and License Vote up 5 votes
public static void invoke(View view, boolean activated) {
    view.setActivated(activated);
}
 
Example 10
Project: recyclerview-android   File: ChoiceModeHelper.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setViewHolderChecked(@NonNull final RecyclerView.ViewHolder viewHolder,
                                  final boolean isChecked) {
    final View itemView = viewHolder.itemView;
    if (isCheckableView(viewHolder)) {
        ((Checkable) itemView).setChecked(isChecked);
    } else if (shouldUseActivated(viewHolder)) {
        itemView.setActivated(isChecked);
    }
}
 
Example 11
Project: letv   File: HListView.java   Source Code and License Vote up 5 votes
@TargetApi(11)
private void setupChild(View child, int position, int x, boolean flowDown, int childrenTop, boolean selected, boolean recycled) {
    boolean isSelected = selected && shouldShowSelector();
    boolean updateChildSelected = isSelected != child.isSelected();
    int mode = this.mTouchMode;
    boolean isPressed = mode > 0 && mode < 3 && this.mMotionPosition == position;
    boolean updateChildPressed = isPressed != child.isPressed();
    boolean needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested();
    LayoutParams p = (LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = (LayoutParams) generateDefaultLayoutParams();
    }
    p.viewType = this.mAdapter.getItemViewType(position);
    if ((!recycled || p.forceAdd) && !(p.recycledHeaderFooter && p.viewType == -2)) {
        p.forceAdd = false;
        if (p.viewType == -2) {
            p.recycledHeaderFooter = true;
        }
        addViewInLayout(child, flowDown ? -1 : 0, p, true);
    } else {
        attachViewToParent(child, flowDown ? -1 : 0, p);
    }
    if (updateChildSelected) {
        child.setSelected(isSelected);
    }
    if (updateChildPressed) {
        child.setPressed(isPressed);
    }
    if (!(this.mChoiceMode == 0 || this.mCheckStates == null)) {
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        } else if (VERSION.SDK_INT >= 11) {
            child.setActivated(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        }
    }
    if (needToMeasure) {
        int childWidthSpec;
        int childHeightSpec = ViewGroup.getChildMeasureSpec(this.mHeightMeasureSpec, this.mListPadding.top + this.mListPadding.bottom, p.height);
        int lpWidth = p.width;
        if (lpWidth > 0) {
            childWidthSpec = MeasureSpec.makeMeasureSpec(lpWidth, 1073741824);
        } else {
            childWidthSpec = MeasureSpec.makeMeasureSpec(0, 0);
        }
        child.measure(childWidthSpec, childHeightSpec);
    } else {
        cleanupLayoutState(child);
    }
    int w = child.getMeasuredWidth();
    int h = child.getMeasuredHeight();
    int childLeft = flowDown ? x : x - w;
    if (needToMeasure) {
        child.layout(childLeft, childrenTop, childLeft + w, childrenTop + h);
    } else {
        child.offsetLeftAndRight(childLeft - child.getLeft());
        child.offsetTopAndBottom(childrenTop - child.getTop());
    }
    if (this.mCachingStarted && !child.isDrawingCacheEnabled()) {
        child.setDrawingCacheEnabled(true);
    }
    if (VERSION.SDK_INT >= 11 && recycled && ((LayoutParams) child.getLayoutParams()).scrappedFromPosition != position) {
        child.jumpDrawablesToCurrentState();
    }
}
 
Example 12
Project: letv   File: ViewCompatHC.java   Source Code and License Vote up 5 votes
public static void setActivated(View view, boolean activated) {
    view.setActivated(activated);
}
 
Example 13
Project: boohee_v5.6   File: ViewCompatHC.java   Source Code and License Vote up 5 votes
public static void setActivated(View view, boolean activated) {
    view.setActivated(activated);
}