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

Commit c58e035f authored by Uma Maheshwari Bhiram's avatar Uma Maheshwari Bhiram Committed by Steve Kondik
Browse files

Frameworks: Fix to avoid crash when the tab is not set.

Tab is not highlighted in Videoapp unlike Music app.
Instead the list is highlighted with mSelectedTab a negative value
when onFocusChange is called.
Add a check for mSelectedTab.

Change-Id: I930657b8a9be4be4d973f876242a15a667ec6f94
CRs-Fixed: 657606
parent 772ca3d4
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -309,10 +309,12 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {

    @Override
    public void childDrawableStateChanged(View child) {
        if (mSelectedTab != -1) {
            if (getTabCount() > 0 && child == getChildTabViewAt(mSelectedTab)) {
                // To make sure that the bottom strip is redrawn
                invalidate();
            }
        }
        super.childDrawableStateChanged(child);
    }

@@ -387,7 +389,6 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {
        if (index < 0 || index >= getTabCount() || index == mSelectedTab) {
            return;
        }

        if (mSelectedTab != -1) {
            getChildTabViewAt(mSelectedTab).setSelected(false);
        }
@@ -512,7 +513,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener {

    /** {@inheritDoc} */
    public void onFocusChange(View v, boolean hasFocus) {
        if (v == this && hasFocus && getTabCount() > 0) {
        if (v == this && hasFocus && getTabCount() > 0 && (mSelectedTab != -1)) {
            getChildTabViewAt(mSelectedTab).requestFocus();
            return;
        }