Skip to content

Commit

Permalink
-Fixed bug: Event listener not triggering
Browse files Browse the repository at this point in the history
krishanudey committed Jan 18, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7be0806 commit 75fa14c
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.goodiebag.pinview.Pinview;

@@ -19,5 +20,12 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pinview1= (Pinview) findViewById(R.id.pinview1);
pinview1.setPinViewEventListener(new Pinview.PinViewEventListener() {
@Override
public void onDataEntered(Pinview pinview, boolean fromUser) {
Toast.makeText(MainActivity.this, pinview.getValue(), Toast.LENGTH_SHORT).show();
}
});
}
}
4 changes: 2 additions & 2 deletions pinview/src/main/java/com/goodiebag/pinview/Pinview.java
Original file line number Diff line number Diff line change
@@ -280,7 +280,7 @@ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int count) {
public void onTextChanged(CharSequence charSequence, int start, int i1, int count) {

if (charSequence.length() == 1 && currentFocus != null) {
final int currentTag = getIndexOfCurrentFocus();
@@ -312,7 +312,7 @@ public void run() {
for (int index = 0; index < mPinLength; index++) {
if (editTextList.get(index).getText().length() < 1)
break;
if (!fromSetValue && i + 1 == mPinLength && mListener != null)
if (!fromSetValue && index + 1 == mPinLength && mListener != null)
mListener.onDataEntered(this, true);
}
}

0 comments on commit 75fa14c

Please sign in to comment.