Showing
10 changed files
with
109 additions
and
71 deletions
| ... | @@ -99,19 +99,24 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe | ... | @@ -99,19 +99,24 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe |
| 99 | setContentView(R.layout.activity_home); | 99 | setContentView(R.layout.activity_home); |
| 100 | 100 | ||
| 101 | initViews(); | 101 | initViews(); |
| 102 | + | ||
| 103 | + WarpUtils.applyEdgeToEdge(this, | ||
| 104 | + findViewById(R.id.header_layout), | ||
| 105 | + null); | ||
| 106 | + | ||
| 102 | mPbLoading.setVisibility(View.VISIBLE); | 107 | mPbLoading.setVisibility(View.VISIBLE); |
| 103 | WarplyManager.getCampaigns(mCampaignsCallback); | 108 | WarplyManager.getCampaigns(mCampaignsCallback); |
| 104 | WarplyManager.getCouponsets(mCouponsetsCallback); | 109 | WarplyManager.getCouponsets(mCouponsetsCallback); |
| 105 | 110 | ||
| 106 | // Setup all category sections | 111 | // Setup all category sections |
| 107 | -// setupTopOffersSection(); | 112 | + setupTopOffersSection(); |
| 108 | -// setupFavoritesSection(); | 113 | + setupFavoritesSection(); |
| 109 | -// setupViabilitySection(); | 114 | + setupViabilitySection(); |
| 110 | -// setupFamilySection(); | 115 | + setupFamilySection(); |
| 111 | -// setupFoodCoffeeSection(); | 116 | + setupFoodCoffeeSection(); |
| 112 | -// setupTravellingSection(); | 117 | + setupTravellingSection(); |
| 113 | -// setupKidsSection(); | 118 | + setupKidsSection(); |
| 114 | -// setupPurchasesSection(); | 119 | + setupPurchasesSection(); |
| 115 | } | 120 | } |
| 116 | 121 | ||
| 117 | @Override | 122 | @Override | ... | ... |
| ... | @@ -62,11 +62,12 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O | ... | @@ -62,11 +62,12 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O |
| 62 | super.onCreate(savedInstanceState); | 62 | super.onCreate(savedInstanceState); |
| 63 | setContentView(R.layout.activity_profile); | 63 | setContentView(R.layout.activity_profile); |
| 64 | 64 | ||
| 65 | - // Setup white status bar | ||
| 66 | - setupStatusBar(); | ||
| 67 | - | ||
| 68 | initViews(); | 65 | initViews(); |
| 69 | 66 | ||
| 67 | + WarpUtils.applyEdgeToEdge(this, | ||
| 68 | + findViewById(R.id.header_layout), | ||
| 69 | + null); | ||
| 70 | + | ||
| 70 | // Setup profile suggestions section | 71 | // Setup profile suggestions section |
| 71 | setupProfileSuggestionsSection(); | 72 | setupProfileSuggestionsSection(); |
| 72 | 73 | ||
| ... | @@ -234,32 +235,6 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O | ... | @@ -234,32 +235,6 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O |
| 234 | mCouponsAdapter.filterByStatus(status); | 235 | mCouponsAdapter.filterByStatus(status); |
| 235 | } | 236 | } |
| 236 | 237 | ||
| 237 | - /** | ||
| 238 | - * Sets up the status bar to be white with dark icons | ||
| 239 | - */ | ||
| 240 | - private void setupStatusBar() { | ||
| 241 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
| 242 | - // API 30+ | ||
| 243 | - WindowInsetsController controller = getWindow().getInsetsController(); | ||
| 244 | - if (controller != null) { | ||
| 245 | - controller.setSystemBarsAppearance( | ||
| 246 | - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, | ||
| 247 | - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS | ||
| 248 | - ); | ||
| 249 | - } | ||
| 250 | - getWindow().setStatusBarColor(Color.WHITE); | ||
| 251 | - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
| 252 | - // API 23+ | ||
| 253 | - getWindow().getDecorView().setSystemUiVisibility( | ||
| 254 | - View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | ||
| 255 | - ); | ||
| 256 | - getWindow().setStatusBarColor(Color.WHITE); | ||
| 257 | - } else { | ||
| 258 | - // For older versions, just set a light gray color | ||
| 259 | - getWindow().setStatusBarColor(Color.parseColor("#F5F5F5")); | ||
| 260 | - } | ||
| 261 | - } | ||
| 262 | - | ||
| 263 | // =========================================================== | 238 | // =========================================================== |
| 264 | // Inner and Anonymous Classes | 239 | // Inner and Anonymous Classes |
| 265 | // =========================================================== | 240 | // =========================================================== | ... | ... |
| ... | @@ -79,9 +79,6 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen | ... | @@ -79,9 +79,6 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen |
| 79 | public void onCreate(Bundle savedInstanceState) { | 79 | public void onCreate(Bundle savedInstanceState) { |
| 80 | super.onCreate(savedInstanceState); | 80 | super.onCreate(savedInstanceState); |
| 81 | setContentView(R.layout.activity_single_coupon); | 81 | setContentView(R.layout.activity_single_coupon); |
| 82 | - | ||
| 83 | - // Setup white status bar | ||
| 84 | - setupStatusBar(); | ||
| 85 | 82 | ||
| 86 | // Get offer item from intent | 83 | // Get offer item from intent |
| 87 | Intent intent = getIntent(); | 84 | Intent intent = getIntent(); |
| ... | @@ -90,32 +87,10 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen | ... | @@ -90,32 +87,10 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen |
| 90 | } | 87 | } |
| 91 | 88 | ||
| 92 | initViews(); | 89 | initViews(); |
| 93 | - } | 90 | + |
| 94 | - | 91 | + WarpUtils.applyEdgeToEdge(this, |
| 95 | - /** | 92 | + findViewById(R.id.header_layout), |
| 96 | - * Sets up the status bar to be white with dark icons | 93 | + null); |
| 97 | - */ | ||
| 98 | - private void setupStatusBar() { | ||
| 99 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
| 100 | - // API 30+ | ||
| 101 | - WindowInsetsController controller = getWindow().getInsetsController(); | ||
| 102 | - if (controller != null) { | ||
| 103 | - controller.setSystemBarsAppearance( | ||
| 104 | - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, | ||
| 105 | - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS | ||
| 106 | - ); | ||
| 107 | - } | ||
| 108 | - getWindow().setStatusBarColor(Color.WHITE); | ||
| 109 | - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
| 110 | - // API 23+ | ||
| 111 | - getWindow().getDecorView().setSystemUiVisibility( | ||
| 112 | - View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | ||
| 113 | - ); | ||
| 114 | - getWindow().setStatusBarColor(Color.WHITE); | ||
| 115 | - } else { | ||
| 116 | - // For older versions, just set a light gray color | ||
| 117 | - getWindow().setStatusBarColor(Color.parseColor("#F5F5F5")); | ||
| 118 | - } | ||
| 119 | } | 94 | } |
| 120 | 95 | ||
| 121 | @Override | 96 | @Override | ... | ... |
| ... | @@ -17,6 +17,7 @@ import org.json.JSONObject; | ... | @@ -17,6 +17,7 @@ import org.json.JSONObject; |
| 17 | import ly.warp.sdk.R; | 17 | import ly.warp.sdk.R; |
| 18 | import ly.warp.sdk.activities.HomeActivity; | 18 | import ly.warp.sdk.activities.HomeActivity; |
| 19 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 19 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
| 20 | +import ly.warp.sdk.utils.WarpUtils; | ||
| 20 | import ly.warp.sdk.utils.managers.WarplyManager; | 21 | import ly.warp.sdk.utils.managers.WarplyManager; |
| 21 | 22 | ||
| 22 | public class HomeFragment extends Fragment implements View.OnClickListener { | 23 | public class HomeFragment extends Fragment implements View.OnClickListener { |
| ... | @@ -36,6 +37,10 @@ public class HomeFragment extends Fragment implements View.OnClickListener { | ... | @@ -36,6 +37,10 @@ public class HomeFragment extends Fragment implements View.OnClickListener { |
| 36 | mRlSmFlow = view.findViewById(R.id.ll_sm_flow); | 37 | mRlSmFlow = view.findViewById(R.id.ll_sm_flow); |
| 37 | mRlSmFlow.setOnClickListener(this); | 38 | mRlSmFlow.setOnClickListener(this); |
| 38 | 39 | ||
| 40 | + WarpUtils.applyEdgeToEdge(getActivity(), | ||
| 41 | + view.findViewById(R.id.rl_header), | ||
| 42 | + null); | ||
| 43 | + | ||
| 39 | // 6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826 | 44 | // 6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826 |
| 40 | // prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179 | 45 | // prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179 |
| 41 | // mPbLoading.setVisibility(View.VISIBLE); | 46 | // mPbLoading.setVisibility(View.VISIBLE); | ... | ... |
| ... | @@ -41,7 +41,7 @@ public interface ApiService { | ... | @@ -41,7 +41,7 @@ public interface ApiService { |
| 41 | @Header(WarpConstants.HEADER_SIGNATURE) String signature); | 41 | @Header(WarpConstants.HEADER_SIGNATURE) String signature); |
| 42 | 42 | ||
| 43 | @Headers("Content-Type: application/json") | 43 | @Headers("Content-Type: application/json") |
| 44 | - @POST("/partners/cosmote/verify") | 44 | + @POST("/partners/dei/verify") |
| 45 | Call<ResponseBody> verifyUser(@Body RequestBody request, | 45 | Call<ResponseBody> verifyUser(@Body RequestBody request, |
| 46 | @Header(WarpConstants.HEADER_DATE) String timeStamp, | 46 | @Header(WarpConstants.HEADER_DATE) String timeStamp, |
| 47 | @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | 47 | @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, | ... | ... |
| ... | @@ -48,13 +48,21 @@ import android.util.Base64; | ... | @@ -48,13 +48,21 @@ import android.util.Base64; |
| 48 | import android.util.Log; | 48 | import android.util.Log; |
| 49 | import android.view.Gravity; | 49 | import android.view.Gravity; |
| 50 | import android.view.View; | 50 | import android.view.View; |
| 51 | +import android.view.WindowInsetsController; | ||
| 51 | import android.view.animation.Animation; | 52 | import android.view.animation.Animation; |
| 52 | import android.view.animation.ScaleAnimation; | 53 | import android.view.animation.ScaleAnimation; |
| 53 | import android.widget.TextView; | 54 | import android.widget.TextView; |
| 54 | 55 | ||
| 56 | +import android.app.Activity; | ||
| 57 | + | ||
| 55 | import androidx.annotation.FontRes; | 58 | import androidx.annotation.FontRes; |
| 56 | import androidx.annotation.NonNull; | 59 | import androidx.annotation.NonNull; |
| 60 | +import androidx.annotation.Nullable; | ||
| 57 | import androidx.core.content.res.ResourcesCompat; | 61 | import androidx.core.content.res.ResourcesCompat; |
| 62 | +import androidx.core.graphics.Insets; | ||
| 63 | +import androidx.core.view.ViewCompat; | ||
| 64 | +import androidx.core.view.WindowCompat; | ||
| 65 | +import androidx.core.view.WindowInsetsCompat; | ||
| 58 | import androidx.security.crypto.EncryptedSharedPreferences; | 66 | import androidx.security.crypto.EncryptedSharedPreferences; |
| 59 | import androidx.security.crypto.MasterKey; | 67 | import androidx.security.crypto.MasterKey; |
| 60 | import androidx.work.OneTimeWorkRequest; | 68 | import androidx.work.OneTimeWorkRequest; |
| ... | @@ -941,4 +949,71 @@ public class WarpUtils { | ... | @@ -941,4 +949,71 @@ public class WarpUtils { |
| 941 | } | 949 | } |
| 942 | } | 950 | } |
| 943 | 951 | ||
| 952 | + /** | ||
| 953 | + * Applies edge-to-edge display and handles window insets for Android 16+ compatibility. | ||
| 954 | + * Call this in onCreate() after setContentView(). | ||
| 955 | + * | ||
| 956 | + * @param activity The activity to apply edge-to-edge to | ||
| 957 | + * @param topView The view that should receive top inset padding (e.g., header/toolbar). Can be null. | ||
| 958 | + * @param bottomView The view that should receive bottom inset padding (e.g., scroll content or bottom nav). Can be null. | ||
| 959 | + */ | ||
| 960 | + public static void applyEdgeToEdge(@NonNull Activity activity, @Nullable View topView, @Nullable View bottomView) { | ||
| 961 | + // Tell the system we will handle insets ourselves | ||
| 962 | + WindowCompat.setDecorFitsSystemWindows(activity.getWindow(), false); | ||
| 963 | + | ||
| 964 | + // Use a single listener on the root content view to avoid insets being | ||
| 965 | + // consumed by a parent before reaching child views in the hierarchy. | ||
| 966 | + View rootView = activity.findViewById(android.R.id.content); | ||
| 967 | + ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, windowInsets) -> { | ||
| 968 | + Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); | ||
| 969 | + | ||
| 970 | + // Apply top system bar insets (status bar) to the top view | ||
| 971 | + if (topView != null) { | ||
| 972 | + topView.setPadding( | ||
| 973 | + topView.getPaddingLeft(), | ||
| 974 | + insets.top, | ||
| 975 | + topView.getPaddingRight(), | ||
| 976 | + topView.getPaddingBottom() | ||
| 977 | + ); | ||
| 978 | + } | ||
| 979 | + | ||
| 980 | + // Apply bottom system bar insets (navigation bar) to the bottom view | ||
| 981 | + if (bottomView != null) { | ||
| 982 | + bottomView.setPadding( | ||
| 983 | + bottomView.getPaddingLeft(), | ||
| 984 | + bottomView.getPaddingTop(), | ||
| 985 | + bottomView.getPaddingRight(), | ||
| 986 | + insets.bottom | ||
| 987 | + ); | ||
| 988 | + } | ||
| 989 | + | ||
| 990 | + return WindowInsetsCompat.CONSUMED; | ||
| 991 | + }); | ||
| 992 | + } | ||
| 993 | + | ||
| 994 | + /** | ||
| 995 | + * Sets up the status bar to be white with dark icons | ||
| 996 | + */ | ||
| 997 | + public static void setupStatusBar(@NonNull Activity activity) { | ||
| 998 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
| 999 | + // API 30+ | ||
| 1000 | + WindowInsetsController controller = activity.getWindow().getInsetsController(); | ||
| 1001 | + if (controller != null) { | ||
| 1002 | + controller.setSystemBarsAppearance( | ||
| 1003 | + WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, | ||
| 1004 | + WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS | ||
| 1005 | + ); | ||
| 1006 | + } | ||
| 1007 | + activity.getWindow().setStatusBarColor(Color.WHITE); | ||
| 1008 | + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
| 1009 | + // API 23+ | ||
| 1010 | + activity.getWindow().getDecorView().setSystemUiVisibility( | ||
| 1011 | + View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | ||
| 1012 | + ); | ||
| 1013 | + activity.getWindow().setStatusBarColor(Color.WHITE); | ||
| 1014 | + } else { | ||
| 1015 | + // For older versions, just set a light gray color | ||
| 1016 | + activity.getWindow().setStatusBarColor(Color.parseColor("#F5F5F5")); | ||
| 1017 | + } | ||
| 1018 | + } | ||
| 944 | } | 1019 | } | ... | ... |
| ... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
| 24 | android:layout_gravity="center" | 24 | android:layout_gravity="center" |
| 25 | android:background="@color/custom_grey_light" | 25 | android:background="@color/custom_grey_light" |
| 26 | android:orientation="horizontal" | 26 | android:orientation="horizontal" |
| 27 | - android:padding="16dp"> | 27 | + android:paddingHorizontal="16dp"> |
| 28 | 28 | ||
| 29 | <LinearLayout | 29 | <LinearLayout |
| 30 | android:layout_width="0dp" | 30 | android:layout_width="0dp" | ... | ... |
| ... | @@ -151,7 +151,8 @@ | ... | @@ -151,7 +151,8 @@ |
| 151 | android:layout_height="wrap_content" | 151 | android:layout_height="wrap_content" |
| 152 | android:layout_marginTop="40dp" | 152 | android:layout_marginTop="40dp" |
| 153 | android:background="@color/white" | 153 | android:background="@color/white" |
| 154 | - android:paddingVertical="16dp"> | 154 | + android:paddingVertical="16dp" |
| 155 | + android:layout_marginBottom="48dp"> | ||
| 155 | 156 | ||
| 156 | <TextView | 157 | <TextView |
| 157 | android:id="@+id/tv_my_coupons_title" | 158 | android:id="@+id/tv_my_coupons_title" | ... | ... |
| ... | @@ -101,7 +101,8 @@ | ... | @@ -101,7 +101,8 @@ |
| 101 | android:layout_height="wrap_content" | 101 | android:layout_height="wrap_content" |
| 102 | android:orientation="vertical" | 102 | android:orientation="vertical" |
| 103 | android:paddingHorizontal="16dp" | 103 | android:paddingHorizontal="16dp" |
| 104 | - android:paddingVertical="16dp"> | 104 | + android:paddingVertical="16dp" |
| 105 | + android:layout_marginBottom="48dp"> | ||
| 105 | 106 | ||
| 106 | <androidx.constraintlayout.widget.ConstraintLayout | 107 | <androidx.constraintlayout.widget.ConstraintLayout |
| 107 | android:layout_width="match_parent" | 108 | android:layout_width="match_parent" | ... | ... |
| ... | @@ -5,7 +5,8 @@ | ... | @@ -5,7 +5,8 @@ |
| 5 | </style> | 5 | </style> |
| 6 | 6 | ||
| 7 | <style name="SDKAppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> | 7 | <style name="SDKAppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> |
| 8 | - <item name="android:statusBarColor">@color/custom_grey_light</item> | 8 | + <item name="android:statusBarColor">@android:color/transparent</item> |
| 9 | + <item name="android:navigationBarColor">@android:color/transparent</item> | ||
| 9 | <item name="android:windowLightStatusBar">true</item> | 10 | <item name="android:windowLightStatusBar">true</item> |
| 10 | <item name="android:forceDarkAllowed" tools:targetApi="q">false</item> | 11 | <item name="android:forceDarkAllowed" tools:targetApi="q">false</item> |
| 11 | </style> | 12 | </style> | ... | ... |
-
Please register or login to post a comment