aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java
index 93e4e2a8..2c3e10b6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java
@@ -433,6 +433,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
}
private void uploadImageToReddit(Uri imageUri) {
+ Toast.makeText(this, R.string.uploading_image, Toast.LENGTH_SHORT).show();
Handler handler = new Handler();
mExecutor.execute(() -> {
try {
@@ -449,8 +450,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
int start = Math.max(commentEditText.getSelectionStart(), 0);
int end = Math.max(commentEditText.getSelectionEnd(), 0);
commentEditText.getText().replace(Math.min(start, end), Math.max(start, end),
- "[" + imageUrlOrError + "](" + imageUrlOrError + ")",
- 0, "[]()".length() + imageUrlOrError.length() + imageUrlOrError.length());
+ "[" + fileName + "](" + imageUrlOrError + ")",
+ 0, "[]()".length() + fileName.length() + imageUrlOrError.length());
+ Snackbar.make(coordinatorLayout, R.string.upload_image_success, Snackbar.LENGTH_LONG).show();
} else {
Toast.makeText(CommentActivity.this, R.string.upload_image_failed, Toast.LENGTH_LONG).show();
}
@@ -497,7 +499,11 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
if (cursor != null) {
int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
cursor.moveToFirst();
- return cursor.getString(nameIndex);
+ String fileName = cursor.getString(nameIndex);
+ if(fileName != null && fileName.contains(".")) {
+ fileName = fileName.substring(0, fileName.lastIndexOf('.'));
+ }
+ return fileName;
}
}