protected void onFinishInflate()
{
super.onFinishInflate();
this.mDetailsExpandedCallout = ((TextView)findViewById(2131755581));
this.mDetailsExpandedCallout.setMovementMethod(LinkMovementMethod.getInstance());
this.mDetailsExpandedBody1 = ((DetailsTextBlock)findViewById(2131755582));
this.mDetailsExpandedBody2 = ((DetailsTextBlock)findViewById(2131755583));
this.mDetailsExpandedExtras = ((ViewGroup)findViewById(2131755584));
if (Build.VERSION.SDK_INT >= 11)
{
this.mDetailsExpandedCallout.setTextIsSelectable(true);
this.mDetailsExpandedCallout.setAutoLinkMask(15);
this.mDetailsExpandedCallout.setMovementMethod(ArrowKeyMovementMethod.getInstance());
}
this.mDetailsExpandedBody1.setBodyTextIsSelectable(true);
this.mDetailsExpandedBody2.setBodyTextIsSelectable(true);
}
java类android.text.method.ArrowKeyMovementMethod的实例源码
DetailsExpandedContainer.java 文件源码
项目:FMTech
阅读 52
收藏 0
点赞 0
评论 0
TagGroup.java 文件源码
项目:LsPush
阅读 20
收藏 0
点赞 0
评论 0
public void setEditable(boolean editable, @Nullable CharSequence hint) {
if (mEditable == editable) {
return;
}
mEditable = editable;
setFocusable(editable);
setFocusableInTouchMode(editable);
setHint(hint);
setMovementMethod(editable ? ArrowKeyMovementMethod.getInstance() : null);
resetPaint();
}
DetailsTextBlock.java 文件源码
项目:FMTech
阅读 18
收藏 0
点赞 0
评论 0
public void setBodyTextIsSelectable(boolean paramBoolean)
{
if (Build.VERSION.SDK_INT >= 11)
{
this.mBodyView.setTextIsSelectable(paramBoolean);
this.mBodyView.setAutoLinkMask(15);
this.mBodyView.setMovementMethod(ArrowKeyMovementMethod.getInstance());
}
}
TextViewTest.java 文件源码
项目:FullRobolectricTestSample
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void testMovementMethod() {
MovementMethod movement = new ArrowKeyMovementMethod();
assertNull(textView.getMovementMethod());
textView.setMovementMethod(movement);
assertThat(textView.getMovementMethod()).isSameAs(movement);
}
PostFragment.java 文件源码
项目:SmileEssence
阅读 20
收藏 0
点赞 0
评论 0
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Logger.debug("PostFragment CreateView");
MainActivity activity = (MainActivity) getActivity();
PostState.getState().setListener(this);
UserPreferenceHelper preferenceHelper = new UserPreferenceHelper(activity);
View v = inflater.inflate(R.layout.fragment_post, null);
buttonTweet = getTweetButton(v);
buttonTweet.setOnClickListener(this);
editText = getEditText(v);
textViewCount = getCountTextView(v);
int textSize = preferenceHelper.getValue(R.string.key_setting_text_size, 10);
editText.addTextChangedListener(this);
editText.setOnFocusChangeListener(this);
editText.setTextSize(textSize + 4);
editText.setMovementMethod(new ArrowKeyMovementMethod() {
@Override
protected boolean right(TextView widget, Spannable buffer) {
//Don't back to Home
return widget.getSelectionEnd() == widget.length() || super.right(widget, buffer);
}
});
ImageButton imageButtonDeleteText = (ImageButton) v.findViewById(R.id.button_post_delete);
imageButtonDeleteText.setOnClickListener(this);
ImageButton imageButtonMedia = (ImageButton) v.findViewById(R.id.button_post_media);
imageButtonMedia.setOnClickListener(this);
ImageButton imageButtonMenu = (ImageButton) v.findViewById(R.id.button_post_menu);
imageButtonMenu.setOnClickListener(this);
//Reply view
viewGroupReply = getReplyViewGroup(v);
ImageButton imageButtonDeleteReply = (ImageButton) viewGroupReply.findViewById(R.id.button_post_reply_delete);
imageButtonDeleteReply.setOnClickListener(this);
//Media view
viewGroupMedia = getMediaViewGroup(v);
ImageView imageViewMedia = (ImageView) viewGroupMedia.findViewById(R.id.image_post_media);
ImageButton imageButtonDeleteMedia = (ImageButton) viewGroupMedia.findViewById(R.id.button_post_media_delete);
imageViewMedia.setOnClickListener(this);
imageButtonDeleteMedia.setOnClickListener(this);
editText.requestFocus();
return v;
}
HighlightEditor.java 文件源码
项目:javaide
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected MovementMethod getDefaultMovementMethod() {
return ArrowKeyMovementMethod.getInstance();
}
FMedittext.java 文件源码
项目:Android-Music-Player
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected MovementMethod getDefaultMovementMethod() {
return ArrowKeyMovementMethod.getInstance();
}
MyEditText.java 文件源码
项目:Attendance
阅读 18
收藏 0
点赞 0
评论 0
@Override
protected MovementMethod getDefaultMovementMethod() {
return ArrowKeyMovementMethod.getInstance();
}
SyntaxHighlightEditor.java 文件源码
项目:Android-Syntax-Highlight-Library
阅读 21
收藏 0
点赞 0
评论 0
@Override
protected MovementMethod getDefaultMovementMethod() {
return ArrowKeyMovementMethod.getInstance();
}
TextView.java 文件源码
项目:Tada
阅读 26
收藏 0
点赞 0
评论 0
/**
* Sets whether the content of this view is selectable by the user. The default is
* {@code false}, meaning that the content is not selectable.
* <p>
* When you use a TextView to display a useful piece of information to the user (such as a
* contact's address), make it selectable, so that the user can select and copy its
* content. You can also use set the XML attribute
* {@link android.R.styleable#TextView_textIsSelectable} to "true".
* <p>
* When you call this method to set the value of {@code textIsSelectable}, it sets
* the flags {@code focusable}, {@code focusableInTouchMode}, {@code clickable},
* and {@code longClickable} to the same value. These flags correspond to the attributes
* {@link android.R.styleable#View_focusable android:focusable},
* {@link android.R.styleable#View_focusableInTouchMode android:focusableInTouchMode},
* {@link android.R.styleable#View_clickable android:clickable}, and
* {@link android.R.styleable#View_longClickable android:longClickable}. To restore any of these
* flags to a state you had set previously, call one or more of the following methods:
* {@link #setFocusable(boolean) setFocusable()},
* {@link #setFocusableInTouchMode(boolean) setFocusableInTouchMode()},
* {@link #setClickable(boolean) setClickable()} or
* {@link #setLongClickable(boolean) setLongClickable()}.
*
* @param selectable Whether the content of this TextView should be selectable.
*/
public void setTextIsSelectable(boolean selectable) {
if (!selectable && mEditor == null) return; // false is default value with no edit data
createEditorIfNeeded();
if (mEditor.mTextIsSelectable == selectable) return;
mEditor.mTextIsSelectable = selectable;
setFocusableInTouchMode(selectable);
setFocusable(selectable);
setClickable(selectable);
setLongClickable(selectable);
// mInputType should already be EditorInfo.TYPE_NULL and mInput should be null
setMovementMethod(selectable ? ArrowKeyMovementMethod.getInstance() : null);
setText(mText, selectable ? BufferType.SPANNABLE : BufferType.NORMAL);
// Called by setText above, but safer in case of future code changes
mEditor.prepareCursorControllers();
}
LineNumberEditText.java 文件源码
项目:LineNumberTextView
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected MovementMethod getDefaultMovementMethod() {
return ArrowKeyMovementMethod.getInstance();
}
ConfigEditor.java 文件源码
项目:dungeon-crawl-android
阅读 26
收藏 0
点赞 0
评论 0
@Override
protected void onResume()
{
super.onResume();
getNoteFromFile();
// Make sure that we don't use the link movement method.
// Instead, we need a blend between the arrow key movement (for regular
// navigation) and
// the link movement (so the user can click on links).
// TODO: Might be able to edit this, since we don't care about
// linkifying text
getMText().setMovementMethod(new ArrowKeyMovementMethod()
{
public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event)
{
// This block is copied and pasted from LinkMovementMethod's
// onTouchEvent (without the part that actually changes the
// selection).
int action = event.getAction();
if (action == MotionEvent.ACTION_UP)
{
int x = (int) event.getX();
int y = (int) event.getY();
x -= widget.getTotalPaddingLeft();
y -= widget.getTotalPaddingTop();
x += widget.getScrollX();
y += widget.getScrollY();
Layout layout = widget.getLayout();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class);
if (link.length != 0)
{
link[0].onClick(widget);
return true;
}
}
return super.onTouchEvent(widget, buffer, event);
}
});
}
CharFileViewer.java 文件源码
项目:dungeon-crawl-android
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected void onResume()
{
super.onResume();
getNoteFromFile();
// Make sure that we don't use the link movement method.
// Instead, we need a blend between the arrow key movement (for regular
// navigation) and
// the link movement (so the user can click on links).
// TODO: Might be able to edit this, since we don't care about
// linkifying text
mText.setMovementMethod(new ArrowKeyMovementMethod()
{
public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event)
{
// This block is copied and pasted from LinkMovementMethod's
// onTouchEvent (without the part that actually changes the
// selection).
int action = event.getAction();
if (action == MotionEvent.ACTION_UP)
{
int x = (int) event.getX();
int y = (int) event.getY();
x -= widget.getTotalPaddingLeft();
y -= widget.getTotalPaddingTop();
x += widget.getScrollX();
y += widget.getScrollY();
Layout layout = widget.getLayout();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class);
if (link.length != 0)
{
link[0].onClick(widget);
return true;
}
}
return super.onTouchEvent(widget, buffer, event);
}
});
}
AndroidOnscreenKeyboard$1.java 文件源码
项目:ingress-indonesia-dev
阅读 20
收藏 0
点赞 0
评论 0
protected final MovementMethod getDefaultMovementMethod()
{
return ArrowKeyMovementMethod.getInstance();
}