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


Java Tweet类代码示例

本文整理汇总了Java中com.twitter.sdk.android.core.models.Tweet的典型用法代码示例。如果您正苦于以下问题:Java Tweet类的具体用法?Java Tweet怎么用?Java Tweet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Tweet类属于com.twitter.sdk.android.core.models包,在下文中一共展示了Tweet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: measure

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
public synchronized long measure(
        Tweet tweet,
        YogaNode node,
        float width,
        YogaMeasureMode widthMode,
        float height,
        YogaMeasureMode heightMode
) {
  if (mTweetView == null) {
    mTweetView = ReactTweetViewManager.createTweetView(getThemedContext());
  }

  if (tweet != null) {
    mTweetView.setTweet(tweet);
  }
  mTweetView.measure(yogaToAndroid(widthMode, width), yogaToAndroid(heightMode, height));

  int measuredWidth = mTweetView.getMeasuredWidth();
  int measuredHeight = mTweetView.getMeasuredHeight();
  return YogaMeasureOutput.make(measuredWidth, measuredHeight);
}
 
开发者ID:netceteragroup,项目名称:react-native-twitterkit,代码行数:22,代码来源:TweetShadowNode.java

示例2: setTweet

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
public void setTweet(Tweet tweet) {
  this.tweet = tweet;
  if (tweet != null) {
    setTweetIdInternally(tweet.getId());
  }
  if(tweetView == null){
    tweetView = new com.twitter.sdk.android.tweetui.TweetView(getContext(), tweet);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    layoutParams.addRule(CENTER_IN_PARENT);
    tweetView.setLayoutParams(layoutParams);
    tweetView.setTweetActionsEnabled(true);
    addView(tweetView);
  }
  initializeTweetView();

  updateSize();
  hideLikeButton();
}
 
开发者ID:netceteragroup,项目名称:react-native-twitterkit,代码行数:19,代码来源:TweetView.java

示例3: loadTweet

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
private void loadTweet() {
  LogUtils.d(TAG, "loadTweet, tweetId = " + tweetId);

  TweetUtils.loadTweet(tweetId, new Callback<Tweet>() {
    @Override
    public void success(Result<Tweet> result) {
      LogUtils.d(TAG, "loadTweet, success");
      Tweet selectedTweet = result.data;
      setTweet(selectedTweet);
      handleSuccess();
    }

    @Override
    public void failure(TwitterException exception) {
      LogUtils.d(TAG, "loadTweet, failure");
      // TODO send message
      handleError();
    }
  });
}
 
开发者ID:netceteragroup,项目名称:react-native-twitterkit,代码行数:21,代码来源:TweetView.java

示例4: homeTimeline

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
@GET("/1.1/statuses/home_timeline.json")
void homeTimeline(@Query("count") Integer count,
                  @Query("trim_user") Boolean trim_user,
                  @Query("exclude_replies") Boolean exclude_replies,
                  @Query("contributor_details") Boolean contributor_details,
                  @Query("include_entities") Boolean include_entities,
                  Callback<List<Tweet>> callback);
 
开发者ID:micromasterandroid,项目名称:androidadvanced,代码行数:8,代码来源:TimelineService.java

示例5: handleTweet

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
/**
 * Handles adding a tweet to the view.
 *
 * @param holder the holder for hte tweet.
 * @param post   the post that contains the Id for the tweet.
 * @see CompactTweetView
 * @see TweetUtils#loadTweet(long, Callback)
 * @see Tweet
 */
private void handleTweet(ViewHolder holder, Post post) {
    final TwitterViewHolder twitterViewHolder = (TwitterViewHolder) holder;
    TwitterPost twitterPost = (TwitterPost) post;
    TweetUtils.loadTweet(twitterPost.tweetId, new Callback<Tweet>() {
        @Override
        public void success(Result<Tweet> result) {
            //Unlike the other posts, we have to add a delivered TweetView to the card view.
            twitterViewHolder.mCardView.addView(new CompactTweetView(mContext, result.data));
        }

        @Override
        public void failure(TwitterException exception) {
            Log.d(TAG, "Failed to handle tweet properly in adapter");
        }
    });
}
 
开发者ID:cache117,项目名称:social-journal,代码行数:26,代码来源:SocialJournalAdapter.java

示例6: onRefresh

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
@Override
public void onRefresh() {
    mBinding.swipe.setRefreshing(true);
    mAdapter.refresh(new Callback<TimelineResult<Tweet>>() {
        @Override
        public void success(Result<TimelineResult<Tweet>> result) {
            mBinding.swipe.setRefreshing(false);
        }

        @Override
        public void failure(TwitterException exception) {
            mBinding.swipe.setRefreshing(false);
            Toast.makeText(getContext(), exception.getMessage(), Toast.LENGTH_SHORT).show();
        }
    });
}
 
