How to get this chat bubble in drawable - kotlin

'''
<item>
<rotate
android:fromDegrees="45"
android:pivotX="0%"
android:pivotY="100%"
android:toDegrees="0" >
<shape android:shape="rectangle" >
<solid android:color="#color/white" />
</shape>
</rotate>
</item>
<item android:left="20dp">
<shape android:shape="rectangle" >
<solid android:color="#color/white" />
<corners android:radius="10dp" />
</shape>
</item>
'''
I am able to achieve left bottom tilted , but I want curved shaped on the left bottom

This should work
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="2dp">
<rotate
android:fromDegrees="15"
android:pivotX="0%"
android:pivotY="100%"
android:toDegrees="0">
<shape android:shape="rectangle">
<corners
android:bottomLeftRadius="0dp"
android:radius="250dp" />
<solid android:color="#color/white" />
</shape>
</rotate>
</item>
<item android:left="5dp">
<shape android:shape="rectangle">
<solid android:color="#color/white" />
<corners android:radius="15dp" />
</shape>
</item>
</layer-list>

Related

Can we remove image preview from ui fileuploader?

Is it possible to remove image preview from UI fileuploder component, without using file component?
here is my code=>
<field name="file">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">TestGroup</item>
<item name="label" xsi:type="string" translate="true">File</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">Vendor_Module/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="number">40</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="controller/index/upload"/>
</item>
</argument>
</field>
tried by removing item name= elementTmpl and previewTmpl but not working
can anybody help me to disable the image preview for fileupload.
Thanks in Advance.
Remove the src of image every time you click:
$("#input1").click(function () {
$('#imagepreview1').attr('src','');
});

SELECT FROM XML MULTIPLE ELEMENTS SQL

