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
2022-03-28 14:29:04 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3963d97336ac5f795d065dbcb95966e00f756957
3963d973
1 parent
cfec34d9
minor changes
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
43 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/BaseFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/LoyaltyFragment.java
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/BaseFragment.java
0 → 100644
View file @
3963d97
package
ly
.
warp
.
sdk
.
fragments
;
import
android.os.Bundle
;
import
androidx.fragment.app.Fragment
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
public
class
BaseFragment
extends
Fragment
{
private
static
Consumer
mConsumer
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getConsumer
(
new
WarplyConsumerRequest
(),
mConsumerReceiver
);
}
}).
start
();
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
}
public
static
Consumer
getConsumer
()
{
return
mConsumer
;
}
private
final
CallbackReceiver
<
Consumer
>
mConsumerReceiver
=
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
mConsumer
=
result
;
Thread
.
currentThread
().
interrupt
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
}
\ No newline at end of file
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
View file @
3963d97
...
...
@@ -2,8 +2,6 @@ package ly.warp.sdk.fragments;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -22,20 +20,15 @@ import org.json.JSONException;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.BillPaymentActivity
;
import
ly.warp.sdk.activities.CouponInfoActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.io.request.WarplyLoginRequest
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.views.adapters.HomeCampaignAdapter
;
import
ly.warp.sdk.views.adapters.HomeCouponAdapter
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.views.adapters.HomeCampaignAdapter
;
import
ly.warp.sdk.views.adapters.HomeCouponAdapter
;
public
class
HomeFragment
extends
Fragment
implements
View
.
OnClickListener
{
public
class
HomeFragment
extends
Base
Fragment
implements
View
.
OnClickListener
{
private
RelativeLayout
mOptionOne
,
mOptionTwo
,
mOptionThree
;
private
RecyclerView
mRecyclerCampaigns
,
mRecyclerCoupons
;
...
...
@@ -43,18 +36,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
private
HomeCampaignAdapter
mAdapterCampaigns
;
private
LinearLayout
mLlBillPayment
;
private
TextView
mTvUsername
;
public
static
Consumer
mConsumer
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getConsumer
(
new
WarplyConsumerRequest
(),
mConsumerReceiver
);
}
}).
start
();
}
@Override
public
View
onCreateView
(
...
...
@@ -89,6 +70,9 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
mLlBillPayment
.
setOnClickListener
(
this
);
mTvUsername
=
view
.
findViewById
(
R
.
id
.
welcome_user_txt
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
welcome_user
),
BaseFragment
.
getConsumer
().
getFirstName
()
+
" "
+
BaseFragment
.
getConsumer
().
getLastName
()));
/********* TEST CAMPAIGNS DATA **********/
CampaignList
clistCampaigns
=
new
CampaignList
();
...
...
@@ -156,20 +140,4 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
HomeFragment
homeFragment
=
new
HomeFragment
();
return
homeFragment
;
}
private
final
CallbackReceiver
<
Consumer
>
mConsumerReceiver
=
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
mConsumer
=
result
;
new
Handler
(
Looper
.
getMainLooper
()).
post
(()
->
{
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
welcome_user
),
mConsumer
.
getFirstName
()
+
" "
+
mConsumer
.
getLastName
()));
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/LoyaltyFragment.java
View file @
3963d97
...
...
@@ -6,6 +6,7 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.annotation.Nullable
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
...
...
@@ -22,7 +23,7 @@ import ly.warp.sdk.io.models.Campaign;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.views.adapters.ProfileCampaignAdapter
;
public
class
LoyaltyFragment
extends
Fragment
implements
View
.
OnClickListener
{
public
class
LoyaltyFragment
extends
Base
Fragment
implements
View
.
OnClickListener
{
// ===========================================================
// Constants
...
...
@@ -36,6 +37,7 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
private
ProfileCampaignAdapter
mAdapterDeals
,
mAdapterGifts
,
mAdapterMore
;
private
LinearLayout
mLlMoreDeals
,
mLlMoreGifts
,
mLlMore
;
private
ConstraintLayout
mClRewardsWallet
;
private
TextView
mTvUsername
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -63,6 +65,11 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mClRewardsWallet
=
view
.
findViewById
(
R
.
id
.
cl_rewards_wallet
);
mClRewardsWallet
.
setOnClickListener
(
this
);
mTvUsername
=
view
.
findViewById
(
R
.
id
.
tv_name
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
cos_profile_name
),
BaseFragment
.
getConsumer
().
getFirstName
()
+
" "
+
BaseFragment
.
getConsumer
().
getLastName
()));
mLlMoreDeals
=
view
.
findViewById
(
R
.
id
.
ll_more
);
mLlMoreDeals
.
setOnClickListener
(
this
);
mLlMoreGifts
=
view
.
findViewById
(
R
.
id
.
ll_more2
);
...
...
warply_android_sdk/src/main/res/layout/fragment_loyalty.xml
View file @
3963d97
...
...
@@ -4,6 +4,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@android:color/white"
>
<LinearLayout
...
...
@@ -32,7 +33,7 @@
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"6dp"
android:text=
"@string/cos_profile_n
ame"
tools:text=
"Test N
ame"
android:maxLines=
"1"
android:textColor=
"@color/grey"
app:layout_constraintLeft_toRightOf=
"@+id/iv_profile_photo"
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
3963d97
...
...
@@ -7,7 +7,7 @@
<string
name=
"cos_profile_tab"
>
Profile
</string>
<string
name=
"welcome_user"
>
Γεία σου %1$s !
</string>
<string
name=
"cos_profile_name"
>
Γιώργος
</string>
<string
name=
"cos_profile_name"
>
%1$s
</string>
<string
name=
"cos_profile_type"
>
Traveller
</string>
<string
name=
"header_add"
>
Προσθήκη
</string>
<string
name=
"cos_profile_reward"
>
My reward wallet
</string>
...
...
Please
register
or
login
to post a comment