File tree Expand file tree Collapse file tree
affirm/src/main/java/com/affirm/android Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010import android .app .Activity ;
1111import android .content .Intent ;
12+ import android .os .Bundle ;
1213
1314import androidx .annotation .NonNull ;
1415import androidx .annotation .Nullable ;
2021
2122abstract class AffirmActivity extends AppCompatActivity {
2223
24+ @ Override
25+ protected void onCreate (@ Nullable Bundle savedInstanceState ) {
26+ super .onCreate (savedInstanceState );
27+ AffirmUtils .applyWindowInsets (findViewById (android .R .id .content ));
28+ }
29+
2330 static void startForResult (@ NonNull Activity originalActivity ,
2431 @ NonNull Intent intent ,
2532 int requestCode ) {
Original file line number Diff line number Diff line change 2525
2626import androidx .annotation .NonNull ;
2727import androidx .annotation .Nullable ;
28+ import androidx .core .view .ViewCompat ;
2829
2930import static com .affirm .android .AffirmColor .AFFIRM_COLOR_TYPE_BLUE ;
3031import static com .affirm .android .AffirmColor .AFFIRM_COLOR_TYPE_BLUE_BLACK ;
@@ -40,6 +41,22 @@ public final class AffirmUtils {
4041 private AffirmUtils () {
4142 }
4243
44+ static void applyWindowInsets (@ NonNull View root ) {
45+ final int left = root .getPaddingLeft ();
46+ final int top = root .getPaddingTop ();
47+ final int right = root .getPaddingRight ();
48+ final int bottom = root .getPaddingBottom ();
49+ ViewCompat .setOnApplyWindowInsetsListener (root , (v , insets ) -> {
50+ v .setPadding (
51+ left + insets .getSystemWindowInsetLeft (),
52+ top + insets .getSystemWindowInsetTop (),
53+ right + insets .getSystemWindowInsetRight (),
54+ bottom + insets .getSystemWindowInsetBottom ());
55+ return insets .consumeSystemWindowInsets ();
56+ });
57+ ViewCompat .requestApplyInsets (root );
58+ }
59+
4360 public static int decimalDollarsToIntegerCents (BigDecimal amount ) {
4461 return amount .movePointRight (2 ).intValue ();
4562 }
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6868 }
6969 super .onCreate (savedInstanceState );
7070 setContentView (R .layout .activity_loan_amount );
71+ AffirmUtils .applyWindowInsets (findViewById (android .R .id .content ));
7172
7273 Toolbar toolbar = findViewById (R .id .toolbar );
7374 setSupportActionBar (toolbar );
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
7070
7171 super .onCreate (savedInstanceState );
7272 setContentView (R .layout .activity_vcn_display );
73+ AffirmUtils .applyWindowInsets (findViewById (android .R .id .content ));
7374
7475 Toolbar toolbar = findViewById (R .id .toolbar );
7576 toolbar .setTitleTextColor (getResources ().getColor (R .color .affirm_color_primary ));
You can’t perform that action at this time.
0 commit comments