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

Commit 0e0bc99c authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "CM11 Themes: Update lights out resources and extra nav buttons" into cm-11.0

parents 8c6ba033 70d089dd
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -370,6 +370,7 @@ public class NavigationBarView extends LinearLayout {
            ViewGroup container = (ViewGroup) mRotatedViews[i];
            if (container != null) {
                updateKeyButtonViewResources(container);
                updateLightsOutResources(container);
            }
        }
    }
@@ -377,18 +378,40 @@ public class NavigationBarView extends LinearLayout {
    private void updateKeyButtonViewResources(ViewGroup container) {
        ViewGroup midNavButtons = (ViewGroup) container.findViewById(R.id.mid_nav_buttons);
        if (midNavButtons != null) {
            final int nChildern = midNavButtons.getChildCount();
            for (int i = 0; i < nChildern; i++) {
            final int nChildren = midNavButtons.getChildCount();
            for (int i = 0; i < nChildren; i++) {
                final View child = midNavButtons.getChildAt(i);
                if (child instanceof KeyButtonView) {
                    ((KeyButtonView) child).updateResources();
                }
            }
        }
        KeyButtonView kbv = (KeyButtonView) findViewById(R.id.six);
        KeyButtonView kbv = (KeyButtonView) findViewById(R.id.one);
        if (kbv != null) {
            kbv.updateResources();
        }
        kbv = (KeyButtonView) findViewById(R.id.six);
        if (kbv != null) {
            kbv.updateResources();
        }
    }

    private void updateLightsOutResources(ViewGroup container) {
        ViewGroup lightsOut = (ViewGroup) container.findViewById(R.id.lights_out);
        if (lightsOut != null) {
            final int nChildren = lightsOut.getChildCount();
            for (int i = 0; i < nChildren; i++) {
                final View child = lightsOut.getChildAt(i);
                if (child instanceof ImageView) {
                    final ImageView iv = (ImageView) child;
                    // clear out the existing drawable, this is required since the
                    // ImageView keeps track of the resource ID and if it is the same
                    // it will not update the drawable.
                    iv.setImageDrawable(null);
                    iv.setImageResource(R.drawable.ic_sysbar_lights_out_dot_large);
                }
            }
        }
    }

    @Override