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


Java Result类代码示例

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


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

示例1: loadTweet

import com.twitter.sdk.android.core.Result; //导入依赖的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

示例2: onLogin

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
@Override
public void onLogin() {
    twitterAuthClient.authorize(activity, new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            Map<UserInfoType, String> userInfoMap = new HashMap<>();

            String id = String.valueOf(result.data.getUserId());
            String name = result.data.getUserName();

            userInfoMap.put(UserInfoType.ID, id);
            userInfoMap.put(UserInfoType.NAME, name);

            responseListener.onResult(SocialType.TWITTER, ResultType.SUCCESS, userInfoMap);
        }

        @Override
        public void failure(TwitterException exception) {
            responseListener.onResult(SocialType.TWITTER, ResultType.FAILURE, null);
        }
    });
}
 
开发者ID:WindSekirun,项目名称:SocialLogin,代码行数:23,代码来源:TwitterLogin.java

示例3: onCreate

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_landing);

    // Intent to start the content activity
    final Intent i = new Intent(this, HomeActivity.class);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    if (App.getApplicationInstance().getTwitterSession() != null)
        startActivity(i);

    loginButton = (TwitterLoginButton) findViewById(R.id.login_button);
    loginButton.setCallback(new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            // Show contents activity
            startActivity(i);
        }

        @Override
        public void failure(TwitterException exception) {
            // Do something on failure
        }
    });
}
 
开发者ID:beraldofilippo,项目名称:TWStreaming,代码行数:27,代码来源:LandingActivity.java

示例4: onCreate

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);

    if (Twitter.getSessionManager().getActiveSession() != null){
        navigateToMainScreen();
    }

    twitterLoginButton.setCallback(new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            navigateToMainScreen();
        }

        @Override
        public void failure(TwitterException e) {
            String msgError = String.format(getString(R.string.login_error_message),
                                            e.getLocalizedMessage());
            Snackbar.make(container, msgError, Snackbar.LENGTH_SHORT).show();
        }
    });
}
 
开发者ID:micromasterandroid,项目名称:androidadvanced,代码行数:25,代码来源:LoginActivity.java

示例5: handleTweet

import com.twitter.sdk.android.core.Result; //导入依赖的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: initializeTwitterLogin

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
void initializeTwitterLogin() {
    Twitter.initialize(LoginActivity.this);
    mLoginButton = (TwitterLoginButton) findViewById(R.id.login_button);
    mLoginButton.setCallback(new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            // Do something with result, which provides a TwitterSession for making API calls
            Log.d(TAG, "twitterLogin:success" + result);
            handleTwitterSession(result.data);
        }

        @Override
        public void failure(TwitterException exception) {
            Log.w(TAG, "twitterLogin:failure", exception);
        }
    });
}
 
开发者ID:cache117,项目名称:social-journal,代码行数:18,代码来源:LoginActivity.java

示例7: fetchTwitterUserData

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
private void fetchTwitterUserData(final IOperationFinishWithDataCallback profileFetched) {
    TwitterSession session =
            Twitter.getSessionManager().getActiveSession();
    Twitter.getApiClient(session).getAccountService()
            .verifyCredentials(true, false, new Callback<User>() {
                @Override
                public void success(Result<User> userResult) {
                    User user = userResult.data;
                    userProfile = new UserProfile();
                    userProfile.setName(user.screenName);
                    String profileImage = user.profileImageUrlHttps;
                    profileImage = profileImage.replace("_normal", "");
                    userProfile.setProfileImageUrl(profileImage);
                    profileFetched.operationFinished(userProfile);
                }

                @Override
                public void failure(TwitterException e) {

                }
            });
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:23,代码来源:LoginMaster.java

示例8: login

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
@ReactMethod
public void login(final Callback callback) {

    loginButton = new TwitterLoginButton(getCurrentActivity());
    loginButton.setCallback(new com.twitter.sdk.android.core.Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> sessionResult) {
            WritableMap result = new WritableNativeMap();
            result.putString("authToken", sessionResult.data.getAuthToken().token);
            result.putString("authTokenSecret",sessionResult.data.getAuthToken().secret);
            result.putString("userID", sessionResult.data.getUserId()+"");
            result.putString("userName", sessionResult.data.getUserName());
            callback.invoke(null, result);
        }

        @Override
        public void failure(TwitterException exception) {
            exception.printStackTrace();
            callback.invoke(exception.getMessage());
        }
    });

    loginButton.performClick();
}
 
