Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2025-09-23 13:24:28 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
431e6117bf7ab6a400a66be29599dbdaca3e3418
431e6117
1 parent
c9a11058
webview android 15 and up fixes
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
135 additions
and
11 deletions
.idea/AndroidProjectSystem.xml
.idea/gradle.xml
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/constants/WarpConstants.java
.idea/AndroidProjectSystem.xml
0 → 100644
View file @
431e611
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"AndroidProjectSystem"
>
<option
name=
"providerId"
value=
"com.android.tools.idea.GradleProjectSystem"
/>
</component>
</project>
\ No newline at end of file
.idea/gradle.xml
View file @
431e611
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"GradleMigrationSettings"
migrationVersion=
"1"
/>
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
...
...
@@ -13,7 +14,6 @@
<option
value=
"$PROJECT_DIR$/warply_android_sdk"
/>
</set>
</option>
<option
name=
"resolveExternalAnnotations"
value=
"false"
/>
</GradleProjectSettings>
</option>
</component>
...
...
warply_android_sdk/build.gradle
View file @
431e611
...
...
@@ -5,7 +5,7 @@ android.buildFeatures.buildConfig = true
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.5.
5
'
PUBLISH_VERSION
=
'4.5.5.
6
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
View file @
431e611
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...
...
@@ -30,7 +30,9 @@ import android.content.Intent;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.View
;
...
...
@@ -43,10 +45,14 @@ import java.security.SecureRandom;
import
java.util.concurrent.ThreadLocalRandom
;
import
java.util.concurrent.TimeUnit
;
import
androidx.core.graphics.Insets
;
import
androidx.core.view.ViewCompat
;
import
androidx.core.view.WindowInsetsCompat
;
import
androidx.work.Constraints
;
import
androidx.work.NetworkType
;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.services.PushEventsClickedWorkerService
;
import
ly.warp.sdk.utils.WarpJSONParser
;
...
...
@@ -116,7 +122,68 @@ public class WarpViewActivity extends WarpBaseActivity {
// Methods
// ===========================================================
//OLD with edge to edge enabled
// private void initViews() {
//
// RelativeLayout root = new RelativeLayout(this);
// root.setBackgroundColor(Color.WHITE);
//
// final ImageView ivLogo = new ImageView(this);
// RelativeLayout.LayoutParams ivLogoParams = new RelativeLayout.LayoutParams(
// RelativeLayout.LayoutParams.WRAP_CONTENT,
// RelativeLayout.LayoutParams.WRAP_CONTENT);
// ivLogoParams.addRule(RelativeLayout.CENTER_IN_PARENT);
// root.addView(ivLogo, ivLogoParams);
//
// ivLogo.setImageDrawable(WarplyProperty.getProgressDrawable(this));
// ivLogo.startAnimation(WarpUtils.getPulseAnimation());
//
// mWarpView = new WarpView(this);
// RelativeLayout.LayoutParams warpViewParams = new RelativeLayout.LayoutParams(
// RelativeLayout.LayoutParams.MATCH_PARENT,
// RelativeLayout.LayoutParams.MATCH_PARENT);
// root.addView(mWarpView, warpViewParams);
//
//
// int progressHeightDp = 7;
// final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
// progressBar.setProgressDrawable(WarpUtils.getHorizontalProgressDrawable(WarplyProperty.getProgressColor(this)));
// RelativeLayout.LayoutParams progressBarParams = new RelativeLayout.LayoutParams(
// RelativeLayout.LayoutParams.MATCH_PARENT, (int)
// (progressHeightDp * getResources().getDisplayMetrics().density + 0.5f));
// mWarpView.setProgressChangeListener(new WarpView.ProgressChangeListener() {
// @Override
// public void onProgressChanged(WebView view, int newProgress) {
//
// progressBar.setProgress(newProgress);
// if (progressBar.getProgress() == 100) {
// WarpUtils.animateVisibility(ivLogo, View.INVISIBLE);
// WarpUtils.animateVisibility(progressBar, View.INVISIBLE);
// } else {
// WarpUtils.animateVisibility(ivLogo, View.VISIBLE);
// WarpUtils.animateVisibility(progressBar, View.VISIBLE);
// }
// }
// });
/// / root.addView(progressBar, progressBarParams);
// setContentView(root);
// }
// NEW that handles edge to edge properly
private
void
initViews
()
{
// Enable edge-to-edge display for SDK 35
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
getWindow
().
setDecorFitsSystemWindows
(
false
);
}
else
{
// For older Android versions
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
);
}
RelativeLayout
root
=
new
RelativeLayout
(
this
);
root
.
setBackgroundColor
(
Color
.
WHITE
);
...
...
@@ -131,12 +198,45 @@ public class WarpViewActivity extends WarpBaseActivity {
ivLogo
.
setImageDrawable
(
WarplyProperty
.
getProgressDrawable
(
this
));
ivLogo
.
startAnimation
(
WarpUtils
.
getPulseAnimation
());
// Create a container for the WebView to handle insets properly
RelativeLayout
webViewContainer
=
new
RelativeLayout
(
this
);
RelativeLayout
.
LayoutParams
containerParams
=
new
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
);
root
.
addView
(
webViewContainer
,
containerParams
);
mWarpView
=
new
WarpView
(
this
);
RelativeLayout
.
LayoutParams
warpViewParams
=
new
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
);
root
.
addView
(
mWarpView
,
warpViewParams
);
webViewContainer
.
addView
(
mWarpView
,
warpViewParams
);
// Handle window insets for the WebView container
ViewCompat
.
setOnApplyWindowInsetsListener
(
webViewContainer
,
(
v
,
insets
)
->
{
Insets
systemBars
=
insets
.
getInsets
(
WindowInsetsCompat
.
Type
.
systemBars
());
// Apply padding to the WebView container (parent layout) instead of WebView directly
webViewContainer
.
setPadding
(
systemBars
.
left
,
systemBars
.
top
,
systemBars
.
right
,
systemBars
.
bottom
);
return
WindowInsetsCompat
.
CONSUMED
;
});
// Force apply insets immediately with fallback values
webViewContainer
.
post
(()
->
{
// Get status bar height programmatically as fallback
int
statusBarHeight
=
getStatusBarHeight
();
int
navigationBarHeight
=
getNavigationBarHeight
();
// Apply fallback padding to container if insets haven't been applied yet
if
(
webViewContainer
.
getPaddingTop
()
==
0
&&
statusBarHeight
>
0
)
{
webViewContainer
.
setPadding
(
0
,
statusBarHeight
,
0
,
navigationBarHeight
);
}
});
int
progressHeightDp
=
7
;
final
ProgressBar
progressBar
=
new
ProgressBar
(
this
,
null
,
android
.
R
.
attr
.
progressBarStyleHorizontal
);
...
...
@@ -144,10 +244,10 @@ public class WarpViewActivity extends WarpBaseActivity {
RelativeLayout
.
LayoutParams
progressBarParams
=
new
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
(
int
)
(
progressHeightDp
*
getResources
().
getDisplayMetrics
().
density
+
0.5f
));
mWarpView
.
setProgressChangeListener
(
new
WarpView
.
ProgressChangeListener
()
{
@Override
public
void
onProgressChanged
(
WebView
view
,
int
newProgress
)
{
progressBar
.
setProgress
(
newProgress
);
if
(
progressBar
.
getProgress
()
==
100
)
{
WarpUtils
.
animateVisibility
(
ivLogo
,
View
.
INVISIBLE
);
...
...
@@ -158,10 +258,28 @@ public class WarpViewActivity extends WarpBaseActivity {
}
}
});
// root.addView(progressBar, progressBarParams);
setContentView
(
root
);
}
private
int
getStatusBarHeight
()
{
int
result
=
0
;
int
resourceId
=
getResources
().
getIdentifier
(
"status_bar_height"
,
"dimen"
,
"android"
);
if
(
resourceId
>
0
)
{
result
=
getResources
().
getDimensionPixelSize
(
resourceId
);
}
return
result
;
}
private
int
getNavigationBarHeight
()
{
int
result
=
0
;
int
resourceId
=
getResources
().
getIdentifier
(
"navigation_bar_height"
,
"dimen"
,
"android"
);
if
(
resourceId
>
0
)
{
result
=
getResources
().
getDimensionPixelSize
(
resourceId
);
}
return
result
;
}
private
void
setPageAccordingToIntent
()
{
Intent
intent
=
getIntent
();
...
...
@@ -226,4 +344,4 @@ public class WarpViewActivity extends WarpBaseActivity {
public
static
Intent
createIntentFromURL
(
Context
context
,
String
url
)
{
return
new
Intent
(
context
,
WarpViewActivity
.
class
).
putExtra
(
"sessionUrl"
,
url
);
}
}
\ No newline at end of file
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/constants/WarpConstants.java
View file @
431e611
...
...
@@ -30,7 +30,7 @@ public class WarpConstants {
/**
* The version of the SDK installed in the device
*/
public
static
final
String
SDK_VERSION
=
"4.5.5.
5
"
;
public
static
final
String
SDK_VERSION
=
"4.5.5.
6
"
;
/**
* The URL of the server where it should ping
...
...
Please
register
or
login
to post a comment