Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setOnPinEnteredListener #34

Open
Louroj opened this issue Sep 19, 2016 · 4 comments
Open

setOnPinEnteredListener #34

Louroj opened this issue Sep 19, 2016 · 4 comments

Comments

@Louroj
Copy link

Louroj commented Sep 19, 2016

I'm currently trying to put a setOnPinEnteredListener on my app so it calls a webservice to validate the password but unfortunately it is not recognized.

here is what I have:

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import com.ggs.managerroom.MainActivity;
import com.mycomapany.myapp.R;
import me.philio.pinentry.PinEntryView;

public class PasswordFragment extends Fragment {
    private PinEntryView pinEntryView;


@Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        loadControls();

        pinEntryView.setOnPinEnteredListener(new PinEntryView.OnPinEnteredListener() {
           @Override
            public void onPinEntered(String pin) {
                Toast.makeText(getActivity(), "Pin entered: " + pin, Toast.LENGTH_LONG).show();
            }
        });
    }

    protected void loadControls() {
        MainActivity activity;
        activity = (MainActivity) getActivity();
       pinEntryView = (PinEntryView)activity.findViewById(R.id.pin_entry);
    }
....
}

Any help on what I might be doing wrong?

here is a image to see what my problem is:

https://gyazo.com/8396ff4586e70d2822510b22565ca8a2

@Isabellle
Copy link

Same here

@Lawrence-Windsor
Copy link

If this is of any help. setOnPinEnteredListener doesn't seem to exists in the library so what i used was textchanged here is an example that works

            pinEntryView.addTextChangedListener(new TextWatcher() {
                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {}

                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

                @Override
                public void afterTextChanged(Editable s) {
                    if(s.length() == 4){
                        InputMethodManager imm = (InputMethodManager)
                        getActivity().getSystemService(getActivity().INPUT_METHOD_SERVICE);
                        imm.hideSoftInputFromWindow(
                                pinEntryView.getWindowToken(), 0);
                    }
                }
            });

@volax
Copy link

volax commented Jun 15, 2017

You need to download library sources: https://github.com/Philio/PinEntryView/tree/master/pinentry
and include 'pinentry' project into application's build.gradle as a dependency:

dependencies {
....
compile project(':pinentry')
}

setOnPinEnteredListener is here on line 284:
https://github.com/Philio/PinEntryView/blob/master/pinentry/src/main/java/me/philio/pinentry/PinEntryView.java

UPDATE1: You can also include a git repo dependency with this guy: https://github.com/bat-cha/gradle-plugin-git-dependencies

UPDATE2: My favorite way now: https://jitpack.io/#Philio/PinEntryView/master

@dmast3r
Copy link

dmast3r commented Mar 1, 2018

Thanks @volax works like charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants