Skip to content

Commit 13ff97f

Browse files
committed
full edge to edge support
1 parent 302409b commit 13ff97f

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
vNext
22
----------
3+
- [MINOR] Full edge to edge support (#2721)
34
- [MAJOR] Bump TargetSdk to 35, minSdk to 24, AGP to 8.10.0 (#2713)
45
- [PATCH] Fix caching of secret key and add retries for InvalidKeyException during unwrap (#2659)
56
- [MINOR] Replace AbstractSecretKeyLoader with ISecretKeyProvider (#2666)

common/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ dependencies {
158158

159159
implementation 'org.apache.httpcomponents.core5:httpcore5:5.3'
160160
implementation "com.nimbusds:nimbus-jose-jwt:$rootProject.ext.nimbusVersion"
161+
implementation "androidx.activity:activity:1.8.2"
161162
implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion"
162163
implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion"
163164
implementation "com.squareup.moshi:moshi:$rootProject.ext.moshiVersion"

common/src/main/java/com/microsoft/identity/common/internal/ui/DualScreenActivity.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@
2626
import android.content.Context;
2727
import android.content.pm.PackageManager;
2828
import android.content.res.Configuration;
29+
import android.graphics.Color;
2930
import android.graphics.Rect;
31+
import android.os.Bundle;
3032
import android.view.LayoutInflater;
3133
import android.view.Surface;
3234
import android.view.WindowManager;
3335
import android.widget.RelativeLayout;
3436

37+
import androidx.activity.EdgeToEdge;
38+
import androidx.activity.SystemBarStyle;
3539
import androidx.annotation.NonNull;
40+
import androidx.annotation.Nullable;
3641
import androidx.constraintlayout.widget.ConstraintLayout;
3742
import androidx.constraintlayout.widget.ConstraintSet;
43+
import androidx.core.graphics.Insets;
3844
import androidx.core.view.ViewCompat;
3945
import androidx.core.view.WindowInsetsCompat;
4046
import androidx.fragment.app.Fragment;
@@ -52,6 +58,22 @@
5258
// This activity readjusts its child layouts so that they're displayed on both single-screen and dual-screen device correctly.
5359
public class DualScreenActivity extends FragmentActivity {
5460

61+
@Override
62+
protected void onCreate(@Nullable Bundle savedInstanceState) {
63+
super.onCreate(savedInstanceState);
64+
65+
if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_HANDLING_FOR_EDGE_TO_EDGE)) {
66+
// Force set to a light theme (to status and navigation bars) since broker/common activities always have white background.
67+
// (We don't support dark mode in broker/common activities yet.
68+
// Until then, having everything consistently rendered with white background looks better.)
69+
// This will also guarantee that the icons on those bars are always visible.
70+
setTheme(R.style.Theme_AppCompat_Light);
71+
EdgeToEdge.enable(this,
72+
SystemBarStyle.light(Color.TRANSPARENT,Color.TRANSPARENT),
73+
SystemBarStyle.light(Color.TRANSPARENT,Color.TRANSPARENT));
74+
}
75+
}
76+
5577
@Override
5678
public void setContentView(int layoutResID) {
5779
initializeContentView();
@@ -65,18 +87,19 @@ private void initializeContentView(){
6587
if (CommonFlightsManager.INSTANCE.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_HANDLING_FOR_EDGE_TO_EDGE)) {
6688
try {
6789
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (view, insets) -> {
68-
int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
69-
int bottomInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom;
70-
int leftInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).left;
71-
int rightInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).right;
72-
73-
view.setPadding(leftInset, topInset, rightInset, bottomInset);
90+
// Set the padding of the view to the insets of system bars, display cutout, system gestures, and Input (keyboards).
91+
final Insets inset = insets.getInsets(WindowInsetsCompat.Type.systemBars()
92+
| WindowInsetsCompat.Type.displayCutout()
93+
| WindowInsetsCompat.Type.systemGestures()
94+
| WindowInsetsCompat.Type.ime());
95+
view.setPadding(inset.left, inset.top, inset.right, inset.bottom);
7496
return insets;
7597
});
7698
} catch (final Throwable throwable) {
7799
Logger.warn("DualScreenActivity:initializeContentView", "Failed to set OnApplyWindowInsetsListener");
78100
}
79101
}
102+
80103
adjustLayoutForDualScreenActivity();
81104
}
82105

common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public enum CommonFlight implements IFlightConfig {
124124
/**
125125
* Flight to enable handling the UI in edge to edge mode
126126
*/
127-
ENABLE_HANDLING_FOR_EDGE_TO_EDGE("EnableHandlingEdgeToEdge", false),
127+
ENABLE_HANDLING_FOR_EDGE_TO_EDGE("EnableHandlingEdgeToEdge", true),
128128

129129
/**
130130
* Flight to enable the Web CP in WebView.

0 commit comments

Comments
 (0)