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

Commit ad199ecc authored by Ben Komalo's avatar Ben Komalo
Browse files

Fix issue where home layout click listener was being attached

before it was initialized.

Change-Id: I25641ca7c2db18d423dcafebc9bdf42d608a7a31
parent e0c0504c
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -123,8 +123,6 @@ public class ActionBarView extends ViewGroup {
        }
    };

    private OnClickListener mHomeClickListener = null;

    private OnClickListener mTabClickListener = null;

    public ActionBarView(Context context, AttributeSet attrs) {
@@ -169,9 +167,6 @@ public class ActionBarView extends ViewGroup {

        mHomeLayout = new LinearLayout(context, null,
                com.android.internal.R.attr.actionButtonStyle);
        mHomeLayout.setClickable(true);
        mHomeLayout.setFocusable(true);
        mHomeLayout.setOnClickListener(mHomeClickListener);
        mHomeLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.MATCH_PARENT));

@@ -207,9 +202,8 @@ public class ActionBarView extends ViewGroup {

        a.recycle();
        
        if (mLogo != null || mIcon != null || mTitle != null) {
        mLogoNavItem = new ActionMenuItem(context, 0, android.R.id.home, 0, 0, mTitle);
            mHomeClickListener = new OnClickListener() {
        mHomeLayout.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
            Context context = getContext();
            if (context instanceof Activity) {
@@ -217,8 +211,9 @@ public class ActionBarView extends ViewGroup {
              activity.onOptionsItemSelected(mLogoNavItem);
            }
          }
            };
        }
        });
        mHomeLayout.setClickable(true);
        mHomeLayout.setFocusable(true);
    }

    @Override