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

Commit 7287dc17 authored by Steve Kondik's avatar Steve Kondik
Browse files

Revert "Dialer app changes for IMS"

 * Get rid of the weird fab on the dialtacts activity, we do
   not currently need the IMS conference feature.

This reverts commit b674c9f1.

Change-Id: I5eef0c71576aee957fb18c8a4641ebac76da3b92
parent 414c5567
Loading
Loading
Loading
Loading
−3.11 KiB
Loading image diff...
+6 −15
Original line number Diff line number Diff line
@@ -37,33 +37,24 @@
            android:clipChildren="false" />
    </FrameLayout>

    <LinearLayout
    <FrameLayout
        android:id="@+id/floating_action_button_container"
        android:background="@drawable/fab_blue"
        android:layout_width="wrap_content"
        android:layout_width="@dimen/floating_action_button_width"
        android:layout_height="@dimen/floating_action_button_height"
        android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
        android:layout_gravity="center_horizontal|bottom">

        <ImageButton
            android:id="@+id/floating_action_button"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="bottom|left"
            android:layout_weight="1"
            android:background="@drawable/floating_action_button"
            android:contentDescription="@string/action_menu_dialpad_button"
            android:src="@drawable/fab_ic_dial"/>
       <ImageButton
            android:id="@+id/dialConferenceButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="bottom|right"
            android:layout_weight="1"
            android:background="@drawable/floating_action_button"
            android:contentDescription="@string/action_menu_dialpad_button"
            android:src="@drawable/ic_add_group_holo_dark"/>
    </LinearLayout>
            android:src="@drawable/fab_ic_dial"/>

    </FrameLayout>

    <!-- Host container for the contact tile drag shadow -->
    <FrameLayout
        android:id="@+id/activity_overlay"
+5 −79
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.preference.PreferenceManager;
@@ -97,7 +96,6 @@ import com.android.dialerbind.DatabaseHelperManager;
import com.android.phone.common.animation.AnimUtils;
import com.android.phone.common.util.SettingsUtil;
import com.android.ims.ImsManager;
import com.android.internal.telephony.TelephonyProperties;
import com.android.phone.common.animation.AnimationListenerAdapter;
import com.android.phone.common.animation.AnimUtils.AnimationCallback;

@@ -113,7 +111,6 @@ import java.util.Locale;
public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener,
        DialpadFragment.OnDialpadQueryChangedListener,
        OnListFragmentScrolledListener,
        DialpadFragment.HostInterface,
        ListsFragment.HostInterface,
        SpeedDialFragment.HostInterface,
        SearchFragment.HostInterface,
@@ -168,8 +165,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
     */
    private SmartDialSearchFragment mSmartDialSearchFragment;

    private boolean mDialConferenceButtonPressed = false;

    /**
     * Animation that slides in.
     */
@@ -236,16 +231,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
    private PopupMenu mOverflowMenu;
    private EditText mSearchView;
    private View mVoiceSearchButton;
    private View mDialCallButton;

    private String mSearchQuery;

    private DialerDatabaseHelper mDialerDatabaseHelper;
    private DragDropController mDragDropController;
    private ActionBarController mActionBarController;
    private ImageButton mFloatingActionButton;

    private ImageButton mConferenceDialButton;
    private FloatingActionButtonController mFloatingActionButtonController;

    private int mActionBarHeight;
@@ -411,13 +403,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O

        final View floatingActionButtonContainer = findViewById(
                R.id.floating_action_button_container);
        mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
        mDialCallButton =  findViewById(R.id.floating_action_button);
        mFloatingActionButton.setOnClickListener(this);
        mConferenceDialButton = (ImageButton) findViewById(R.id.dialConferenceButton);
        mConferenceDialButton.setOnClickListener(this);
        ImageButton floatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
        floatingActionButton.setOnClickListener(this);
        mFloatingActionButtonController = new FloatingActionButtonController(this,
                floatingActionButtonContainer,mFloatingActionButton);
                floatingActionButtonContainer, floatingActionButton);

        ImageButton optionsMenuButton =
                (ImageButton) searchEditTextLayout.findViewById(R.id.dialtacts_options_menu_button);
