Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f9ef97a authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Frameworks/base: Fix AdapterViewAnimator.createOrReuseLayoutParams

The original code was certainly not wrong, but not readable. currentLp
was already an instance (ViewGroup.LayoutParams == LayoutParams), so the
instanceof is the same as a null check. Simplify.

Change-Id: I5ec96ab1243aa5f3a4d74a5fb991dded37c149c3
parent 30fcd2aa
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -403,12 +403,11 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
     }

    LayoutParams createOrReuseLayoutParams(View v) {
        final ViewGroup.LayoutParams currentLp = v.getLayoutParams();
        if (currentLp instanceof ViewGroup.LayoutParams) {
            LayoutParams lp = (LayoutParams) currentLp;
            return lp;
        final LayoutParams currentLp = v.getLayoutParams();
        if (currentLp != null) {
            return currentLp;
        }
        return new ViewGroup.LayoutParams(0, 0);
        return new LayoutParams(0, 0);
    }

    void refreshChildren() {