How can access preferences set in account-authenticator in Android - android-authenticator

I need to get value of CheckBoxPreference and SwitchPreference.
In account_preferences.xml i have:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="User Preferences" />
<CheckBoxPreference android:key="test1" android:title="Test 1" />
<SwitchPreference android:key="test2" android:title="Test 2" />
</PreferenceScreen>

Related

DocuSign API - Creating an envelope with a Document that has an Approve button

I am creating a draft envelope with a TXT document - which needs to display an Approve button to allow the signer to sign without placing a signature/initials on the document itself. Unfortunately I can't get the Approve button to show on the document, where have I gone wrong?
Here is the Request XML:
<ns1:envelopeDefinition xmlns:ns1="http://www.docusign.com/restapi">
<ns1:emailSubject>Test from iPaaS</ns1:emailSubject>
<ns1:documents>
<ns1:document>
<ns1:name>TestDocument</ns1:name>
<ns1:documentId>1</ns1:documentId>
<ns1:documentBase64><Base64BytesHere></ns1:documentBase64>
<ns1:fileExtension>txt</ns1:fileExtension>
</ns1:document>
</ns1:documents>
<ns1:recipients>
<ns1:signers>
<ns1:signer>
<ns1:routingOrder>1</ns1:routingOrder>
<ns1:recipientId>1</ns1:recipientId>
<ns1:name>John Smith</ns1:name>
<ns1:email>nobody#nobody.com</ns1:email>
</ns1:signer>
</ns1:signers>
</ns1:recipients>
<ns1:tabs>
<ns1:approveTabs>
<ns1:approve>
<anchorCaseSensitive />
<anchorHorizontalAlignment />
<anchorIgnoreIfNotPresent />
<anchorMatchWholeWord />
<anchorString />
<anchorUnits />
<anchorXOffset />
<anchorYOffset />
<conditionalParentLabel />
<conditionalParentValue />
<customTabId />
<documentId>1</documentId>
<mergeField />
<pageNumber>1</pageNumber>
<recipientId>1</recipientId>
<tabId />
<tabOrder />
<templateLocked />
<templateRequired />
<xPosition>100</xPosition>
<yPosition>100</yPosition>
<bold />
<font />
<fontColor />
<fontSize />
<italic />
<tabLabel />
<underline />
<buttonText />
<height>30</height>
<width>50</width>
</ns1:approve>
</ns1:approveTabs>
</ns1:tabs>
</ns1:envelopeDefinition>
Essentially I am looking for something that looks like the attached screenshot
The <tabs> node should be inside the <signer> node. The following example should work.
<ns1:envelopeDefinition xmlns:ns1="http://www.docusign.com/restapi">
<ns1:emailSubject>Test from iPaaS</ns1:emailSubject>
<ns1:documents>
<ns1:document>
<ns1:name>TestDocument</ns1:name>
<ns1:documentId>1</ns1:documentId>
<ns1:fileExtension>txt</ns1:fileExtension>
<ns1:documentBase64>RG9jIFRXTyBUV08gVFdP</ns1:documentBase64>
<ns1:fileExtension>txt</ns1:fileExtension>
</ns1:document>
</ns1:documents>
<ns1:recipients>
<ns1:signers>
<ns1:signer>
<ns1:routingOrder>1</ns1:routingOrder>
<ns1:recipientId>1</ns1:recipientId>
<ns1:name>John Smith</ns1:name>
<ns1:email>johnsmith#acme.com</ns1:email>
<ns1:tabs>
<ns1:approveTabs>
<ns1:approve>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
<xPosition>100</xPosition>
<yPosition>100</yPosition>
<height>30</height>
<width>50</width>
</ns1:approve>
</ns1:approveTabs>
</ns1:tabs>
</ns1:signer>
</ns1:signers>
</ns1:recipients>
</ns1:envelopeDefinition>

SharePoint - Ribbon Button showing wrong LabelText

I have a Ribbon Button with the following XML:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Ribbon.Library.Actions.AddAButton"
Location="CommandUI.Ribbon"
RegistrationId="171"
RegistrationType="List"
Title="Change Email Ribbon Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListForm.Edit.Commit.Controls._children">
<Button Id="Ribbon.ListForm.Edit.Commit.NewRibbonButton"
Command="ChangeEmailButtonCommand"
Image16by16="/_layouts/15/$Resources:core,Language;/images/formatmap16x16.png?rev=23" Image16by16Top="-127" Image16by16Left="-91"
Image32by32="/_layouts/15/$Resources:core,Language;/images/formatmap32x32.png?rev=23" Image32by32Top="-477" Image32by32Left="-307"
LabelText="$Resources:Toolkit,ChangeEmailButtonLabel"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ChangeEmailButtonCommand"
CommandAction="javascript:
ChangeEmailAction();
" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Ribbon.ListForm.Edit.Commit.Scripts" Location="ScriptLink" ScriptSrc="/_layouts/15/GOToolkit/JS/loadJsOrCssFile.js?version=1.7.3" />
</Elements>
Now, the LabelText on my button, shows the exact same text, as it does in the XML: "$Resources:Toolkit,ChangeemailButtonLabel", where I'd expect it to show the text that I have defined in the 'ChangeEmailButtonLabel', which looks like this:
<data name="ChangeEmailButtonLabel" xml:space="preserve">
<value>Change email</value>
</data>
Am I missing something here?
Check that your resources file is stored in the SharePoint Resources folder.
Also, don't know if it's a game changer but you can add ";" at the end of your syntax.

Change background color of richtexttablecell

I like to change the backgroundcolor of a richtexttablecell, I try to solve the problem with lotusscript, but there isn't an method or attribute for this in lotus script.
looks like it is possible to solve this with c api.
can anyone help me?
Use the NotesDXLExporter and NotesDXLImporter:
export the document as DXL,
replace table properties in DXL and
import it back to document.
Make sure that you use notesDXLExporter.RichTextOption=0.
This is an example for a table with background colors in DXL format:
<item name='Body'>
<richtext>
<pardef id='1' />
<par def='1' />
<table widthtype='fixedleft' refwidth='2.1493in'>
<tablecolumn width='1.0667in' />
<tablecolumn width='1.0826in' />
<tablerow>
<tablecell bgcolor='blue'>
<pardef id='3' keepwithnext='true' keeptogether='true' />
<par def='3' />
</tablecell>
<tablecell bgcolor='red'>
<pardef id='4' keepwithnext='true' keeptogether='true' />
<par def='4' />
</tablecell>
</tablerow>
<tablerow>
<tablecell bgcolor='yellow'>
<par def='3' />
</tablecell>
<tablecell>
<par def='4' />
</tablecell>
</tablerow>
</table>
<par def='1' />
</richtext>
</item>
It should be easy to replace the bgcolor properties in DXL.
You can find a code snippet for DXL-export here.
Background color does not appear to be exposed in the LS NotesRichTextStyle or NotesRightTextParagraphStyle classes. The alternate would to use HTML with MIME or the Midas Rich Text LSX from Genii Soft.

How can I change colors in my StateListDrawable?