@@ -552,8 +541,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        }
        prepareVoiceSearchButton();
        updateFloatingActionButtonControllerAlignment(false /* animate */);
        setConferenceDialButtonImage(false);
        setConferenceDialButtonVisibility(true);
    }

    @Override
@@ -616,30 +603,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.floating_action_button:
                mDialConferenceButtonPressed = false;
                if (mDialpadFragment != null) {
                    mDialpadFragment.showDialConference(false);
                }
                if (!mIsDialpadShown) {
                    mInCallDialpadUp = false;
                    showDialpadFragment(true);
                    mFloatingActionButton.setVisibility(view.VISIBLE);
                    setConferenceDialButtonImage(false);
                    setConferenceDialButtonVisibility(true);
                } else {
                    // Dial button was pressed; tell the Dialpad fragment
                    mDialpadFragment.dialButtonPressed();
                }
                break;
            case R.id.dialConferenceButton:
                mDialConferenceButtonPressed = true;
                showDialpadFragment(true);
                mIsDialpadShown = false;
                mDialCallButton.setVisibility(view.VISIBLE);
                mDialpadFragment.dialConferenceButtonPressed();
                updateFloatingActionButtonControllerAlignment(true);
                mFloatingActionButton.setVisibility(view.VISIBLE);
            break;
            case R.id.voice_search_button:
                try {
                    startActivityForResult(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),
@@ -789,7 +760,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
            onFloatingActionButtonHidden();
        }
        mActionBarController.onDialpadUp();
        setConferenceDialButtonVisibility(animate);

        if (!isInSearchUi()) {
            enterSearchUi(true /* isSmartDial */, mSearchQuery);
@@ -802,20 +772,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        if (!mIsDialpadShown) {
            return;
        }

        if (mDialConferenceButtonPressed) {
            mFloatingActionButton.setImageResource(R.drawable.fab_ic_dial);
            mDialConferenceButtonPressed = false;
        } else {
            mFloatingActionButton.setImageResource(R.drawable.fab_ic_call);
        }
    }

    /**
     * Callback from child DialpadFragment when the dialpad is shown.
     */
    public void onDialpadShown() {
        updateFloatingActionButtonControllerAlignment(mDialpadFragment.getAnimate());
        if (mDialpadFragment.getAnimate()) {
            mDialpadFragment.getView().startAnimation(mSlideIn);
        } else {
@@ -837,8 +799,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        if (clearDialpad) {
            mDialpadFragment.clearDialpad();
        }
        if (!mIsDialpadShown && !mDialpadFragment.isRecipientsShown()) {
            updateFloatingActionButtonControllerAlignment(animate);
        if (!mIsDialpadShown) {
            return;
        }
        mIsDialpadShown = false;
@@ -847,7 +808,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        mListsFragment.sendScreenViewForCurrentPosition();

        updateSearchFragmentPosition();
        mFloatingActionButton.setImageResource(R.drawable.fab_ic_dial);

        updateFloatingActionButtonControllerAlignment(animate);
        if (animate) {
@@ -1115,14 +1075,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        if (mStateSaved) {
            return;
        }
        setConferenceDialButtonImage(false);
        setConferenceDialButtonVisibility(true);
        boolean mIsRecipientsShown = mDialpadFragment.isRecipientsShown();
        if(mIsRecipientsShown) {
            mDialpadFragment.hideAndClearDialConference();
        }

        if (mIsDialpadShown || mIsRecipientsShown) {
        if (mIsDialpadShown) {
            if (TextUtils.isEmpty(mSearchQuery) ||
                    (mSmartDialSearchFragment != null && mSmartDialSearchFragment.isVisible()
                            && mSmartDialSearchFragment.getAdapter().getCount() == 0)) {
@@ -1191,33 +1144,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
        // interactions with the ListsFragments.
    }

    @Override
    public void setConferenceDialButtonVisibility(boolean enabled) {
        boolean imsUseEnabled =
                ImsManager.isVolteEnabledByPlatform(this) &&
                ImsManager.isEnhanced4gLteModeSettingEnabledByUser(this);
        if(mConferenceDialButton != null) {
            mConferenceDialButton.setVisibility((enabled && imsUseEnabled) ?
                    View.VISIBLE : View.GONE);
        }
    }

    @Override
    public void setConferenceDialButtonImage(boolean setAddParticipantButton) {
        if(mConferenceDialButton != null) {
            /*
             * If dial conference view is shown, button should show dialpad
             * image. Pressing the button again will return to normal dialpad
             * view. If normal dialpad view is shown, button should show dial
             * conference image. Pressing the button again will show dial
             * conference view
             */
            mConferenceDialButton
                    .setImageResource(setAddParticipantButton ? R.drawable.fab_ic_call
                            : R.drawable.ic_add_group_holo_dark);
        }
    }

    private boolean phoneIsInUse() {
        return getTelecomManager().isInCall();
    }
+23 −149
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ import com.android.dialer.SpeedDialListActivity;
import com.android.dialer.SpeedDialUtils;
import com.android.dialer.util.DialerUtils;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyProperties;
import com.android.dialer.calllog.PhoneAccountUtils;
import com.android.dialer.util.DialerUtils;
import com.android.phone.common.CallLogAsync;
@@ -115,21 +114,6 @@ public class DialpadFragment extends Fragment

    private Context mContext;

    /**
     * This interface allows the DialpadFragment to tell its hosting Activity when and when not
     * to display the "dial" button. While this is logically part of the DialpadFragment, the
     * need to have a particular kind of slick animation puts the "dial" button in the parent.
     *
     * The parent calls dialButtonPressed() and optionsMenuInvoked() on the dialpad fragment
     * when appropriate.
     *
     * TODO: Refactor the app so this interchange is a bit cleaner.
     */
    public interface HostInterface {
        void setConferenceDialButtonVisibility(boolean enabled);
        void setConferenceDialButtonImage(boolean setAddParticipantButton);
    }

    /**
     * LinearLayout with getter and setter methods for the translationY property using floats,
     * for animation purposes.
@@ -188,9 +172,6 @@ public class DialpadFragment extends Fragment

    private DialpadView mDialpadView;
    private EditText mDigits;
    private EditText mRecipients;
    private View mDigitsContainer;
    private View mDialpad;
    private int mDialpadSlideInDuration;

    /** Remembers if we need to clear digits field when the screen is completely gone. */
@@ -277,12 +258,6 @@ public class DialpadFragment extends Fragment
                // onscreen, but useless...)
                showDialpadChooser(false);
            }
            if (TextUtils.equals(state, TelephonyManager.EXTRA_STATE_IDLE)) {
                final Activity activity = getActivity();
                if (activity != null) {
                    ((HostInterface) activity).setConferenceDialButtonVisibility(true);
                }
            }
        }
    }

@@ -393,13 +368,6 @@ public class DialpadFragment extends Fragment
        mDialpadView = (DialpadView) fragmentView.findViewById(R.id.dialpad_view);
        mDialpadView.setCanDigitsBeEdited(true);
        mDigits = mDialpadView.getDigits();
        mRecipients = (EditText) fragmentView.findViewById(R.id.recipients);
        mDigitsContainer = fragmentView.findViewById(R.id.digits_container);
        mDialpad = fragmentView.findViewById(R.id.dialpad);
        if (mRecipients != null) {
            mRecipients.setVisibility(View.GONE);
            mRecipients.addTextChangedListener(this);
        }
        mDigits.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
        mDigits.setOnClickListener(this);
        mDigits.setOnKeyListener(this);
@@ -572,9 +540,6 @@ public class DialpadFragment extends Fragment
                }

            }
        } else {
            mAddParticipant = intent.getBooleanExtra(ADD_PARTICIPANT_KEY, false);
            ((HostInterface) getActivity()).setConferenceDialButtonVisibility(true);
        }
        showDialpadChooser(needToShowDialpadChooser);
        setStartedFromNewIntent(false);
