-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
AwesomeSpinner/src/main/java/com/isapanah/awesomespinner/spinnerDefaultSelection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.isapanah.awesomespinner; | ||
|
||
import android.content.Context; | ||
import android.support.v7.widget.AppCompatSpinner; | ||
import android.util.AttributeSet; | ||
|
||
/** | ||
* Created by sadra on 5/27/17. | ||
*/ | ||
|
||
public class spinnerDefaultSelection extends AppCompatSpinner { | ||
|
||
OnItemSelectedListener listener; | ||
int prevPos = 0; | ||
public spinnerDefaultSelection(Context context) { | ||
super(context); | ||
} | ||
|
||
public spinnerDefaultSelection(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public spinnerDefaultSelection(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
} | ||
|
||
@Override | ||
public void setSelection(int position) { | ||
super.setSelection(position); | ||
if (position == getSelectedItemPosition() && prevPos == position) { | ||
getOnItemSelectedListener().onItemSelected(null, null, position, 0); | ||
} | ||
prevPos = position; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters