Commit dc649b19 authored by akwizgran's avatar akwizgran

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;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
......@@ -198,7 +197,7 @@ public class GroupActivity extends
private void setGroupEnabled(boolean enabled) {
isDissolved = !enabled;
textInput.setEnabled(enabled);
sendController.setReady(enabled);
list.getRecyclerView().setAlpha(enabled ? 1f : 0.5f);
if (!enabled) {
......
......@@ -28,6 +28,7 @@ public abstract class BaseMessageFragment extends BaseFragment
implements SendListener {
protected LargeTextInputView message;
private TextSendController sendController;
private MessageFragmentListener listener;
@Override
......@@ -45,8 +46,7 @@ public abstract class BaseMessageFragment extends BaseFragment
View v = inflater.inflate(R.layout.fragment_message, container,
false);
message = v.findViewById(R.id.messageView);
TextSendController sendController =
new TextSendController(message, this, true);
sendController = new TextSendController(message, this, true);
message.setSendController(sendController);
message.setMaxTextLength(listener.getMaximumTextLength());
message.setButtonText(getString(getButtonText()));
......@@ -85,7 +85,7 @@ public abstract class BaseMessageFragment extends BaseFragment
@Override
public void onSendClick(@Nullable String text, List<Uri> imageUris) {
// disable button to prevent accidental double actions
message.setEnabled(false);
sendController.setReady(false);
message.hideSoftKeyboard();
listener.onButtonClick(text);
......
......@@ -62,6 +62,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
protected BriarRecyclerView list;
private LinearLayoutManager layoutManager;
protected TextInputView textInput;
protected TextSendController sendController;
protected GroupId groupId;
@Nullable
private Parcelable layoutManagerState;
......@@ -87,8 +88,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
getController().setGroupId(groupId);
textInput = findViewById(R.id.text_input_container);
TextSendController sendController =
new TextSendController(textInput, this, false);
sendController = new TextSendController(textInput, this, false);
textInput.setSendController(sendController);
textInput.setMaxTextLength(getMaxTextLength());
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