Skip to content

Commit

Permalink
Add get position method to both libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbit committed Jul 21, 2016
1 parent 25a479e commit 8b3bbfb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.android.tools.build:gradle:2.1.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Dec 05 17:29:04 EST 2015
#Thu Jul 21 08:20:52 BST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.weiwangcn.betterspinner.library.material;

import com.rengwuxian.materialedittext.MaterialAutoCompleteTextView;

import android.content.Context;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
Expand All @@ -9,8 +11,7 @@
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;

import com.rengwuxian.materialedittext.MaterialAutoCompleteTextView;
import android.widget.ListView;

import java.util.Calendar;

Expand All @@ -20,6 +21,7 @@ public class MaterialBetterSpinner extends MaterialAutoCompleteTextView implemen
private static final int MAX_CLICK_DURATION = 200;
private long startClickTime;
private boolean isPopup;
private int mPosition = ListView.INVALID_POSITION;

public MaterialBetterSpinner(Context context) {
super(context);
Expand Down Expand Up @@ -83,7 +85,8 @@ public boolean onTouchEvent(MotionEvent event) {
}

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
mPosition = position;
isPopup = false;
}

Expand All @@ -97,4 +100,7 @@ public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top,
super.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
}

public int getPosition() {
return mPosition;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
import android.widget.ListView;

import java.util.Calendar;

Expand All @@ -18,6 +19,7 @@ public class BetterSpinner extends AutoCompleteTextView implements AdapterView.O
private static final int MAX_CLICK_DURATION = 200;
private long startClickTime;
private boolean isPopup;
private int mPosition = ListView.INVALID_POSITION;

public BetterSpinner(Context context) {
super(context);
Expand Down Expand Up @@ -81,7 +83,8 @@ public boolean onTouchEvent(MotionEvent event) {
}

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
mPosition = position;
isPopup = false;
}

Expand All @@ -95,4 +98,7 @@ public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top,
super.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
}

public int getPosition() {
return mPosition;
}
}

0 comments on commit 8b3bbfb

Please sign in to comment.