Fixes cursor being placed after a media link when it is added in the composer. Also, adjusts a tinting error in the composer buttons.

This commit is contained in:
Vavassor 2017-06-20 16:57:04 -04:00
parent b9b5e58b50
commit 2e29088d65
2 changed files with 13 additions and 6 deletions

View file

@ -682,7 +682,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
mediaIds.add(item.id); mediaIds.add(item.id);
} }
mastodonAPI.createStatus(content, inReplyToId, spoilerText, visibility, sensitive, mediaIds).enqueue(new Callback<Status>() { Callback<Status> callback = new Callback<Status>() {
@Override @Override
public void onResponse(Call<Status> call, Response<Status> response) { public void onResponse(Call<Status> call, Response<Status> response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
@ -696,11 +696,14 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
public void onFailure(Call<Status> call, Throwable t) { public void onFailure(Call<Status> call, Throwable t) {
onSendFailure(); onSendFailure();
} }
}); };
mastodonAPI.createStatus(content, inReplyToId, spoilerText, visibility, sensitive, mediaIds)
.enqueue(callback);
} }
private void onSendSuccess() { private void onSendSuccess() {
Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose), getString(R.string.confirmation_send), Snackbar.LENGTH_SHORT); Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose),
getString(R.string.confirmation_send), Snackbar.LENGTH_SHORT);
bar.show(); bar.show();
setResult(COMPOSE_SUCCESS); setResult(COMPOSE_SUCCESS);
finish(); finish();
@ -1059,8 +1062,12 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm
SpannableStringBuilder builder = new SpannableStringBuilder(); SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append(' '); builder.append(' ');
builder.append(media.textUrl); builder.append(media.textUrl);
builder.setSpan(item.uploadUrl, 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setSpan(item.uploadUrl, 1, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
int cursorStart = textEditor.getSelectionStart();
textEditor.append(builder); textEditor.append(builder);
if (cursorStart == textEditor.getText().length()) {
textEditor.setSelection(cursorStart);
}
waitForMediaLatch.countDown(); waitForMediaLatch.countDown();
} }

View file

@ -32,7 +32,7 @@
<color name="tab_page_margin_dark">#4C534B</color> <color name="tab_page_margin_dark">#4C534B</color>
<color name="account_toolbar_icon_collapsed_dark">#FFFFFF</color> <color name="account_toolbar_icon_collapsed_dark">#FFFFFF</color>
<color name="account_header_background_dark">#000000</color> <color name="account_header_background_dark">#000000</color>
<color name="compose_media_button_dark">#FFFFFF</color> <color name="compose_media_button_dark">#d9e1e8</color>
<color name="compose_media_button_disabled_dark">#8F8F8F</color> <color name="compose_media_button_disabled_dark">#8F8F8F</color>
<color name="compose_mention_dark">#AFBFCF</color> <color name="compose_mention_dark">#AFBFCF</color>
<color name="report_status_background_dark">#000000</color> <color name="report_status_background_dark">#000000</color>
@ -66,7 +66,7 @@
<color name="tab_page_margin_light">#9F9F9F</color> <color name="tab_page_margin_light">#9F9F9F</color>
<color name="account_toolbar_icon_collapsed_light">#DE000000</color> <color name="account_toolbar_icon_collapsed_light">#DE000000</color>
<color name="account_header_background_light">#EFEFEF</color> <color name="account_header_background_light">#EFEFEF</color>
<color name="compose_media_button_light">#DE000000</color> <color name="compose_media_button_light">#4f4f4f</color>
<color name="compose_media_button_disabled_light">#8F8F8F</color> <color name="compose_media_button_disabled_light">#8F8F8F</color>
<color name="compose_mention_light">#2F5F6F</color> <color name="compose_mention_light">#2F5F6F</color>
<color name="report_status_background_light">#EFEFEF</color> <color name="report_status_background_light">#EFEFEF</color>