Hide navigation bar (if exists) when phone is close to ear while in call on Android ICS+ device
This commit is contained in:
parent
39233976a7
commit
4a4f2fb5d4
3 changed files with 28 additions and 1 deletions
|
@ -49,6 +49,7 @@ import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener.AudioS
|
|||
import org.linphone.LinphoneSimpleListener.LinphoneOnDTMFReceivedListener;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneOnMessageReceivedListener;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneServiceListener;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
|
@ -1507,9 +1508,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
if (nearby) {
|
||||
params.screenBrightness = 0.1f;
|
||||
view.setVisibility(View.INVISIBLE);
|
||||
Compatibility.hideNavigationBar(activity);
|
||||
} else {
|
||||
params.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
|
||||
view.setVisibility(View.VISIBLE);
|
||||
Compatibility.showNavigationBar(activity);
|
||||
}
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package org.linphone.compatibility;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.preference.Preference;
|
||||
import android.preference.TwoStatePreference;
|
||||
import android.view.View;
|
||||
|
||||
/*
|
||||
ApiFourteenPlus.java
|
||||
|
@ -35,4 +37,12 @@ public class ApiFourteenPlus {
|
|||
public static boolean isPreferenceChecked(Preference preference) {
|
||||
return ((TwoStatePreference) preference).isChecked();
|
||||
}
|
||||
|
||||
public static void hideNavigationBar(Activity activity) {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
|
||||
}
|
||||
|
||||
public static void showNavigationBar(Activity activity) {
|
||||
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,10 +248,24 @@ public class Compatibility {
|
|||
|
||||
|
||||
public static void removeGlobalLayoutListener(ViewTreeObserver viewTreeObserver, OnGlobalLayoutListener keyboardListener) {
|
||||
if (Version.sdkAboveOrEqual(16)) {
|
||||
if (Version.sdkAboveOrEqual(Version.API16_JELLY_BEAN_41)) {
|
||||
ApiSixteenPlus.removeGlobalLayoutListener(viewTreeObserver, keyboardListener);
|
||||
} else {
|
||||
ApiFivePlus.removeGlobalLayoutListener(viewTreeObserver, keyboardListener);
|
||||
}
|
||||
}
|
||||
|
||||
public static void hideNavigationBar(Activity activity)
|
||||
{
|
||||
if (Version.sdkAboveOrEqual(Version.API14_ICE_CREAM_SANDWICH_40)) {
|
||||
ApiFourteenPlus.hideNavigationBar(activity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showNavigationBar(Activity activity)
|
||||
{
|
||||
if (Version.sdkAboveOrEqual(Version.API14_ICE_CREAM_SANDWICH_40)) {
|
||||
ApiFourteenPlus.showNavigationBar(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue