Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private ListView mListView;
private ArrayAdapter mListAdapter;
private final AlphaAnimation mFadeOut = new AlphaAnimation(1.0f, 0.3f);
private final AlphaAnimation mFadeIn = new AlphaAnimation(0.3f, 1.0f);
public class OnFolderOverflowSelectedListener implements OnClickListner {
// Stuff from above
public void onClick(View v) {
// All the stuff above
// Dim out all the other list items if they exist
int firstPos = mListView.getFirstVisiblePosition() - mListView.getHeaderViewsCount();
final int ourPos = mListAdapter.getPosition(mAlbum) - firstPos;
int count = mListView.getChildCount();
for (int i = 0; i <= count; i++) {
if (i == ourPos) {
continue;
}
final View child = mListView.getChildAt(i);
if (child != null) {
child.clearAnimation();
child.startAnimation(mFadeOut);
}
}
// Make sure to bring them back to normal after the menu is gone
popupMenu.setOnDismissListener(new PopupMenu.OnDismissListener() {
@Override
public void onDismiss(PopupMenu popupMenu) {
int count = mListView.getChildCount();
for (int i = 0; i <= count; i++) {
if (i == ourPos) {
continue;
}
final View v = mListView.getChildAt(i);
if (v != null) {
v.clearAnimation();
v.startAnimation(mFadeIn);
}
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.