mirror of
https://github.com/TrianguloY/UrlChecker.git
synced 2024-09-19 20:02:16 +02:00
debug module is shown collapsed until touched
This commit is contained in:
parent
e981fcff66
commit
51281683b3
@ -2,6 +2,7 @@ package com.trianguloy.urlchecker.modules.list;
|
||||
|
||||
import static java.util.Objects.requireNonNullElse;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -74,13 +75,23 @@ class DebugDialog extends AModuleDialog {
|
||||
public void onInitialize(View views) {
|
||||
textView = views.findViewById(R.id.data);
|
||||
|
||||
// cached
|
||||
// expand when touched (not only clicked, to avoid a double-click-required bug and because it feels better)
|
||||
textView.setOnTouchListener((v, event) -> {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN || textView.getMaxHeight() != Integer.MAX_VALUE) textView.setMaxHeight(Integer.MAX_VALUE);
|
||||
return false;
|
||||
});
|
||||
|
||||
// cached values
|
||||
intentUri = getActivity().getIntent().toUri(0);
|
||||
referrer = requireNonNullElse(AndroidUtils.getReferrer(getActivity()), "null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayUrl(UrlData urlData) {
|
||||
// collapse module to show exactly 5 lines and a half (to indicate there is more data)
|
||||
var fontMetrics = textView.getPaint().getFontMetrics();
|
||||
textView.setMaxHeight(Math.round((fontMetrics.bottom - fontMetrics.top) * 5.5f));
|
||||
|
||||
// data to display
|
||||
textView.setText(String.join("\n", List.of(
|
||||
"Intent:",
|
||||
|
Loading…
Reference in New Issue
Block a user