Fix "Send Message" & "Send without sound" width

I took the trouble to solve this little graphic bug, since the parent layout is a FrameLayout, but we use createLinear as parameters, this means that the button does not expand completely, so to make sure to keep the buttons that are below the other and at the same time using the createFrame, I directly created a parent linearlayout (Using as parameters createFrame) and then add the various buttons as children keeping the createLinear, in this way the father will take the maximum length thanks to createFrame and the children will follow it
This commit is contained in:
Laky64 2022-02-17 12:49:02 +01:00 committed by GitHub
parent 3708e9847a
commit 56963b774f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1392,6 +1392,8 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
LinearLayout layout = new LinearLayout(getContext());
layout.setOrientation(LinearLayout.VERTICAL);
if (sendingMessageObjects != null) {
LinearLayout layout1 = new LinearLayout(getContext());
layout1.setOrientation(LinearLayout.VERTICAL);
ActionBarPopupWindow.ActionBarPopupWindowLayout sendPopupLayout1 = new ActionBarPopupWindow.ActionBarPopupWindowLayout(parentActivity, resourcesProvider);
sendPopupLayout1.setAnimationEnabled(false);
sendPopupLayout1.setOnTouchListener(new View.OnTouchListener() {
@ -1419,12 +1421,12 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
sendPopupLayout1.setupRadialSelectors(getThemedColor(Theme.key_dialogButtonSelector));
ActionBarMenuSubItem showSendersNameView = new ActionBarMenuSubItem(getContext(), true, true, false, resourcesProvider);
sendPopupLayout1.addView(showSendersNameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
layout1.addView(showSendersNameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
showSendersNameView.setTextAndIcon(false ? LocaleController.getString("ShowSenderNames", R.string.ShowSenderNames) : LocaleController.getString("ShowSendersName", R.string.ShowSendersName), 0);
showSendersNameView.setChecked(showSendersName = true);
ActionBarMenuSubItem hideSendersNameView = new ActionBarMenuSubItem(getContext(), true, false, true, resourcesProvider);
sendPopupLayout1.addView(hideSendersNameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
layout1.addView(hideSendersNameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
hideSendersNameView.setTextAndIcon(false ? LocaleController.getString("HideSenderNames", R.string.HideSenderNames) : LocaleController.getString("HideSendersName", R.string.HideSendersName), 0);
hideSendersNameView.setChecked(!showSendersName);
showSendersNameView.setOnClickListener(e -> {
@ -1435,10 +1437,11 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
showSendersNameView.setChecked(showSendersName = false);
hideSendersNameView.setChecked(!showSendersName);
});
sendPopupLayout1.addView(layout1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
layout.addView(sendPopupLayout1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, -8));
}
LinearLayout layout2 = new LinearLayout(getContext());
layout2.setOrientation(LinearLayout.VERTICAL);
ActionBarPopupWindow.ActionBarPopupWindowLayout sendPopupLayout2 = new ActionBarPopupWindow.ActionBarPopupWindowLayout(parentActivity, resourcesProvider);
sendPopupLayout2.setAnimationEnabled(false);
sendPopupLayout2.setOnTouchListener(new View.OnTouchListener() {
@ -1468,7 +1471,7 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
ActionBarMenuSubItem sendWithoutSound = new ActionBarMenuSubItem(getContext(), true, true, resourcesProvider);
sendWithoutSound.setTextAndIcon(LocaleController.getString("SendWithoutSound", R.string.SendWithoutSound), R.drawable.input_notify_off);
sendWithoutSound.setMinimumWidth(AndroidUtilities.dp(196));
sendPopupLayout2.addView(sendWithoutSound, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
layout2.addView(sendWithoutSound, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
sendWithoutSound.setOnClickListener(v -> {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
@ -1478,14 +1481,15 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
ActionBarMenuSubItem sendMessage = new ActionBarMenuSubItem(getContext(), true, true, resourcesProvider);
sendMessage.setTextAndIcon(LocaleController.getString("SendMessage", R.string.SendMessage), R.drawable.msg_forward_send);
sendMessage.setMinimumWidth(AndroidUtilities.dp(196));
sendPopupLayout2.addView(sendMessage, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
layout2.addView(sendMessage, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
sendMessage.setOnClickListener(v -> {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
}
sendInternal(true);
});
sendPopupLayout2.addView(layout2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
layout.addView(sendPopupLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
sendPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);