Search in sources :

Example 1 with AppCompatTextView

use of androidx.appcompat.widget.AppCompatTextView in project J2ME-Loader by nikita36078.

the class StringItem method getItemContentView.

@Override
public View getItemContentView() {
    if (textview == null) {
        Context context = getOwnerForm().getParentActivity();
        if (appearanceMode == BUTTON) {
            textview = new AppCompatButton(context);
        } else {
            textview = new AppCompatTextView(context);
        }
        textview.setTextAppearance(context, android.R.style.TextAppearance_Small);
        if (appearanceMode == HYPERLINK && text != null) {
            SpannableStringBuilder s = new SpannableStringBuilder(text);
            s.setSpan(new URLSpan(text), 0, s.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            textview.setText(s);
        } else {
            textview.setText(text);
        }
        textview.setOnClickListener(v -> fireDefaultCommandAction());
    }
    return textview;
}
Also used : Context(android.content.Context) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) URLSpan(android.text.style.URLSpan) SpannableStringBuilder(android.text.SpannableStringBuilder) AppCompatButton(androidx.appcompat.widget.AppCompatButton)

Example 2 with AppCompatTextView

use of androidx.appcompat.widget.AppCompatTextView in project J2ME-Loader by nikita36078.

the class Item method getItemView.

/**
 * Get the whole item
 *
 * @return LinearLayout with a label in the first row and some content in the second row
 */
public View getItemView() {
    if (layout == null) {
        Context context = owner.getParentActivity();
        layout = new LinearLayout(context);
        layout.setOrientation(LinearLayout.VERTICAL);
        labelview = new AppCompatTextView(context);
        labelview.setTextAppearance(context, android.R.style.TextAppearance_Medium);
        labelview.setText(label);
        if (label != null) {
            layout.addView(labelview, getLayoutParams());
        }
        contentview = getItemContentView();
        layout.addView(contentview, getLayoutParams());
        ViewHandler.postEvent(msgSetContextMenuListener);
    }
    return layout;
}
Also used : Context(android.content.Context) AppCompatTextView(androidx.appcompat.widget.AppCompatTextView) LinearLayout(android.widget.LinearLayout)

Aggregations

Context (android.content.Context)2 AppCompatTextView (androidx.appcompat.widget.AppCompatTextView)2 SpannableStringBuilder (android.text.SpannableStringBuilder)1 URLSpan (android.text.style.URLSpan)1 LinearLayout (android.widget.LinearLayout)1 AppCompatButton (androidx.appcompat.widget.AppCompatButton)1