当前位置: 首页>>代码示例>>Java>>正文


Java View.setActivated方法代码示例

本文整理汇总了Java中android.view.View.setActivated方法的典型用法代码示例。如果您正苦于以下问题:Java View.setActivated方法的具体用法?Java View.setActivated怎么用?Java View.setActivated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.setActivated方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getView

import android.view.View; //导入方法依赖的package包/类
@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;
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:24,代码来源:UARTButtonAdapter.java

示例2: updateOnScreenCheckedViews

import android.view.View; //导入方法依赖的package包/类
/**
 * 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);
		}
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:FreeFlowContainer.java

示例3: updateOnScreenCheckedViews

import android.view.View; //导入方法依赖的package包/类
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());
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:20,代码来源:AbsHListView.java

示例4: onFocusChange

import android.view.View; //导入方法依赖的package包/类
@CallSuper
@Override
public void onFocusChange(View view, boolean isFocused) {
    view.setActivated(isFocused);

    if (isFocused) {
        _selectedItemPosition = getAdapterPosition();
        raiseOnItemSelected(_selectedItemPosition);
    }
}
 
开发者ID:CoryCharlton,项目名称:BittrexApi,代码行数:11,代码来源:SelectableAdapter.java

示例5: updateOnScreenCheckedViews

import android.view.View; //导入方法依赖的package包/类
/**
 * 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));
		}
	}
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:22,代码来源:AbsHListView.java

示例6: onDrawOver

import android.view.View; //导入方法依赖的package包/类
@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;
  }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:15,代码来源:BridgeUIView.java

示例7: getView

import android.view.View; //导入方法依赖的package包/类
@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;
}
 
开发者ID:whirlwind-studios,项目名称:School1-Android,代码行数:49,代码来源:TimetableConfigAdapter.java

示例8: viewSetActivated

import android.view.View; //导入方法依赖的package包/类
@Override
public void viewSetActivated(View view, boolean activated) {
    view.setActivated(activated);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:5,代码来源:Utility11.java

示例9: invoke

import android.view.View; //导入方法依赖的package包/类
public static void invoke(View view, boolean activated) {
    view.setActivated(activated);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:4,代码来源:ActivityChooserView.java

示例10: setViewHolderChecked

import android.view.View; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:11,代码来源:ChoiceModeHelper.java

示例11: setupChild

import android.view.View; //导入方法依赖的package包/类
@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();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:65,代码来源:HListView.java

示例12: setActivated

import android.view.View; //导入方法依赖的package包/类
public static void setActivated(View view, boolean activated) {
    view.setActivated(activated);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:ViewCompatHC.java


注:本文中的android.view.View.setActivated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。