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
2026-03-18 13:43:23 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5f9e647cbf4b8a4f4ed06c29a00176997575e5ba
5f9e647c
1 parent
47fecc12
added filter dialog part1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
216 additions
and
1 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/HomeActivity.java
warply_android_sdk/src/main/res/drawable-xhdpi/ic_arrow_down_white.png
warply_android_sdk/src/main/res/layout/dl_filter.xml
warply_android_sdk/src/main/res/layout/item_filter_category.xml
warply_android_sdk/src/main/res/layout/item_filter_subcategory.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/res/values/dimens.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/src/main/res/values/styles.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/HomeActivity.java
View file @
5f9e647
...
...
@@ -10,6 +10,7 @@ import android.text.TextUtils;
import
android.util.TypedValue
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
...
...
@@ -24,6 +25,8 @@ import androidx.viewpager2.widget.ViewPager2;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.android.material.bottomsheet.BottomSheetDialog
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
...
...
@@ -58,7 +61,7 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup
private
RelativeLayout
mPbLoading
;
private
TextView
mTvHeaderTitle
,
mTvMyCouponsTitle
,
mTvMyCouponsValue
,
mTvSearchTitle
;
private
LinearLayout
mLlUserTags
,
mLlMyCoupons
;
private
LinearLayout
mLlUserTags
,
mLlMyCoupons
,
mLlSearchFilterButton
;
/* View Pager */
// private ViewPager2 mBannerViewPager;
private
RecyclerView
mRvBannerViewPager
;
...
...
@@ -114,6 +117,10 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup
startActivity
(
myIntent
);
return
;
}
if
(
v
.
getId
()
==
R
.
id
.
ll_search_filter_button
)
{
showFilterDialog
();
return
;
}
if
(
v
.
getId
()
==
R
.
id
.
ll_all
)
{
String
categoryName
=
(
String
)
v
.
getTag
();
Intent
myIntent
=
new
Intent
(
HomeActivity
.
this
,
CouponsetsActivity
.
class
);
...
...
@@ -138,6 +145,8 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup
mPbLoading
.
setOnTouchListener
((
v
,
event
)
->
true
);
mLlMyCoupons
=
findViewById
(
R
.
id
.
ll_my_coupons
);
mLlMyCoupons
.
setOnClickListener
(
this
);
mLlSearchFilterButton
=
findViewById
(
R
.
id
.
ll_search_filter_button
);
mLlSearchFilterButton
.
setOnClickListener
(
this
);
mViewPager
=
findViewById
(
R
.
id
.
cl_viewpager
);
mSectionsContainer
=
findViewById
(
R
.
id
.
ll_sections_container
);
mSectionsLoading
=
findViewById
(
R
.
id
.
rl_sections_loading
);
...
...
@@ -355,6 +364,122 @@ public class HomeActivity extends Activity implements View.OnClickListener, Coup
mSectionsLoading
.
setVisibility
(
View
.
GONE
);
}
private
void
showFilterDialog
()
{
Filter
filter
=
WarplyManagerHelper
.
getFilter
();
if
(
filter
==
null
||
filter
.
getOfferCategories
()
==
null
||
filter
.
getOfferCategories
().
isEmpty
())
{
return
;
}
BottomSheetDialog
bottomSheetDialog
=
new
BottomSheetDialog
(
this
,
R
.
style
.
FullScreenBottomSheetDialog
);
View
dialogView
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
dl_filter
,
null
);
bottomSheetDialog
.
setContentView
(
dialogView
);
LinearLayout
llFilterContainer
=
dialogView
.
findViewById
(
R
.
id
.
ll_filter_container
);
// Static "Top Offers" row
View
topOffersRow
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
item_filter_category
,
llFilterContainer
,
false
);
TextView
tvTopOffers
=
topOffersRow
.
findViewById
(
R
.
id
.
tv_category_name
);
tvTopOffers
.
setText
(
getString
(
R
.
string
.
lbl_top_offers
));
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
ping_lcg_regular
,
tvTopOffers
);
topOffersRow
.
setTag
(
R
.
string
.
lbl_top_offers
);
topOffersRow
.
setOnClickListener
(
v
->
{
// TODO: filter action
bottomSheetDialog
.
dismiss
();
});
llFilterContainer
.
addView
(
topOffersRow
);
// Divider after Top Offers
View
divider
=
new
View
(
this
);
LinearLayout
.
LayoutParams
dividerParams
=
new
LinearLayout
.
LayoutParams
(
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
1
);
int
dividerMarginPx
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
24
,
getResources
().
getDisplayMetrics
());
dividerParams
.
setMarginStart
(
dividerMarginPx
);
dividerParams
.
setMarginEnd
(
dividerMarginPx
);
divider
.
setLayoutParams
(
dividerParams
);
divider
.
setBackgroundColor
(
getColor
(
R
.
color
.
custom_grey12
));
llFilterContainer
.
addView
(
divider
);
// Dynamic categories from Filter
for
(
Filter
.
OfferCategory
parent
:
filter
.
getOfferCategories
())
{
if
(
parent
.
getAdminName
()
==
null
)
continue
;
View
categoryRow
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
item_filter_category
,
llFilterContainer
,
false
);
TextView
tvCategoryName
=
categoryRow
.
findViewById
(
R
.
id
.
tv_category_name
);
ImageView
ivArrow
=
categoryRow
.
findViewById
(
R
.
id
.
iv_arrow
);
tvCategoryName
.
setText
(
parent
.
getAdminName
());
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
ping_lcg_regular
,
tvCategoryName
);
boolean
hasChildren
=
parent
.
getChildren
()
!=
null
&&
!
parent
.
getChildren
().
isEmpty
();
if
(!
hasChildren
)
{
ivArrow
.
setVisibility
(
View
.
GONE
);
categoryRow
.
setTag
(
parent
.
getAdminName
());
categoryRow
.
setOnClickListener
(
v
->
{
// TODO: filter action
bottomSheetDialog
.
dismiss
();
});
llFilterContainer
.
addView
(
categoryRow
);
}
else
{
ivArrow
.
setVisibility
(
View
.
VISIBLE
);
// Child container (collapsed by default)
LinearLayout
childContainer
=
new
LinearLayout
(
this
);
childContainer
.
setOrientation
(
LinearLayout
.
VERTICAL
);
childContainer
.
setVisibility
(
View
.
GONE
);
childContainer
.
setLayoutParams
(
new
LinearLayout
.
LayoutParams
(
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
LinearLayout
.
LayoutParams
.
WRAP_CONTENT
));
for
(
Filter
.
OfferCategory
child
:
parent
.
getChildren
())
{
if
(
child
.
getAdminName
()
==
null
)
continue
;
View
childRow
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
item_filter_subcategory
,
childContainer
,
false
);
TextView
tvSubcategoryName
=
childRow
.
findViewById
(
R
.
id
.
tv_subcategory_name
);
tvSubcategoryName
.
setText
(
child
.
getAdminName
());
WarpUtils
.
renderCustomFont
(
this
,
R
.
font
.
ping_lcg_regular
,
tvSubcategoryName
);
childRow
.
setTag
(
child
.
getAdminName
());
childRow
.
setOnClickListener
(
v
->
{
// TODO: filter action
bottomSheetDialog
.
dismiss
();
});
childContainer
.
addView
(
childRow
);
}
categoryRow
.
setOnClickListener
(
v
->
{
boolean
isExpanded
=
childContainer
.
getVisibility
()
==
View
.
VISIBLE
;
if
(
isExpanded
)
{
childContainer
.
setVisibility
(
View
.
GONE
);
ivArrow
.
animate
().
rotation
(
0
f
).
setDuration
(
200
).
start
();
}
else
{
childContainer
.
setVisibility
(
View
.
VISIBLE
);
ivArrow
.
animate
().
rotation
(
180
f
).
setDuration
(
200
).
start
();
}
});
llFilterContainer
.
addView
(
categoryRow
);
llFilterContainer
.
addView
(
childContainer
);
}
}
bottomSheetDialog
.
setOnShowListener
(
dialog
->
{
View
bottomSheet
=
bottomSheetDialog
.
findViewById
(
com
.
google
.
android
.
material
.
R
.
id
.
design_bottom_sheet
);
if
(
bottomSheet
!=
null
)
{
bottomSheet
.
post
(()
->
{
int
screenHeight
=
getResources
().
getDisplayMetrics
().
heightPixels
;
ViewGroup
.
LayoutParams
lp
=
bottomSheet
.
getLayoutParams
();
lp
.
height
=
screenHeight
;
bottomSheet
.
setLayoutParams
(
lp
);
BottomSheetBehavior
<
View
>
behavior
=
BottomSheetBehavior
.
from
(
bottomSheet
);
behavior
.
setSkipCollapsed
(
true
);
behavior
.
setPeekHeight
(
screenHeight
);
behavior
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
});
}
});
bottomSheetDialog
.
show
();
}
private
Couponset
findCouponsetByUuid
(
String
uuid
)
{
LinkedHashMap
<
String
,
ArrayList
<
Couponset
>>
categorizedMap
=
WarplyManagerHelper
.
getCouponsetCategorizedMap
();
if
(
categorizedMap
!=
null
)
{
...
...
warply_android_sdk/src/main/res/drawable-xhdpi/ic_arrow_down_white.png
0 → 100644
View file @
5f9e647
941 Bytes
warply_android_sdk/src/main/res/layout/dl_filter.xml
0 → 100644
View file @
5f9e647
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/custom_black7"
android:orientation=
"vertical"
>
<androidx.core.widget.NestedScrollView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:id=
"@+id/ll_filter_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
/>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
warply_android_sdk/src/main/res/layout/item_filter_category.xml
0 → 100644
View file @
5f9e647
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"56dp"
android:background=
"@color/custom_black7"
android:paddingHorizontal=
"24dp"
>
<TextView
android:id=
"@+id/tv_category_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_alignParentStart=
"true"
android:includeFontPadding=
"false"
android:textColor=
"@color/white"
android:textSize=
"16sp"
/>
<ImageView
android:id=
"@+id/iv_arrow"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:src=
"@drawable/ic_arrow_down_white"
android:visibility=
"gone"
/>
</RelativeLayout>
warply_android_sdk/src/main/res/layout/item_filter_subcategory.xml
0 → 100644
View file @
5f9e647
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"56dp"
android:background=
"@color/custom_black7"
android:paddingHorizontal=
"24dp"
>
<TextView
android:id=
"@+id/tv_subcategory_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_alignParentStart=
"true"
android:layout_marginStart=
"32dp"
android:includeFontPadding=
"false"
android:textColor=
"@color/custom_skyblue4"
android:textSize=
"16sp"
/>
</RelativeLayout>
warply_android_sdk/src/main/res/values/colors.xml
View file @
5f9e647
...
...
@@ -44,4 +44,5 @@
<color
name=
"custom_grey10"
>
#ECEDEF
</color>
<color
name=
"custom_grey11"
>
#E7E7E7
</color>
<color
name=
"custom_blue"
>
#004E6E
</color>
<color
name=
"custom_grey12"
>
#EBEDEF
</color>
</resources>
...
...
warply_android_sdk/src/main/res/values/dimens.xml
0 → 100644
View file @
5f9e647
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen
name=
"bottom_sheet_full_height"
>
2000dp
</dimen>
</resources>
warply_android_sdk/src/main/res/values/strings.xml
View file @
5f9e647
...
...
@@ -42,4 +42,5 @@
<string
name=
"demo_partners_title"
>
Partner businesses
</string>
<string
name=
"demo_search_title"
>
Αναζήτηση
</string>
<string
name=
"lbl_directions"
>
Οδηγίες
</string>
<string
name=
"lbl_top_offers"
>
Top Offers
</string>
</resources>
...
...
warply_android_sdk/src/main/res/values/styles.xml
View file @
5f9e647
...
...
@@ -47,4 +47,22 @@
<item
name=
"cornerSizeBottomLeft"
>
0dp
</item>
<item
name=
"cornerSizeBottomRight"
>
0dp
</item>
</style>
<style
name=
"FullScreenBottomSheetDialog"
parent=
"Theme.MaterialComponents.Light.BottomSheetDialog"
>
<item
name=
"android:windowIsFloating"
>
false
</item>
<item
name=
"android:windowFullscreen"
>
true
</item>
<item
name=
"android:windowContentOverlay"
>
@null
</item>
<item
name=
"bottomSheetStyle"
>
@style/FullScreenBottomSheetStyle
</item>
</style>
<style
name=
"FullScreenBottomSheetStyle"
parent=
"Widget.MaterialComponents.BottomSheet.Modal"
>
<item
name=
"android:layout_height"
>
match_parent
</item>
<item
name=
"shapeAppearanceOverlay"
>
@style/NoCornerShapeAppearance
</item>
<item
name=
"behavior_peekHeight"
>
@dimen/bottom_sheet_full_height
</item>
<item
name=
"behavior_skipCollapsed"
>
true
</item>
</style>
<style
name=
"NoCornerShapeAppearance"
parent=
""
>
<item
name=
"cornerSize"
>
0dp
</item>
</style>
</resources>
...
...
Please
register
or
login
to post a comment