Created
June 10, 2014 02:09
-
-
Save Reacoder/c2b613590e616d162d49 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 OnClickListener popupClickListener = new OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
switch (v.getId()) { | |
case R.id.share_google: | |
System.out.println("===== share_google"); | |
break; | |
case R.id.share_facebook: | |
System.out.println("===== share_facebook"); | |
break; | |
case R.id.share_twitter: | |
System.out.println("===== share_twitter"); | |
break; | |
default: | |
break; | |
} | |
popupWindow.dismiss(); | |
} | |
}; | |
private void initSharePopup() { | |
popupLayout = (LinearLayout) LayoutInflater.from(this).inflate( | |
R.layout.popup_share_layout, null); | |
popupLayout.findViewById(R.id.share_google).setOnClickListener( | |
popupClickListener); | |
popupLayout.findViewById(R.id.share_facebook).setOnClickListener( | |
popupClickListener); | |
popupLayout.findViewById(R.id.share_twitter).setOnClickListener( | |
popupClickListener); | |
popupWindow = new PopupWindow(popupLayout, | |
WindowManager.LayoutParams.WRAP_CONTENT, | |
WindowManager.LayoutParams.WRAP_CONTENT); | |
} | |
private void showSharePopupMenu(View v) { | |
if (popupWindow.isShowing()) { | |
popupWindow.dismiss(); | |
} else { | |
if (mFullScreen) { | |
float px = TypedValue.applyDimension( | |
TypedValue.COMPLEX_UNIT_DIP, 10, getResources() | |
.getDisplayMetrics()); | |
popupWindow.showAsDropDown(v, (int) -px, (int) px); | |
} else { | |
popupWindow.showAsDropDown(v); | |
} | |
} | |
} |
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
Can't get action view for ActionBar MenuItem using support library | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
if(item.getItemId() == R.id.action_filter){ | |
View view= getActivity().findViewById(R.id.action_filter); | |
showFilterWindow(view); | |
} | |
return super.onOptionsItemSelected(item); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment