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


Java SingleLineTransformationMethod类代码示例

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


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

示例1: getMaxLines

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
private static int getMaxLines(AppCompatTextView view)
{
       int maxLines = -1; // No limit (Integer.MAX_VALUE also means no limit)

       TransformationMethod method = view.getTransformationMethod();
       if (method != null && method instanceof SingleLineTransformationMethod)
	{
           maxLines = 1;
       }
       else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
	{
           // setMaxLines() and getMaxLines() are only available on android-16+
           maxLines = view.getMaxLines();
       }

       return maxLines;
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:18,代码来源:AutofitHelper.java

示例2: applySingleLine

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
private void applySingleLine(boolean singleLine, boolean applyTransformation,
        boolean changeMaxLines) {
    mSingleLine = singleLine;
    if (singleLine) {
        setLines(1);
        setHorizontallyScrolling(true);
        if (applyTransformation) {
            setTransformationMethod(SingleLineTransformationMethod.getInstance());
        }
    } else {
        if (changeMaxLines) {
            setMaxLines(Integer.MAX_VALUE);
        }
        setHorizontallyScrolling(false);
        if (applyTransformation) {
            setTransformationMethod(null);
        }
    }
}
 
开发者ID:AungThiha,项目名称:Tada,代码行数:20,代码来源:TextView.java

示例3: setPasswordButtonShown

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void setPasswordButtonShown(boolean shouldShow) {
  // Changing input type loses position in edit text; let's try to maintain it.
  int start = passwordEdit.getSelectionStart();
  int stop = passwordEdit.getSelectionEnd();

  if (!shouldShow) {
    passwordEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
    showPasswordButton.setText(R.string.fxaccount_password_show);
    showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_show_background));
    showPasswordButton.setTextColor(ColorUtils.getColor(this, R.color.fxaccount_password_show_textcolor));
  } else {
    passwordEdit.setTransformationMethod(SingleLineTransformationMethod.getInstance());
    showPasswordButton.setText(R.string.fxaccount_password_hide);
    showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_hide_background));
    showPasswordButton.setTextColor(ColorUtils.getColor(this, R.color.fxaccount_password_hide_textcolor));
  }
  passwordEdit.setSelection(start, stop);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:20,代码来源:FxAccountAbstractSetupActivity.java

