From 9e07c59565603bfcb6cc76db9e6d85779675a2e5 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Sun, 2 Jul 2017 16:34:10 -0400 Subject: [PATCH] Adjusts composer imports. --- .../keylesspalace/tusky/ComposeActivity.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 865c18ed4..e9f2975c7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -87,6 +87,7 @@ import com.keylesspalace.tusky.util.MediaUtils; import com.keylesspalace.tusky.util.MentionTokenizer; import com.keylesspalace.tusky.util.ParserUtils; import com.keylesspalace.tusky.util.SpanUtils; +import com.keylesspalace.tusky.util.StringUtils; import com.keylesspalace.tusky.util.ThemeUtils; import com.keylesspalace.tusky.view.EditTextTyped; import com.keylesspalace.tusky.view.RoundedTransformation; @@ -112,12 +113,6 @@ import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; -import static com.keylesspalace.tusky.util.MediaUtils.MEDIA_SIZE_UNKNOWN; -import static com.keylesspalace.tusky.util.MediaUtils.getMediaSize; -import static com.keylesspalace.tusky.util.MediaUtils.inputStreamGetBytes; -import static com.keylesspalace.tusky.util.StringUtils.carriageReturn; -import static com.keylesspalace.tusky.util.StringUtils.randomAlphanumericString; - public class ComposeActivity extends BaseActivity implements ComposeOptionsFragment.Listener, ParserUtils.ParserListener { private static final String TAG = "ComposeActivity"; // logging tag private static final int STATUS_CHARACTER_LIMIT = 500; @@ -398,7 +393,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm } } for (Uri uri : uriList) { - long mediaSize = getMediaSize(getContentResolver(), uri); + long mediaSize = MediaUtils.getMediaSize(getContentResolver(), uri); pickMedia(uri, mediaSize); } } else if (type.equals("text/plain")) { @@ -663,7 +658,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm // Just eat this exception. } } else { - mediaSize = MEDIA_SIZE_UNKNOWN; + mediaSize = MediaUtils.MEDIA_SIZE_UNKNOWN; } pickMedia(uri, mediaSize); @@ -806,7 +801,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm @Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], - @NonNull int[] grantResults) { + @NonNull int[] grantResults) { switch (requestCode) { case PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE: { if (grantResults.length > 0 @@ -1004,7 +999,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm final String filename = String.format("%s_%s_%s.%s", getString(R.string.app_name), String.valueOf(new Date().getTime()), - randomAlphanumericString(10), + StringUtils.randomAlphanumericString(10), fileExtension); byte[] content = item.content; @@ -1019,7 +1014,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm return; } - content = inputStreamGetBytes(stream); + content = MediaUtils.inputStreamGetBytes(stream); IOUtils.closeQuietly(stream); if (content == null) { @@ -1099,17 +1094,17 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm super.onActivityResult(requestCode, resultCode, data); if (requestCode == MEDIA_PICK_RESULT && resultCode == RESULT_OK && data != null) { Uri uri = data.getData(); - long mediaSize = getMediaSize(getContentResolver(), uri); + long mediaSize = MediaUtils.getMediaSize(getContentResolver(), uri); pickMedia(uri, mediaSize); } else if (requestCode == MEDIA_TAKE_PHOTO_RESULT && resultCode == RESULT_OK) { - long mediaSize = getMediaSize(getContentResolver(), photoUploadUri); + long mediaSize = MediaUtils.getMediaSize(getContentResolver(), photoUploadUri); pickMedia(photoUploadUri, mediaSize); } } private void pickMedia(Uri uri, long mediaSize) { ContentResolver contentResolver = getContentResolver(); - if (mediaSize == MEDIA_SIZE_UNKNOWN) { + if (mediaSize == MediaUtils.MEDIA_SIZE_UNKNOWN) { displayTransientError(R.string.error_media_upload_opening); return; } @@ -1211,7 +1206,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm if (!TextUtils.isEmpty(headerInfo.title)) { cleanBaseUrl(headerInfo); textEditor.append(headerInfo.title); - textEditor.append(carriageReturn); + textEditor.append(StringUtils.carriageReturn); textEditor.append(headerInfo.baseUrl); } if (!TextUtils.isEmpty(headerInfo.image)) { @@ -1230,7 +1225,8 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm runOnUiThread(new Runnable() { @Override public void run() { - long mediaSize = getMediaSize(getContentResolver(), headerInfo); + long mediaSize = MediaUtils.getMediaSize(getContentResolver(), + headerInfo); pickMedia(headerInfo, mediaSize); } });