Java 类android.text.method.SingleLineTransformationMethod 实例源码

项目:stynico    文件:AutofitHelper.java   
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;
   }
项目:Tada    文件:TextView.java   
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);
        }
    }
}
项目:mc_backup    文件:FxAccountAbstractSetupActivity.java   
@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);
}
项目:mc_backup    文件:FxAccountAbstractSetupActivity.java   
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;
}
项目:JotaTextEditor    文件:TextView.java   
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);
        }
    }
}
项目:Passbook    文件:DetailFragment.java   
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);
    }
}
项目:ATimeTracker    文件:TaskTimes.java   
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);
}
项目:AutoResizeEditText    文件:AutofitHelper.java   
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;
}
项目:LuaViewPlayground    文件:AutofitHelper.java   
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;
}
项目:LuaViewPlayground    文件:TextUtil.java   
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;
}
项目:DarkCalculator    文件:AutofitHelper.java   
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;
}
项目:android-autofittextview    文件:AutofitHelper.java   
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;
}
项目:android-autofittextview-master    文件:AutofitHelper.java   
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;
}
项目:aMatch    文件:AutofitHelper.java   
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;
}
项目:mc_backup    文件:FxAccountAbstractSetupActivity.java   
protected void createShowPasswordButton() {
  showPasswordButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      boolean isShown = passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
      setPasswordButtonShown(!isShown);
    }
  });
}
项目:Passbook    文件:DetailFragment.java   
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;
}
项目:RealTextView    文件:AutofitHelper.java   
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;
}
项目:skandroid-core    文件:AutofitHelper.java   
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;
}
项目:ATimeTracker    文件:Tasks.java   
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);
}
项目:RSSFeedReader-App    文件:ArticleView.java   
@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());
}