@@ -976,70 +941,6 @@ public class DialpadFragment extends Fragment
        handleDialButtonPressed();
    }

    public void dialConferenceButtonPressed() {
        // show dial conference screen if it is not shown
        // If it is already shown, show normal dial screen
        boolean show = (mRecipients != null) && !mRecipients.isShown();
        Log.d(TAG, "dialConferenceButtonPressed show " + show);
        if (show) {
            showDialConference(show);
        } else {
            handleDialButtonPressed();
            showDialConference(!show);
        }
    }

    public void showDialConference(boolean enabled) {
        // Check if onCreateView() is already called by checking one of View
        // objects.
        if (!isLayoutReady()) {
            return;
        }
        Log.d(TAG, "showDialConference " + enabled);
        /*
         * if enabled is true then pick child views that should be
         * visible/invisible when dialpad is choosen from conference dial button
         * if enabled is false then pick child views that should be
         * visible/invisible when dialpad is choosen from other buttons
         */

        // viewable when choosen through conference button
        int conferenceButtonVisibility = (enabled ? View.VISIBLE : View.GONE);
        // not viewable when choosen through conference button
        int nonConferenceButtonVisibility = (enabled ? View.GONE : View.VISIBLE);

        // change the image visibility of the button
        if (mRecipients != null)
            mRecipients.setVisibility(conferenceButtonVisibility);
        if (mDigits != null)
            mDigits.setVisibility(nonConferenceButtonVisibility);
        if (mDelete != null)
            mDelete.setVisibility(nonConferenceButtonVisibility);
        if (mDialpad != null)
            mDialpad.setVisibility(enabled ? View.INVISIBLE : View.VISIBLE);

        if (enabled && (HostInterface)getActivity() != null) {
            ((HostInterface)getActivity()).setConferenceDialButtonImage(enabled);
        }
    }

    public void hideAndClearDialConference() {
        // hide the image visibility of the button
        if (mRecipients != null)
            mRecipients.setVisibility(View.GONE);
        if (mDigits != null)
            mDigits.setVisibility(View.GONE);
        if (mDelete != null)
            mDelete.setVisibility(View.GONE);
        if (mDialpad != null)
            mDialpad.setVisibility(View.GONE);
        ((DialtactsActivity) getActivity()).commitDialpadFragmentHide();
    }

    public boolean isRecipientsShown() {
        return mRecipients != null && mRecipients.isShown();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
@@ -1310,25 +1211,11 @@ public class DialpadFragment extends Fragment
     * case described above).
     */
    private void handleDialButtonPressed() {
        if (isDigitsEmpty() && (mRecipients == null || !mRecipients.isShown())) {
            // No number entered.
            handleDialButtonClickWithEmptyDigits();
        } else {
            boolean isDigitsShown = mDigits.isShown();
            final String number = isDigitsShown ? mDigits.getText().toString() :
                    mRecipients.getText().toString().trim();
            if (isDigitsShown && isDigitsEmpty()) {
        if (isDigitsEmpty()) { // No number entered.
            handleDialButtonClickWithEmptyDigits();
            } else if (mAddParticipant && isDigitsEmpty() && mRecipients.isShown()
                    && isRecipientEmpty()) {
                // mRecipients must be empty
                // TODO add support for conference URI in last number dialed
                // use ErrorDialogFragment instead? also see
                // android.app.AlertDialog
                android.widget.Toast.makeText(getActivity(),
                        "Error: Cannot dial.  Please provide conference recipients.",
                        android.widget.Toast.LENGTH_SHORT).show();
        } else {
            final String number = mDigits.getText().toString();

            // "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated
            // test equipment.
            // TODO: clean it up.
@@ -1348,17 +1235,11 @@ public class DialpadFragment extends Fragment
                final Intent intent = CallUtil.getCallIntent(number,
                        (getActivity() instanceof DialtactsActivity ?
                                ((DialtactsActivity) getActivity()).getCallOrigin() : null));
                    if (!isDigitsShown) {
                        // must be dial conference add extra
                        intent.putExtra(TelephonyProperties.EXTRA_DIAL_CONFERENCE_URI, true);
                    }
                    intent.putExtra(ADD_PARTICIPANT_KEY, mAddParticipant);
                DialerUtils.startActivityWithErrorToast(getActivity(), intent);
                hideAndClearDialpad(false);
            }
        }
    }
    }

    public void clearDialpad() {
        mDigits.getText().clear();
@@ -1883,13 +1764,6 @@ public class DialpadFragment extends Fragment
        return mDigits.length() == 0;
    }

    /**
     * @return true if the widget with the mRecipients is empty.
     */
    private boolean isRecipientEmpty() {
        return  (mRecipients == null) || (mRecipients.length() == 0);
    }

    /**
     * Starts the asyn query to get the last dialed/outgoing
     * number. When the background query finishes, mLastNumberDialed