Search in sources :

Example 1 with LikeView

use of com.facebook.share.widget.LikeView in project facebook-android-sdk by facebook.

the class ShareFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    mCallbackManager = CallbackManager.Factory.create();
    View view = inflater.inflate(R.layout.share_it_view, container, false);
    LoginButton loginButton = (LoginButton) view.findViewById(R.id.login_button);
    loginButton.setFragment(this);
    loginButton.setReadPermissions("public_profile");
    setupViewPage(view);
    LikeView pageLike = (LikeView) view.findViewById(R.id.like_page);
    pageLike.setFragment(this);
    return view;
}
Also used : LikeView(com.facebook.share.widget.LikeView) View(android.view.View) LikeView(com.facebook.share.widget.LikeView) LoginButton(com.facebook.login.widget.LoginButton)

Example 2 with LikeView

use of com.facebook.share.widget.LikeView in project facebook-android-sdk by facebook.

the class ShareFragment method setupViewPage.

private void setupViewPage(View view) {
    mViewPage = (ViewPager) view.findViewById(R.id.pager);
    PagerAdapter adapter = new ScreenSlidePagerAdapter(getFragmentManager());
    mViewPage.setAdapter(adapter);
    final PageSelector pageSelector = (PageSelector) view.findViewById(R.id.page_selector);
    pageSelector.setImageCount(IMAGE_IDS.size());
    final LikeView photoLike = (LikeView) view.findViewById(R.id.like_photo);
    photoLike.setFragment(this);
    mViewPage.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            pageSelector.setPosition(position);
            String shareContent = IMAGE_IDS.get(position).second;
            photoLike.setObjectIdAndType(shareContent, LikeView.ObjectType.OPEN_GRAPH);
            mShareContentChangedListener.onShareContentChanged(shareContent);
        }

        @Override
        public void onPageSelected(int position) {
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
}
Also used : LikeView(com.facebook.share.widget.LikeView) ViewPager(android.support.v4.view.ViewPager) PagerAdapter(android.support.v4.view.PagerAdapter) FragmentStatePagerAdapter(android.support.v4.app.FragmentStatePagerAdapter)

Aggregations

LikeView (com.facebook.share.widget.LikeView)2 FragmentStatePagerAdapter (android.support.v4.app.FragmentStatePagerAdapter)1 PagerAdapter (android.support.v4.view.PagerAdapter)1 ViewPager (android.support.v4.view.ViewPager)1 View (android.view.View)1 LoginButton (com.facebook.login.widget.LoginButton)1