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

Commit 4c8dc577 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Dialer : Don't hold on to views used in listviews" into cm-11.0

parents be2c4b78 757920b6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
    <Button
            android:id="@+id/all_contacts_button"
            android:fontFamily="@string/favorites_menu_all_contacts_font_family"
            android:onClick="allContactsClick"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/favorites_menu_all_contacts_height"
            android:paddingLeft="@dimen/favorites_menu_padding_horizontal"
+4 −0
Original line number Diff line number Diff line
@@ -1037,6 +1037,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        return tm.getCallState() != TelephonyManager.CALL_STATE_IDLE;
    }

    public void allContactsClick(View v) {
        onShowAllContacts();
    }

    @Override
    public void onShowAllContacts() {
        final Intent intent = new Intent(this, AllContactsActivity.class);
+1 −19
Original line number Diff line number Diff line
@@ -199,7 +199,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen

    private PhoneFavoriteListView mListView;

    private View mPhoneFavoritesMenu;
    private View mContactTileFrame;

    private TileInteractionTeaserView mTileInteractionTeaserView;
@@ -291,16 +290,13 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen

        mEmptyView = mParentView.findViewById(R.id.phone_no_favorites_view);

        mPhoneFavoritesMenu = inflater.inflate(R.layout.phone_favorites_menu, mListView, false);
        prepareFavoritesMenu(mPhoneFavoritesMenu);

        mContactTileFrame = mParentView.findViewById(R.id.contact_tile_frame);

        mTileInteractionTeaserView = (TileInteractionTeaserView) inflater.inflate(
                R.layout.tile_interactions_teaser_view, mListView, false);

        mAdapter = new PhoneFavoriteMergedAdapter(getActivity(), this, mContactTileAdapter,
                mCallLogAdapter, mPhoneFavoritesMenu, mTileInteractionTeaserView);
                mCallLogAdapter, mTileInteractionTeaserView);

        mTileInteractionTeaserView.setAdapter(mAdapter);

@@ -663,18 +659,4 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
        fetchCalls();
    }

    /**
     * Prepares the favorites menu which contains the static label "Speed Dial" and the
     * "All Contacts" button.  Sets the onClickListener for the "All Contacts" button.
     */
    private void prepareFavoritesMenu(View favoritesMenu) {
        Button allContactsButton = (Button) favoritesMenu.findViewById(R.id.all_contacts_button);
        // Set the onClick listener for the button to bring up the all contacts view.
        allContactsButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                showAllContacts();
            }
        });
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
    private static final int FAVORITES_MENU_ITEM_ID = -3;
    private final PhoneFavoritesTileAdapter mContactTileAdapter;
    private final CallLogAdapter mCallLogAdapter;
    private final View mPhoneFavoritesMenu;
    private final PhoneFavoriteFragment mFragment;
    private final TileInteractionTeaserView mTileInteractionTeaserView;

@@ -103,7 +102,6 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
            PhoneFavoriteFragment fragment,
            PhoneFavoritesTileAdapter contactTileAdapter,
            CallLogAdapter callLogAdapter,
            View phoneFavoritesMenu,
            TileInteractionTeaserView tileInteractionTeaserView) {
        final Resources resources = context.getResources();
        mContext = context;
@@ -114,7 +112,6 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
        mObserver = new CustomDataSetObserver();
        mCallLogAdapter.registerDataSetObserver(mObserver);
        mContactTileAdapter.registerDataSetObserver(mObserver);
        mPhoneFavoritesMenu = phoneFavoritesMenu;
        mTileInteractionTeaserView = tileInteractionTeaserView;
        mCallLogQueryHandler = new CallLogQueryHandler(mContext.getContentResolver(),
                mCallLogQueryHandlerListener);
@@ -262,9 +259,12 @@ public class PhoneFavoriteMergedAdapter extends BaseAdapter {
            wrapper.addView(view);
            return wrapper;
        } else if (position == callLogAdapterCount) {
            if (convertView == null) {
                convertView = View.inflate(mContext, R.layout.phone_favorites_menu, null);
            }
            // If position is just after the entries in the mCallLogAdapter (most recent call),
            // return the favorites menu.
            return mPhoneFavoritesMenu;
            return convertView;
        }

        // Set position to the position of the actual favorite contact in the favorites adapter.