Search in sources :

Example 1 with LinkTransformationMethod

use of de.robv.android.xposed.installer.util.chrome.LinkTransformationMethod in project XposedInstaller by rovo89.

the class DownloadDetailsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Module module = mActivity.getModule();
    if (module == null)
        return null;
    final View view = inflater.inflate(R.layout.download_details, container, false);
    TextView title = (TextView) view.findViewById(R.id.download_title);
    title.setText(module.name);
    TextView author = (TextView) view.findViewById(R.id.download_author);
    if (module.author != null && !module.author.isEmpty())
        author.setText(getString(R.string.download_author, module.author));
    else
        author.setText(R.string.download_unknown_author);
    TextView description = (TextView) view.findViewById(R.id.download_description);
    if (module.description != null) {
        if (module.descriptionIsHtml) {
            description.setText(RepoParser.parseSimpleHtml(getActivity(), module.description, description));
            description.setTransformationMethod(new LinkTransformationMethod(getActivity()));
            description.setMovementMethod(LinkMovementMethod.getInstance());
        } else {
            description.setText(module.description);
        }
    } else {
        description.setVisibility(View.GONE);
    }
    ViewGroup moreInfoContainer = (ViewGroup) view.findViewById(R.id.download_moreinfo_container);
    for (Pair<String, String> moreInfoEntry : module.moreInfo) {
        View moreInfoView = inflater.inflate(R.layout.download_moreinfo, moreInfoContainer, false);
        TextView txtTitle = (TextView) moreInfoView.findViewById(android.R.id.title);
        TextView txtValue = (TextView) moreInfoView.findViewById(android.R.id.message);
        txtTitle.setText(moreInfoEntry.first + ":");
        txtValue.setText(moreInfoEntry.second);
        final Uri link = NavUtil.parseURL(moreInfoEntry.second);
        if (link != null) {
            txtValue.setTextColor(txtValue.getLinkTextColors());
            moreInfoView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    NavUtil.startURL(getActivity(), link);
                }
            });
        }
        moreInfoContainer.addView(moreInfoView);
    }
    return view;
}
Also used : LinkTransformationMethod(de.robv.android.xposed.installer.util.chrome.LinkTransformationMethod) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) Module(de.robv.android.xposed.installer.repo.Module) TextView(android.widget.TextView) View(android.view.View) Uri(android.net.Uri)

Aggregations

Uri (android.net.Uri)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 TextView (android.widget.TextView)1 Module (de.robv.android.xposed.installer.repo.Module)1 LinkTransformationMethod (de.robv.android.xposed.installer.util.chrome.LinkTransformationMethod)1