开发者ID:Gnzlt,项目名称:UCOmove,代码行数:17,代码来源:TwitterFragment.java

示例7: onCreate

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tweetlist);
    setListAdapter(adapter);
    adapter.setTweetIds(tweetIds, new Callback<List<Tweet>>() {
        @Override
        public void success(Result<List<Tweet>> result) {
            // my custom actions
        }

        @Override
        public void failure(TwitterException exception) {
            // Toast.makeText(...).show();
        }
    });
}
 
开发者ID:manishpatelgt,项目名称:MyTwitterRepo,代码行数:18,代码来源:TweetListActivity.java

示例8: loadAllTweets

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
private void loadAllTweets(){

        for(final Long tweetId: tweetIds){

            TweetUtils.loadTweet(tweetId, new Callback<Tweet>() {
                @Override
                public void success(Result<Tweet> result) {
                    //Tweet tweet = result.data;

                    TweetView tweetView = new TweetView(MyReTweetsActivity.this, result.data,
                            R.style.tw__TweetLightWithActionsStyle);

                    View breakLine = getLayoutInflater().inflate(R.layout.tweet_view_layout, null);
                    tweetView.setOnActionCallback(actionCallback);
                    myLayout.addView(tweetView);
                    myLayout.addView(breakLine);
                }

                @Override
                public void failure(TwitterException exception) {
                    // Toast.makeText(...).show();
                }
            });

        }
    }
 
开发者ID:manishpatelgt,项目名称:MyTwitterRepo,代码行数:27,代码来源:MyReTweetsActivity.java

示例9: loadAllTweets

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
private void loadAllTweets(){

        for(final Long tweetId: tweetIds){

            TweetUtils.loadTweet(tweetId, new Callback<Tweet>() {
                @Override
                public void success(Result<Tweet> result) {
                    //Tweet tweet = result.data;

                    TweetView tweetView = new TweetView(MyTweetsActivity.this, result.data,
                            R.style.tw__TweetLightWithActionsStyle);

                    View breakLine = getLayoutInflater().inflate(R.layout.tweet_view_layout, null);
                    tweetView.setOnActionCallback(actionCallback);
                    myLayout.addView(tweetView);
                    myLayout.addView(breakLine);
                }

                @Override
                public void failure(TwitterException exception) {
                    // Toast.makeText(...).show();
                }
            });

        }
    }
 
开发者ID:manishpatelgt,项目名称:MyTwitterRepo,代码行数:27,代码来源:MyTweetsActivity.java

示例10: loadAllTweets

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
private void loadAllTweets(){

        for(final Long tweetId: tweetIds){

            TweetUtils.loadTweet(tweetId, new Callback<Tweet>() {
                @Override
                public void success(Result<Tweet> result) {
                    //Tweet tweet = result.data;

                    TweetView tweetView = new TweetView(HomeActivity.this, result.data,
                            R.style.tw__TweetLightWithActionsStyle);

                    View breakLine = getLayoutInflater().inflate(R.layout.tweet_view_layout, null);
                    tweetView.setOnActionCallback(actionCallback);
                    myLayout.addView(tweetView);
                    myLayout.addView(breakLine);
                }

                @Override
                public void failure(TwitterException exception) {
                    // Toast.makeText(...).show();
                }
            });

        }
    }
 
开发者ID:manishpatelgt,项目名称:MyTwitterRepo,代码行数:27,代码来源:HomeActivity.java

示例11: testFavoriteCallback_failureAlreadyUnfavorited

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
@Test
public void testFavoriteCallback_failureAlreadyUnfavorited() {
    final ToggleImageButton mockToggleButton = mock(ToggleImageButton.class);
    // locally favorited, but on server the tweet is unfavorited
    final Tweet tweet = TestFixtures.TEST_FAVORITED_TWEET;
    final LikeTweetAction.LikeCallback callback
            = new LikeTweetAction.LikeCallback(mockToggleButton, tweet,
            mockCallback);
    final TwitterApiException alreadyUnfavoritedException = mock(TwitterApiException.class);
    when(alreadyUnfavoritedException.getErrorCode()).thenReturn(
            TwitterApiConstants.Errors.ALREADY_UNFAVORITED);
    // assert that
    // - the failure is treated as a cb success
    // - success result Tweet is marked as unfavorited
    callback.failure(alreadyUnfavoritedException);
    final ArgumentCaptor<Result<Tweet>> resultCaptor
            = ArgumentCaptor.forClass(Result.class);
    verify(mockCallback).success(resultCaptor.capture());
    assertEquals(tweet.getId(), resultCaptor.getValue().data.getId());
    assertFalse(resultCaptor.getValue().data.favorited);
}
 
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:22,代码来源:LikeTweetActionTest.java

