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-29 11:58:18 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3978fb53ab07e30c72a8181bff544e04d163fc8a
3978fb53
1 parent
1c4e20b8
fixs
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
135 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/warp/ly/android_sdk/activities/MainActivity.java
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/BaseFragment.java → warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BillPaymentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyActivity.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
app/src/main/res/layout/activity_main.xml → warply_android_sdk/src/main/res/layout/activity_base_fragment.xml
app/src/main/AndroidManifest.xml
View file @
3978fb5
...
...
@@ -19,10 +19,10 @@
android:fullBackupContent=
"false"
android:hardwareAccelerated=
"true"
android:icon=
"@mipmap/ic_launcher"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:installLocation=
"internalOnly"
android:label=
"@string/app_name"
android:largeHeap=
"true"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:theme=
"@style/AppTheme"
>
<activity
...
...
@@ -38,12 +38,10 @@
</activity>
<activity
android:name=
"
warp.ly.android_sdk.activities.Main
Activity"
android:name=
"
ly.warp.sdk.activities.BaseFragment
Activity"
android:exported=
"false"
android:label=
"@string/title_activity_main"
android:screenOrientation=
"portrait"
/>
</application>
<!-- For Huawei Push, only if we targetSdkVersion 30, comment if we are in Google build -->
...
...
app/src/main/java/warp/ly/android_sdk/activities/MainActivity.java
deleted
100644 → 0
View file @
1c4e20b
package
warp
.
ly
.
android_sdk
.
activities
;
import
android.os.Bundle
;
import
android.view.MenuItem
;
import
androidx.annotation.NonNull
;
import
androidx.fragment.app.Fragment
;
import
com.google.android.material.bottomnavigation.BottomNavigationView
;
import
com.google.android.material.navigation.NavigationBarView
;
import
ly.warp.sdk.fragments.HomeFragment
;
import
ly.warp.sdk.fragments.LoyaltyFragment
;
import
warp.ly.android_sdk.R
;
public
class
MainActivity
extends
BaseActivity
implements
NavigationBarView
.
OnItemSelectedListener
{
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private
BottomNavigationView
mBottomNavigationView
;
Fragment
mFragmentToSet
=
null
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
mBottomNavigationView
=
findViewById
(
R
.
id
.
bt_tabs
);
initViews
();
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
@Override
public
boolean
onNavigationItemSelected
(
@NonNull
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
menu_loyalty
:
mFragmentToSet
=
LoyaltyFragment
.
newInstance
();
getSupportFragmentManager
().
beginTransaction
()
.
replace
(
R
.
id
.
fl_fragment
,
mFragmentToSet
)
.
addToBackStack
(
null
)
.
commit
();
return
true
;
case
R
.
id
.
menu_home
:
mFragmentToSet
=
HomeFragment
.
newInstance
();
getSupportFragmentManager
().
beginTransaction
()
.
replace
(
R
.
id
.
fl_fragment
,
mFragmentToSet
)
.
addToBackStack
(
null
)
.
commit
();
return
true
;
}
return
false
;
}
// ===========================================================
// Methods
// ===========================================================
private
void
initViews
()
{
mBottomNavigationView
.
setOnItemSelectedListener
(
this
);
mFragmentToSet
=
HomeFragment
.
newInstance
();
getSupportFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
fl_fragment
,
mFragmentToSet
).
commit
();
mBottomNavigationView
.
setSelectedItemId
(
R
.
id
.
menu_home
);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
3978fb5
...
...
@@ -9,6 +9,7 @@ import java.util.Timer;
import
java.util.TimerTask
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.BaseFragmentActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.callbacks.SimpleCallbackReceiver
;
import
ly.warp.sdk.io.callbacks.WarplyReadyCallback
;
...
...
@@ -76,7 +77,7 @@ public class SplashActivity extends BaseActivity {
runOnUiThread
(
new
Runnable
()
{
public
void
run
()
{
if
(!
isFinishing
())
{
startActivity
(
new
Intent
(
SplashActivity
.
this
,
Main
Activity
.
class
));
startActivity
(
new
Intent
(
SplashActivity
.
this
,
BaseFragment
Activity
.
class
));
finish
();
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/
fragments/BaseFragment
.java
→
warply_android_sdk/src/main/java/ly/warp/sdk/
activities/BaseFragmentActivity
.java
View file @
3978fb5
package
ly
.
warp
.
sdk
.
fragment
s
;
package
ly
.
warp
.
sdk
.
activitie
s
;
import
android.os.Bundle
;
import
android.view.MenuItem
;
import
androidx.annotation.NonNull
;
import
androidx.fragment.app.Fragment
;
import
androidx.fragment.app.FragmentActivity
;
import
com.google.android.material.bottomnavigation.BottomNavigationView
;
import
com.google.android.material.navigation.NavigationBarView
;
import
java.util.HashMap
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.fragments.HomeFragment
;
import
ly.warp.sdk.fragments.LoyaltyFragment
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
...
...
@@ -16,15 +25,35 @@ import ly.warp.sdk.io.request.WarplyConsumerRequest;
import
ly.warp.sdk.io.request.WarplyInboxRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.utils.managers.WarplySessionManager
;
public
class
BaseFragmentActivity
extends
FragmentActivity
implements
NavigationBarView
.
OnItemSelectedListener
{
// ===========================================================
// Constants
// ===========================================================
public
class
BaseFragment
extends
Fragment
{
// ===========================================================
// Fields
// ===========================================================
private
BottomNavigationView
mBottomNavigationView
;
private
Fragment
mFragmentToSet
=
null
;
private
static
Consumer
mConsumer
;
private
static
HashMap
mUniqueCampaignList
=
new
HashMap
<
String
,
CampaignList
>();
private
static
CouponList
mCouponList
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
WarplySessionManager
.
onCreateActivity
(
this
);
setContentView
(
R
.
layout
.
activity_base_fragment
);
mBottomNavigationView
=
findViewById
(
R
.
id
.
bt_tabs
);
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
...
...
@@ -43,14 +72,52 @@ public class BaseFragment extends Fragment {
WarplyManager
.
getUserCoupons
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
}).
start
();
initViews
();
}
@Override
protected
void
onStart
()
{
super
.
onStart
();
WarplySessionManager
.
onStartActivity
(
this
);
}
@Override
public
void
onDestroyView
()
{
super
.
onDestroyView
();
protected
void
onStop
()
{
super
.
onStop
();
WarplySessionManager
.
onStopActivity
(
this
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
@Override
public
boolean
onNavigationItemSelected
(
@NonNull
MenuItem
item
)
{
int
itemId
=
item
.
getItemId
();
if
(
itemId
==
R
.
id
.
menu_loyalty
)
{
mFragmentToSet
=
LoyaltyFragment
.
newInstance
();
getSupportFragmentManager
().
beginTransaction
()
.
replace
(
R
.
id
.
fl_fragment
,
mFragmentToSet
)
.
addToBackStack
(
null
)
.
commit
();
return
true
;
}
else
if
(
itemId
==
R
.
id
.
menu_home
)
{
mFragmentToSet
=
HomeFragment
.
newInstance
();
getSupportFragmentManager
().
beginTransaction
()
.
replace
(
R
.
id
.
fl_fragment
,
mFragmentToSet
)
.
addToBackStack
(
null
)
.
commit
();
return
true
;
}
return
false
;
}
// ===========================================================
// Methods
// ===========================================================
public
static
Consumer
getConsumer
()
{
return
mConsumer
;
}
...
...
@@ -63,6 +130,17 @@ public class BaseFragment extends Fragment {
return
mCouponList
;
}
private
void
initViews
()
{
mBottomNavigationView
.
setOnItemSelectedListener
(
this
);
mFragmentToSet
=
HomeFragment
.
newInstance
();
getSupportFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
fl_fragment
,
mFragmentToSet
).
commit
();
mBottomNavigationView
.
setSelectedItemId
(
R
.
id
.
menu_home
);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
private
final
CallbackReceiver
<
Consumer
>
mConsumerReceiver
=
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BillPaymentActivity.java
View file @
3978fb5
...
...
@@ -16,7 +16,6 @@ import android.widget.TextView;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.fragments.BaseFragment
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyProperty
;
...
...
@@ -96,22 +95,22 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
mTvLuckyDraw
.
setText
(
builder
,
TextView
.
BufferType
.
SPANNABLE
);
mClLuckyDraw
.
setOnClickListener
(
view
->
{
if
(
BaseFragment
.
getUniqueCampaignList
()
!=
null
&&
!
BaseFragment
.
getUniqueCampaignList
().
isEmpty
())
{
if
(
BaseFragment
.
getUniqueCampaignList
().
containsKey
(
"lucky_draw"
)
&&
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
size
()
>
0
)
{
String
tempUrl
=
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
if
(
BaseFragment
Activity
.
getUniqueCampaignList
()
!=
null
&&
!
BaseFragmentActivity
.
getUniqueCampaignList
().
isEmpty
())
{
if
(
BaseFragment
Activity
.
getUniqueCampaignList
().
containsKey
(
"lucky_draw"
)
&&
BaseFragmentActivity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
size
()
>
0
)
{
String
tempUrl
=
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
tempUrl
=
tempUrl
+
"?web_id="
+
WarpUtils
.
getWebId
(
this
)
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
this
)
+
"&api_key="
+
WarpUtils
.
getApiKey
(
this
)
+
"&session_uuid="
+
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&session_uuid="
+
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&access_token="
+
WarplyDBHelper
.
getInstance
(
this
).
getAuthValue
(
"access_token"
)
+
"&refresh_token="
+
WarplyDBHelper
.
getInstance
(
this
).
getAuthValue
(
"refresh_token"
)
+
"&client_id="
+
WarplyDBHelper
.
getInstance
(
this
).
getClientValue
(
"client_id"
)
+
"&client_secret="
+
WarplyDBHelper
.
getInstance
(
this
).
getClientValue
(
"client_secret"
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
.
getConsumer
().
getUuid
());
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
Activity
.
getConsumer
().
getUuid
());
else
tempUrl
=
tempUrl
+
"&auth_token="
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyActivity.java
View file @
3978fb5
...
...
@@ -16,7 +16,6 @@ import androidx.recyclerview.widget.RecyclerView;
import
java.io.Serializable
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.fragments.BaseFragment
;
import
ly.warp.sdk.views.adapters.HomeCouponAdapter
;
...
...
@@ -90,15 +89,15 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
// ===========================================================
private
void
initViews
()
{
if
(
BaseFragment
.
getConsumer
()
!=
null
)
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
cos_profile_loyalty_name
),
BaseFragment
.
getConsumer
().
getFirstName
(),
BaseFragment
.
getConsumer
().
getLastName
()));
BaseFragment
Activity
.
getConsumer
().
getFirstName
(),
BaseFragmentActivity
.
getConsumer
().
getLastName
()));
mIvBack
.
setOnClickListener
(
this
);
mTvAnalysisButton
.
setOnClickListener
(
this
);
mRecyclerCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCoupons
=
new
HomeCouponAdapter
(
this
,
BaseFragment
.
getCouponList
());
mAdapterCoupons
=
new
HomeCouponAdapter
(
this
,
BaseFragment
Activity
.
getCouponList
());
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
...
...
@@ -111,7 +110,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
.
subscribe
();
mRecyclerBurntCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterBurntCoupons
=
new
HomeCouponAdapter
(
this
,
BaseFragment
.
getCouponList
(),
true
);
mAdapterBurntCoupons
=
new
HomeCouponAdapter
(
this
,
BaseFragment
Activity
.
getCouponList
(),
true
);
mRecyclerBurntCoupons
.
setAdapter
(
mAdapterBurntCoupons
);
ArrayAdapter
<
CharSequence
>
adapter
=
ArrayAdapter
.
createFromResource
(
this
,
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
View file @
3978fb5
...
...
@@ -20,6 +20,7 @@ import org.json.JSONException;
import
java.io.Serializable
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.BaseFragmentActivity
;
import
ly.warp.sdk.activities.BillPaymentActivity
;
import
ly.warp.sdk.activities.CouponInfoActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
...
...
@@ -31,7 +32,7 @@ import ly.warp.sdk.utils.WarplyProperty;
import
ly.warp.sdk.views.adapters.HomeCampaignAdapter
;
import
ly.warp.sdk.views.adapters.HomeCouponAdapter
;
public
class
HomeFragment
extends
Base
Fragment
implements
View
.
OnClickListener
{
public
class
HomeFragment
extends
Fragment
implements
View
.
OnClickListener
{
private
RelativeLayout
mOptionOne
,
mOptionTwo
,
mOptionThree
;
private
RecyclerView
mRecyclerCampaigns
,
mRecyclerCoupons
;
...
...
@@ -41,10 +42,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
private
TextView
mTvUsername
;
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_home
,
container
,
false
);
}
...
...
@@ -73,30 +71,30 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
mLlBillPayment
.
setOnClickListener
(
this
);
mTvUsername
=
view
.
findViewById
(
R
.
id
.
welcome_user_txt
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
welcome_user
),
BaseFragment
.
getConsumer
().
getFirstName
()
+
" "
+
BaseFragment
.
getConsumer
().
getLastName
()));
BaseFragment
Activity
.
getConsumer
().
getFirstName
()
+
" "
+
BaseFragmentActivity
.
getConsumer
().
getLastName
()));
mRecyclerCampaigns
=
view
.
findViewById
(
R
.
id
.
rv_home_campaigns
);
mRecyclerCampaigns
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCampaigns
=
new
HomeCampaignAdapter
(
getContext
(),
BaseFragment
.
getUniqueCampaignList
().
get
(
"homescreen"
));
mAdapterCampaigns
=
new
HomeCampaignAdapter
(
getContext
(),
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"homescreen"
));
mRecyclerCampaigns
.
setAdapter
(
mAdapterCampaigns
);
mAdapterCampaigns
.
getPositionClicks
()
.
doOnNext
(
campaign
->
{
String
tempUrl
=
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
String
tempUrl
=
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
tempUrl
=
tempUrl
+
"?web_id="
+
WarpUtils
.
getWebId
(
getContext
())
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
getContext
())
+
"&api_key="
+
WarpUtils
.
getApiKey
(
getContext
())
+
"&session_uuid="
+
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&session_uuid="
+
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&access_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"access_token"
)
+
"&refresh_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"refresh_token"
)
+
"&client_id="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_id"
)
+
"&client_secret="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_secret"
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
.
getConsumer
().
getUuid
());
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
Activity
.
getConsumer
().
getUuid
());
else
tempUrl
=
tempUrl
+
"&auth_token="
;
...
...
@@ -108,7 +106,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
mRecyclerCoupons
=
view
.
findViewById
(
R
.
id
.
rv_home_coupons
);
mRecyclerCoupons
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCoupons
=
new
HomeCouponAdapter
(
getContext
(),
BaseFragment
.
getCouponList
());
mAdapterCoupons
=
new
HomeCouponAdapter
(
getContext
(),
BaseFragment
Activity
.
getCouponList
());
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/LoyaltyFragment.java
View file @
3978fb5
...
...
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import
androidx.recyclerview.widget.RecyclerView
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.BaseFragmentActivity
;
import
ly.warp.sdk.activities.LoyaltyActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.db.WarplyDBHelper
;
...
...
@@ -22,7 +23,7 @@ import ly.warp.sdk.utils.WarpUtils;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.views.adapters.ProfileCampaignAdapter
;
public
class
LoyaltyFragment
extends
Base
Fragment
implements
View
.
OnClickListener
{
public
class
LoyaltyFragment
extends
Fragment
implements
View
.
OnClickListener
{
// ===========================================================
// Constants
...
...
@@ -55,9 +56,9 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
mClRewardsWallet
.
setOnClickListener
(
this
);
mTvUsername
=
view
.
findViewById
(
R
.
id
.
tv_name
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
cos_profile_name
),
BaseFragment
.
getConsumer
().
getFirstName
()
+
" "
+
BaseFragment
.
getConsumer
().
getLastName
()));
BaseFragment
Activity
.
getConsumer
().
getFirstName
()
+
" "
+
BaseFragmentActivity
.
getConsumer
().
getLastName
()));
mLlMoreDeals
=
view
.
findViewById
(
R
.
id
.
ll_more
);
mLlMoreDeals
.
setOnClickListener
(
this
);
...
...
@@ -68,24 +69,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
mRecyclerDeals
=
view
.
findViewById
(
R
.
id
.
rv_deals
);
mRecyclerDeals
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterDeals
=
new
ProfileCampaignAdapter
(
getContext
(),
BaseFragment
.
getUniqueCampaignList
().
get
(
"deals"
));
mAdapterDeals
=
new
ProfileCampaignAdapter
(
getContext
(),
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"deals"
));
mRecyclerDeals
.
setAdapter
(
mAdapterDeals
);
mAdapterDeals
.
getPositionClicks
()
.
doOnNext
(
deal
->
{
String
tempUrl
=
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
String
tempUrl
=
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
tempUrl
=
tempUrl
+
"?web_id="
+
WarpUtils
.
getWebId
(
getContext
())
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
getContext
())
+
"&api_key="
+
WarpUtils
.
getApiKey
(
getContext
())
+
"&session_uuid="
+
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&session_uuid="
+
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&access_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"access_token"
)
+
"&refresh_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"refresh_token"
)
+
"&client_id="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_id"
)
+
"&client_secret="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_secret"
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
.
getConsumer
().
getUuid
());
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
Activity
.
getConsumer
().
getUuid
());
else
tempUrl
=
tempUrl
+
"&auth_token="
;
...
...
@@ -97,24 +98,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
mRecyclerGifts
=
view
.
findViewById
(
R
.
id
.
rv_gifts
);
mRecyclerGifts
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterGifts
=
new
ProfileCampaignAdapter
(
getContext
(),
BaseFragment
.
getUniqueCampaignList
().
get
(
"gifts"
));
mAdapterGifts
=
new
ProfileCampaignAdapter
(
getContext
(),
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"gifts"
));
mRecyclerGifts
.
setAdapter
(
mAdapterGifts
);
mAdapterGifts
.
getPositionClicks
()
.
doOnNext
(
gift
->
{
String
tempUrl
=
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
String
tempUrl
=
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
tempUrl
=
tempUrl
+
"?web_id="
+
WarpUtils
.
getWebId
(
getContext
())
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
getContext
())
+
"&api_key="
+
WarpUtils
.
getApiKey
(
getContext
())
+
"&session_uuid="
+
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&session_uuid="
+
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&access_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"access_token"
)
+
"&refresh_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"refresh_token"
)
+
"&client_id="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_id"
)
+
"&client_secret="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_secret"
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
.
getConsumer
().
getUuid
());
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
Activity
.
getConsumer
().
getUuid
());
else
tempUrl
=
tempUrl
+
"&auth_token="
;
...
...
@@ -126,24 +127,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
mRecyclerMore
=
view
.
findViewById
(
R
.
id
.
rv_more
);
mRecyclerMore
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterMore
=
new
ProfileCampaignAdapter
(
getContext
(),
BaseFragment
.
getUniqueCampaignList
().
get
(
"more"
));
mAdapterMore
=
new
ProfileCampaignAdapter
(
getContext
(),
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"more"
));
mRecyclerMore
.
setAdapter
(
mAdapterMore
);
mAdapterMore
.
getPositionClicks
()
.
doOnNext
(
more
->
{
String
tempUrl
=
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
String
tempUrl
=
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getIndexUrl
();
tempUrl
=
tempUrl
+
"?web_id="
+
WarpUtils
.
getWebId
(
getContext
())
+
"&app_uuid="
+
WarplyProperty
.
getAppUuid
(
getContext
())
+
"&api_key="
+
WarpUtils
.
getApiKey
(
getContext
())
+
"&session_uuid="
+
BaseFragment
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&session_uuid="
+
BaseFragment
Activity
.
getUniqueCampaignList
().
get
(
"lucky_draw"
).
get
(
0
).
getSessionUUID
()
+
"&access_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"access_token"
)
+
"&refresh_token="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getAuthValue
(
"refresh_token"
)
+
"&client_id="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_id"
)
+
"&client_secret="
+
WarplyDBHelper
.
getInstance
(
getContext
()).
getClientValue
(
"client_secret"
);
if
(
BaseFragment
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
.
getConsumer
().
getUuid
());
if
(
BaseFragment
Activity
.
getConsumer
()
!=
null
)
tempUrl
=
tempUrl
+
"&auth_token="
+
(
BaseFragment
Activity
.
getConsumer
().
getUuid
());
else
tempUrl
=
tempUrl
+
"&auth_token="
;
...
...
app/src/main/res/layout/activity_main
.xml
→
warply_android_sdk/src/main/res/layout/activity_base_fragment
.xml
View file @
3978fb5
File moved
Please
register
or
login
to post a comment