removed character limit of message conversation fragment

This commit is contained in:
Mariotaku Lee 2015-11-06 08:36:19 +08:00
parent 83ee6d855b
commit abb76664ee
3 changed files with 12 additions and 3 deletions

View File

@ -630,8 +630,6 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
final String message = mEditText.getText().toString(); final String message = mEditText.getText().toString();
if (TextUtils.isEmpty(message)) { if (TextUtils.isEmpty(message)) {
mEditText.setError(getString(R.string.error_message_no_content)); mEditText.setError(getString(R.string.error_message_no_content));
} else if (mValidator.getTweetLength(message) > mValidator.getMaxTweetLength()) {
mEditText.setError(getString(R.string.error_message_message_too_long));
} else { } else {
mTwitterWrapper.sendDirectMessageAsync(account.account_id, recipient.id, message, mImageUri); mTwitterWrapper.sendDirectMessageAsync(account.account_id, recipient.id, message, mImageUri);
mEditText.setText(null); mEditText.setText(null);
@ -727,7 +725,7 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
@Override @Override
public void onTextChanged(final CharSequence s, final int start, final int before, final int count) { public void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
if (mSendButton == null || s == null) return; if (mSendButton == null || s == null) return;
mSendButton.setEnabled(mValidator.isValidTweet(s.toString())); mSendButton.setEnabled(mValidator.isValidDirectMessage(s.toString()));
} }
}); });
} }

View File

@ -55,4 +55,8 @@ public class TwidereValidator implements Constants {
return !TextUtils.isEmpty(text) && getTweetLength(text) <= getMaxTweetLength(); return !TextUtils.isEmpty(text) && getTweetLength(text) <= getMaxTweetLength();
} }
public boolean isValidDirectMessage(final CharSequence text) {
return !TextUtils.isEmpty(text);
}
} }

View File

@ -3350,6 +3350,13 @@ public final class Utils implements Constants {
final MenuItem favorite = menu.findItem(R.id.favorite); final MenuItem favorite = menu.findItem(R.id.favorite);
if (favorite != null) { if (favorite != null) {
if (preferences.getBoolean(KEY_I_WANT_MY_STARS_BACK)) { if (preferences.getBoolean(KEY_I_WANT_MY_STARS_BACK)) {
final Drawable oldIcon = favorite.getIcon();
if (oldIcon instanceof ActionIconDrawable) {
final Drawable starIcon = ContextCompat.getDrawable(context, R.drawable.ic_action_star);
favorite.setIcon(new ActionIconDrawable(starIcon, ((ActionIconDrawable) oldIcon).getDefaultColor()));
} else {
favorite.setIcon(R.drawable.ic_action_star);
}
ActionIconDrawable.setMenuHighlight(favorite, new TwidereMenuInfo(status.is_favorite, favoriteHighlight)); ActionIconDrawable.setMenuHighlight(favorite, new TwidereMenuInfo(status.is_favorite, favoriteHighlight));
favorite.setTitle(status.is_favorite ? R.string.unfavorite : R.string.favorite); favorite.setTitle(status.is_favorite ? R.string.unfavorite : R.string.favorite);
} else { } else {