How to set a part of validation in saripaar? - android

When I use android-saripaar I want to use only some of the validation. I used the ViewPager and had a dozen of EditText. Each page had some inputs. And I want to validate the inputs at every step.
For example, I had username and password at first step, and phone, email at the second. If user type in the invalid data at first step, validation worked.

Finally I find the answer in the ISSUE : https://github.com/ragunathjawahar/android-saripaar/issues/104#issuecomment-133822417

Related

How to identify a Login Page of a App from my app using Accessibility in android

Hi. Using Accessibility, i am trying to auto fill username &
password of an any app from my app which is managing username &
password of all apps like dashlane. i found one way to auto fill
field value using Action_Paste. when user starts to focusing on
EditText it will get the AccessibilityNodeInfo by using getSource() method, using that it auto
fills EditText Filed, below is a code for above process.
Code:
AccessibilityNodeInfo source = event.getSource();
if (source != null) {
ClipboardManager clipboard = (ClipboardManager) MyAccessibilityService.this.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", "TEST DATA");
clipboard.setPrimaryClip(clip);
source.performAction(AccessibilityNodeInfo.ACTION_PASTE);
Toast.makeText(MyAccessibilityService.this, "Pasted Successfully", Toast.LENGTH_LONG).show(0;
}
Here i need to extend my ui like, it needs identify the login page, once its confirmed as a login page it will show the list of login item. based on user selection it will auto fill username field & password field.
Here i have two question
how to identify the login page of an app, i tried something like, when user clicks a First Edittext filed i will search for next node and check whether it is password filed or not? i used getchild() method. but does not give the child element. When login page loaded in app, i need identify whether it is login field or not? How can i identify a login page, please any tutorial welcome.
based on the source i am filling the field values. if i identified a login page then how to get AccessibilityNodeInfo of username & password. So that i can fill both fields rite?
i spent time for those problem.but i cant get any thing. please anyone can give deep explanation & tutorials for the above problems. thanks.
Use getRootInActiveWindow() to get the root node & iterate the tree to check all the nodes.
My answer here might help.
This way, you will find your Username & Password nodes.
Now, you can paste the text in these nodes.
But i will suggest to not use clipboard to fill passwords as there are some apps that continuously watch your clipboard.
Such apps can intercept your login credentials.

Registered user check for lowercase or uppercase

I want to know how to check the existing users for either upper or lowercase when a new user is signing up. At present for example the followig two users can be registered
tom and Tom, both of these are considered as two separate users, so if this happens I want to sound off to the user that the username already exists. Where in code exactly can I do this?
You can create a textwatcher for the edittext where user enters loginname and when focus changes from the edittext get the string in there using getText and pass this to an api which will check the username with db to check for similarity and will return a status false if similar user exits and you can show a red underline or red hidden badge to side of the edittext on the basis of this result to notify the user that such a username already exists.

Calabash Android: Check if a button is present and enabled

I am new to Calabash and sadly, possess no programming experience, so I hope people shall be patient with me and offer explicit answers.
On the Login page, I am successfully able to check for the...
Email Address field
Password field
but I can't seem to test for the presence and enabled state of the...
Sign in button
Hide button (to hide or show the Password typed)
Password Help and Recovery button
Using query("*"), I can obtain all the IDs but I'm stumped about the actual query commands with which to test.
This is my test thus far:
Feature: Sign In appearance
Scenario: Upon launch, all elements of the login page should appear correctly
Then I see "Email Address"
Then I see "Password"
Then I see "button marked:'Sign In'"
Which yields the following results:
Then I see "button marked:'Sign In'" # calabash-android-0.4.20/lib/calabash-android/steps/assert_steps.rb:5
Action 'assert_text' unsuccessful: Text'button marked:'Sign In'' was not found (RuntimeError)
features/Login_appearance.feature:6:in `Then I see "button marked:'Sign In'"'
Failing Scenarios:
cucumber features/Login_appearance.feature:3
How shall I proceed?
Instead of trying to use the predefined steps create a custom step and use the Ruby api's query and wait_for_elements_exist methods.
Take a look at this post first to learn more about the query language:
http://krazyrobot.com/2014/04/calabash-using-query/
Then find the elements with query possibly by id, eg.:
query("* id:'email_field'")
query("* id:'pwd_field'")
Create a custom step in your step definition and use the wait_for_elements_exist method to verify the elements:
Then /^all the elements are present on the login screen$/ do
wait_for_elements_exist(["* id:'email_field'", "* id:'pwd_field'"])
end
Have you tried replacing
Then I see "button marked:'Sign In'"
with
Then I see "Sign In"
?

How can I check an EditTextPreference value before the User validate it?

I have currently a Preference in my application where the user is prompted to enter between 2 and 10 numerical values.
As this feature is only available for power users and beta testers, not for public release, I decided to let them enter a CSV value.
So, in my EditTextPreference, some users will enter: "1;20;30", some other will enter "1;10;10;10;10;10;10;10" etc...
After, in my code, I am just splitting these values to build an array and execute my code.
I have to admit that's not very professional, but that just works!
String[] patternString = PreferenceManager.getDefaultSharedPreferences(getBaseContext()).getString("vibPattern", "0;500;500;500;500;500;500;500").split(";");
The main issue is that I would like to check the validity of the String while the user is writing it!
Does some of you have an idea how to achieve that?
you need to use "addTextChangedListener" and act according to the text that was , well, changed...
if you wish, you can use regular expressions in order to check for validity .
why not just programmatically add the amount of wished boxes, (for an example) have a spinner(drop down menu), from where you can choose the amount, and then add that amount of edittext with numerical only?
In the EditText entry in your layout add the following:
android:inputType="number"
android:digits="0123456789,"
Then on the addTextChangeListener implementations you only have to check if a user just entered a bunch of commas.

autofill password on edittext

i'm a little blocked with this thing. I want to fill one edittext's password when the user type its login. I have the login and password on one database sqlite. I have read on android developers that it can be done with a AutocompleTextView, but i only want to fill the edittext with its password, nothing else. It Anyone knows how can i do this?¿
Cheers
when you create your activity with the EditText get a handle on it and call setText() with the password from your database.

Categories

Resources