-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TextView converted to EditText for display
- Loading branch information
travijuu
committed
Apr 14, 2017
1 parent
380f5dc
commit 8823d27
Showing
7 changed files
with
91 additions
and
20 deletions.
There are no files selected for viewing
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
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
40 changes: 40 additions & 0 deletions
40
...c/main/java/com/travijuu/numberpicker/library/Listener/DefaultOnEditorActionListener.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,40 @@ | ||
package com.travijuu.numberpicker.library.Listener; | ||
|
||
import android.view.KeyEvent; | ||
import android.view.inputmethod.EditorInfo; | ||
import android.widget.TextView; | ||
|
||
import com.travijuu.numberpicker.library.NumberPicker; | ||
|
||
/** | ||
* Created by travijuu on 13/04/17. | ||
*/ | ||
|
||
public class DefaultOnEditorActionListener implements TextView.OnEditorActionListener { | ||
|
||
NumberPicker numberPicker; | ||
|
||
public DefaultOnEditorActionListener(NumberPicker numberPicker) { | ||
this.numberPicker = numberPicker; | ||
} | ||
|
||
@Override | ||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | ||
if (actionId == EditorInfo.IME_ACTION_DONE) { | ||
int value = numberPicker.getMin(); | ||
|
||
try { | ||
value = Integer.parseInt(v.getText().toString()); | ||
} catch (Exception e) { | ||
// pass | ||
} | ||
|
||
numberPicker.setValue(value); | ||
|
||
if (numberPicker.getValue() == value) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
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
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
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
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
gcvgtvt