Fixed: In the composer, certain combinations of opening/closing the keyboard and add/removing media items would cause the text editor to shrink so the text was no longer visible.

This commit is contained in:
Vavassor 2017-02-07 16:05:55 -05:00
parent b4a91112a3
commit 5f39da27b3
1 changed files with 4 additions and 12 deletions

View File

@ -506,15 +506,6 @@ public class ComposeActivity extends AppCompatActivity {
startActivityForResult(intent, MEDIA_PICK_RESULT); startActivityForResult(intent, MEDIA_PICK_RESULT);
} }
/** A replacement for View.setPaddingRelative to use under API level 16. */
private static void setPaddingRelative(View view, int left, int top, int right, int bottom) {
view.setPadding(
view.getPaddingLeft() + left,
view.getPaddingTop() + top,
view.getPaddingRight() + right,
view.getPaddingBottom() + bottom);
}
private void enableMediaPicking() { private void enableMediaPicking() {
mediaPick.setEnabled(true); mediaPick.setEnabled(true);
} }
@ -550,7 +541,8 @@ public class ComposeActivity extends AppCompatActivity {
* is aligned to the bottom. But, so that text doesn't get hidden under it, extra * is aligned to the bottom. But, so that text doesn't get hidden under it, extra
* padding is added at the bottom of the EditText. */ * padding is added at the bottom of the EditText. */
int totalHeight = side + margin + marginBottom; int totalHeight = side + margin + marginBottom;
setPaddingRelative(textEditor, 0, 0, 0, totalHeight); textEditor.setPadding(textEditor.getPaddingLeft(), textEditor.getPaddingTop(),
textEditor.getPaddingRight(), totalHeight);
// If there's one video in the queue it is full, so disable the button to queue more. // If there's one video in the queue it is full, so disable the button to queue more.
if (item.getType() == QueuedMedia.Type.VIDEO) { if (item.getType() == QueuedMedia.Type.VIDEO) {
disableMediaPicking(); disableMediaPicking();
@ -571,14 +563,14 @@ public class ComposeActivity extends AppCompatActivity {
} }
private void removeMediaFromQueue(QueuedMedia item) { private void removeMediaFromQueue(QueuedMedia item) {
int moveBottom = mediaPreviewBar.getMeasuredHeight();
mediaPreviewBar.removeView(item.getPreview()); mediaPreviewBar.removeView(item.getPreview());
mediaQueued.remove(item); mediaQueued.remove(item);
if (mediaQueued.size() == 0) { if (mediaQueued.size() == 0) {
showMarkSensitive(false); showMarkSensitive(false);
/* If there are no image previews to show, the extra padding that was added to the /* If there are no image previews to show, the extra padding that was added to the
* EditText can be removed so there isn't unnecessary empty space. */ * EditText can be removed so there isn't unnecessary empty space. */
setPaddingRelative(textEditor, 0, 0, 0, moveBottom); textEditor.setPadding(textEditor.getPaddingLeft(), textEditor.getPaddingTop(),
textEditor.getPaddingRight(), 0);
} }
enableMediaPicking(); enableMediaPicking();
cancelReadyingMedia(item); cancelReadyingMedia(item);