Loading java/com/android/dialer/util/ViewUtil.java +0 −44 Original line number Diff line number Diff line Loading @@ -19,19 +19,16 @@ package com.android.dialer.util; import android.content.ContentResolver; import android.content.Context; import android.graphics.Paint; import android.graphics.Point; import android.os.PowerManager; import android.provider.Settings; import android.provider.Settings.Global; import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.TypedValue; import android.view.Display; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.ViewTreeObserver.OnPreDrawListener; import android.view.WindowManager; import android.widget.TextView; import java.util.Locale; Loading Loading @@ -142,45 +139,4 @@ public class ViewUtil { return Settings.Global.getFloat(contentResolver, Global.ANIMATOR_DURATION_SCALE, 1.0f) == 0 || powerManager.isPowerSaveMode(); } /** * Get navigation bar height by calculating difference between app usable size and real screen * size. Note that this won't work in multi-window mode so it's caller's responsibility to check * if the app is in multi-window mode before using this. * * @param context Context * @return Navigation bar height */ public static int getNavigationBarHeight(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point appUsableSize = getAppUsableScreenSize(display); Point realScreenSize = getRealScreenSize(display); // Navigation bar on the right. if (appUsableSize.x < realScreenSize.x) { return appUsableSize.y; } // Navigation bar at the bottom. if (appUsableSize.y < realScreenSize.y) { return realScreenSize.y - appUsableSize.y; } // Navigation bar is not present. return 0; } private static Point getAppUsableScreenSize(Display display) { Point size = new Point(); display.getSize(size); return size; } private static Point getRealScreenSize(Display display) { Point size = new Point(); display.getRealSize(size); return size; } } java/com/android/incallui/InCallActivity.java +2 −24 Original line number Diff line number Diff line Loading @@ -488,7 +488,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity } showDialpadRequest = DIALPAD_REQUEST_NONE; } updateNavigationBar(isDialpadVisible()); CallList.getInstance() .onInCallUiShown(getIntent().getBooleanExtra(IntentExtraNames.FOR_FULL_SCREEN, false)); Loading Loading @@ -807,10 +806,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity sensor.onDialpadVisible(show); } showDialpadRequest = DIALPAD_REQUEST_NONE; // Note: onInCallScreenDialpadVisibilityChange is called here to ensure that the dialpad FAB // repositions itself. getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(show); } private void showDialpadFragment() { Loading @@ -835,7 +830,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity dialpadFragmentManager.executePendingTransactions(); Logger.get(this).logScreenView(ScreenEvent.Type.INCALL_DIALPAD, this); updateNavigationBar(true /* isDialpadVisible */); getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(true); } private void hideDialpadFragment() { Loading @@ -851,8 +846,8 @@ public class InCallActivity extends TransactionSafeFragmentActivity transaction.commitAllowingStateLoss(); dialpadFragmentManager.executePendingTransactions(); dialpadFragment.setUserVisibleHint(false); getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(false); } updateNavigationBar(false /* isDialpadVisible */); } public boolean isDialpadVisible() { Loading Loading @@ -1183,23 +1178,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity fragment.show(getSupportFragmentManager(), Tags.RTT_REQUEST_DIALOG); } @Override public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { super.onMultiWindowModeChanged(isInMultiWindowMode); updateNavigationBar(isDialpadVisible()); } private void updateNavigationBar(boolean isDialpadVisible) { if (isInMultiWindowMode()) { return; } View navigationBarBackground = getWindow().findViewById(R.id.navigation_bar_background); if (navigationBarBackground != null) { navigationBarBackground.setVisibility(isDialpadVisible ? View.VISIBLE : View.GONE); } } public void setAllowOrientationChange(boolean allowOrientationChange) { if (this.allowOrientationChange == allowOrientationChange) { return; Loading java/com/android/incallui/incall/impl/InCallFragment.java +7 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.incallui.incall.impl; import android.Manifest.permission; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; Loading @@ -36,6 +37,7 @@ import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.RelativeLayout; Loading @@ -47,7 +49,6 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.multimedia.MultimediaData; import com.android.dialer.strictmode.StrictModeUtils; import com.android.dialer.util.ViewUtil; import com.android.dialer.widget.LockableViewPager; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; Loading Loading @@ -179,8 +180,6 @@ public class InCallFragment extends Fragment } // TODO(a bug): Change to use corresponding phone type used for current call. phoneType = getContext().getSystemService(TelephonyManager.class).getPhoneType(); View space = view.findViewById(R.id.navigation_bar_background); space.getLayoutParams().height = ViewUtil.getNavigationBarHeight(getContext()); // Workaround to adjust padding for status bar and navigation bar since fitsSystemWindows // doesn't work well when switching with other fragments. Loading Loading @@ -395,6 +394,11 @@ public class InCallFragment extends Fragment // Update the Android Button's state to isShowing. inCallButtonGridFragment.onInCallScreenDialpadVisibilityChange(isShowing); } Activity activity = getActivity(); Window window = activity.getWindow(); window.setNavigationBarColor( activity.getColor( isShowing ? android.R.color.background_dark : android.R.color.transparent)); } @Override Loading java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml +0 −7 Original line number Diff line number Diff line Loading @@ -125,11 +125,4 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top"/> <FrameLayout android:id="@+id/navigation_bar_background" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="bottom" android:background="@android:color/background_dark" android:visibility="gone"/> </FrameLayout> Loading
java/com/android/dialer/util/ViewUtil.java +0 −44 Original line number Diff line number Diff line Loading @@ -19,19 +19,16 @@ package com.android.dialer.util; import android.content.ContentResolver; import android.content.Context; import android.graphics.Paint; import android.graphics.Point; import android.os.PowerManager; import android.provider.Settings; import android.provider.Settings.Global; import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.TypedValue; import android.view.Display; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.ViewTreeObserver.OnPreDrawListener; import android.view.WindowManager; import android.widget.TextView; import java.util.Locale; Loading Loading @@ -142,45 +139,4 @@ public class ViewUtil { return Settings.Global.getFloat(contentResolver, Global.ANIMATOR_DURATION_SCALE, 1.0f) == 0 || powerManager.isPowerSaveMode(); } /** * Get navigation bar height by calculating difference between app usable size and real screen * size. Note that this won't work in multi-window mode so it's caller's responsibility to check * if the app is in multi-window mode before using this. * * @param context Context * @return Navigation bar height */ public static int getNavigationBarHeight(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point appUsableSize = getAppUsableScreenSize(display); Point realScreenSize = getRealScreenSize(display); // Navigation bar on the right. if (appUsableSize.x < realScreenSize.x) { return appUsableSize.y; } // Navigation bar at the bottom. if (appUsableSize.y < realScreenSize.y) { return realScreenSize.y - appUsableSize.y; } // Navigation bar is not present. return 0; } private static Point getAppUsableScreenSize(Display display) { Point size = new Point(); display.getSize(size); return size; } private static Point getRealScreenSize(Display display) { Point size = new Point(); display.getRealSize(size); return size; } }
java/com/android/incallui/InCallActivity.java +2 −24 Original line number Diff line number Diff line Loading @@ -488,7 +488,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity } showDialpadRequest = DIALPAD_REQUEST_NONE; } updateNavigationBar(isDialpadVisible()); CallList.getInstance() .onInCallUiShown(getIntent().getBooleanExtra(IntentExtraNames.FOR_FULL_SCREEN, false)); Loading Loading @@ -807,10 +806,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity sensor.onDialpadVisible(show); } showDialpadRequest = DIALPAD_REQUEST_NONE; // Note: onInCallScreenDialpadVisibilityChange is called here to ensure that the dialpad FAB // repositions itself. getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(show); } private void showDialpadFragment() { Loading @@ -835,7 +830,7 @@ public class InCallActivity extends TransactionSafeFragmentActivity dialpadFragmentManager.executePendingTransactions(); Logger.get(this).logScreenView(ScreenEvent.Type.INCALL_DIALPAD, this); updateNavigationBar(true /* isDialpadVisible */); getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(true); } private void hideDialpadFragment() { Loading @@ -851,8 +846,8 @@ public class InCallActivity extends TransactionSafeFragmentActivity transaction.commitAllowingStateLoss(); dialpadFragmentManager.executePendingTransactions(); dialpadFragment.setUserVisibleHint(false); getInCallOrRttCallScreen().onInCallScreenDialpadVisibilityChange(false); } updateNavigationBar(false /* isDialpadVisible */); } public boolean isDialpadVisible() { Loading Loading @@ -1183,23 +1178,6 @@ public class InCallActivity extends TransactionSafeFragmentActivity fragment.show(getSupportFragmentManager(), Tags.RTT_REQUEST_DIALOG); } @Override public void onMultiWindowModeChanged(boolean isInMultiWindowMode) { super.onMultiWindowModeChanged(isInMultiWindowMode); updateNavigationBar(isDialpadVisible()); } private void updateNavigationBar(boolean isDialpadVisible) { if (isInMultiWindowMode()) { return; } View navigationBarBackground = getWindow().findViewById(R.id.navigation_bar_background); if (navigationBarBackground != null) { navigationBarBackground.setVisibility(isDialpadVisible ? View.VISIBLE : View.GONE); } } public void setAllowOrientationChange(boolean allowOrientationChange) { if (this.allowOrientationChange == allowOrientationChange) { return; Loading
java/com/android/incallui/incall/impl/InCallFragment.java +7 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.incallui.incall.impl; import android.Manifest.permission; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; Loading @@ -36,6 +37,7 @@ import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.RelativeLayout; Loading @@ -47,7 +49,6 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.multimedia.MultimediaData; import com.android.dialer.strictmode.StrictModeUtils; import com.android.dialer.util.ViewUtil; import com.android.dialer.widget.LockableViewPager; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment; import com.android.incallui.audioroute.AudioRouteSelectorDialogFragment.AudioRouteSelectorPresenter; Loading Loading @@ -179,8 +180,6 @@ public class InCallFragment extends Fragment } // TODO(a bug): Change to use corresponding phone type used for current call. phoneType = getContext().getSystemService(TelephonyManager.class).getPhoneType(); View space = view.findViewById(R.id.navigation_bar_background); space.getLayoutParams().height = ViewUtil.getNavigationBarHeight(getContext()); // Workaround to adjust padding for status bar and navigation bar since fitsSystemWindows // doesn't work well when switching with other fragments. Loading Loading @@ -395,6 +394,11 @@ public class InCallFragment extends Fragment // Update the Android Button's state to isShowing. inCallButtonGridFragment.onInCallScreenDialpadVisibilityChange(isShowing); } Activity activity = getActivity(); Window window = activity.getWindow(); window.setNavigationBarColor( activity.getColor( isShowing ? android.R.color.background_dark : android.R.color.transparent)); } @Override Loading
java/com/android/incallui/incall/impl/res/layout/frag_incall_voice.xml +0 −7 Original line number Diff line number Diff line Loading @@ -125,11 +125,4 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top"/> <FrameLayout android:id="@+id/navigation_bar_background" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="bottom" android:background="@android:color/background_dark" android:visibility="gone"/> </FrameLayout>