mirror of
https://github.com/TrianguloY/UrlChecker.git
synced 2024-09-20 04:12:14 +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 static java.util.Objects.requireNonNullElse;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -74,13 +75,23 @@ class DebugDialog extends AModuleDialog {
|
|||||||
public void onInitialize(View views) {
|
public void onInitialize(View views) {
|
||||||
textView = views.findViewById(R.id.data);
|
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);
|
intentUri = getActivity().getIntent().toUri(0);
|
||||||
referrer = requireNonNullElse(AndroidUtils.getReferrer(getActivity()), "null");
|
referrer = requireNonNullElse(AndroidUtils.getReferrer(getActivity()), "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisplayUrl(UrlData urlData) {
|
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
|
// data to display
|
||||||
textView.setText(String.join("\n", List.of(
|
textView.setText(String.join("\n", List.of(
|
||||||
"Intent:",
|
"Intent:",
|
||||||
|
Loading…
Reference in New Issue
Block a user