示例4: makeExtrasBundle

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
protected Bundle makeExtrasBundle(String email, String password) {
  final Bundle bundle = new Bundle();

  // Pass through any extras that we were started with.
  if (getIntent() != null && getIntent().getExtras() != null) {
    bundle.putAll(getIntent().getExtras());
  }

  // Overwrite with current settings.
  if (email == null) {
    email = emailEdit.getText().toString();
  }
  if (password == null) {
    password = passwordEdit.getText().toString();
  }
  bundle.putString(EXTRA_EMAIL, email);
  bundle.putString(EXTRA_PASSWORD, password);

  boolean isPasswordShown = passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
  bundle.putBoolean(EXTRA_PASSWORD_SHOWN, isPasswordShown);

  return bundle;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:24,代码来源:FxAccountAbstractSetupActivity.java

示例5: applySingleLine

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
private void applySingleLine(boolean singleLine, boolean applyTransformation) {
    mSingleLine = singleLine;
    if (singleLine) {
        setLines(1);
        setHorizontallyScrolling(true);
        if (applyTransformation) {
            setTransformationMethod(SingleLineTransformationMethod.
                                    getInstance());
        }
    } else {
        setMaxLines(Integer.MAX_VALUE);
        setHorizontallyScrolling(false);
        if (applyTransformation) {
            setTransformationMethod(null);
        }
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:18,代码来源:TextView.java

示例6: changeDisplay

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
void changeDisplay(View view, int pos) {
    if(mShowPwd) {
        return;
    }
    Account.Entry entry = mItems.get(pos);
    if(entry.mType == AccountManager.EntryType.PASSWORD ||
            entry.mType == AccountManager.EntryType.PIN) {
        boolean showed = mPwdShowed.get(pos);
        ViewHolder holder = (ViewHolder)view.getTag();
        if(showed) {
            holder.mValue.setTransformationMethod(
                    PasswordTransformationMethod.getInstance());
        } else {
            holder.mValue.setTransformationMethod(
                    SingleLineTransformationMethod.getInstance());
        }
        mPwdShowed.set(pos, !showed);
    }
}
 
开发者ID:zhuqianqian,项目名称:Passbook,代码行数:20,代码来源:DetailFragment.java

示例7: TimeView

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
public TimeView(Context context, TimeRange t) {
    super(context);
    setOrientation(LinearLayout.HORIZONTAL);
    setPadding(5, 10, 5, 10);

    dateRange = new TextView(context);
    dateRange.setTextSize(FONT_SIZE);
    addView(dateRange, new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1f));

    total = new TextView(context);
    total.setTextSize(FONT_SIZE);
    total.setGravity(Gravity.RIGHT);
    total.setTransformationMethod(SingleLineTransformationMethod.getInstance());
    addView(total, new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0.0f));

    setTimeRange(t);
}
 
开发者ID:netmackan,项目名称:ATimeTracker,代码行数:20,代码来源:TaskTimes.java

示例8: getMaxLines

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
private static int getMaxLines(TextView view) {
    int maxLines = -1; // No limit (Integer.MAX_VALUE also means no limit)

    TransformationMethod method = view.getTransformationMethod();
    if (method != null && method instanceof SingleLineTransformationMethod) {
        maxLines = 1;
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // setMaxLines() and getMaxLines() are only available on android-16+
        maxLines = view.getMaxLines();
    }

    return maxLines;
}
 
开发者ID:victorminerva,项目名称:AutoResizeEditText,代码行数:14,代码来源:AutofitHelper.java

示例9: getMaxLines

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
private static int getMaxLines(TextView view) {
    int maxLines = -1; // No limit (Integer.MAX_VALUE also means no limit)

    TransformationMethod method = view.getTransformationMethod();
    if (method != null && method instanceof SingleLineTransformationMethod) {
        maxLines = 1;
    }
    else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // setMaxLines() and getMaxLines() are only available on android-16+
        maxLines = view.getMaxLines();
    }

    return maxLines;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:15,代码来源:AutofitHelper.java

示例10: createShowPasswordButton

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
protected void createShowPasswordButton() {
  showPasswordButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      boolean isShown = passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
      setPasswordButtonShown(!isShown);
    }
  });
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:10,代码来源:FxAccountAbstractSetupActivity.java

示例11: getView

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    View v = convertView;
    Account.Entry entry = mItems.get(position);
    if(v == null) {
        holder = new ViewHolder();
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        v = inflater.inflate(R.layout.account_view_item, parent, false);

        holder.mName = (TextView)v.findViewById(R.id.field_name);
        holder.mValue = (TextView)v.findViewById(R.id.field_value);
        v.setTag(holder);

    }
    else{
        holder = (ViewHolder) v.getTag();
    }
    holder.mName.setText(entry.mName);
    if(!mShowPwd) {
        boolean showed = mPwdShowed.get(position);
        if(entry.mType == AccountManager.EntryType.PASSWORD ||
                entry.mType == AccountManager.EntryType.PIN && !showed) {
            holder.mValue.setTransformationMethod(
                    PasswordTransformationMethod.getInstance());
        }
        else {
            holder.mValue.setTransformationMethod(
                    SingleLineTransformationMethod.getInstance());
        }
        if(entry.mType == AccountManager.EntryType.WEBADDR) {
            holder.mValue.setAutoLinkMask(Linkify.WEB_URLS);
        }
    }
    holder.mValue.setText(entry.mValue);
    return v;
}
 
开发者ID:zhuqianqian,项目名称:Passbook,代码行数:38,代码来源:DetailFragment.java

