Java Code Examples for android.view.View#setActivated()
The following examples show how to use
android.view.View#setActivated() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: UltimateAndroid File: FreeFlowContainer.java License: Apache License 2.0 | 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 2
Source Project: google-authenticator-android File: AuthenticatorActivity.java License: Apache License 2.0 | 5 votes |
@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; }
Example 3
Source Project: material-components-android File: TabLayout.java License: Apache License 2.0 | 5 votes |
/** * 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); } } }
Example 4
Source Project: ticdesign File: TrackSelectionAdapterWrapper.java License: Apache License 2.0 | 5 votes |
private void updateCheckState(View itemView, int position) { if (itemView instanceof Checkable) { ((Checkable) itemView).setChecked(mCheckStates.get(position)); } else { itemView.setActivated(mCheckStates.get(position)); } }
Example 5
Source Project: AndroidMaterialValidation File: AbstractValidateableView.java License: Apache License 2.0 | 5 votes |
/** * 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); } } }
Example 6
Source Project: droidddle File: PagerSlidingTabStrip.java License: Apache License 2.0 | 5 votes |
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); } } }
Example 7
Source Project: something.apk File: ForumItem.java License: MIT License | 5 votes |
@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); }
Example 8
Source Project: Nimingban File: DrawerListView.java License: Apache License 2.0 | 5 votes |
@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; }
Example 9
Source Project: TurboLauncher File: Workspace.java License: Apache License 2.0 | 5 votes |
private void updateDefaultScreenButton() { View overviewPanel = mLauncher.getOverviewPanel(); if (overviewPanel != null) { View defaultPageButton = overviewPanel.findViewById(R.id.default_screen_button); defaultPageButton.setActivated( getScreenIdForPageIndex(getPageNearestToCenterOfScreen()) == mDefaultScreenId); } }
Example 10
Source Project: MultiView File: ItemSelectionSupport.java License: Apache License 2.0 | 5 votes |
@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); } }
Example 11
Source Project: MaterialDrawer-Xamarin File: DrawerUtils.java License: Apache License 2.0 | 4 votes |
/** * 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(); } } }
Example 12
Source Project: CSipSimple File: Utility11.java License: GNU General Public License v3.0 | 4 votes |
@Override public void viewSetActivated(View view, boolean activated) { view.setActivated(activated); }
Example 13
Source Project: Passbook File: MainListAdapter.java License: Apache License 2.0 | 4 votes |
@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; }
Example 14
Source Project: something.apk File: PrivateMessageFolderItem.java License: MIT License | 4 votes |
@Override public void updateViewFromHolder(View view, PMFolderHolder holder) { holder.title.setText(title); view.setActivated(selected); }
Example 15
Source Project: something.apk File: ThreadItem.java License: MIT License | 4 votes |
@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); }
Example 16
Source Project: letv File: ViewCompatHC.java License: Apache License 2.0 | 4 votes |
public static void setActivated(View view, boolean activated) { view.setActivated(activated); }
Example 17
Source Project: smartcard-reader File: NavDrawer.java License: GNU General Public License v3.0 | 4 votes |
@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(); }
Example 18
Source Project: android-spotify-demo File: MainFragment.java License: MIT License | 4 votes |
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; } }
Example 19
Source Project: android File: OverlayManager.java License: Apache License 2.0 | 4 votes |
@Override public boolean onFling(float posX, float posY, float velocityX, float velocityY) { final View findMe = mapView.getFindMe(); findMe.setActivated(false); return false; }
Example 20
Source Project: call_manage File: Utilities.java License: MIT License | 2 votes |
/** * Toggle the active state of a view * * @param view the view to toggle */ public static void toggleViewActivation(View view) { view.setActivated(!view.isActivated()); }