mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Allow using the menu if there is a draft; add 'Attach files' as a normal menu entry to access this function if the normal 'attach' button is replaces by the 'send' button.
This commit is contained in:
@@ -134,7 +134,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private FrameLayout bottomOverlay;
|
||||
protected ChatActivityEnterView chatActivityEnterView;
|
||||
private ActionBarMenuItem menuItem;
|
||||
private ActionBarMenuItem attachItem;
|
||||
private ActionBarMenuItem headerItem;
|
||||
private ActionBarMenuItem searchItem;
|
||||
private LinearLayoutManager chatLayoutManager;
|
||||
@@ -200,7 +199,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private final static int id_copy = 10;
|
||||
private final static int id_forward = 11;
|
||||
private final static int id_delete_messages = 12;
|
||||
private final static int chat_menu_attach = 14;
|
||||
private final static int id_attach = 14;
|
||||
private final static int id_delete_chat = 16;
|
||||
private final static int mute = 18;
|
||||
private final static int id_reply = 19;
|
||||
@@ -512,7 +511,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
} else if (id == chat_menu_attach) {
|
||||
} else if (id == id_attach) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
@@ -541,21 +540,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
@Override
|
||||
public void onSearchCollapse() {
|
||||
avatarContainer.setVisibility(View.VISIBLE);
|
||||
if (chatActivityEnterView.hasText()) {
|
||||
if (headerItem != null) {
|
||||
headerItem.setVisibility(View.GONE);
|
||||
}
|
||||
if (attachItem != null) {
|
||||
attachItem.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (headerItem != null) {
|
||||
headerItem.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (attachItem != null) {
|
||||
attachItem.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
headerItem.setVisibility(View.VISIBLE);
|
||||
searchItem.setVisibility(View.GONE);
|
||||
highlightMessageId = Integer.MAX_VALUE;
|
||||
updateVisibleRows();
|
||||
@@ -604,6 +589,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
if( !isChatWithDeaddrop ) {
|
||||
headerItem.addSubItem(id_attach, LocaleController.getString("SendFiles", R.string.SendFiles), 0);
|
||||
if (m_mrChat.getType() == MrChat.MR_CHAT_GROUP) {
|
||||
headerItem.addSubItem(id_delete_chat, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit), 0);
|
||||
} else {
|
||||
@@ -615,9 +601,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
avatarContainer.updateSubtitle();
|
||||
updateTitleIcons();
|
||||
|
||||
attachItem = menu.addItem(chat_menu_attach, R.drawable.ic_ab_other).setOverrideMenuClick(true).setAllowCloseAnimation(false);
|
||||
attachItem.setVisibility(View.GONE);
|
||||
menuItem = menu.addItem(chat_menu_attach, R.drawable.ic_ab_attach).setAllowCloseAnimation(false);
|
||||
menuItem = menu.addItem(id_attach, R.drawable.ic_ab_attach).setAllowCloseAnimation(false); // "menuItem" is added to ChatEnterViewActivity
|
||||
menuItem.setBackgroundDrawable(null);
|
||||
|
||||
actionModeViews.clear();
|
||||
@@ -1101,35 +1085,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
MessagesController.getInstance().sendTyping(dialog_id, 0, classGuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachButtonHidden() {
|
||||
if (actionBar.isSearchFieldVisible()) {
|
||||
return;
|
||||
}
|
||||
if (attachItem != null) {
|
||||
attachItem.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (headerItem != null) {
|
||||
headerItem.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachButtonShow() {
|
||||
if (actionBar.isSearchFieldVisible()) {
|
||||
return;
|
||||
}
|
||||
if (attachItem != null) {
|
||||
attachItem.setVisibility(View.GONE);
|
||||
}
|
||||
if (headerItem != null) {
|
||||
headerItem.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowSizeChanged(int size) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2750,7 +2707,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private void openSearchWithText(String text) {
|
||||
avatarContainer.setVisibility(View.GONE);
|
||||
headerItem.setVisibility(View.GONE);
|
||||
attachItem.setVisibility(View.GONE);
|
||||
//attachItem.setVisibility(View.GONE);
|
||||
searchItem.setVisibility(View.VISIBLE);
|
||||
updateSearchButtons(0, 0, 0);
|
||||
updateBottomOverlay();
|
||||
|
||||
@@ -94,8 +94,8 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
void onMessageSend(CharSequence message);
|
||||
void needSendTyping();
|
||||
void onTextChanged(CharSequence text, boolean bigChange);
|
||||
void onAttachButtonHidden();
|
||||
void onAttachButtonShow();
|
||||
//void onAttachButtonHidden();
|
||||
//void onAttachButtonShow();
|
||||
void onWindowSizeChanged(int size);
|
||||
void onStickersTab(boolean opened);
|
||||
//void onMessageEditEnd(boolean loading);
|
||||
@@ -1308,9 +1308,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
});
|
||||
runningAnimation2.start();
|
||||
updateFieldRight(0);
|
||||
if (delegate != null) {
|
||||
/*if (delegate != null) {
|
||||
delegate.onAttachButtonHidden();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
runningAnimation = new AnimatorSet();
|
||||
@@ -1397,9 +1397,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
audioSendButton.setVisibility(GONE);
|
||||
if (attachButton != null) {
|
||||
attachButton.setVisibility(GONE);
|
||||
if (delegate != null) {
|
||||
/*if (delegate != null) {
|
||||
delegate.onAttachButtonHidden();
|
||||
}
|
||||
}*/
|
||||
updateFieldRight(0);
|
||||
}
|
||||
}
|
||||
@@ -1429,7 +1429,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
runningAnimation2.setDuration(100);
|
||||
runningAnimation2.start();
|
||||
updateFieldRight(1);
|
||||
delegate.onAttachButtonShow();
|
||||
//delegate.onAttachButtonShow();
|
||||
}
|
||||
|
||||
audioSendButton.setVisibility(VISIBLE);
|
||||
@@ -1486,7 +1486,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
sendButton.setVisibility(GONE);
|
||||
audioSendButton.setVisibility(VISIBLE);
|
||||
if (attachButton != null) {
|
||||
delegate.onAttachButtonShow();
|
||||
//delegate.onAttachButtonShow();
|
||||
attachButton.setVisibility(VISIBLE);
|
||||
updateFieldRight(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user