示例12: TaskView

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
public TaskView(Context context, Task t) {
    super(context);
    setOrientation(LinearLayout.HORIZONTAL);
    setPadding(5, 10, 5, 10);

    taskName = new TextView(context);
    taskName.setTextSize(fontSize);
    taskName.setText(t.getTaskName());
    addView(taskName, new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1f));

    checkMark = new ImageView(context);
    checkMark.setImageResource(R.drawable.ic_check_mark_dark);
    checkMark.setVisibility(View.INVISIBLE);
    addView(checkMark, new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0f));

    total = new TextView(context);
    total.setTextSize(fontSize);
    total.setGravity(Gravity.RIGHT);
    total.setTransformationMethod(SingleLineTransformationMethod.getInstance());
    total.setText(formatTotal(decimalFormat, t.getTotal(), 0));
    addView(total, new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0f));

    setGravity(Gravity.TOP);
    markupSelectedTask(t);
}
 
开发者ID:netmackan,项目名称:ATimeTracker,代码行数:29,代码来源:Tasks.java

示例13: onCreate

import android.text.method.SingleLineTransformationMethod; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
       BrightnessControl.toggleBrightness(getApplicationContext(), this);
	if (savedInstanceState == null) {
		rssData = HeadlinesFragment.getInstance().getRssData();
	}
	else {
		rssData = savedInstanceState.getParcelableArrayList(RSS_DATA_KEY);
	}
	setContentView(R.layout.article_view);
       viewPager = (ViewPager) findViewById(R.id.viewPager);

	viewPager
			.setOnPageChangeListener(viewPagerPageChangeListener = new ArticleViewPagerChangeListener());
	FragmentManager fragMan = getSupportFragmentManager();
	viewPager
			.setAdapter(viewPagerAdapter = new FixedFragmentStatePagerAdapter(
                   fragMan) {

                   @Override
                   public Fragment getItem (int arg0) {
                       return ArticleViewFragment.newArticleViewFragment(rssData.get(arg0));
                   }

                   @Override
                   public int getCount () {
                       return rssData.size();
                   }

               });
       viewPager.setPageTransformer(true, new DepthPageTransformer());
	String uuid = getIntent().getStringExtra(HeadlinesFragment.ARTICLE_ID);

	for (int i = 0; i < rssData.size(); i++) {
		RSSDataBundle rdBundle = rssData.get(i);
		if (rdBundle.getId().equals(uuid)) {
			viewPager.setCurrentItem(i);
			// Explicitly call the page change listener to set
			// the action bar title appropriately
			viewPagerPageChangeListener.onPageSelected(i);
			break;
		}
	}

       ActionBar actionBar = getActionBar();
       if (actionBar != null) {
           actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME
                                     | ActionBar.DISPLAY_USE_LOGO
                                     | ActionBar.DISPLAY_SHOW_TITLE
                                     | ActionBar.DISPLAY_HOME_AS_UP);
       }
       title = Utils.getTitleTextView(this);

	if (title != null) {
		title.setEllipsize(TruncateAt.MARQUEE);
		title.setMarqueeRepeatLimit(-1);
		title.setHorizontallyScrolling(true);
		title.setFocusable(true);
		title.setFocusableInTouchMode(true);
		title.requestFocus();
		title.setTransformationMethod(SingleLineTransformationMethod
				.getInstance());
		title.setTextColor(getResources().getColor((R.color.AppPrimaryTextColor)));
	}

       action_openInBrowser = (LinearLayout) findViewById(R.id.action_open_in_browser);
       action_openInBrowser
           .setOnClickListener(new ArticleViewOpenInBrowserActionClickListener());
       action_next_unread = (LinearLayout) findViewById(R.id.action_next_unread);
       action_next_unread
           .setOnClickListener(new ArticleViewNextUnreadActionClickListener());
       action_previous_unread = (LinearLayout) findViewById(R.id.action_previous_unread);
       action_previous_unread
           .setOnClickListener(new ArticleViewPreviousUnreadActionClickListener());
}
 
开发者ID:ChesleyTan,项目名称:RSSFeedReader-App,代码行数:77,代码来源:ArticleView.java


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