开发者ID:tkporter,项目名称:react-native-fabric-twitterkit,代码行数:25,代码来源:FabricTwitterKitModule.java

示例9: loginWithTwitter

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
public void loginWithTwitter(TwitterAuthClient mTwitterAuthClient) {

        mTwitterAuthClient.authorize(activity, new com.twitter.sdk.android.core.Callback<TwitterSession>() {

            @Override
            public void success(Result<TwitterSession> twitterSessionResult) {
                // Success
                shareOnTwitter(imgPath, etsharing_text.getText().toString());
            }

            @Override
            public void failure(TwitterException e) {

            }
        });
    }
 
开发者ID:saveendhiman,项目名称:BackgroundTwitterSharing,代码行数:17,代码来源:TwitterSharingActivity.java

示例10: onRefresh

import com.twitter.sdk.android.core.Result; //导入依赖的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

示例11: requestTwitterUserData

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
@Override
public void requestTwitterUserData() {
    TwitterSession session = Twitter.getSessionManager().getActiveSession();
    Twitter.getApiClient(session).getAccountService().verifyCredentials(true, false, new Callback<User>() {
        @Override
        public void success(Result<User> userResult) {
            User user = userResult.data;
            final String fullName = user.name;
            final String userImage = user.profileImageUrl.replace("_normal", "");
            loginAsGuestPresenter.twitterUserDataSuccess(fullName, userImage);
        }

        @Override
        public void failure(TwitterException e) {

        }
    });
}
 
开发者ID:belatrix,项目名称:AndroidAllStars,代码行数:19,代码来源:LoginAsGuestFragment.java

示例12: requestTwitterEmail

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
@Override
public void requestTwitterEmail() {
    TwitterSession session = Twitter.getSessionManager().getActiveSession();
    twitterAuthClient.requestEmail(session, new Callback<String>() {
        @Override
        public void success(Result<String> result) {
            String email = result.data;
            loginAsGuestPresenter.twitterEmailSuccess(email);
        }

        @Override
        public void failure(TwitterException exception) {
            loginAsGuestPresenter.onGettingEmailError();
        }
    });
}
 
开发者ID:belatrix,项目名称:AndroidAllStars,代码行数:17,代码来源:LoginAsGuestFragment.java

示例13: loginTwitter

import com.twitter.sdk.android.core.Result; //导入依赖的package包/类
/**
 * Twitter
 */

private void loginTwitter() {
    Log.i(TAG, "loginTwitter: Activity = " + getActivity().getClass().getSimpleName());
    PDSocialUtils.loginWithTwitter(getActivity(), new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            if (result.data != null) {
                Log.i(TAG, "success: Twitter Data present");
                registerTwitterAccount(result.data);
            } else {
                showGenericAlert();
            }
        }

        @Override
        public void failure(TwitterException e) {
            if (getActivity() != null) {
                PDUIDialogUtils.showBasicOKAlertDialog(getActivity(), R.string.pd_claim_twitter_button_text, e.getMessage());
            }
        }
    });
}
 
开发者ID:Popdeem,项目名称:Popdeem-SDK-Android,代码行数:26,代码来源:PDUISocialMultiLoginFragment.java

示例14: onCreate

import com.twitter.sdk.android.core.Result; //导入依赖的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

示例15: loadAllTweets

import com.twitter.sdk.android.core.Result; //导入依赖的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


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