Created
September 16, 2020 07:43
-
-
Save tolunayozturk/047148b29957e633c599e573aed45489 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void commentFile() { | |
new Thread(new Runnable() { | |
@Override | |
public void run() { | |
try { | |
if (mAccessToken == null) { | |
Log.d(TAG, "need to sign in first"); | |
return; | |
} | |
if (fileSearched == null) { | |
Log.d(TAG, "query file first"); | |
return; | |
} | |
if (StringUtils.isNullOrEmpty(et_comment.getText().toString())) { | |
Log.d(TAG, "file name is required to comment"); | |
return; | |
} | |
Drive drive = buildDrive(); | |
Comment comment = new Comment(); | |
comment.setDescription(et_comment.getText().toString()); | |
mComment = drive.comments() | |
.create(fileSearched.getId(), comment) | |
.setFields("*") | |
.execute(); | |
if (mComment != null && mComment.getId() != null) { | |
Log.d(TAG, "add comment success"); | |
} else { | |
Log.d(TAG, "add comment failed"); | |
} | |
} catch (Exception e) { | |
Log.d(TAG, "add comment failed" + e.toString()); | |
} | |
} | |
}).start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment