Panagiotis Triantafyllou

edge to edge support

......@@ -99,19 +99,24 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
setContentView(R.layout.activity_home);
initViews();
WarpUtils.applyEdgeToEdge(this,
findViewById(R.id.header_layout),
null);
mPbLoading.setVisibility(View.VISIBLE);
WarplyManager.getCampaigns(mCampaignsCallback);
WarplyManager.getCouponsets(mCouponsetsCallback);
// Setup all category sections
// setupTopOffersSection();
// setupFavoritesSection();
// setupViabilitySection();
// setupFamilySection();
// setupFoodCoffeeSection();
// setupTravellingSection();
// setupKidsSection();
// setupPurchasesSection();
setupTopOffersSection();
setupFavoritesSection();
setupViabilitySection();
setupFamilySection();
setupFoodCoffeeSection();
setupTravellingSection();
setupKidsSection();
setupPurchasesSection();
}
@Override
......
......@@ -62,11 +62,12 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
// Setup white status bar
setupStatusBar();
initViews();
WarpUtils.applyEdgeToEdge(this,
findViewById(R.id.header_layout),
null);
// Setup profile suggestions section
setupProfileSuggestionsSection();
......@@ -234,32 +235,6 @@ public class ProfileActivity extends Activity implements View.OnClickListener, O
mCouponsAdapter.filterByStatus(status);
}
/**
* Sets up the status bar to be white with dark icons
*/
private void setupStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// API 30+
WindowInsetsController controller = getWindow().getInsetsController();
if (controller != null) {
controller.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
);
}
getWindow().setStatusBarColor(Color.WHITE);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// API 23+
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
getWindow().setStatusBarColor(Color.WHITE);
} else {
// For older versions, just set a light gray color
getWindow().setStatusBarColor(Color.parseColor("#F5F5F5"));
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
......
......@@ -79,9 +79,6 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_coupon);
// Setup white status bar
setupStatusBar();
// Get offer item from intent
Intent intent = getIntent();
......@@ -90,32 +87,10 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
}
initViews();
}
/**
* Sets up the status bar to be white with dark icons
*/
private void setupStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// API 30+
WindowInsetsController controller = getWindow().getInsetsController();
if (controller != null) {
controller.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
);
}
getWindow().setStatusBarColor(Color.WHITE);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// API 23+
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
getWindow().setStatusBarColor(Color.WHITE);
} else {
// For older versions, just set a light gray color
getWindow().setStatusBarColor(Color.parseColor("#F5F5F5"));
}
WarpUtils.applyEdgeToEdge(this,
findViewById(R.id.header_layout),
null);
}
@Override
......
......@@ -17,6 +17,7 @@ import org.json.JSONObject;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.HomeActivity;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.managers.WarplyManager;
public class HomeFragment extends Fragment implements View.OnClickListener {
......@@ -36,6 +37,10 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
mRlSmFlow = view.findViewById(R.id.ll_sm_flow);
mRlSmFlow.setOnClickListener(this);
WarpUtils.applyEdgeToEdge(getActivity(),
view.findViewById(R.id.rl_header),
null);
// 6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826
// prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
// mPbLoading.setVisibility(View.VISIBLE);
......
......@@ -41,7 +41,7 @@ public interface ApiService {
@Header(WarpConstants.HEADER_SIGNATURE) String signature);
@Headers("Content-Type: application/json")
@POST("/partners/cosmote/verify")
@POST("/partners/dei/verify")
Call<ResponseBody> verifyUser(@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
......
......@@ -48,13 +48,21 @@ import android.util.Base64;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.WindowInsetsController;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.TextView;
import android.app.Activity;
import androidx.annotation.FontRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.security.crypto.EncryptedSharedPreferences;
import androidx.security.crypto.MasterKey;
import androidx.work.OneTimeWorkRequest;
......@@ -941,4 +949,71 @@ public class WarpUtils {
}
}
/**
* Applies edge-to-edge display and handles window insets for Android 16+ compatibility.
* Call this in onCreate() after setContentView().
*
* @param activity The activity to apply edge-to-edge to
* @param topView The view that should receive top inset padding (e.g., header/toolbar). Can be null.
* @param bottomView The view that should receive bottom inset padding (e.g., scroll content or bottom nav). Can be null.
*/
public static void applyEdgeToEdge(@NonNull Activity activity, @Nullable View topView, @Nullable View bottomView) {
// Tell the system we will handle insets ourselves
WindowCompat.setDecorFitsSystemWindows(activity.getWindow(), false);
// Use a single listener on the root content view to avoid insets being
// consumed by a parent before reaching child views in the hierarchy.
View rootView = activity.findViewById(android.R.id.content);
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, windowInsets) -> {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
// Apply top system bar insets (status bar) to the top view
if (topView != null) {
topView.setPadding(
topView.getPaddingLeft(),
insets.top,
topView.getPaddingRight(),
topView.getPaddingBottom()
);
}
// Apply bottom system bar insets (navigation bar) to the bottom view
if (bottomView != null) {
bottomView.setPadding(
bottomView.getPaddingLeft(),
bottomView.getPaddingTop(),
bottomView.getPaddingRight(),
insets.bottom
);
}
return WindowInsetsCompat.CONSUMED;
});
}
/**
* Sets up the status bar to be white with dark icons
*/
public static void setupStatusBar(@NonNull Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// API 30+
WindowInsetsController controller = activity.getWindow().getInsetsController();
if (controller != null) {
controller.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
);
}
activity.getWindow().setStatusBarColor(Color.WHITE);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// API 23+
activity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
);
activity.getWindow().setStatusBarColor(Color.WHITE);
} else {
// For older versions, just set a light gray color
activity.getWindow().setStatusBarColor(Color.parseColor("#F5F5F5"));
}
}
}
......
......@@ -24,7 +24,7 @@
android:layout_gravity="center"
android:background="@color/custom_grey_light"
android:orientation="horizontal"
android:padding="16dp">
android:paddingHorizontal="16dp">
<LinearLayout
android:layout_width="0dp"
......
......@@ -151,7 +151,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="@color/white"
android:paddingVertical="16dp">
android:paddingVertical="16dp"
android:layout_marginBottom="48dp">
<TextView
android:id="@+id/tv_my_coupons_title"
......
......@@ -101,7 +101,8 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp">
android:paddingVertical="16dp"
android:layout_marginBottom="48dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......
......@@ -5,7 +5,8 @@
</style>
<style name="SDKAppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="android:statusBarColor">@color/custom_grey_light</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style>
......