-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move WPEditText to WordPressUtils and reorganize WordPressUtils
- Loading branch information
Showing
16 changed files
with
86 additions
and
24 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
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
2 changes: 1 addition & 1 deletion
2
...droid/util/ListScrollPositionManager.java → ...il/helpers/ListScrollPositionManager.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
2 changes: 1 addition & 1 deletion
2
...ordpress/android/util/LocationHelper.java → .../android/util/helpers/LocationHelper.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
2 changes: 1 addition & 1 deletion
2
...ndroid/util/ptr/SwipeToRefreshHelper.java → ...id/util/helpers/SwipeToRefreshHelper.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
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
2 changes: 1 addition & 1 deletion
2
...dpress/android/util/WPHtmlTagHandler.java → ...ndroid/util/helpers/WPHtmlTagHandler.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
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
2 changes: 1 addition & 1 deletion
2
...g/wordpress/android/util/WPQuoteSpan.java → ...ess/android/util/helpers/WPQuoteSpan.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
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
2 changes: 1 addition & 1 deletion
2
...ress/android/util/AutoResizeTextView.java → ...roid/util/widgets/AutoResizeTextView.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
57 changes: 57 additions & 0 deletions
57
WordPressUtils/src/main/java/org/wordpress/android/util/widgets/WPEditText.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,57 @@ | ||
package org.wordpress.android.util.widgets; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.KeyEvent; | ||
import android.widget.EditText; | ||
|
||
public class WPEditText extends EditText { | ||
private EditTextImeBackListener mOnImeBack; | ||
private OnSelectionChangedListener onSelectionChangedListener; | ||
|
||
public WPEditText(Context context) { | ||
super(context); | ||
} | ||
|
||
public WPEditText(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public WPEditText(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
} | ||
|
||
@Override | ||
protected void onSelectionChanged(int selStart, int selEnd) { | ||
if (onSelectionChangedListener != null) { | ||
onSelectionChangedListener.onSelectionChanged(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onKeyPreIme(int keyCode, KeyEvent event) { | ||
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK | ||
&& event.getAction() == KeyEvent.ACTION_UP) { | ||
if (mOnImeBack != null) | ||
mOnImeBack.onImeBack(this, this.getText().toString()); | ||
} | ||
|
||
return super.onKeyPreIme(keyCode, event); | ||
} | ||
|
||
public void setOnEditTextImeBackListener(EditTextImeBackListener listener) { | ||
mOnImeBack = listener; | ||
} | ||
|
||
public interface EditTextImeBackListener { | ||
public abstract void onImeBack(WPEditText ctrl, String text); | ||
} | ||
|
||
public void setOnSelectionChangedListener(OnSelectionChangedListener listener) { | ||
onSelectionChangedListener = listener; | ||
} | ||
|
||
public interface OnSelectionChangedListener { | ||
public abstract void onSelectionChanged(); | ||
} | ||
} |