Material3: Unwanted White bg on text selection menu on AlertDialog - android-xml

There is a white background when users select text and see copy/paste menu.
And you see handles are not the accentPrimary color too.
This happens on AlertDialogs which it's style is deriven from Theme.Material3.DayNight.Dialog.Alert
The dialog is built by AlertDialog.Builder(context, style)
These are the style attributes I am using for style variable above:
<item name="android:background"/>
<item name="android:windowTitleStyle"/>
<item name="android:textColorPrimary"/>
<item name="windowFixedWidthMajor"/>
<item name="windowFixedWidthMinor"/>
<item name="buttonBarNeutralButtonStyle"/>
<item name="buttonBarNegativeButtonStyle"/>
<item name="buttonBarPositiveButtonStyle"/>
<item name="android:windowMinWidthMajor"/>
<item name="android:windowMinWidthMinor"/>
<item name="android:buttonBarNeutralButtonStyle"/>
<item name="android:buttonBarNegativeButtonStyle"/>
<item name="android:buttonBarPositiveButtonStyle"/>
When I do not use these styles, the white bg is not there, but the editText's height becomes extremely thin.
What is the attribute in Material3 to change those colors and fix them?

Related

How to override form in magento 2 (uiComponent)

I have form declared as uiComponent(custom module). I have to disable top menu button based on some status.
The button is in structure
<form>
<argument name="data" xsi:type="array">
<item name="buttons" xsi:type="array">
<item name="save_and_continue" xsi:type="array">
<item name="name" xsi:type="string">save_and_continue</item>
<item name="label" xsi:type="string" translate="true">Save and Continue Edit</item>
<item name="class" xsi:type="string">save_and_continue</item>
</item>
....
</item>
....
</form>
I try to create observer to remove element from view but using $layout->unsetElement('save_and_continue') not work. I found that there is some think like PHP modifiers in UI components but i cant get this right from tutorial provided in doc.
How can i remove remove such item ? It can`t be static xml to override this one because i have some dynamic parameters.
I end up doing is to override with my own class.
<item name="save_and_continue" xsi:type="string">
class\namespace....
</item>

Updating day/night mode capable Android app to MaterialComponents theme, but getting incorrect theme error when inflating material widgets

EDIT: On further inspection, it seems to be that only NightMode causes this crash, regardless of whether or not I am explicitly setting it myself, or letting Android's system wide setting take care of it!
I have an app that supports day/night mode using AppCompat theme. On startup, it applies either the day/night style from a stored setting (the user can update the setting at anytime from within the app as well).
To do so:
int mode = GlobalAppSettings.getStoredSettings().nightModeEnabled() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO;
AppCompatDelegate.setDefaultNightMode(mode);
I recently decided I wanted to use the Chip widget from material to implement tags, but when I the app tries to inflate a view with a Chip in it, I get the error:
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
I have updated my themes in my style to be derived from MaterialComponents, but nothing seemed to help. It still crashed. Then I commented out:
AppCompatDelegate.setDefaultNightMode(mode);
And while the app is seemingly stuck in day mode, the Chip is now inflated correctly. Is the AppCompatDelegate method of forcing the day/night theme not compatible with MaterialComponents.DayNight theme?
Has anyone else experienced this issue?
My styles:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowDisablePreview">true</item>
</style>
<style name="SplashTheme" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">#drawable/launch_image</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
<style name="EditText.Search" parent="Widget.AppCompat.EditText">
<item name="colorControlNormal">#color/black_overlay</item>
<item name="colorControlActivated">#color/black_overlay</item>
</style>
<style name="GameyeToolbarTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/toolbar_title_color</item>
<item name="android:textSize">#dimen/toolbar_title_text_size</item>
</style>
I ended up just setting the theme on the Chip directly with
android:theme="#style/Theme.MaterialComponents"
Which seems like it shouldn't be necessary given that my them derives from MaterialComponents. Maybe it's a bug in material?
I opened up a ticket on material to see if they had any ideas.
https://github.com/material-components/material-components-android/issues/1872

Sorting not working correctly custom order grid in magento 2

I have created a custom order grid in magento. If I sort the grid once, an ajax request is made, and everything sorts correctly. However, the second sort renders the grid with all the same Order IDs.
This question have the same issue as mine: https://magento.stackexchange.com/questions/123707/magento-grid-component-not-sorting-correctly. Tried his solution but didn't worked.
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">syncback_order_form.syncback_order_form_data_source</item>
<item name="deps" xsi:type="string">syncback_order_form.syncback_order_form_data_source</item>
</item>
<item name="label" xsi:type="string" translate="true">API URL Form</item>
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string">data</item>
<item name="namespace" xsi:type="string">syncback_order_form</item>
</item>
<item name="template" xsi:type="string">templates/form/collapsible</item>
<item name="buttons" xsi:type="array">
<item name="save" xsi:type="array">
<item name="name" xsi:type="string">save</item>
<item name="label" xsi:type="string">Save API</item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string">*/*/saveapi</item>
</item>
</item>
</argument>
<dataSource name="syncback_order_form_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Panemirates\Syncbackorder\Ui\Component\Apiform\DataProvider</argument>
<argument name="name" xsi:type="string">syncback_order_form_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">type_id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="collectionFactory" xsi:type="object">Panemirates\Syncbackorder\Model\ResourceModel\Collections\ApisavercollectionFactory</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="submit_url" xsi:type="url" path="panemirates/status/saveapi"></item>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
</dataSource>
<fieldset name="callback_form">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<!--
<item name="collapsible" xsi:type="boolean">true</item>
-->
<item name="label" xsi:type="string" translate="true">Callback URL</item>
<item name="sortOrder" xsi:type="number">20</item>
</item>
</argument>
<field name="url">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">API Url</item>
<item name="formElement" xsi:type="string">input</item>
<!--
<item name="source" xsi:type="string">panemirates_apiurl</item>
<item name="dataScope" xsi:type="string">url</item>
<item name="default" xsi:type="string">${ console.log($.syncback) }</item>
-->
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
<item name="url-required" xsi:type="boolean">true</item>
<item name="validate-url" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
</fieldset>
</form>```
May be I am replying late, but hope so it will help other like me. I am also facing same kind of issue and tried hard to solve it, but didn't get any help. So I have gone through the core modules and found solution:
Add below line of code inside datasource element of your ui_component.
<settings>
<storageConfig>
<param name="cacheRequests" xsi:type="boolean">false</param>
</storageConfig>
<updateUrl path="mui/index/render"/>
</settings>
This resolved my issue.
I had the same problem and found the answer in the link you provided, more specifically here https://magento.stackexchange.com/a/123884/58072
Just add this code inside your dataSource
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="update_url" xsi:type="url" path="mui/index/render"/>
<item name="storageConfig" xsi:type="array">
<item name="indexField" xsi:type="string">column_id</item>
</item>
</item>
</argument>

