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-05-26 17:26:46 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bffc662844f1cc335460ff3945db8cd44b623b6b
bffc6628
1 parent
2b1d6ea5
deh part4
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
254 additions
and
46 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/HomeActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/SingleCouponActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/adapters/BannerAdapter.java
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner.png
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner1.png
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner2.png
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner3.png
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner4.png
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner5.png
warply_android_sdk/src/main/res/drawable/dot_active.xml
warply_android_sdk/src/main/res/drawable/dot_inactive.xml
warply_android_sdk/src/main/res/layout/activity_home.xml
warply_android_sdk/src/main/res/layout/activity_single_coupon.xml
warply_android_sdk/src/main/res/layout/item_banner.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/HomeActivity.java
View file @
bffc662
...
...
@@ -6,12 +6,20 @@ import android.os.Bundle;
import
android.util.TypedValue
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.viewpager2.widget.ViewPager2
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.adapters.BannerAdapter
;
import
ly.warp.sdk.io.adapters.OfferAdapter
;
import
ly.warp.sdk.io.models.DummyDataProvider
;
import
ly.warp.sdk.io.models.OfferCategory
;
...
...
@@ -28,7 +36,10 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
// ===========================================================
// Fields
// ===========================================================
private
ImageView
mIvBanner
;
private
ViewPager2
mBannerViewPager
;
private
BannerAdapter
mBannerAdapter
;
private
LinearLayout
mDotsContainer
;
private
List
<
ImageView
>
mDots
;
// Category sections
private
TextView
mTvCategoryTopOffers
;
...
...
@@ -95,9 +106,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
@Override
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
R
.
id
.
banner_icon
)
{
WarplyManagerHelper
.
openContest
(
this
);
}
// No longer needed as banner clicks are handled by the adapter
}
@Override
...
...
@@ -117,9 +126,8 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
// ===========================================================
private
void
initViews
()
{
// Initialize banner
mIvBanner
=
findViewById
(
R
.
id
.
banner_icon
);
mIvBanner
.
setOnClickListener
(
this
);
// Initialize banner carousel
setupBannerCarousel
();
// Initialize Top Offers section
mTvCategoryTopOffers
=
findViewById
(
R
.
id
.
tv_recycler_category1
);
...
...
@@ -378,6 +386,89 @@ public class HomeActivity extends Activity implements View.OnClickListener, Offe
}
// ===========================================================
//
Inner and Anonymous Classe
s
//
Method
s
// ===========================================================
/**
* Sets up the banner carousel with ViewPager2 and pagination dots
*/
private
void
setupBannerCarousel
()
{
mBannerViewPager
=
findViewById
(
R
.
id
.
banner_viewpager
);
mDotsContainer
=
findViewById
(
R
.
id
.
dots_container
);
// Setup adapter with 5 banner images
List
<
Integer
>
bannerImages
=
getBannerImages
();
mBannerAdapter
=
new
BannerAdapter
(
this
,
bannerImages
);
mBannerAdapter
.
setOnBannerClickListener
(
position
->
{
// Handle banner click (same as the original banner click)
WarplyManagerHelper
.
openContest
(
this
);
});
mBannerViewPager
.
setAdapter
(
mBannerAdapter
);
// Setup pagination dots
setupPaginationDots
(
bannerImages
.
size
());
// Handle page changes
mBannerViewPager
.
registerOnPageChangeCallback
(
new
ViewPager2
.
OnPageChangeCallback
()
{
@Override
public
void
onPageSelected
(
int
position
)
{
updateDots
(
position
);
}
});
}
/**
* Returns a list of banner image resource IDs
*/
private
List
<
Integer
>
getBannerImages
()
{
return
Arrays
.
asList
(
R
.
drawable
.
demo_home_banner1
,
R
.
drawable
.
demo_home_banner2
,
R
.
drawable
.
demo_home_banner3
,
R
.
drawable
.
demo_home_banner4
,
R
.
drawable
.
demo_home_banner5
);
}
/**
* Sets up the pagination dots
* @param count Number of dots to display
*/
private
void
setupPaginationDots
(
int
count
)
{
mDots
=
new
ArrayList
<>();
mDotsContainer
.
removeAllViews
();
// Create dots
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
ImageView
dot
=
new
ImageView
(
this
);
// Set dot appearance
LinearLayout
.
LayoutParams
params
=
new
LinearLayout
.
LayoutParams
(
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
,
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
);
// Add margin between dots
params
.
setMargins
(
8
,
0
,
8
,
0
);
dot
.
setLayoutParams
(
params
);
// Set initial state (first dot active, others inactive)
dot
.
setImageResource
(
i
==
0
?
R
.
drawable
.
dot_active
:
R
.
drawable
.
dot_inactive
);
// Add to container and list
mDotsContainer
.
addView
(
dot
);
mDots
.
add
(
dot
);
}
}
/**
* Updates the dots to reflect the current page
* @param position Current page position
*/
private
void
updateDots
(
int
position
)
{
for
(
int
i
=
0
;
i
<
mDots
.
size
();
i
++)
{
mDots
.
get
(
i
).
setImageResource
(
i
==
position
?
R
.
drawable
.
dot_active
:
R
.
drawable
.
dot_inactive
);
}
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/SingleCouponActivity.java
View file @
bffc662
...
...
@@ -179,7 +179,7 @@ public class SingleCouponActivity extends Activity implements View.OnClickListen
// Populate views with offer data
if
(
mOfferItem
!=
null
)
{
mTvValue
.
setText
(
mOfferItem
.
getValue
());
mTvSmallDescription
.
setText
(
mOfferItem
.
getDescription
());
//
mTvSmallDescription.setText(mOfferItem.getDescription());
// Store the full description text
mFullDescriptionText
=
mOfferItem
.
getFullDescription
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/adapters/BannerAdapter.java
0 → 100644
View file @
bffc662
package
ly
.
warp
.
sdk
.
io
.
adapters
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
java.util.List
;
import
ly.warp.sdk.R
;
public
class
BannerAdapter
extends
RecyclerView
.
Adapter
<
BannerAdapter
.
BannerViewHolder
>
{
private
final
Context
mContext
;
private
final
List
<
Integer
>
mBannerImages
;
private
OnBannerClickListener
mListener
;
public
interface
OnBannerClickListener
{
void
onBannerClick
(
int
position
);
}
public
BannerAdapter
(
Context
context
,
List
<
Integer
>
bannerImages
)
{
this
.
mContext
=
context
;
this
.
mBannerImages
=
bannerImages
;
}
public
void
setOnBannerClickListener
(
OnBannerClickListener
listener
)
{
this
.
mListener
=
listener
;
}
@NonNull
@Override
public
BannerViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
mContext
).
inflate
(
R
.
layout
.
item_banner
,
parent
,
false
);
return
new
BannerViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
BannerViewHolder
holder
,
int
position
)
{
holder
.
imageView
.
setImageResource
(
mBannerImages
.
get
(
position
));
holder
.
itemView
.
setOnClickListener
(
v
->
{
if
(
mListener
!=
null
)
{
mListener
.
onBannerClick
(
position
);
}
});
}
@Override
public
int
getItemCount
()
{
return
mBannerImages
.
size
();
}
static
class
BannerViewHolder
extends
RecyclerView
.
ViewHolder
{
ImageView
imageView
;
BannerViewHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
imageView
=
itemView
.
findViewById
(
R
.
id
.
iv_banner
);
}
}
}
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner.png
deleted
100644 → 0
View file @
2b1d6ea
253 KB
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner1.png
0 → 100644
View file @
bffc662
250 KB
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner2.png
0 → 100644
View file @
bffc662
229 KB
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner3.png
0 → 100644
View file @
bffc662
205 KB
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner4.png
0 → 100644
View file @
bffc662
208 KB
warply_android_sdk/src/main/res/drawable-xhdpi/demo_home_banner5.png
0 → 100644
View file @
bffc662
214 KB
warply_android_sdk/src/main/res/drawable/dot_active.xml
0 → 100644
View file @
bffc662
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"oval"
>
<solid
android:color=
"@color/pink3"
/>
<size
android:width=
"8dp"
android:height=
"8dp"
/>
</shape>
warply_android_sdk/src/main/res/drawable/dot_inactive.xml
0 → 100644
View file @
bffc662
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"oval"
>
<solid
android:color=
"@color/grey2"
/>
<size
android:width=
"8dp"
android:height=
"8dp"
/>
</shape>
warply_android_sdk/src/main/res/layout/activity_home.xml
View file @
bffc662
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
@@ -53,12 +54,31 @@
android:src=
"@drawable/demo_profile"
/>
</LinearLayout>
<ImageView
android:id=
"@+id/banner_icon"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<androidx.viewpager2.widget.ViewPager2
android:id=
"@+id/banner_viewpager"
android:layout_width=
"match_parent"
android:layout_height=
"320dp"
android:scaleType=
"fitXY"
android:src=
"@drawable/demo_home_banner"
/>
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<LinearLayout
android:id=
"@+id/dots_container"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:background=
"@color/cos_grey_light"
android:gravity=
"center"
android:orientation=
"horizontal"
android:padding=
"4dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- Top Offers Section -->
<RelativeLayout
...
...
@@ -71,8 +91,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category1"
...
...
@@ -101,9 +121,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler1"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Favorites Section -->
...
...
@@ -117,8 +137,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category2"
...
...
@@ -147,9 +167,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler2"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Viability Section -->
...
...
@@ -163,8 +183,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category3"
...
...
@@ -193,9 +213,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler3"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Family Section -->
...
...
@@ -209,8 +229,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category4"
...
...
@@ -239,9 +259,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler4"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Food and Coffee Section -->
...
...
@@ -255,8 +275,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category5"
...
...
@@ -285,9 +305,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler5"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Travelling Section -->
...
...
@@ -301,8 +321,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category6"
...
...
@@ -331,9 +351,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler6"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Kids Section -->
...
...
@@ -347,8 +367,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category7"
...
...
@@ -377,9 +397,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler7"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
<!-- Purchases Section -->
...
...
@@ -394,8 +414,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:
paddingHorizontal=
"16dp
"
android:
orientation=
"horizontal
"
>
android:
orientation=
"horizontal
"
android:
paddingHorizontal=
"16dp
"
>
<TextView
android:id=
"@+id/tv_recycler_category8"
...
...
@@ -424,9 +444,9 @@
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/ll_recycler8"
android:layout_marginTop=
"16dp"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingHorizontal=
"16dp"
android:clipToPadding=
"false"
/>
android:paddingHorizontal=
"16dp"
/>
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
...
...
warply_android_sdk/src/main/res/layout/activity_single_coupon.xml
View file @
bffc662
...
...
@@ -60,7 +60,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"fitXY"
android:src=
"@drawable/demo_home_banner
"
tools:src=
"@drawable/demo_home_banner1
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
warply_android_sdk/src/main/res/layout/item_banner.xml
0 → 100644
View file @
bffc662
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/iv_banner"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"fitXY"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
warply_android_sdk/src/main/res/values/colors.xml
View file @
bffc662
...
...
@@ -23,6 +23,8 @@
<color
name=
"black5"
>
#020E1C
</color>
<color
name=
"pink2"
>
#F2709D
</color>
<color
name=
"skyblue"
>
#00A3E0
</color>
<color
name=
"grey2"
>
#D8D8D8
</color>
<color
name=
"pink3"
>
#EE437E
</color>
<!-- Used in styles -->
<color
name=
"cos_light_blue"
>
#00A5E3
</color>
...
...
Please
register
or
login
to post a comment