示例12: fetchPrevious

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
private void fetchPrevious(Long minPosition) {
    mTimeline.previous(minPosition, new Callback<TimelineResult<Tweet>>() {
        @Override
        public void success(Result<TimelineResult<Tweet>> result) {
            mTimelineStateHolder.setPreviousCursor(result.data.timelineCursor);
            if (mRefreshing) {
                mTweets.clear();
            }
            int position = mTweets.size();
            mTweets.addAll(result.data.items);

            mPreviousSubject.onNext(new DataSetInsertResult(position, result.data.items.size()));

            mTimelineStateHolder.finishTimelineRequest();
            mRefreshing = false;
        }

        @Override
        public void failure(TwitterException e) {
            mPreviousSubject.onError(e);

            mTimelineStateHolder.finishTimelineRequest();
            mRefreshing = false;
        }
    });
}
 
开发者ID:yshrsmz,项目名称:photosearcher,代码行数:27,代码来源:TimelineObservable.java

示例13: loadTweet

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
/**
 * loadTweet wraps TweetUtils.loadTweet with a callback that ensures the view is given a
 * known id to simplify UI automation testing.
 */
private void loadTweet(long tweetId, final ViewGroup container, final int viewId) {
    final Callback<Tweet> singleTweetCallback = new Callback<Tweet>() {
        @Override
        public void success(Result<Tweet> result) {
            final Context context = getActivity();
            if (context == null) return;
            final Tweet tweet = result.data;
            final BaseTweetView tv = new TweetView(context, tweet,
                    R.style.tw__TweetLightWithActionsStyle);
            tv.setOnActionCallback(actionCallback);
            tv.setId(viewId);
            container.addView(tv);
        }

        @Override
        public void failure(TwitterException exception) {
            Log.e(TAG, "loadTweet failure", exception);
        }
    };
    TweetUtils.loadTweet(tweetId, singleTweetCallback);
}
 
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:26,代码来源:TweetActivity.java

示例14: testFavoriteCallback_failureAlreadyFavorited

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
@Test
public void testFavoriteCallback_failureAlreadyFavorited() {
    final ToggleImageButton mockToggleButton = mock(ToggleImageButton.class);
    // locally unfavorited, but on server the tweet is favorited
    final Tweet tweet = TestFixtures.TEST_TWEET;
    final LikeTweetAction.LikeCallback callback
            = new LikeTweetAction.LikeCallback(mockToggleButton, tweet,
            mockCallback);
    final TwitterApiException alreadyFavoritedException = mock(TwitterApiException.class);
    when(alreadyFavoritedException.getErrorCode()).thenReturn(
            TwitterApiConstants.Errors.ALREADY_FAVORITED);
    // assert that
    // - the failure is treated as a cb success
    // - success result Tweet is marked as favorited
    callback.failure(alreadyFavoritedException);
    final ArgumentCaptor<Result<Tweet>> resultCaptor
            = ArgumentCaptor.forClass(Result.class);
    verify(mockCallback).success(resultCaptor.capture());
    assertEquals(tweet.getId(), resultCaptor.getValue().data.getId());
    assertTrue(resultCaptor.getValue().data.favorited);
}
 
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:22,代码来源:LikeTweetActionTest.java

示例15: testConstructor_withActionCallback

import com.twitter.sdk.android.core.models.Tweet; //导入依赖的package包/类
public void testConstructor_withActionCallback() {
    final TimelineDelegate<Tweet> mockTimelineDelegate = mock(TestTimelineDelegate.class);
    final Callback<Tweet> mockCallback = mock(Callback.class);
    final TweetUi tweetUi = mock(TweetUi.class);
    recyclerViewAdapter = new TweetTimelineRecyclerViewAdapter(getContext(),
            mockTimelineDelegate, ANY_STYLE, mockCallback, tweetUi);
    // assert that
    // - developer callback wrapped in a ReplaceTweetCallback
    if (recyclerViewAdapter.actionCallback instanceof
            TweetTimelineRecyclerViewAdapter.ReplaceTweetCallback) {
        final TweetTimelineRecyclerViewAdapter.ReplaceTweetCallback replaceCallback
                = (TweetTimelineRecyclerViewAdapter.ReplaceTweetCallback)
                recyclerViewAdapter.actionCallback;
        assertEquals(mockTimelineDelegate, replaceCallback.delegate);
        assertEquals(mockCallback, replaceCallback.cb);
    } else {
        fail("Expected actionCallback to be wrapped in ReplaceTweetCallback");
    }
}
 
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:20,代码来源:TweetTimelineRecyclerViewAdapterTest.java


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