Browse Source

close #1346

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
bcfe4819cb
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 32
      app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java

32
app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java

@ -7,6 +7,8 @@ import android.graphics.drawable.Animatable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.Gravity; import android.view.Gravity;
@ -214,7 +216,7 @@ public class StoryViewerFragment extends Fragment {
if (itemId == R.id.action_dms) { if (itemId == R.id.action_dms) {
final EditText input = new EditText(context); final EditText input = new EditText(context);
input.setHint(R.string.reply_hint); input.setHint(R.string.reply_hint);
new AlertDialog.Builder(context)
final AlertDialog ad = new AlertDialog.Builder(context)
.setTitle(R.string.reply_story) .setTitle(R.string.reply_story)
.setView(input) .setView(input)
.setPositiveButton(R.string.confirm, (d, w) -> directMessagesService.createThread( .setPositiveButton(R.string.confirm, (d, w) -> directMessagesService.createThread(
@ -247,6 +249,19 @@ public class StoryViewerFragment extends Fragment {
)) ))
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show(); .show();
ad.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
input.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) {}
@Override
public void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
ad.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(!TextUtils.isEmpty(s));
}
@Override
public void afterTextChanged(final Editable s) {}
});
return true; return true;
} }
if (itemId == R.id.action_profile) { if (itemId == R.id.action_profile) {
@ -529,7 +544,7 @@ public class StoryViewerFragment extends Fragment {
question = (QuestionModel) tag; question = (QuestionModel) tag;
final EditText input = new EditText(context); final EditText input = new EditText(context);
input.setHint(R.string.answer_hint); input.setHint(R.string.answer_hint);
new AlertDialog.Builder(context)
final AlertDialog ad = new AlertDialog.Builder(context)
.setTitle(question.getQuestion()) .setTitle(question.getQuestion())
.setView(input) .setView(input)
.setPositiveButton(R.string.confirm, (d, w) -> { .setPositiveButton(R.string.confirm, (d, w) -> {
@ -559,6 +574,19 @@ public class StoryViewerFragment extends Fragment {
}) })
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.show(); .show();
ad.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
input.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) {}
@Override
public void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
ad.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(!TextUtils.isEmpty(s));
}
@Override
public void afterTextChanged(final Editable s) {}
});
} else if (tag instanceof String[]) { } else if (tag instanceof String[]) {
mentions = (String[]) tag; mentions = (String[]) tag;
new AlertDialog.Builder(context) new AlertDialog.Builder(context)

Loading…
Cancel
Save