当前位置: 首页>>代码示例>>Java>>正文


Java ArrowKeyMovementMethod类代码示例

本文整理汇总了Java中android.text.method.ArrowKeyMovementMethod的典型用法代码示例。如果您正苦于以下问题:Java ArrowKeyMovementMethod类的具体用法?Java ArrowKeyMovementMethod怎么用?Java ArrowKeyMovementMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArrowKeyMovementMethod类属于android.text.method包,在下文中一共展示了ArrowKeyMovementMethod类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onFinishInflate

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
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);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:18,代码来源:DetailsExpandedContainer.java

示例2: checkMentionSpannable

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
/**
 * 为TextView设置显示@效果
 */
public static void checkMentionSpannable(TextView textView, String content, List<String> allMention) {
    if (textView == null) {
        return;
    }
    if (allMention.isEmpty() || TextUtils.isEmpty(content)) {
        textView.setText(content);
        textView.setMovementMethod(ArrowKeyMovementMethod.getInstance());
        return;
    }

    SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(content);
    int lastMentionIndex = -1;

    for (String mention : allMention) {
        Matcher matcher = Pattern.compile("\\[email protected]" + mention + "\\E").matcher(content);

        while (matcher.find()) {
            String mentionText = matcher.group();
            int start;
            if (lastMentionIndex != -1) {
                start = content.indexOf(mentionText, lastMentionIndex);
            } else {
                start = content.indexOf(mentionText);
            }
            int end = start + mentionText.length();
            spannableStringBuilder.setSpan(new MentionSpan(mentionText), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
    textView.setText(spannableStringBuilder);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:35,代码来源:ExEditText.java

示例3: setEditable

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
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();
}
 
开发者ID:TomeOkin,项目名称:LsPush,代码行数:13,代码来源:TagGroup.java

示例4: setBodyTextIsSelectable

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
public void setBodyTextIsSelectable(boolean paramBoolean)
{
  if (Build.VERSION.SDK_INT >= 11)
  {
    this.mBodyView.setTextIsSelectable(paramBoolean);
    this.mBodyView.setAutoLinkMask(15);
    this.mBodyView.setMovementMethod(ArrowKeyMovementMethod.getInstance());
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:10,代码来源:DetailsTextBlock.java

示例5: testMovementMethod

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
@Test
public void testMovementMethod() {
  MovementMethod movement = new ArrowKeyMovementMethod();

  assertNull(textView.getMovementMethod());
  textView.setMovementMethod(movement);
  assertThat(textView.getMovementMethod()).isSameAs(movement);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:9,代码来源:TextViewTest.java

示例6: onCreateView

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
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;
}
 
开发者ID:lacolaco,项目名称:SmileEssence,代码行数:41,代码来源:PostFragment.java

示例7: getDefaultMovementMethod

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
@Override
protected MovementMethod getDefaultMovementMethod() {
    return ArrowKeyMovementMethod.getInstance();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:5,代码来源:HighlightEditor.java

示例8: setTextIsSelectable

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:AungThiha,项目名称:Tada,代码行数:45,代码来源:TextView.java

示例9: onResume

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
@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);
		}
	});

}
 
开发者ID:michaelbarlow7,项目名称:dungeon-crawl-android,代码行数:50,代码来源:ConfigEditor.java

示例10: onResume

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
@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);
		}
	});

}
 
开发者ID:michaelbarlow7,项目名称:dungeon-crawl-android,代码行数:50,代码来源:CharFileViewer.java

示例11: getDefaultMovementMethod

import android.text.method.ArrowKeyMovementMethod; //导入依赖的package包/类
protected final MovementMethod getDefaultMovementMethod()
{
  return ArrowKeyMovementMethod.getInstance();
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:5,代码来源:AndroidOnscreenKeyboard$1.java


注:本文中的android.text.method.ArrowKeyMovementMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。