android.view.View#setActivated ( )源码实例Demo

下面列出了android.view.View#setActivated ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UltimateAndroid   文件: FreeFlowContainer.java
/**
 * 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);
		}
	}
}
 
@Override
public View onCreateFloatView(int position) {
  View view =
      dragSortListView.getChildAt(
          position
              + dragSortListView.getHeaderViewsCount()
              - dragSortListView.getFirstVisiblePosition());
  if (view == null) {
    return null;
  }
  View userRowLayout = view.findViewById(R.id.user_row_layout);
  if (userRowLayout != null) {
    userRowLayout.setPressed(false);
    userRowLayout.setSelected(false);
    userRowLayout.setActivated(false);
  }

  // Take a picture of the selected item and add it to the holder with shadow we have prepared.
  view.setDrawingCacheEnabled(true);
  floatBitmap = Bitmap.createBitmap(view.getDrawingCache());
  view.setDrawingCacheEnabled(false);

  if (floatView == null) {
    LayoutInflater inflater = activity.getLayoutInflater();
    floatView = inflater.inflate(R.layout.user_row_dragged, null);
  }
  ImageView imageView = floatView.findViewById(R.id.user_row_dragged_image);
  imageView.setImageBitmap(floatBitmap);
  imageView.setLayoutParams(new RelativeLayout.LayoutParams(view.getWidth(), view.getHeight()));

  return floatView;
}
 
源代码3 项目: material-components-android   文件: TabLayout.java
/**
 * Called when a selected tab is added. Unselects all other tabs in the TabLayout.
 *
 * @param position Position of the selected tab.
 */
private void setSelectedTabView(int position) {
  final int tabCount = slidingTabIndicator.getChildCount();
  if (position < tabCount) {
    for (int i = 0; i < tabCount; i++) {
      final View child = slidingTabIndicator.getChildAt(i);
      child.setSelected(i == position);
      child.setActivated(i == position);
    }
  }
}
 
源代码4 项目: ticdesign   文件: TrackSelectionAdapterWrapper.java
private void updateCheckState(View itemView, int position) {
    if (itemView instanceof Checkable) {
        ((Checkable) itemView).setChecked(mCheckStates.get(position));
    } else {
        itemView.setActivated(mCheckStates.get(position));
    }
}
 
/**
 * Adapts the activated state of all children of a specific view group.
 *
 * @param viewGroup
 *         The view group, whose children's activated states should be adapted, as an instance
 *         of the class {@link ViewGroup}. The view group may not be null
 * @param activated
 *         True, if the children should be activated, false otherwise
 */
private void setActivatedOnViewGroup(@NonNull final ViewGroup viewGroup,
                                     final boolean activated) {
    viewGroup.setActivated(activated);

    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        View child = viewGroup.getChildAt(i);

        if (child instanceof ViewGroup) {
            setActivatedOnViewGroup((ViewGroup) child, activated);
        } else {
            child.setActivated(activated);
        }
    }
}
 
源代码6 项目: droidddle   文件: PagerSlidingTabStrip.java
void activiteCurentTab(View v) {
    v.setActivated(true);
    int count = tabsContainer.getChildCount();
    for (int i = 0; i < count; i++) {
        View view = tabsContainer.getChildAt(i);
        if (view != v) {
            view.setActivated(false);
        }
    }
}
 
源代码7 项目: something.apk   文件: ForumItem.java
@Override
public void updateViewFromHolder(View view, ForumHolder holder) {
    holder.forum = this;
    holder.title.setText(title);
    if(showStar){
        TypedValue star = new TypedValue();
        if(view.getContext().getTheme().resolveAttribute(starred ? R.attr.inlineStarIcon : R.attr.inlineEmptyStarIcon, star, false)){
            holder.star.setVisibility(View.VISIBLE);
            holder.star.setImageResource(star.data);
        }
    }else{
        holder.star.setVisibility(View.GONE);
    }
    view.setActivated(selected);
}
 
