Java Code Examples for android.widget.TextView.setTextIsSelectable()

The following are Jave code examples for showing how to use setTextIsSelectable() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: MTweaks-KernelAdiutorMOD   File: DescriptionFragment.java   View Source Code Vote up 6 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_description, container, false);

    mTitleView = (TextView) rootView.findViewById(R.id.title);
    mSummaryView = (TextView) rootView.findViewById(R.id.summary);

    if (Utils.isTv(getActivity())) {
        mSummaryView.setFocusable(true);
    } else {
        mTitleView.setTextIsSelectable(true);
        mSummaryView.setTextIsSelectable(true);
    }

    mSummaryView.setSelected(true);
    mSummaryView.setMovementMethod(LinkMovementMethod.getInstance());

    mTitle = getArguments().getCharSequence("title");
    mSummary = getArguments().getCharSequence("summary");

    refresh();
    return rootView;
}
 
Example 2
Project: PicKing   File: AboutActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    ButterKnife.bind(this);

    toolbar.setTitle("关于  v " + PackageUtil.getAppPackageInfo(this).versionName);
    setSupportActionBar(toolbar);

    TextView alipay = (TextView) findViewById(R.id.alipay);
    alipay.setTextIsSelectable(true);
    alipay.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!AliPayUtil.goAliPay(AboutActivity.this))
                SnackbarUtils.Short(getWindow().getDecorView(), "设备上没有安装支付宝").danger().show();
        }
    });
}
 
Example 3
Project: KernelAdiutor-Mod   File: DescriptionFragment.java   View Source Code Vote up 6 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_description, container, false);

    mTitleView = (TextView) rootView.findViewById(R.id.title);
    mSummaryView = (TextView) rootView.findViewById(R.id.summary);

    if (Utils.isTv(getActivity())) {
        mSummaryView.setFocusable(true);
    } else {
        mTitleView.setTextIsSelectable(true);
        mSummaryView.setTextIsSelectable(true);
    }

    mSummaryView.setSelected(true);
    mSummaryView.setMovementMethod(LinkMovementMethod.getInstance());

    mTitle = getArguments().getCharSequence("title");
    mSummary = getArguments().getCharSequence("summary");

    refresh();
    return rootView;
}
 
Example 4
Project: yaacc-code   File: YaaccLogActivity.java   View Source Code Vote up 6 votes
private void displayLog() {
    TextView textView = (TextView) findViewById(R.id.yaaccLog_content);

    try {
        Process process = Runtime.getRuntime().exec("logcat -d");
        BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(process.getInputStream()));

        StringBuilder log = new StringBuilder();
        String line = "";
        while ((line = bufferedReader.readLine()) != null) {
            log.insert(0,"\n");
            log.insert(0,line);
        }

        textView.setText(log.toString());
        textView.setTextIsSelectable(true);


    } catch (IOException e) {
        textView.setText("Error while reading log: " + e.getMessage());
    }
}
 
Example 5
Project: Phoenix-for-VK   File: WallPostFragment.java   View Source Code Vote up 5 votes
private void resolveTextSelection(){
    if(nonNull(mText)){
        mText.setTextIsSelectable(mTextSelectionAllowed);
    }

    ViewGroup copiesRoot = mAttachmentsViews.getVgPosts();

    for(int i = 0; i < copiesRoot.getChildCount(); i++){
        ViewGroup copyRoot = (ViewGroup) copiesRoot.getChildAt(i);
        TextView textView = copyRoot.findViewById(R.id.item_post_copy_text);
        if(nonNull(textView)){
            textView.setTextIsSelectable(mTextSelectionAllowed);
        }
    }
}
 
Example 6
Project: Quran   File: InlineTranslationView.java   View Source Code Vote up 4 votes
private void addTextForAyah(String[] translations, QuranAyahInfo ayah) {
  LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
      LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.setMargins(leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin);

  final int suraNumber = ayah.sura;
  final int ayahNumber = ayah.ayah;
  TextView ayahHeader = new TextView(context);
  ayahHeader.setTextColor(Color.WHITE);
  ayahHeader.setTextSize(fontSize);
  ayahHeader.setTypeface(null, Typeface.BOLD);
  ayahHeader.setText(resources.getString(R.string.sura_ayah, suraNumber, ayahNumber));
  linearLayout.addView(ayahHeader, params);

  TextView ayahView = new TextView(context);
  ayahView.setTextAppearance(context, textStyle);
  ayahView.setTextColor(Color.WHITE);
  ayahView.setTextSize(fontSize);

  // translation
  boolean showHeader = translations.length > 1;
  SpannableStringBuilder builder = new SpannableStringBuilder();
  for (int i = 0; i < translations.length; i++) {
    String translationText = ayah.texts.get(i);
    if (!TextUtils.isEmpty(translationText)) {
      if (showHeader) {
        if (i > 0) {
          builder.append("\n\n");
        }
        int start = builder.length();
        builder.append(translations[i]);
        builder.setSpan(new StyleSpan(Typeface.BOLD),
            start, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.append("\n\n");
      }
      builder.append(translationText);
    }
  }
  ayahView.append(builder);

  params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.setMargins(leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin);
  ayahView.setTextIsSelectable(true);
  linearLayout.addView(ayahView, params);
}