本文整理汇总了Java中com.facebook.share.widget.ShareButton类的典型用法代码示例。如果您正苦于以下问题:Java ShareButton类的具体用法?Java ShareButton怎么用?Java ShareButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShareButton类属于com.facebook.share.widget包,在下文中一共展示了ShareButton类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.facebook.share.widget.ShareButton; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_routine_completed, container);
fbShare = (ShareButton) view.findViewById(R.id.fb_share);
tvMessage = (DCTextView) view.findViewById(R.id.tv_message);
tvCompleted = (DCTextView) view.findViewById(R.id.tv_completed);
ivTooth = (ImageView) view.findViewById(R.id.iv_tooth);
if (getArguments() != null) {
final Routine.Type routineType = (Routine.Type)getArguments().getSerializable(KEY_ROUTINE_TYPE);
if (routineType != null) {
AudibleMessage audibleMessage;
String shareLinkMessage;
switch (routineType) {
case MORNING:
shareLinkMessage = getString(R.string.fb_share_morning_routine_completed);
audibleMessage = AudibleMessage.MORNING_ROUTINE_END;
break;
default:
shareLinkMessage = getString(R.string.fb_share_evening_routine_completed);
audibleMessage = AudibleMessage.EVENING_ROUTINE_END;
break;
}
tvMessage.setText(audibleMessage.getMessage(getActivity()));
ShareLinkContent shareLinkContent = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(DCConstants.DENTACARE_GOOGLE_PLAY))
.setShareHashtag(new ShareHashtag.Builder()
.setHashtag("#dentacoin")
.build())
.setQuote(shareLinkMessage)
.build();
fbShare.setShareContent(shareLinkContent);
if (audibleMessage.getVoices() != null && audibleMessage.getVoices().length > 0) {
DCSoundManager.getInstance().playVoice(getActivity(), audibleMessage.getVoices()[0]);
}
}
}
AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
alphaAnimation.setDuration(1000);
ivTooth.startAnimation(alphaAnimation);
AlphaAnimation dayAlphaAnimation = new AlphaAnimation(0f, 1f);
dayAlphaAnimation.setDuration(2000);
tvCompleted.startAnimation(dayAlphaAnimation);
AlphaAnimation alphaAnimationMessage = new AlphaAnimation(0f, 1f);
alphaAnimationMessage.setDuration(1000);
tvMessage.startAnimation(alphaAnimationMessage);
return view;
}
示例2: testFBShareBind_shareContentSet
import com.facebook.share.widget.ShareButton; //导入依赖的package包/类
@Test
public void testFBShareBind_shareContentSet() throws Exception {
int positionToShow = 0;
when(recipeList.get(positionToShow)).thenReturn(recipe);
shadowAdapter.itemVisible(positionToShow);
View view = shadowAdapter.getViewForHolderPosition(positionToShow);
ShareButton fbShare = (ShareButton) view.findViewById(R.id.fbShare);
ShareContent shareContent = fbShare.getShareContent();
assertNotNull(shareContent);
assertEquals(URL, shareContent.getContentUrl().toString());
}