源代码8 项目: Nimingban   文件: DrawerListView.java
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.item_drawer_list, parent, false);
    }

    // Handle activated
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        if (position == mActivatedPosition) {
            convertView.setActivated(true);
        } else {
            convertView.setActivated(false);
        }
    }

    TextView tv = (TextView) convertView;
    CharSequence t = mTitleArray[position];
    tv.setText(t);
    Drawable d = mDrawableArray[position];
    if (d != null) {
        d.setBounds(0, 0, mDrawableSize, mDrawableSize);
        tv.setCompoundDrawables(d, null, null, null);
    } else {
        tv.setCompoundDrawables(null, null, null, null);
    }

    return convertView;
}
 
源代码9 项目: TurboLauncher   文件: Workspace.java
private void updateDefaultScreenButton() {
    View overviewPanel = mLauncher.getOverviewPanel();
    if (overviewPanel != null) {
        View defaultPageButton = overviewPanel.findViewById(R.id.default_screen_button);
        defaultPageButton.setActivated(
                getScreenIdForPageIndex(getPageNearestToCenterOfScreen()) == mDefaultScreenId);
    }
}
 
源代码10 项目: MultiView   文件: ItemSelectionSupport.java
@TargetApi(HONEYCOMB)
public void setViewChecked(View view, boolean checked) {
    if (view instanceof Checkable) {
        ((Checkable) view).setChecked(checked);
    } else if (Build.VERSION.SDK_INT >= HONEYCOMB) {
        view.setActivated(checked);
    }
}
 
源代码11 项目: MaterialDrawer-Xamarin   文件: DrawerUtils.java
/**
 * helper method to handle the onClick of the footer
 *
 * @param drawer
 * @param drawerItem
 * @param v
 * @param fireOnClick true if we should call the listener, false if not, null to not call the listener and not close the drawer
 */
public static void onFooterDrawerItemClick(DrawerBuilder drawer, IDrawerItem drawerItem, View v, Boolean fireOnClick) {
    boolean checkable = !(drawerItem != null && drawerItem instanceof Selectable && !((Selectable) drawerItem).isSelectable());
    if (checkable) {
        drawer.resetStickyFooterSelection();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            v.setActivated(true);
        }
        v.setSelected(true);

        //remove the selection in the list
        drawer.getAdapter().handleSelection(null, -1);

        //set currentSelection to -1 because we selected a stickyFooter element
        drawer.mCurrentSelection = -1;

        //find the position of the clicked footer item
        if (drawer.mStickyFooterView != null && drawer.mStickyFooterView instanceof LinearLayout) {
            LinearLayout footer = (LinearLayout) drawer.mStickyFooterView;
            for (int i = 0; i < footer.getChildCount(); i++) {
                if (footer.getChildAt(i) == v) {
                    drawer.mCurrentStickyFooterSelection = i;
                    break;
                }
            }
        }
    }


    if (fireOnClick != null) {
        boolean consumed = false;
        if (fireOnClick && drawer.mOnDrawerItemClickListener != null) {
            consumed = drawer.mOnDrawerItemClickListener.onItemClick(v, -1, drawerItem);
        }

        if (!consumed) {
            //close the drawer after click
            drawer.closeDrawerDelayed();
        }
    }
}
 
源代码12 项目: CSipSimple   文件: Utility11.java
@Override
public void viewSetActivated(View view, boolean activated) {
    view.setActivated(activated);
}
 
源代码13 项目: Passbook   文件: MainListAdapter.java
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    View view = convertView;
    ViewHolder holder;
    AccountManager.Account account = mEntries.get(position);
    boolean checked = mChecked.get(position);
    if (convertView == null) {
        view = inflate(parent);
    }
    else {
        holder = (ViewHolder) view.getTag();
        if(holder.mInflate) {
            view = inflate(parent);
        }
    }
    if (mDeleted.get(position)) {
        final View deletedView = view;
        view.post(() -> animateDeletion(deletedView, position));
    }
    holder = (ViewHolder) view.getTag();
    holder.mTextView.setText(account.getAccountName());
    holder.mIconView.setPressed(checked);
    holder.mIconView.setTag(position);
    int srcId = checked ? R.drawable.checkmark : mIcons.get(position);
    String iconUrl = checked ? null : account.getIconUrl();
    if (!checked) {
        holder.mIconView.setColorFilter(COLORS[account.getCategoryId() & 0x0f]);
    } else {
        holder.mIconView.clearColorFilter();
    }
    final ImageView iconView = holder.mIconView;
    Picasso.get().load(iconUrl).placeholder(srcId)
            .transform(new CircleTransform())
            .fit().into(holder.mIconView, new Callback() {
        @Override
        public void onSuccess() {
            iconView.clearColorFilter();
        }

        @Override
        public void onError(Exception e) {

        }
    });
    final View currentView = view;
    holder.mIconView.setOnClickListener(v -> {
        v.clearAnimation();
        v.setAnimation(FLIP1);
        v.startAnimation(FLIP1);
        AnimationListener listener = getAnimListener(currentView, (ImageButton) v,
                Integer.parseInt(v.getTag().toString()), FLIP1, FLIP2);
        FLIP1.setAnimationListener(listener);
        FLIP2.setAnimationListener(listener);
    });
    if(mAnimationEnabled) {
        long timestamp = System.currentTimeMillis();
        long delta = timestamp - mLastTimestamp;
        mLastTimestamp = timestamp;

        Animation animation = AnimationUtils.loadAnimation(mContext,
                position < mLastPosition ? R.anim.down_from_top : R.anim.up_from_bottom);
        if(delta > TIME_INTERVAL) {
            animation.setStartOffset(0);
            mAdjustment = 0;
        }
        else{
            mAdjustment += TIME_INTERVAL - delta;
            if(mAdjustment > 100) {
                mAdjustment = 100;
            }
            animation.setStartOffset(mAdjustment);
        }
        view.startAnimation(animation);
    }
    view.setActivated(checked);
    mLastPosition = position;
    return view;
}
 
源代码14 项目: something.apk   文件: PrivateMessageFolderItem.java
@Override
public void updateViewFromHolder(View view, PMFolderHolder holder) {
    holder.title.setText(title);
    view.setActivated(selected);
}
 
源代码15 项目: something.apk   文件: ThreadItem.java
@Override
public void updateViewFromHolder(View view, ThreadHolder holder) {
    holder.title.setText(threadTitle);
    if(unread >= 0){
        holder.unread.setVisibility(View.VISIBLE);
        holder.unread.setText(Integer.toString(unread));
    }else{
        holder.unread.setVisibility(View.GONE);
    }
    GradientDrawable unreadBackground = (GradientDrawable) holder.unread.getBackground();
    switch (bookmark){
        case 0:
            unreadBackground.setColor(SomeTheme.bookmark_unread);
            break;
        case 1:
            unreadBackground.setColor(SomeTheme.bookmark_normal);
            break;
        case 2:
            unreadBackground.setColor(SomeTheme.bookmark_red);
            break;
        case 3:
            unreadBackground.setColor(SomeTheme.bookmark_gold);
            break;
    }

    holder.unread.setAlpha(unread > 0 ? 1.0f : 0.5f);
    holder.subtext.setText(lastPost);

    if (pinned) {
        holder.subtext.setCompoundDrawablesWithIntrinsicBounds(R.drawable.sticky, 0, 0, 0);
    }
    else {
        holder.subtext.setCompoundDrawablesWithIntrinsicBounds(R.drawable.pages, 0, 0, 0);
    }

    if (!TextUtils.isEmpty(tagUrl)) {
        holder.tagImage.setImageUrl(tagUrl, FastVolley.getImageLoader());
        holder.tagImage.setVisibility(View.VISIBLE);
    }
    else {
        holder.tagImage.setVisibility(View.GONE);
    }

    view.setAlpha(closed ? 0.5f : 1f);
    view.setActivated(selected);
}
 
