summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-05-12 15:56:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-12 15:56:11 +0000
commit848e15821b95718f54a95259d239ff799d2b7449 (patch)
tree8ca6b9fde714a6113853c54c47d12ca1bb99b514 /InCallUI
parent27706bf46c5d1872cc3c6c58e9d5fa255529c2ee (diff)
parent3326f42f13f6f8cd8934aec615078a8890212402 (diff)
Merge "Handle fullscreen mode toggle when tapping contact photo." into mnc-dev
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java6
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java20
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java53
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java60
4 files changed, 88 insertions, 51 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 499f46417..3211c4784 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -218,6 +218,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mSecondaryCallInfo = view.findViewById(R.id.secondary_call_info);
mSecondaryCallProviderInfo = view.findViewById(R.id.secondary_call_provider_info);
mPhoto = (ImageView) view.findViewById(R.id.photo);
+ mPhoto.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getPresenter().onContactPhotoClick();
+ }
+ });
mCallStateIcon = (ImageView) view.findViewById(R.id.callStateIcon);
mCallStateVideoCallIcon = (ImageView) view.findViewById(R.id.videoCallIcon);
mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel);
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 6b3ee812d..5d62b5cd0 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -416,7 +416,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
String simNumber = mgr.getLine1Number(mPrimary.getAccountHandle());
if (!showCallbackNumber && PhoneNumberUtils.compare(callbackNumber, simNumber)) {
Log.d(this, "Numbers are the same (and callback number is not being forced to show);" +
- " not showing the callback number");
+ " not showing the callback number");
callbackNumber = null;
}
@@ -446,6 +446,16 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
}
+ /**
+ * Handles click on the contact photo by toggling fullscreen mode if the current call is a video
+ * call.
+ */
+ public void onContactPhotoClick() {
+ if (mPrimary != null && mPrimary.isVideoCall(mContext)) {
+ InCallPresenter.getInstance().toggleFullscreenMode();
+ }
+ }
+
private void maybeStartSearch(Call call, boolean isPrimary) {
// no need to start search for conference calls which show generic info.
if (call != null && !call.isConferenceCall()) {
@@ -763,17 +773,17 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
/**
- * Handles a change to the full screen video state.
+ * Handles a change to the fullscreen mode of the in-call UI.
*
- * @param isFullScreenVideo {@code True} if the application is entering full screen video mode.
+ * @param isFullscreenMode {@code True} if the in-call UI is entering full screen mode.
*/
@Override
- public void onFullScreenVideoStateChanged(boolean isFullScreenVideo) {
+ public void onFullscreenModeChanged(boolean isFullscreenMode) {
final CallCardUi ui = getUi();
if (ui == null) {
return;
}
- ui.setCallCardVisible(!isFullScreenVideo);
+ ui.setCallCardVisible(!isFullscreenMode);
}
private boolean isPrimaryCallActive() {
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 2b7540091..391d77a2c 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -104,12 +104,18 @@ public class InCallPresenter implements CallList.Listener,
* Whether or not we are currently bound and waiting for Telecom to send us a new call.
*/
private boolean mBoundAndWaitingForOutgoingCall;
+
/**
* If there is no actual call currently in the call list, this will be used as a fallback
* to determine the theme color for InCallUI.
*/
private PhoneAccountHandle mPendingPhoneAccountHandle;
+ /**
+ * Determines if the InCall UI is in fullscreen mode or not.
+ */
+ private boolean mIsFullScreen = false;
+
private final android.telecom.Call.Callback mCallCallback =
new android.telecom.Call.Callback() {
@Override
@@ -824,7 +830,7 @@ public class InCallPresenter implements CallList.Listener,
private void notifyVideoPauseController(boolean showing) {
Log.d(this, "notifyVideoPauseController: mIsChangingConfigurations=" +
- mIsChangingConfigurations);
+ mIsChangingConfigurations);
if (!mIsChangingConfigurations) {
VideoPauseController.getInstance().onUiShowing(showing);
}
@@ -938,13 +944,50 @@ public class InCallPresenter implements CallList.Listener,
}
/**
+ * Toggles whether the application is in fullscreen mode or not.
+ *
+ * @return {@code true} if in-call is now in fullscreen mode.
+ */
+ public boolean toggleFullscreenMode() {
+ mIsFullScreen = !mIsFullScreen;
+ Log.v(this, "toggleFullscreenMode = " + mIsFullScreen);
+ notifyFullscreenModeChange(mIsFullScreen);
+ return mIsFullScreen;
+ }
+
+ /**
+ * Changes the fullscreen mode of the in-call UI.
+ *
+ * @param isFullScreen {@code true} if in-call should be in fullscreen mode, {@code false}
+ * otherwise.
+ */
+ public void setFullScreen(boolean isFullScreen) {
+ Log.v(this, "setFullScreen = " + isFullScreen);
+ if (mIsFullScreen == isFullScreen) {
+ Log.v(this, "setFullScreen ignored as already in that state.");
+ return;
+ }
+ mIsFullScreen = isFullScreen;
+ notifyFullscreenModeChange(mIsFullScreen);
+ }
+
+ /**
+ * @return {@code true} if the in-call ui is currently in fullscreen mode, {@code false}
+ * otherwise.
+ */
+ public boolean isFullscreen() {
+ return mIsFullScreen;
+ }
+
+
+ /**
* Called by the {@link VideoCallPresenter} to inform of a change in full screen video status.
*
- * @param isFullScreenVideo {@code True} if entering full screen video mode.
+ * @param isFullscreenMode {@code True} if entering full screen mode.
*/
- public void setFullScreenVideoState(boolean isFullScreenVideo) {
+ public void notifyFullscreenModeChange(boolean isFullscreenMode) {
for (InCallEventListener listener : mInCallEventListeners) {
- listener.onFullScreenVideoStateChanged(isFullScreenVideo);
+ listener.onFullscreenModeChanged(isFullscreenMode);
}
}
@@ -1568,7 +1611,7 @@ public class InCallPresenter implements CallList.Listener,
* In-Call UI. Used as a means of communicating between fragments that make up the UI.
*/
public interface InCallEventListener {
- public void onFullScreenVideoStateChanged(boolean isFullScreenVideo);
+ public void onFullscreenModeChanged(boolean isFullscreenMode);
}
public interface InCallUiListener {
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index ba82c01fc..0fac39adc 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -28,14 +28,11 @@ import android.provider.ContactsContract;
import android.telecom.AudioState;
import android.telecom.CameraCapabilities;
import android.telecom.Connection;
-import android.telecom.Connection.VideoProvider;
import android.telecom.InCallService.VideoCall;
import android.telecom.VideoProfile;
import android.view.Surface;
-import android.view.View;
import android.widget.ImageView;
-import com.android.contacts.common.CallUtil;
import com.android.contacts.common.ContactPhotoManager;
import com.android.incallui.InCallPresenter.InCallDetailsListener;
import com.android.incallui.InCallPresenter.InCallOrientationListener;
@@ -71,7 +68,8 @@ import java.util.Objects;
public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi> implements
IncomingCallListener, InCallOrientationListener, InCallStateListener,
InCallDetailsListener, SurfaceChangeListener, VideoEventListener,
- InCallVideoCallCallbackNotifier.SessionModificationListener {
+ InCallVideoCallCallbackNotifier.SessionModificationListener,
+ InCallPresenter.InCallEventListener {
public static final String TAG = "VideoCallPresenter";
public static final boolean DEBUG = false;
@@ -84,7 +82,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
public void run() {
if (mAutoFullScreenPending) {
Log.v(this, "Automatically entering fullscreen mode.");
- setFullScreen(true);
+ InCallPresenter.getInstance().setFullScreen(true);
mAutoFullScreenPending = false;
} else {
Log.v(this, "Skipping scheduled fullscreen mode.");
@@ -170,11 +168,6 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
private int mPreviewSurfaceState = PreviewSurfaceState.NONE;
/**
- * Determines whether the video surface is in full-screen mode.
- */
- private boolean mIsFullScreen = false;
-
- /**
* Saves the audio mode which was selected prior to going into a video call.
*/
private static int sPrevVideoAudioMode = AudioModeProvider.AUDIO_MODE_INVALID;
@@ -369,31 +362,6 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
}
- private void toggleFullScreen() {
- mIsFullScreen = !mIsFullScreen;
- Log.v(this, "toggleFullScreen = " + mIsFullScreen);
- // Ensure we cancel any scheduled auto activation of fullscreen mode as the user's setting
- // should override any automatic operation.
- cancelAutoFullScreen();
- InCallPresenter.getInstance().setFullScreenVideoState(mIsFullScreen);
- }
-
- /**
- * Sets the current full screen mode.
- *
- * @param isFullScreen {@code true} if full screen mode should be active, {@code false}
- * otherwise.
- */
- public void setFullScreen(boolean isFullScreen) {
- Log.v(this, "setFullScreen = " + isFullScreen);
- if (mIsFullScreen == isFullScreen) {
- Log.v(this, "setFullScreen ignored as already in that state.");
- return;
- }
- mIsFullScreen = isFullScreen;
- InCallPresenter.getInstance().setFullScreenVideoState(mIsFullScreen);
- }
-
/**
* Handles clicks on the video surfaces by toggling full screen state.
* Informs the {@link InCallPresenter} of the change so that it can inform the
@@ -402,7 +370,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* @param surfaceId The video surface receiving the click.
*/
public void onSurfaceClick(int surfaceId) {
- toggleFullScreen();
+ boolean isFullscreen = InCallPresenter.getInstance().toggleFullscreenMode();
+ Log.v(this, "toggleFullScreen = " + isFullscreen);
}
/**
@@ -487,6 +456,16 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
maybeAutoEnterFullscreen(currentCall);
}
+ /**
+ * Handles a change to the fullscreen mode of the app.
+ *
+ * @param isFullscreenMode {@code true} if the app is now fullscreen, {@code false} otherwise.
+ */
+ @Override
+ public void onFullscreenModeChanged(boolean isFullscreenMode) {
+ cancelAutoFullScreen();
+ }
+
private void checkForVideoStateChange(Call call) {
final boolean isVideoCall = CallUtils.isVideoCall(call);
final boolean hasVideoStateChanged = mCurrentVideoState != call.getVideoState();
@@ -775,9 +754,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
showVideoUi(VideoProfile.VideoState.AUDIO_ONLY, Call.State.ACTIVE);
enableCamera(mVideoCall, false);
-
- Log.d(this, "exitVideoMode mIsFullScreen: " + mIsFullScreen);
- setFullScreen(false);
+ InCallPresenter.getInstance().setFullScreen(false);
mIsVideoMode = false;
}
@@ -1094,7 +1071,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
if (!CallUtils.isVideoCall(call) || call.getState() == Call.State.INCOMING) {
- setFullScreen(false);
+ InCallPresenter.getInstance().setFullScreen(false);
}
}
@@ -1115,7 +1092,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
if (call == null || (
call != null && (call.getState() != Call.State.ACTIVE ||
- !CallUtils.isVideoCall(call)) || mIsFullScreen)) {
+ !CallUtils.isVideoCall(call)) ||
+ InCallPresenter.getInstance().isFullscreen())) {
// Ensure any previously scheduled attempt to enter fullscreen is cancelled.
cancelAutoFullScreen();
return;