fixed quoting dialog crash

fixed reply quote status name
This commit is contained in:
Mariotaku Lee 2015-05-14 11:11:55 +08:00
parent adc9434695
commit 5718920a5a
4 changed files with 18 additions and 9 deletions

View File

@ -962,12 +962,12 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
if (status == null || status.id <= 0) return false;
final String myScreenName = Utils.getAccountScreenName(this, status.account_id);
if (TextUtils.isEmpty(myScreenName)) return false;
if (!TextUtils.isEmpty(status.quoted_by_user_name)) {
mEditText.append("@" + status.quoted_by_user_name + " ");
if (status.is_quote) {
mEditText.append("@" + status.quoted_by_user_screen_name + " ");
}
mEditText.append("@" + status.user_screen_name + " ");
final int selectionStart = mEditText.length();
if (!TextUtils.isEmpty(status.retweeted_by_user_screen_name)) {
if (status.is_retweet) {
mEditText.append("@" + status.retweeted_by_user_screen_name + " ");
}
final Collection<String> mentions = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);

View File

@ -36,7 +36,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.rengwuxian.materialedittext.MaterialEditText;
import com.rengwuxian.materialedittext.validation.METLengthChecker;
import org.mariotaku.twidere.Constants;
@ -50,6 +49,7 @@ import org.mariotaku.twidere.util.MenuUtils;
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.TwidereValidator;
import org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText;
import org.mariotaku.twidere.view.holder.StatusViewHolder;
import org.mariotaku.twidere.view.holder.StatusViewHolder.DummyStatusHolderAdapter;
@ -59,7 +59,7 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
Constants, DialogInterface.OnClickListener {
public static final String FRAGMENT_TAG = "retweet_quote";
private MaterialEditText mEditComment;
private UserHashtagAutoCompleteEditText mEditComment;
private PopupMenu mPopupMenu;
private View mCommentMenu;
private TwidereValidator mValidator;
@ -113,7 +113,8 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
view.findViewById(R.id.item_menu).setVisibility(View.GONE);
view.findViewById(R.id.action_buttons).setVisibility(View.GONE);
view.findViewById(R.id.item_content).setFocusable(false);
mEditComment = (MaterialEditText) view.findViewById(R.id.edit_comment);
mEditComment = (UserHashtagAutoCompleteEditText) view.findViewById(R.id.edit_comment);
mEditComment.setAccountId(status.account_id);
mEditComment.setLengthChecker(new METLengthChecker() {
final String statusLink = LinkCreator.getTwitterStatusLink(status.user_screen_name, status.quote_id).toString();

View File

@ -20,6 +20,8 @@
package org.mariotaku.twidere.view;
import android.content.Context;
import android.content.res.ColorStateList;
import android.support.annotation.NonNull;
import android.text.InputType;
import android.text.method.ArrowKeyMovementMethod;
import android.util.AttributeSet;
@ -29,8 +31,9 @@ import com.rengwuxian.materialedittext.MaterialMultiAutoCompleteTextView;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.UserHashtagAutoCompleteAdapter;
import org.mariotaku.twidere.util.widget.ScreenNameTokenizer;
import org.mariotaku.twidere.view.iface.IThemeBackgroundTintView;
public class UserHashtagAutoCompleteEditText extends MaterialMultiAutoCompleteTextView {
public class UserHashtagAutoCompleteEditText extends MaterialMultiAutoCompleteTextView implements IThemeBackgroundTintView {
private UserHashtagAutoCompleteAdapter mAdapter;
private long mAccountId;
@ -75,6 +78,11 @@ public class UserHashtagAutoCompleteEditText extends MaterialMultiAutoCompleteTe
}
}
@Override
public void setBackgroundTintColor(@NonNull ColorStateList color) {
setPrimaryColor(color.getDefaultColor());
}
public void setAccountId(long accountId) {
mAccountId = accountId;
updateAccountId();

View File

@ -37,7 +37,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
<org.mariotaku.twidere.view.themed.BackgroundTintMaterialEditText
<org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText
android:id="@+id/edit_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -55,7 +55,7 @@
app:met_textColorHint="?android:textColorTertiary">
<requestFocus />
</org.mariotaku.twidere.view.themed.BackgroundTintMaterialEditText>
</org.mariotaku.twidere.view.UserHashtagAutoCompleteEditText>
<org.mariotaku.twidere.view.ActionIconButton
android:id="@+id/comment_menu"