Search in sources :

Example 1 with Comment

use of io.plaidapp.data.api.dribbble.model.Comment in project plaid by nickbutcher.

the class DribbbleShot method postComment.

public void postComment(View view) {
    if (dribbblePrefs.isLoggedIn()) {
        if (TextUtils.isEmpty(enterComment.getText()))
            return;
        enterComment.setEnabled(false);
        final Call<Comment> postCommentCall = dribbblePrefs.getApi().postComment(shot.id, enterComment.getText().toString().trim());
        postCommentCall.enqueue(new Callback<Comment>() {

            @Override
            public void onResponse(Call<Comment> call, Response<Comment> response) {
                loadComments();
                enterComment.getText().clear();
                enterComment.setEnabled(true);
            }

            @Override
            public void onFailure(Call<Comment> call, Throwable t) {
                enterComment.setEnabled(true);
            }
        });
    } else {
        Intent login = new Intent(DribbbleShot.this, DribbbleLogin.class);
        FabTransform.addExtras(login, ContextCompat.getColor(DribbbleShot.this, R.color.background_light), R.drawable.ic_comment_add);
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(DribbbleShot.this, postComment, getString(R.string.transition_dribbble_login));
        startActivityForResult(login, RC_LOGIN_COMMENT, options.toBundle());
    }
}
Also used : Comment(io.plaidapp.data.api.dribbble.model.Comment) CustomTabsIntent(android.support.customtabs.CustomTabsIntent) Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions)

Aggregations

ActivityOptions (android.app.ActivityOptions)1 Intent (android.content.Intent)1 CustomTabsIntent (android.support.customtabs.CustomTabsIntent)1 Comment (io.plaidapp.data.api.dribbble.model.Comment)1