本文整理汇总了Java中com.twitter.sdk.android.core.services.StatusesService类的典型用法代码示例。如果您正苦于以下问题:Java StatusesService类的具体用法?Java StatusesService怎么用?Java StatusesService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatusesService类属于com.twitter.sdk.android.core.services包,在下文中一共展示了StatusesService类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
anyIds.add(anyId);
mockTwitterCore = mock(TwitterCore.class);
mockApiClient = mock(TwitterApiClient.class);
mockStatusesService = mock(StatusesService.class, Mockito.RETURNS_MOCKS);
when(mockApiClient.getStatusesService()).thenReturn(mockStatusesService);
mockFavoriteService = mock(FavoriteService.class, Mockito.RETURNS_MOCKS);
when(mockApiClient.getFavoriteService()).thenReturn(mockFavoriteService);
when(mockTwitterCore.getApiClient(any(TwitterSession.class))).thenReturn(mockApiClient);
when(mockTwitterCore.getApiClient()).thenReturn(mockApiClient);
mockSessionManager = mock(SessionManager.class);
when(mockSessionManager.getActiveSession()).thenReturn(mock(TwitterSession.class));
mockHandler = mock(Handler.class);
tweetRepository = new TweetRepository(mockHandler, mockSessionManager, mockTwitterCore);
}
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:17,代码来源:TweetRepositoryTest.java
示例2: setUp
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
context = RuntimeEnvironment.application;
mockMediaService = mock(MediaService.class);
mockStatusesService = mock(StatusesService.class);
tweet = new TweetBuilder().setId(123L).setText(EXPECTED_TWEET_TEXT).build();
when(mockMediaService
.upload(any(RequestBody.class), any(RequestBody.class), any(RequestBody.class)))
.thenReturn(mock(Call.class));
when(mockStatusesService.update(anyString(), isNull(Long.class), isNull(Boolean.class),
isNull(Double.class), isNull(Double.class), isNull(String.class),
isNull(Boolean.class), eq(true), isNull(String.class)))
.thenReturn(Calls.response(tweet));
mockTwitterApiClient = mock(TwitterApiClient.class);
when(mockTwitterApiClient.getStatusesService()).thenReturn(mockStatusesService);
when(mockTwitterApiClient.getMediaService()).thenReturn(mockMediaService);
mockDependencyProvider = mock(TweetUploadService.DependencyProvider.class);
when(mockDependencyProvider.getTwitterApiClient(any(TwitterSession.class)))
.thenReturn(mockTwitterApiClient);
service = spy(Robolectric.buildService(TweetUploadService.class).create().get());
service.dependencyProvider = mockDependencyProvider;
}
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:26,代码来源:TweetUploadServiceTest.java
示例3: updateStatus
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
public void updateStatus(View view){
EditText editText = (EditText) findViewById(R.id.editText);
TwitterApiClient apiClient = TwitterCore.getInstance().getApiClient();
StatusesService statusesService = apiClient.getStatusesService();
statusesService.update(editText.getText().toString(), 1l, false, 0d, 0d, "", false, false, new Callback<Tweet>() {
@Override
public void success(Result<Tweet> tweetResult) {
Log.d(TAG, "posté");
Toast.makeText(TweetActivity.this, "Posté", Toast.LENGTH_SHORT).show();
}
@Override
public void failure(TwitterException e) {
Log.d(TAG, "Erreur");
Toast.makeText(TweetActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:jacquesgiraudel,项目名称:TP-Formation-Android,代码行数:19,代码来源:TweetActivity.java
示例4: importExistingTwitterPosts
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
private void importExistingTwitterPosts(final String uid) {
TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
StatusesService statusesService = twitterApiClient.getStatusesService();
statusesService
.userTimeline(TwitterCore
.getInstance()
.getSessionManager()
.getActiveSession()
.getUserId(),
null, null, null, null, null, null, null, null)
.enqueue(new ImportExistingTwitterPostsCallback(uid));
}
开发者ID:cache117,项目名称:social-journal,代码行数:13,代码来源:MainActivity.java
示例5: setUp
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
@Before
public void setUp() {
twitterCore = mock(TwitterCore.class);
apiClient = mock(TwitterApiClient.class);
statusesService = mock(StatusesService.class, new MockCallAnswer());
when(apiClient.getStatusesService()).thenReturn(statusesService);
when(twitterCore.getApiClient()).thenReturn(apiClient);
}
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:10,代码来源:UserTimelineTest.java
示例6: tweet
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
/**
* Update the user's twitter status.
*
* @param status the status to tweet
*/
public static void tweet(String status) {
StatusesService statusesService = TwitterCore.getInstance().getApiClient().getStatusesService();
statusesService.update(status, null, null, null, null, null, null, null, new Callback<Tweet>() {
@Override
public void success(Result<Tweet> result) {
Log.d(TAG, "UPDATING STATUS SUCCESS");
}
@Override
public void failure(TwitterException e) {
Log.d(TAG, "UPDATING STATUS FAILURE");
}
});
}
开发者ID:IBM-MIL,项目名称:IBM-Ready-App-for-Telecommunications,代码行数:20,代码来源:TwitterHelper.java
示例7: getTweet
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
private static void getTweet(final Long id, final String fname){
showFetchingTweetNoti();
TwitterApiClient twitterApiClient= TwitterCore.getInstance().getApiClient();
StatusesService statusesService=twitterApiClient.getStatusesService();
Call<Tweet> tweetCall=statusesService.show(id,null,null,null);
tweetCall.enqueue(new Callback<Tweet>() {
@Override
public void success(Result<Tweet> result) {
//Check if media is present
if (result.data.extendedEtities==null && result.data.entities.media==null){
alertNoMedia();
}
//Check if gif or mp4 present in the file
else if (!(result.data.extendedEtities.media.get(0).type).equals("video") && !(result.data.extendedEtities.media.get(0).type).equals("animated_gif")){
alertNoVideo();
}
else {
String filename=fname;
String url;
//Set filename to gif or mp4
if ((result.data.extendedEtities.media.get(0).type).equals("video")) {
filename = filename + ".mp4";
}else {
filename = filename + ".gif";
}
int i=0;
url = result.data.extendedEtities.media.get(0).videoInfo.variants.get(i).url;
while (!url.endsWith(".mp4")){
if(result.data.extendedEtities.media.get(0).videoInfo.variants.get(i)!=null) {
url = result.data.extendedEtities.media.get(0).videoInfo.variants.get(i).url;
i += 1;
}
}
downloadVideo(url,filename);
}
}
@Override
public void failure(TwitterException exception) {
Toast.makeText(c, "Request Failed: Check your internet connection", Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:emmanuelkehinde,项目名称:TwittaSave-Android,代码行数:49,代码来源:ServiceUtil.java
示例8: getTweet
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
public void getTweet(final Long id, final String fname){
progressDialog.show();
TwitterApiClient twitterApiClient=TwitterCore.getInstance().getApiClient();
StatusesService statusesService=twitterApiClient.getStatusesService();
Call<Tweet> tweetCall=statusesService.show(id,null,null,null);
tweetCall.enqueue(new Callback<Tweet>() {
@Override
public void success(Result<Tweet> result) {
//Check if media is present
if (result.data.extendedEtities==null && result.data.entities.media==null){
alertNoMedia();
}
//Check if gif or mp4 present in the file
else if (!(result.data.extendedEtities.media.get(0).type).equals("video") && !(result.data.extendedEtities.media.get(0).type).equals("animated_gif")){
alertNoVideo();
}
else {
String filename=fname;
String url;
//Set filename to gif or mp4
if ((result.data.extendedEtities.media.get(0).type).equals("video")) {
filename = filename + ".mp4";
}else {
filename = filename + ".gif";
}
int i=0;
url = result.data.extendedEtities.media.get(0).videoInfo.variants.get(i).url;
while (!url.endsWith(".mp4")){
if(result.data.extendedEtities.media.get(0).videoInfo.variants.get(i)!=null) {
url = result.data.extendedEtities.media.get(0).videoInfo.variants.get(i).url;
i += 1;
}
}
downloadVideo(url,filename);
}
}
@Override
public void failure(TwitterException exception) {
progressDialog.hide();
Toast.makeText(MainActivity.this, "Request Failed: Check your internet connection", Toast.LENGTH_SHORT).show();
}
});
}
开发者ID:emmanuelkehinde,项目名称:TwittaSave-Android,代码行数:50,代码来源:MainActivity.java
示例9: getStatusesService
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
/**
* @return {@link com.twitter.sdk.android.core.services.StatusesService} to access TwitterApi
*/
public StatusesService getStatusesService() {
return getService(StatusesService.class);
}
开发者ID:ahmed-adel-said,项目名称:Twitter_Client,代码行数:7,代码来源:TwitterApiClient.java
示例10: mockApiClient
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
static void mockApiClient(TwitterApiClient apiClient) {
final StatusesService statusesService = mock(StatusesService.class, new MockCallAnswer());
when(apiClient.getStatusesService()).thenReturn(statusesService);
}
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:6,代码来源:MockUtils.java
示例11: testGetService_cachedService
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
public void testGetService_cachedService() throws Exception {
final TwitterApiClient client = newTwitterApiClient();
final StatusesService service = client.getService(StatusesService.class);
assertSame(service, client.getService(StatusesService.class));
}
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:6,代码来源:TwitterApiClientTest.java
示例12: testGetService_differentServices
import com.twitter.sdk.android.core.services.StatusesService; //导入依赖的package包/类
public void testGetService_differentServices() throws Exception {
final TwitterApiClient client = newTwitterApiClient();
final FavoriteService service = client.getService(FavoriteService.class);
assertNotSame(service, client.getService(StatusesService.class));
}
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:6,代码来源:TwitterApiClientTest.java
注:本文中的com.twitter.sdk.android.core.services.StatusesService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论