implement Numerical Edit Text in Android - android-widget

I am trying to implement getting contents of edit text as a number as exemplified in iOS.
The intention is for the user to enter only numerical values.
I am wondering if there is a similar implementation in Android. Can this be done??
I would appreciate some excellent advice. Thanks.

You can use the android:numeric for this like:
<EditText android:text="435.569"
android:id="#+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numeric="integer|decimal" />
to do this dynamically just try something like :EditText.setInputType(InputType.TYPE_CLASS_NUMBER);
Good luck
Arkde

The EditText-widget has the inputType-attribute, which can be used to determine what type of input the user should make.
There is also the corresponding method setRawInputType() to set it programmily.

Related

DITA: reuse the same text multiple times with different variable setting for each instance

I'm working on a document where, among other things, I need to explain two units that are very similar. I want to reuse text in both descriptions, but I want to use the name of the units in the shared text, and to configure a form of substitution/variable so the name of the units appear in each description. Note that the description of both units appear in the final document.
We're using a structure like this:
top.ditamap, which includes:
units_a_and_b.ditamap, which includes:
unit_a.dita
unit_b.dita
and then this file with text snippets:
unit_a_b_shared.dita
unit_a.dita and unit_b.dita will conref text snippets from unit_a_b_shared.dita.
So basically I want unit_a_b_shared.dita to contain something like this:
"When you configure DOODAA to ..."
and then I want DOODAA to be replaced with unit_a inside the unit_a part of the document, and with unit_b inside the unit_b part.
I've tried to use keywords for this, but so far without success. I haven't found a way to make them take on different values in the different files, even when using keyscopes as explained here:
https://blog.oxygenxml.com/keyscopes/keyscopesBlog.html
The problem seems to be that with keyscopes I need the full path, which includes which unit it is, and hence cannot be used in the text snippet which is shared. Without keyscopes the first definition of the keyword applies everywhere.
Any suggestions on how to achieve this goal (using keywords or not)?
I wrote that key scopes article on the Oxygen XML Blog and I think that key scopes seem to be the answer for your case.
So the "unit_a_b_shared.dita" file would have inside a something like:
<p id="reusablePara">some text before <ph keyref="unit"/> some text after</p>
And then in the DITA Map you would refer to ""unit_a_b_shared.dita"" in different key scopes and re-define the key "unit" in those places to bind it to a different value.
The DITA Map would need to look like this:
<map>
<title>Main</title>
<topicref href="unit_a.dita" keyscope="unitA">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KM</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
<topicref href="unit_b.dita" keyscope="unitB">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KG</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
</map>
and inside "unit_a.dita" you would conkeyref to the reusable paragraph inside the "unit_a_b_shared.dita" file:
<p conkeyref="reusables/reusableParagraph"/>
Note that I'm using "conkeyref" not "conref". Once you get to use key scopes you should avoid direct links or direct content references, use only indirect linking using keys.

how to create form like this by vuetify?

I want to create form like the picture above but i dont know how to do it? and i want to bind the data to parameter'quota'
data(){
return {
quota :'',
defaultquota:'-1'//which is defined as unlimited
}
}
I think taking a look into the vuetify examples would probably be your best best. What have you tried so far?
By looking at your picture, you can see that you will require one v-radio-group which will have 2 v-radio buttons. and a v-text-field that will be bound to your quota variable, result will be something like this:
<form>
<v-row>
<v-radio-group label="quota:" row>
<v-radio label="unlimited"/>
<v-radio label="input by yourself:"/>
</v-radio-group>
<v-text-field outlined v-model="quota"/>
</v-row>
</form>
You might want to add a v-model on the v-radio-group in order to figure out which option was chosen and set a default one if needed.
The form is simple, I added a for it to all appear in the same line as the picture. the outlined on the v-text-field will give it that boxy input look that's in the picture. the rest should be self explanatory.
I would strongly suggest looking at what examples and api vuetify has to offer on their main site as the more you look at it the more you will be able to figure out exactly what you need.
https://vuetifyjs.com/en/introduction/why-vuetify/#guide
look under the components in the navigation, all the components are listed there along with examples of using them and how they look, it will be very helpful!
Happy coding!

SAP UI5: NumericContent: scale is shorted

I am having a problem while using SAP UI5. I am using a NumericContent Tile. Here I want to set "km/h" as a scale, but it always gets abbriged to "km/".
How can I prevent this?
<TileContent footer="{i18nExtended>SpeedTripMax}" class="sapUiSmallMargin">
<content>
<NumericContent value="{mymodel>/SpeedTripMax}"
truncateValueTo="6" scale="km/h"/>
</content>
</TileContent>
I do not know why it is happening, but according to api one should use sap.suite.ui.commons.GenericTile instead of sap.suite.ui.commons.NumericTile because it is deprecated since version 1.25.
Try GenericTile approach.
EDITED 10:42 120717:
I tested it on my system and it is bug, because k/h works fine:
The max string length is just 3 signs:
I was testing it within GenericTile.

What does editElementQuery do?

I've came across some examples of a richtext field that has a property called editElementQuery but nobody says what it does. I couldn't find any documentation on it either.
One of the examples is in the stackoverflow question bellow:
AEM/CQ5 html5smartimage filename lost on image upload
Does anybody know what this is suppose to do?
this field is here for storing the selector of the element that should be opened / edited in case of inline edition of that property.
If not fed, the first block element will be taken.
Here is a good explanation what does editElementQuery do:
https://medium.com/#koen_/boost-your-aem-authors-experience-85b2aef04422
Here is a small piece of _cq_editConfig.xml file where I have used this field:
<cq:inplaceEditing
jcr:primaryType="cq:InplaceEditingConfig"
active="{Boolean}true"
editorType="text">
<config jcr:primaryType="nt:unstructured"
editElementQuery="div.rich-text-component__text">
<rtePlugins jcr:primaryType="nt:unstructured">
...
</rtePlugins>
</config>
</cq:inplaceEditing>
I share this config here because I had difficulties in finding where to put this editElementQuery property.

Like, Reblog, and Follow functions

I'm trying to create a really Like, Reblog, and Follow function in my PermalinksPagination section of my coding on Tumblr.
It seems that most Themes place these functions between the {block:Posts} and {/block:posts}, but I am trying to put these functions in between the {block:PermalinkPagination} and {/block:PermalinkPagination}
Can anyone help?
To insert a like- or reblog-button, simply input this code wherever you'd like it to be:
{ReblogButton size="21" color="black"}
{LikeButton size="20" color="black"}