Commit dc649b19 authored by akwizgran's avatar akwizgran
Browse files

Merge branch '1552-send-controller-exception' into 'master'

Don't disable TextInputView directly, use controller

Closes #1552

See merge request !1086
parents 421c9c44 3d9a8f9b
Pipeline #3247 passed with stage
in 11 minutes and 6 seconds
...@@ -4,7 +4,6 @@ import android.content.DialogInterface; ...@@ -4,7 +4,6 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
...@@ -198,7 +197,7 @@ public class GroupActivity extends ...@@ -198,7 +197,7 @@ public class GroupActivity extends
private void setGroupEnabled(boolean enabled) { private void setGroupEnabled(boolean enabled) {
isDissolved = !enabled; isDissolved = !enabled;
textInput.setEnabled(enabled); sendController.setReady(enabled);
list.getRecyclerView().setAlpha(enabled ? 1f : 0.5f); list.getRecyclerView().setAlpha(enabled ? 1f : 0.5f);
if (!enabled) { if (!enabled) {
......
...@@ -28,6 +28,7 @@ public abstract class BaseMessageFragment extends BaseFragment ...@@ -28,6 +28,7 @@ public abstract class BaseMessageFragment extends BaseFragment
implements SendListener { implements SendListener {
protected LargeTextInputView message; protected LargeTextInputView message;
private TextSendController sendController;
private MessageFragmentListener listener; private MessageFragmentListener listener;
@Override @Override
...@@ -45,8 +46,7 @@ public abstract class BaseMessageFragment extends BaseFragment ...@@ -45,8 +46,7 @@ public abstract class BaseMessageFragment extends BaseFragment
View v = inflater.inflate(R.layout.fragment_message, container, View v = inflater.inflate(R.layout.fragment_message, container,
false); false);
message = v.findViewById(R.id.messageView); message = v.findViewById(R.id.messageView);
TextSendController sendController = sendController = new TextSendController(message, this, true);
new TextSendController(message, this, true);
message.setSendController(sendController); message.setSendController(sendController);
message.setMaxTextLength(listener.getMaximumTextLength()); message.setMaxTextLength(listener.getMaximumTextLength());
message.setButtonText(getString(getButtonText())); message.setButtonText(getString(getButtonText()));
...@@ -85,7 +85,7 @@ public abstract class BaseMessageFragment extends BaseFragment ...@@ -85,7 +85,7 @@ public abstract class BaseMessageFragment extends BaseFragment
@Override @Override
public void onSendClick(@Nullable String text, List<Uri> imageUris) { public void onSendClick(@Nullable String text, List<Uri> imageUris) {
// disable button to prevent accidental double actions // disable button to prevent accidental double actions
message.setEnabled(false); sendController.setReady(false);
message.hideSoftKeyboard(); message.hideSoftKeyboard();
listener.onButtonClick(text); listener.onButtonClick(text);
......
...@@ -62,6 +62,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI ...@@ -62,6 +62,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
protected BriarRecyclerView list; protected BriarRecyclerView list;
private LinearLayoutManager layoutManager; private LinearLayoutManager layoutManager;
protected TextInputView textInput; protected TextInputView textInput;
protected TextSendController sendController;
protected GroupId groupId; protected GroupId groupId;
@Nullable @Nullable
private Parcelable layoutManagerState; private Parcelable layoutManagerState;
...@@ -87,8 +88,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI ...@@ -87,8 +88,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
getController().setGroupId(groupId); getController().setGroupId(groupId);
textInput = findViewById(R.id.text_input_container); textInput = findViewById(R.id.text_input_container);
TextSendController sendController = sendController = new TextSendController(textInput, this, false);
new TextSendController(textInput, this, false);
textInput.setSendController(sendController); textInput.setSendController(sendController);
textInput.setMaxTextLength(getMaxTextLength()); textInput.setMaxTextLength(getMaxTextLength());
textInput.setReady(true); textInput.setReady(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment