Package structure: moved UI utils

Part of #963.
This commit is contained in:
Dennis Guse
2022-01-15 22:32:32 +01:00
parent 7caf33fb66
commit 7484ab03ce
23 changed files with 23 additions and 24 deletions
@@ -0,0 +1,30 @@
package de.dennisguse.opentracks.ui.util;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class ViewUtils {
private ViewUtils() {
}
/**
* Traverses all childs of {@link View} recursively and makes links within {@link TextView}s clickable.
*/
public static void makeClickableLinks(ViewGroup view) {
if (view == null) {
return;
}
for (int i = 0; i < view.getChildCount(); i++) {
final View child = view.getChildAt(i);
if (child instanceof ViewGroup) {
makeClickableLinks((ViewGroup) child);
} else if (child instanceof TextView) {
((TextView) child).setMovementMethod(LinkMovementMethod.getInstance());
}
}
}
}