Magento 2 + UI Component don't get value in post

I am using htmlContent in Ui Component form. When i submit form i didn't get data in post which are using in htmlConent.
My Code is : request_form.xml
<fieldset name="request_item">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Products</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">30</item>
<item name="opened" xsi:type="boolean">true</item>
</item>
</argument>
<container name="enduser_container" >
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">10</item>
</item>
</argument>
<htmlContent name="request_price_items">
<!--<argument name="block" xsi:type="object">Extendway\Requestquote\Block\Adminhtml\Index\Edit\Requestproduct</argument>-->
<block class="Extendway\Requestquote\Block\Adminhtml\Index\Edit\Requestproduct" name="item_info" ></block>
</htmlContent>
</container>
</fieldset>
Template File is
<input type="text" name="quote_id" value="XXXX" />
I am not getting "quote_id" in Post data.
Please help what i am missing in HtmlConent & Ui Component file.
You need to add this attribute data-form-part="form-name" to your input.
Please change the form-name with your form name

How to move Apply Discount Code option at Checkout?

How to move Apply Discount code option after Order Summary section of payment step. In Vendor/Magento/Sales Rule/view/front-end/layout/checkout_index_index.xml I tried modifying the item name="afterMethods" but id didn't work.
You first need to remove the afterMethods component in your theme (which call the discount component): app/design/frontend/Vendor/themename/Magento_Checkout/layout/checkout_index_index.xml
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="afterMethods" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
The discount component itself is defined in the Magento_SalesRule module. So Once it's deleted, you can add discount the component after the order summary component in app/design/frontend/Vendor/themename/Magento_SalesRule/layout/checkout_index_index.xml with something like this (code not tested, so maybe you'll need to fix it) :
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="sidebar" xsi:type="array">
<item name="children" xsi:type="array">
<item name="discount" xsi:type="array">
<item name="sortOrder" xsi:type="string">
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>
<item name="children" xsi:type="array">
<item name="errors" xsi:type="array">
<item name="sortOrder" xsi:type="string">0</item>
<item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount-messages</item>
<item name="displayArea" xsi:type="string">messages</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>