1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-01 17:26:12 +00:00

Refactoring

This commit is contained in:
M66B 2024-05-19 12:46:23 +02:00
parent 93e192a309
commit 0703bb232d
2 changed files with 13 additions and 13 deletions

View file

@ -169,7 +169,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
v.setLayoutParams(mlp);
if (edge_to_edge)
for (View child : getInsetViews(v)) {
for (View child : Helper.getViewsWithTag(v, "inset")) {
mlp = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
mlp.bottomMargin = insets.bottom;
child.setLayoutParams(mlp);
@ -226,18 +226,6 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
setContentView(view);
}
private static List<View> getInsetViews(View view) {
List<View> result = new ArrayList<>();
if (view != null && "inset".equals(view.getTag()))
result.add(view);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int i = 0; i <= group.getChildCount(); i++)
result.addAll(getInsetViews(group.getChildAt(i)));
}
return result;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
EntityLog.log(this, "Activity create " + this.getClass().getName() +

View file

@ -935,6 +935,18 @@ public class Helper {
return context.getResources().getDimensionPixelSize(resid);
}
static @NonNull List<View> getViewsWithTag(@NonNull View view, @NonNull String tag) {
List<View> result = new ArrayList<>();
if (view != null && tag.equals(view.getTag()))
result.add(view);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int i = 0; i <= group.getChildCount(); i++)
result.addAll(getViewsWithTag(group.getChildAt(i), tag));
}
return result;
}
static ObjectAnimator getFabAnimator(View fab, LifecycleOwner owner) {
ObjectAnimator.AnimatorUpdateListener listener = new ObjectAnimator.AnimatorUpdateListener() {
@Override