private void fillData(@Nullable Intent intent, @NonNull TextView textView) { Uri data = intent == null ? null : intent.getData(); if (data == null) { textView.setText(Printer.EMPTY); return; } Truss truss = new Truss(); Printer.append(truss, "raw", data); Printer.append(truss, "scheme", data.getScheme()); Printer.append(truss, "host", data.getHost()); Printer.append(truss, "port", data.getPort()); Printer.append(truss, "path", data.getPath()); Printer.appendKey(truss, "query"); boolean query = false; if (data.isHierarchical()) { for (String queryParameterName : data.getQueryParameterNames()) { Printer.appendSecondary( truss, queryParameterName, data.getQueryParameter(queryParameterName)); query = true; } } if (!query) { Printer.appendValue(truss, null); } Printer.append(truss, "fragment", data.getFragment()); textView.setText(truss.build()); }
private void fillIntent(@Nullable Intent intent, @NonNull TextView textView) { if (intent == null) { textView.setText(Printer.EMPTY); return; } Truss truss = new Truss(); Printer.append(truss, "action", intent.getAction()); Printer.append(truss, "categories", intent.getCategories()); Printer.append(truss, "type", intent.getType()); Printer.append(truss, "flags", Flags.decode(intent.getFlags())); Printer.append(truss, "package", intent.getPackage()); Printer.append(truss, "component", intent.getComponent()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { Printer.append(truss, "referrer", getReferrer()); } textView.setText(truss.build()); }