I have the following selector for a button (with 2 states, regular and pressed):
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="#3498DB" />
<stroke
android:width="1dp"
android:color="#2980B9" />
<corners
android:radius="0dp" />
<padding
android:left="12dp"
android:top="12dp"
android:right="12dp"
android:bottom="12dp" />
</shape>
</item>
<item>
<shape>
<solid
android:color="#2980B9" />
<stroke
android:width="1dp"
android:color="#2980B9" />
<corners
android:radius="0dp" />
<padding
android:left="12dp"
android:top="12dp"
android:right="12dp"
android:bottom="12dp" />
</shape>
</item>
</selector>
My button has the following which specifies the background as the above selector:
<Button
android:id="#+id/button_LaunchShiftsGame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/ShiftsMode"
android:background="#drawable/selector_Button"
style="#style/Button_Text" />
I need to access and change the colors for both states from code when the Activity loads.
How can I do this?
StateListDrawable gradientDrawable = (StateListDrawable) inflatedView.getBackground();
DrawableContainerState drawableContainerState = (DrawableContainerState) gradientDrawable.getConstantState();
Drawable[] children = drawableContainerState.getChildren();
LayerDrawable selectedItem = (LayerDrawable) children[0];
LayerDrawable unselectedItem = (LayerDrawable) children[1];
GradientDrawable selectedDrawable = (GradientDrawable) selectedItem.getDrawable(0);
GradientDrawable unselectedDrawable = (GradientDrawable) unselectedItem.getDrawable(0);
selectedDrawable.setStroke(STORKE_SIZE, NOTIFICATION_COLOR);
unselectedDrawable.setStroke(STORKE_SIZE, NOTIFICATION_COLOR);
I used this to change the stroke, it can be helpfull.
This is the Kotlin version of the #Borja's answer with drawable resource
val drawableRes: Drawable? = ResourcesCompat.getDrawable(mContext.resources, R.drawable.drawable_res_id, null)
val drawableContainerState: DrawableContainer.DrawableContainerState = drawableRes?.constantState as DrawableContainer.DrawableContainerState
val children: Array<Drawable> = drawableContainerState.children
val selectedItem: GradientDrawable = children[0] as GradientDrawable
val unselectedItem: GradientDrawable = children[1] as GradientDrawable
selectedItem.setStroke(2, colorState)
unselectedItem.setStroke(2, colorState)
and yes! Many thanks to #Borja. I found this working well as in 2022.
I have below selector round_circle_blue.xml shape xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size android:width="#dimen/_50sdp" android:height="#dimen/_50sdp" />
<solid android:color="#color/color_blue" />
<stroke android:width="#dimen/_2sdp" android:color="#color/white" />
</shape>
</item>
</selector>
And I have set it as background in text view as below
<TextView
android:id="#+id/tvActivityicon"
android:layout_width="#dimen/_40sdp"
android:layout_height="#dimen/_40sdp"
android:textColor="#color/white"
android:gravity="center"
android:text="A"
android:textSize="#dimen/_14sdp"
android:background="#drawable/round_circle_blue" />
and in kotlin file i have use below code to change the color.
val gradientDrawable = tvActivityicon.background as StateListDrawable
val drawableContainerState = gradientDrawable.constantState as DrawableContainer.DrawableContainerState
val children = drawableContainerState!!.children
val selectedItem = children[0] as GradientDrawable
selectedItem.setColor(Color.parseColor("#FD00DF"))

Android custom button sensitivity

I have created a custom button like this :
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="false" android:state_pressed="false">
<shape>
<gradient
android:endColor="#color/title_dark_red"
android:startColor="#color/title_red"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#color/red_stroke" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_focused="true" android:state_pressed="true">
<shape>
<gradient
android:endColor="#color/title_pressed_red"
android:startColor="#color/title_pressed_red"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#color/red_stroke" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="true">
<shape>
<gradient
android:endColor="#color/title_pressed_red"
android:startColor="#color/title_pressed_red"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#color/red_stroke" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
The problem is sensitivity of the button is very bad, not like the regular buttons. The buttons are not too small in the screen, so it's easy to touch.
What can be the problem ?
P.S I'm using Button.OnClickListener() to set click handler.
Button is in relative layout structure :
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
>
<TextView
android:id="#+id/titlePlace"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#drawable/expand_bg"
android:gravity="center_vertical"
android:text=""
android:textColor="#color/titletextcolor"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="#+id/backButton"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/showButton"
android:layout_alignBottom="#+id/showButton"
android:layout_alignParentLeft="true"
android:background="#drawable/custom_button_back"
android:layout_marginLeft="5dip"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Places"
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="bold" />
</RelativeLayout>
It's a hardware related question. Software just takes on click event sent by hardware and checks whether it's in view's bounds.
Other potential issues:
inaccurate touch screen
view was animated and moved to different position
view is too small or finger too big ;)

Resources