源代码16 项目: letv   文件: ViewCompatHC.java
public static void setActivated(View view, boolean activated) {
    view.setActivated(activated);
}
 
源代码17 项目: smartcard-reader   文件: NavDrawer.java
@Override
public void onClick(View view) {
    if (view.getId() == mResId) {
        // already on it, just close nav drawer
        mDrawerLayout.closeDrawers();
        return;
    }
    mParentItem.setActivated(false);
    view.setActivated(true);
    mCurrentItem = view;

    final Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    boolean finishCurrent = false;
    final int viewId = view.getId();
    switch(viewId) {
        case R.id.app_select:
            intent.setClass(mActivity, AppSelectActivity.class);
            finishCurrent = true;
            break;

        case R.id.batch_select:
            intent.setClass(mActivity, BatchSelectActivity.class);
            finishCurrent = true;
            break;

        case R.id.emv_read:
            intent.setClass(mActivity, EmvReadActivity.class);
            finishCurrent = true;
            break;

        case R.id.apps:
            intent.setClass(mActivity, AppListActivity.class);
            finishCurrent = false;
            break;

        case R.id.settings:
            intent.setClass(mActivity, SettingsActivity.class);
            finishCurrent = false;
            break;
    }
    final boolean finish = finishCurrent;
    mHandler.removeCallbacksAndMessages(null);
    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            mActivity.startActivity(intent);
            if (finish) {
                mActivity.finish();
            }
            mActivity.overridePendingTransition(R.anim.abc_fade_in,
                    R.anim.abc_fade_out);
        }
    }, 225);

    mDrawerLayout.closeDrawers();
}
 
源代码18 项目: android-spotify-demo   文件: MainFragment.java
private void setDeFocus(int res_id, View view){
    switch (res_id)
    {
        case R.id.nav_home:
            home.setTint(defocusMode);
            view.setBackground(home);
            homeText.setTextColor(defocusMode);
            homeText.setTypeface(Typeface.DEFAULT);
            view.setActivated(false);
            break;
        case R.id.nav_browse:
            browse.setTint(defocusMode);
            view.setBackground(browse);
            browseText.setTextColor(defocusMode);
            browseText.setTypeface(Typeface.DEFAULT);
            view.setActivated(false);
            break;
        case R.id.nav_search:
            search.setTint(defocusMode);
            view.setBackground(search);
            searchText.setTextColor(defocusMode);
            searchText.setTypeface(Typeface.DEFAULT);
            view.setActivated(false);
            break;
        case R.id.nav_radio:
            radio.setTint(defocusMode);
            view.setBackground(radio);
            radioText.setTextColor(defocusMode);
            radioText.setTypeface(Typeface.DEFAULT);
            view.setActivated(false);
            break;
        case R.id.nav_library:
            library.setTint(defocusMode);
            view.setBackground(library);
            libraryText.setTextColor(defocusMode);
            libraryText.setTypeface(Typeface.DEFAULT);
            view.setActivated(false);
            break;
        case -1:
            break;
        default:
            break;
    }
}
 
源代码19 项目: android   文件: OverlayManager.java
@Override public boolean onFling(float posX, float posY, float velocityX, float velocityY) {
  final View findMe = mapView.getFindMe();
  findMe.setActivated(false);
  return false;
}
 
源代码20 项目: call_manage   文件: Utilities.java
/**
 * Toggle the active state of a view
 *
 * @param view the view to toggle
 */
public static void toggleViewActivation(View view) {
    view.setActivated(!view.isActivated());
}
 
 方法所在类
 同类方法