Merge pull request #87 from ArcaneChat/copilot/add-email-subject-field
Add subject field for mailing list chats
This commit is contained in:
commit
76e4c59119
4 changed files with 57 additions and 1 deletions
|
|
@ -786,6 +786,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
return future;
|
||||
}
|
||||
|
||||
inputPanel.setSubject(draft.getSubject());
|
||||
|
||||
final String text = TextUtils.isEmpty(sharedText)? draft.getText() : sharedText;
|
||||
if(!text.isEmpty()) {
|
||||
composeText.setText(text);
|
||||
|
|
@ -977,10 +979,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
if (dcChat.canSend()) {
|
||||
composePanel.setVisibility(View.VISIBLE);
|
||||
attachmentManager.setHidden(false);
|
||||
inputPanel.setSubjectVisible(!dcChat.isEncrypted());
|
||||
} else {
|
||||
composePanel.setVisibility(View.GONE);
|
||||
attachmentManager.setHidden(true);
|
||||
hideSoftKeyboard();
|
||||
inputPanel.setSubjectVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1063,12 +1067,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
|
||||
Optional<QuoteModel> quote = inputPanel.getQuote();
|
||||
boolean editing = isEditing;
|
||||
final String subject = inputPanel.getSubject();
|
||||
|
||||
// for a quick ui feedback, we clear the related controls immediately on sending messages.
|
||||
// for drafts, however, we do not change the controls, the activity may be resumed.
|
||||
if (action==ACTION_SEND_OUT) {
|
||||
composeText.setText("");
|
||||
inputPanel.clearQuote();
|
||||
inputPanel.clearSubject();
|
||||
}
|
||||
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
|
|
@ -1133,6 +1139,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
msg.setQuote(quote.get().getQuotedMsg());
|
||||
}
|
||||
|
||||
if (!subject.isEmpty() && msg != null) {
|
||||
msg.setSubject(subject);
|
||||
}
|
||||
|
||||
if (action==ACTION_SEND_OUT) {
|
||||
|
||||
// for WEBXDC, drafts are just sent out as is.
|
||||
|
|
|
|||
|
|
@ -411,8 +411,11 @@ public class ConversationItem extends BaseConversationItem
|
|||
bodyText.setClickable(false);
|
||||
bodyText.setFocusable(false);
|
||||
|
||||
String subject = messageRecord.getSubject();
|
||||
String text = messageRecord.getText();
|
||||
|
||||
if (!subject.isEmpty() && messageRecord.isOutgoing() && !messageRecord.isSecure()) text = subject + "\n\n" + text;
|
||||
|
||||
if (messageRecord.getType() == DcMsg.DC_MSG_CALL || text.isEmpty()) {
|
||||
bodyText.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class InputPanel extends ConstraintLayout
|
|||
private QuoteView quoteView;
|
||||
private EmojiToggle emojiToggle;
|
||||
private ComposeText composeText;
|
||||
private android.widget.EditText subjectText;
|
||||
private View quickCameraToggle;
|
||||
private View quickAudioToggle;
|
||||
private View buttonToggle;
|
||||
|
|
@ -91,6 +92,7 @@ public class InputPanel extends ConstraintLayout
|
|||
this.quoteView = findViewById(R.id.quote_view);
|
||||
this.emojiToggle = findViewById(R.id.emoji_toggle);
|
||||
this.composeText = findViewById(R.id.embedded_text_editor);
|
||||
this.subjectText = findViewById(R.id.subject_text);
|
||||
this.quickCameraToggle = findViewById(R.id.quick_camera_toggle);
|
||||
this.quickAudioToggle = findViewById(R.id.quick_audio_toggle);
|
||||
this.buttonToggle = findViewById(R.id.button_toggle);
|
||||
|
|
@ -198,6 +200,30 @@ public class InputPanel extends ConstraintLayout
|
|||
composeText.performClick();
|
||||
}
|
||||
|
||||
public void setSubjectVisible(boolean visible) {
|
||||
subjectText.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
emojiToggle.setVisibility(!visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
if (subjectText != null && subjectText.getVisibility() == View.VISIBLE) {
|
||||
return subjectText.getText().toString().trim();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void clearSubject() {
|
||||
if (subjectText != null) {
|
||||
subjectText.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
if (subjectText != null && subject != null) {
|
||||
subjectText.setText(subject);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMediaKeyboard(@NonNull MediaKeyboard mediaKeyboard) {
|
||||
mediaKeyboard.setKeyboardListener(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,28 @@
|
|||
app:message_type="preview"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/subject_text"
|
||||
style="@style/ComposeEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:hint="@string/subject"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/quote_view"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/input_field_frame_layout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/button_toggle"
|
||||
app:layout_constraintTop_toBottomOf="@id/quote_view"
|
||||
app:layout_constraintTop_toBottomOf="@id/subject_text"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue