当前位置: 首页>>代码示例>>Java>>正文


Java ShareButton类代码示例

本文整理汇总了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;
}
 
开发者ID:Dentacoin,项目名称:aftercare-app-android,代码行数:59,代码来源:DCRoutineCompletedFragment.java

示例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());
}
 
开发者ID:micromasterandroid,项目名称:androidadvanced,代码行数:14,代码来源:RecipesAdapterTest.java


注:本文中的com.facebook.share.widget.ShareButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。