Java Code Examples for com.gianlu.commonutils.misc.SuperTextView#setText()

The following examples show how to use com.gianlu.commonutils.misc.SuperTextView#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootNameserverFragment.java    From DNSHero with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    ScrollView layout = (ScrollView) inflater.inflate(R.layout.fragment_root_nameserver, container, false);

    Bundle args = getArguments();
    Domain.RootNameserver root;
    if (getContext() == null || args == null || (root = (Domain.RootNameserver) args.getSerializable("root")) == null)
        return null;

    SuperTextView name = layout.findViewById(R.id.rootNsFragment_name);
    Utils.clickToCopy(name);
    name.setText(root.name);

    SuperTextView rtt = layout.findViewById(R.id.rootNsFragment_rtt);
    rtt.setHtml(R.string.rtt, Utils.formatRTT(root.rtt));

    final LinearLayout nameservers = layout.findViewById(R.id.rootNsFragment_nameservers);
    for (String nameserver : root.nameservers) {
        TextView text = (TextView) inflater.inflate(R.layout.item_secondary_text, nameservers, false);
        text.setText(nameserver);
        Utils.clickToCopy(text);

        nameservers.addView(text);
    }

    final ImageButton toggleNs = layout.findViewById(R.id.rootNsFragment_toggleNs);
    toggleNs.setOnClickListener(v -> CommonUtils.handleCollapseClick(toggleNs, nameservers));

    GlueView glue = layout.findViewById(R.id.rootNsFragment_glue);
    glue.setGlue(root.glue);

    return layout;
}
 
Example 2
Source File: CustomDownloadInfo.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
public void setText(String text) {
    SuperTextView textView = (SuperTextView) getChildAt(1);
    if (textView == null) {
        textView = SuperTextView.text(getContext(), text);
        textView.setTextColor(Color.WHITE);
        textView.setPaddingRelative(0, 0, dp16 / 2, 0);
        addView(textView);
        return;
    }

    textView.setText(text);
}