I have a return of XML that I wish to select using SQL. I don't have a problem selecting from the XML when I specify the index for the element. This is the XML in question.
<root httpStatusCode="200">
<messages />
<succesfulResponses>
<item position="0">
<response dln="TESTDLN" ServiceVersion="1" hubServiceVersion="1.0.0.0" ProcessingDate="2017-11-20T10:42:20.579Z" hubProcessingDate="2017-11-20T10:41:16.5415151Z" httpStatusCode="200">
<licence status="FC" validFrom="2017-03-18" validTo="2024-10-31" directiveIndicator="4">
<entitlements>
<item code="A" validFrom="2006-04-07" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="AM" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
<item code="B" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="BE" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="F" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="G" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="H" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="K" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="Q" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
</entitlements>
<endorsements />
</licence>
<messages />
</response>
</item>
</succesfulResponses>
<errorResponses />
</root>
The SQL I have written so far is as follows:
select
Rec.value('(#dln)[1]','char(50)'),
Rec.value('(licence/#status)[1]','char(2)'),
pd.value('(entitlements/item/#code)[1]','char(2)')
FROM #xmlData.nodes('//root/succesfulResponses/item/response') as x(Rec)
cross apply #xmlData.nodes('//root/succesfulResponses/item/response/licence') as i(pd)
This returns the obviously First Row code of 'A', however there can be multiple 'entitlements' and I don't ever know how many there could be 3 there could be 9.
I thought a Cross Apply would work but I can't seem to make that work either.
Any thoughts/help.
Try this - expand the XPath after the CROSS APPLY to include the entitlements/item part:
select
Rec.value('(#dln)[1]','char(50)'),
Rec.value('(licence/#status)[1]','char(2)'),
pd.value('#code', 'char(2)')
FROM
#xmlData.nodes('//root/succesfulResponses/item/response') as x(Rec)
cross apply
#xmlData.nodes('//root/succesfulResponses/item/response/licence/entitlements/item') as i(pd)
Returns:
The variant with OPENXML
DECLARE #idoc int, #doc varchar(MAX)
SET #doc='<root httpStatusCode="200">
<messages />
<succesfulResponses>
<item position="0">
<response dln="TESTDLN" ServiceVersion="1" hubServiceVersion="1.0.0.0" ProcessingDate="2017-11-20T10:42:20.579Z" hubProcessingDate="2017-11-20T10:41:16.5415151Z" httpStatusCode="200">
<licence status="FC" validFrom="2017-03-18" validTo="2024-10-31" directiveIndicator="4">
<entitlements>
<item code="A" validFrom="2006-04-07" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="AM" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
<item code="B" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="BE" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="F" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="G" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="H" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="K" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="Q" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
</entitlements>
<endorsements />
</licence>
<messages />
</response>
</item>
</succesfulResponses>
<errorResponses />
</root>'
EXEC sp_xml_preparedocument #idoc OUTPUT, #doc;
SELECT *
FROM OPENXML(#idoc,'/root/succesfulResponses/item/response/licence/entitlements/item',2)
WITH (
status varchar(10) '../../#status',
code varchar(10) './#code',
validFrom date './#validFrom'
);
EXEC sp_xml_removedocument #idoc;
GO

Android L "delightful" drawable transformations

Does Google allow for icon transitions such as these to be created by the developer? Or is it the developers responsibility to create such "delightful" transitions? I'd really like to implement these in my app.
Specifically icons like this
You can create an animated icon using AnimatedDrawable and bitmap-based frames. On L, you can use AnimatedStateListDrawable to create stateful animations (such as the check box animation).
Here is an AnimatedDrawable example (actually this is the implementation for the check box on L preview) using 15ms-long frames that can be started and stopped from code:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="15" android:drawable="#drawable/my_icon_frame_000" />
...additional frames...
</animation-list>
And here is an AnimatedStateListDrawable using AnimatedDrawable transitions to implement a check box animation that starts and stops automatically based on View state:
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:state_checked="true">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorControlActivated" android:alpha="?attr/disabledAlpha" />
</item>
<item android:state_enabled="false">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" android:alpha="?attr/disabledAlpha" />
</item>
<item android:state_checked="true" android:id="#+id/on">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorControlActivated" />
</item>
<item android:id="#+id/off">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" />
</item>
<transition android:fromId="#+id/off" android:toId="#+id/on">
<animation-list>
<item android:duration="15">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" />
</item>
...additional frames...
</animation-list>
</transition>
<transition android:fromId="#+id/on" android:toId="#+id/off">
<animation-list>
<item android:duration="15">
<bitmap android:src="#drawable/btn_check_to_off_mtrl_000" android:tint="?attr/colorControlActivated" />
</item>
...additional frames...
</animation-list>
</transition>
</animated-selector>

XPATH: Filtering (rather than selecting nodes), preserving hierarachy

Given the following XML (with many hierarchy levels), I need to return the nodes after filtering all nodes with Hide"True" attribute and a certain name. Note that hide could be at any hierarchy level:
<items>
<item id="1" >
<item id="2" />
<item id="3" />
<item id="4" hide="true"/>
</item>
<item id="5" hide="true">
<item id="6" >
<item id="7">
<item id="8" hide="true"/>
<item id="9"/>
</item>
</item>
</items>
I would need to get this back:
<items>
<item id="1"">
<item id="2" />
<item id="3" />
</item>
<item id="6" >
<item id="7">
<item id="9"/>
</item>
</item>
</items>
The 'filtered' XML is then assigned to a treeview, so I need to preserve the hierarchical nature of the nodes. I have tried: "items//item[#hide='false' or not(#hide)]", but this returns a flattened (as well as duplicative) data, repeating nodes at the lower level pushed up to the top level as follows. Is there a way to use Xpath to do what I want? I understand that I can Xslt the data first, then display it, but it just seems that there is got to be an easier way. I am using c#/.net4.0 MSXML
<items>
<item id="1"">
<item id="2" />
<item id="3" />
</item>
<item id="6" >
<item id="7">
<item id="9"/>
</item>
</item>
<item id="2" />
<item id="3" />
<item id="7">
<item id="9"/>
</item>
<item id="9"/>
</items>

I want to set an animated image in my application

I want to set an animated image in my application.i use an animation-list to show it frame by frame but it's not working!!
please help me!!
here is Java code
_imagView=(ImageView)findViewById(R.id.imageView1);
_imagView.setBackgroundResource(R.drawable.anim);
AnimationDrawable anim1 = (AnimationDrawable) _imagView.getBackground();
anim1.start();
and here is anim.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/animationchoking0" android:duration="500" />
<item android:drawable="#drawable/animationchoking1" android:duration="500" />
<item android:drawable="#drawable/animationchoking2" android:duration="500" />
<item android:drawable="#drawable/animationchoking3" android:duration="500" />
<item android:drawable="#drawable/animationchoking4" android:duration="500" />
<item android:drawable="#drawable/animationchoking5" android:duration="500" />
<item android:drawable="#drawable/animationchoking6" android:duration="500" />
<item android:drawable="#drawable/animationchoking7" android:duration="500" />
<item android:drawable="#drawable/animationchoking8" android:duration="500" />
</animation-list>
According to the Development guide,you should not call start method directly in onCreate() of your Activity(Drawable Animation at the bottom).Try this:
_imagView.post(new Runnable() {
#Override
public void run() {
// TODO Auto-generated method stub
anim1.start();
}
});