Skip to content

Commit

Permalink
Modify isSelected conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sadra committed Jun 6, 2017
1 parent 111937e commit 2f2e4e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AwesomeSpinner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
versionName "1.0.8"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,17 @@ private void initiateSpinnerString(){
_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

Log.d(TAG, "position selected: " + position);
if (AwesomeSpinner.this._callback == null) {
throw new IllegalStateException("callback cannot be null");
}
if(_allowToSelect){
_isSelected = true;
Object item = AwesomeSpinner.this._spinner.getItemAtPosition(position);
AwesomeSpinner.this._callback.onItemSelected(position, (String) item);
_hintButton.setText(_spinner.getSelectedItem().toString());
_hintButton.setTextColor(Color.BLACK);
_isSelected = true;
}
_allowToSelect = true;

Expand All @@ -141,16 +142,17 @@ private void initiateSpinnerCharSequence(){
_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

Log.d(TAG, "position selected: " + position);
if (AwesomeSpinner.this._callback == null) {
throw new IllegalStateException("callback cannot be null");
}
if(_allowToSelect){
_isSelected = true;
Object item = AwesomeSpinner.this._spinner.getItemAtPosition(position);
AwesomeSpinner.this._callback.onItemSelected(position, (String) item);
_hintButton.setText(_spinner.getSelectedItem().toString());
_hintButton.setTextColor(Color.BLACK);
_isSelected = true;
}
_allowToSelect = true;

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
versionName "1.0.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -30,7 +30,7 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.github.amlashi-sadra:AwesomeSpinner:1.0.7'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile project(':AwesomeSpinner')
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {
spinnerRTL.setOnSpinnerItemClickListener(new AwesomeSpinner.onSpinnerItemClickListener<String>() {
@Override
public void onItemSelected(int position, String itemAtPosition) {
Toast.makeText(getApplicationContext(), "Position: "+position+" | Item: "+itemAtPosition, Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), "Position: "+position+" | Item: "+itemAtPosition+" | isSelected:"+spinnerLTR.isSelected(), Toast.LENGTH_LONG).show();
}
});

Expand All @@ -57,7 +57,7 @@ public void onItemSelected(int position, String itemAtPosition) {
spinnerLTR.setOnSpinnerItemClickListener(new AwesomeSpinner.onSpinnerItemClickListener<String>() {
@Override
public void onItemSelected(int position, String itemAtPosition) {
Toast.makeText(getApplicationContext(), "Position: "+position+" | Item: "+itemAtPosition, Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), "Position: "+position+" | Item: "+itemAtPosition+" | isSelected:"+spinnerLTR.isSelected(), Toast.LENGTH_LONG).show();
}
});

Expand Down

0 comments on commit 2f2e4e0

Please sign in to comment.