Created
November 7, 2015 03:10
-
-
Save philippb/d9d025fc5af8f1e6152e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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