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

Commit 2a5777a3 authored by Kalyani polepeddy's avatar Kalyani polepeddy Committed by Linux Build Service Account
Browse files

frameworks/base: 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 b7dbe042
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -312,10 +312,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);
    }

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

        if (mSelectedTab != -1) {
            getChildTabViewAt(mSelectedTab).setSelected(false);
        }
@@ -513,7 +514,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;
        }