java类android.text.method.SingleLineTransformationMethod的实例源码

AutofitHelper.java 文件源码 项目:stynico 阅读 25 收藏 0 点赞 0 评论 0
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;
   }
TextView.java 文件源码 项目:Tada 阅读 26 收藏 0 点赞 0 评论 0
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);
        }
    }
}
FxAccountAbstractSetupActivity.java 文件源码 项目:mc_backup 阅读 24 收藏 0 点赞 0 评论 0
@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);
}
FxAccountAbstractSetupActivity.java 文件源码 项目:mc_backup 阅读 28 收藏 0 点赞 0 评论 0
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;
}
TextView.java 文件源码 项目:JotaTextEditor 阅读 24 收藏 0 点赞 0 评论 0
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);
        }
    }
}
DetailFragment.java 文件源码 项目:Passbook 阅读 23 收藏 0 点赞 0 评论 0
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);
    }
}
TaskTimes.java 文件源码 项目:ATimeTracker 阅读 17 收藏 0 点赞 0 评论 0
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);
}
AutofitHelper.java 文件源码 项目:AutoResizeEditText 阅读 26 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:LuaViewPlayground 阅读 23 收藏 0 点赞 0 评论 0
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;
}
TextUtil.java 文件源码 项目:LuaViewPlayground 阅读 25 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:DarkCalculator 阅读 27 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:android-autofittextview 阅读 27 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:android-autofittextview-master 阅读 26 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:aMatch 阅读 26 收藏 0 点赞 0 评论 0
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;
}
FxAccountAbstractSetupActivity.java 文件源码 项目:mc_backup 阅读 23 收藏 0 点赞 0 评论 0
protected void createShowPasswordButton() {
  showPasswordButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      boolean isShown = passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
      setPasswordButtonShown(!isShown);
    }
  });
}
DetailFragment.java 文件源码 项目:Passbook 阅读 34 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:RealTextView 阅读 23 收藏 0 点赞 0 评论 0
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;
}
AutofitHelper.java 文件源码 项目:skandroid-core 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Tasks.java 文件源码 项目:ATimeTracker 阅读 21 收藏 0 点赞 0 评论 0
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);
}
ArticleView.java 文件源码 项目:RSSFeedReader-App 阅读 20 收藏 0 点赞 0 评论 0
@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());
}


问题


面经


文章

微信
公众号

扫码关注公众号