Panagiotis Triantafyllou

fixs

...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
19 android:fullBackupContent="false" 19 android:fullBackupContent="false"
20 android:hardwareAccelerated="true" 20 android:hardwareAccelerated="true"
21 android:icon="@mipmap/ic_launcher" 21 android:icon="@mipmap/ic_launcher"
22 - android:roundIcon="@mipmap/ic_launcher_round"
23 android:installLocation="internalOnly" 22 android:installLocation="internalOnly"
24 android:label="@string/app_name" 23 android:label="@string/app_name"
25 android:largeHeap="true" 24 android:largeHeap="true"
25 + android:roundIcon="@mipmap/ic_launcher_round"
26 android:theme="@style/AppTheme"> 26 android:theme="@style/AppTheme">
27 27
28 <activity 28 <activity
...@@ -38,12 +38,10 @@ ...@@ -38,12 +38,10 @@
38 </activity> 38 </activity>
39 39
40 <activity 40 <activity
41 - android:name="warp.ly.android_sdk.activities.MainActivity" 41 + android:name="ly.warp.sdk.activities.BaseFragmentActivity"
42 android:exported="false" 42 android:exported="false"
43 android:label="@string/title_activity_main" 43 android:label="@string/title_activity_main"
44 android:screenOrientation="portrait" /> 44 android:screenOrientation="portrait" />
45 -
46 -
47 </application> 45 </application>
48 46
49 <!-- For Huawei Push, only if we targetSdkVersion 30, comment if we are in Google build --> 47 <!-- For Huawei Push, only if we targetSdkVersion 30, comment if we are in Google build -->
......
1 -package warp.ly.android_sdk.activities;
2 -
3 -import android.os.Bundle;
4 -import android.view.MenuItem;
5 -
6 -import androidx.annotation.NonNull;
7 -import androidx.fragment.app.Fragment;
8 -
9 -import com.google.android.material.bottomnavigation.BottomNavigationView;
10 -import com.google.android.material.navigation.NavigationBarView;
11 -
12 -import ly.warp.sdk.fragments.HomeFragment;
13 -import ly.warp.sdk.fragments.LoyaltyFragment;
14 -import warp.ly.android_sdk.R;
15 -
16 -public class MainActivity extends BaseActivity implements NavigationBarView.OnItemSelectedListener {
17 -
18 - // ===========================================================
19 - // Constants
20 - // ===========================================================
21 -
22 - // ===========================================================
23 - // Fields
24 - // ===========================================================
25 -
26 - private BottomNavigationView mBottomNavigationView;
27 - Fragment mFragmentToSet = null;
28 -
29 - // ===========================================================
30 - // Methods for/from SuperClass/Interfaces
31 - // ===========================================================
32 -
33 - @Override
34 - public void onCreate(Bundle savedInstanceState) {
35 - super.onCreate(savedInstanceState);
36 - setContentView(R.layout.activity_main);
37 -
38 - mBottomNavigationView = findViewById(R.id.bt_tabs);
39 - initViews();
40 - }
41 -
42 - @Override
43 - protected void onResume() {
44 - super.onResume();
45 - }
46 -
47 - @Override
48 - public boolean onNavigationItemSelected(@NonNull MenuItem item) {
49 - switch (item.getItemId()) {
50 - case R.id.menu_loyalty:
51 - mFragmentToSet = LoyaltyFragment.newInstance();
52 - getSupportFragmentManager().beginTransaction()
53 - .replace(R.id.fl_fragment, mFragmentToSet)
54 - .addToBackStack(null)
55 - .commit();
56 - return true;
57 - case R.id.menu_home:
58 - mFragmentToSet = HomeFragment.newInstance();
59 - getSupportFragmentManager().beginTransaction()
60 - .replace(R.id.fl_fragment, mFragmentToSet)
61 - .addToBackStack(null)
62 - .commit();
63 - return true;
64 - }
65 - return false;
66 - }
67 -
68 - // ===========================================================
69 - // Methods
70 - // ===========================================================
71 -
72 - private void initViews() {
73 - mBottomNavigationView.setOnItemSelectedListener(this);
74 - mFragmentToSet = HomeFragment.newInstance();
75 - getSupportFragmentManager().beginTransaction().add(R.id.fl_fragment, mFragmentToSet).commit();
76 - mBottomNavigationView.setSelectedItemId(R.id.menu_home);
77 - }
78 -
79 - // ===========================================================
80 - // Inner and Anonymous Classes
81 - // ===========================================================
82 -
83 -}
...@@ -9,6 +9,7 @@ import java.util.Timer; ...@@ -9,6 +9,7 @@ import java.util.Timer;
9 import java.util.TimerTask; 9 import java.util.TimerTask;
10 10
11 import ly.warp.sdk.Warply; 11 import ly.warp.sdk.Warply;
12 +import ly.warp.sdk.activities.BaseFragmentActivity;
12 import ly.warp.sdk.io.callbacks.CallbackReceiver; 13 import ly.warp.sdk.io.callbacks.CallbackReceiver;
13 import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver; 14 import ly.warp.sdk.io.callbacks.SimpleCallbackReceiver;
14 import ly.warp.sdk.io.callbacks.WarplyReadyCallback; 15 import ly.warp.sdk.io.callbacks.WarplyReadyCallback;
...@@ -76,7 +77,7 @@ public class SplashActivity extends BaseActivity { ...@@ -76,7 +77,7 @@ public class SplashActivity extends BaseActivity {
76 runOnUiThread(new Runnable() { 77 runOnUiThread(new Runnable() {
77 public void run() { 78 public void run() {
78 if (!isFinishing()) { 79 if (!isFinishing()) {
79 - startActivity(new Intent(SplashActivity.this, MainActivity.class)); 80 + startActivity(new Intent(SplashActivity.this, BaseFragmentActivity.class));
80 finish(); 81 finish();
81 } 82 }
82 } 83 }
......
1 -package ly.warp.sdk.fragments; 1 +package ly.warp.sdk.activities;
2 2
3 import android.os.Bundle; 3 import android.os.Bundle;
4 +import android.view.MenuItem;
4 5
6 +import androidx.annotation.NonNull;
5 import androidx.fragment.app.Fragment; 7 import androidx.fragment.app.Fragment;
8 +import androidx.fragment.app.FragmentActivity;
9 +
10 +import com.google.android.material.bottomnavigation.BottomNavigationView;
11 +import com.google.android.material.navigation.NavigationBarView;
6 12
7 import java.util.HashMap; 13 import java.util.HashMap;
8 14
15 +import ly.warp.sdk.R;
9 import ly.warp.sdk.Warply; 16 import ly.warp.sdk.Warply;
17 +import ly.warp.sdk.fragments.HomeFragment;
18 +import ly.warp.sdk.fragments.LoyaltyFragment;
10 import ly.warp.sdk.io.callbacks.CallbackReceiver; 19 import ly.warp.sdk.io.callbacks.CallbackReceiver;
11 import ly.warp.sdk.io.models.Campaign; 20 import ly.warp.sdk.io.models.Campaign;
12 import ly.warp.sdk.io.models.CampaignList; 21 import ly.warp.sdk.io.models.CampaignList;
...@@ -16,15 +25,35 @@ import ly.warp.sdk.io.request.WarplyConsumerRequest; ...@@ -16,15 +25,35 @@ import ly.warp.sdk.io.request.WarplyConsumerRequest;
16 import ly.warp.sdk.io.request.WarplyInboxRequest; 25 import ly.warp.sdk.io.request.WarplyInboxRequest;
17 import ly.warp.sdk.io.request.WarplyUserCouponsRequest; 26 import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
18 import ly.warp.sdk.utils.managers.WarplyManager; 27 import ly.warp.sdk.utils.managers.WarplyManager;
28 +import ly.warp.sdk.utils.managers.WarplySessionManager;
29 +
30 +public class BaseFragmentActivity extends FragmentActivity implements NavigationBarView.OnItemSelectedListener {
31 +
32 + // ===========================================================
33 + // Constants
34 + // ===========================================================
19 35
20 -public class BaseFragment extends Fragment { 36 + // ===========================================================
37 + // Fields
38 + // ===========================================================
39 +
40 + private BottomNavigationView mBottomNavigationView;
41 + private Fragment mFragmentToSet = null;
21 private static Consumer mConsumer; 42 private static Consumer mConsumer;
22 private static HashMap mUniqueCampaignList = new HashMap<String, CampaignList>(); 43 private static HashMap mUniqueCampaignList = new HashMap<String, CampaignList>();
23 private static CouponList mCouponList; 44 private static CouponList mCouponList;
24 45
46 + // ===========================================================
47 + // Methods for/from SuperClass/Interfaces
48 + // ===========================================================
49 +
25 @Override 50 @Override
26 public void onCreate(Bundle savedInstanceState) { 51 public void onCreate(Bundle savedInstanceState) {
27 super.onCreate(savedInstanceState); 52 super.onCreate(savedInstanceState);
53 + WarplySessionManager.onCreateActivity(this);
54 + setContentView(R.layout.activity_base_fragment);
55 +
56 + mBottomNavigationView = findViewById(R.id.bt_tabs);
28 57
29 new Thread(() -> { 58 new Thread(() -> {
30 if (!Thread.currentThread().isInterrupted()) { 59 if (!Thread.currentThread().isInterrupted()) {
...@@ -43,14 +72,52 @@ public class BaseFragment extends Fragment { ...@@ -43,14 +72,52 @@ public class BaseFragment extends Fragment {
43 WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver); 72 WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
44 } 73 }
45 }).start(); 74 }).start();
75 +
76 + initViews();
77 + }
78 +
79 + @Override
80 + protected void onStart() {
81 + super.onStart();
82 + WarplySessionManager.onStartActivity(this);
46 } 83 }
47 84
85 + @Override
86 + protected void onStop() {
87 + super.onStop();
88 + WarplySessionManager.onStopActivity(this);
89 + }
90 +
91 + @Override
92 + protected void onResume() {
93 + super.onResume();
94 + }
48 95
49 @Override 96 @Override
50 - public void onDestroyView() { 97 + public boolean onNavigationItemSelected(@NonNull MenuItem item) {
51 - super.onDestroyView(); 98 + int itemId = item.getItemId();
99 + if (itemId == R.id.menu_loyalty) {
100 + mFragmentToSet = LoyaltyFragment.newInstance();
101 + getSupportFragmentManager().beginTransaction()
102 + .replace(R.id.fl_fragment, mFragmentToSet)
103 + .addToBackStack(null)
104 + .commit();
105 + return true;
106 + } else if (itemId == R.id.menu_home) {
107 + mFragmentToSet = HomeFragment.newInstance();
108 + getSupportFragmentManager().beginTransaction()
109 + .replace(R.id.fl_fragment, mFragmentToSet)
110 + .addToBackStack(null)
111 + .commit();
112 + return true;
113 + }
114 + return false;
52 } 115 }
53 116
117 + // ===========================================================
118 + // Methods
119 + // ===========================================================
120 +
54 public static Consumer getConsumer() { 121 public static Consumer getConsumer() {
55 return mConsumer; 122 return mConsumer;
56 } 123 }
...@@ -63,6 +130,17 @@ public class BaseFragment extends Fragment { ...@@ -63,6 +130,17 @@ public class BaseFragment extends Fragment {
63 return mCouponList; 130 return mCouponList;
64 } 131 }
65 132
133 + private void initViews() {
134 + mBottomNavigationView.setOnItemSelectedListener(this);
135 + mFragmentToSet = HomeFragment.newInstance();
136 + getSupportFragmentManager().beginTransaction().add(R.id.fl_fragment, mFragmentToSet).commit();
137 + mBottomNavigationView.setSelectedItemId(R.id.menu_home);
138 + }
139 +
140 + // ===========================================================
141 + // Inner and Anonymous Classes
142 + // ===========================================================
143 +
66 private final CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() { 144 private final CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() {
67 @Override 145 @Override
68 public void onSuccess(Consumer result) { 146 public void onSuccess(Consumer result) {
...@@ -115,4 +193,4 @@ public class BaseFragment extends Fragment { ...@@ -115,4 +193,4 @@ public class BaseFragment extends Fragment {
115 } 193 }
116 }; 194 };
117 195
118 -}
...\ No newline at end of file ...\ No newline at end of file
196 +}
......
...@@ -16,7 +16,6 @@ import android.widget.TextView; ...@@ -16,7 +16,6 @@ import android.widget.TextView;
16 16
17 import ly.warp.sdk.R; 17 import ly.warp.sdk.R;
18 import ly.warp.sdk.db.WarplyDBHelper; 18 import ly.warp.sdk.db.WarplyDBHelper;
19 -import ly.warp.sdk.fragments.BaseFragment;
20 import ly.warp.sdk.utils.WarpUtils; 19 import ly.warp.sdk.utils.WarpUtils;
21 import ly.warp.sdk.utils.WarplyProperty; 20 import ly.warp.sdk.utils.WarplyProperty;
22 21
...@@ -96,22 +95,22 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene ...@@ -96,22 +95,22 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
96 mTvLuckyDraw.setText(builder, TextView.BufferType.SPANNABLE); 95 mTvLuckyDraw.setText(builder, TextView.BufferType.SPANNABLE);
97 96
98 mClLuckyDraw.setOnClickListener(view -> { 97 mClLuckyDraw.setOnClickListener(view -> {
99 - if (BaseFragment.getUniqueCampaignList() != null && !BaseFragment.getUniqueCampaignList().isEmpty()) { 98 + if (BaseFragmentActivity.getUniqueCampaignList() != null && !BaseFragmentActivity.getUniqueCampaignList().isEmpty()) {
100 - if (BaseFragment.getUniqueCampaignList().containsKey("lucky_draw") && BaseFragment.getUniqueCampaignList().get("lucky_draw").size() > 0) { 99 + if (BaseFragmentActivity.getUniqueCampaignList().containsKey("lucky_draw") && BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").size() > 0) {
101 - String tempUrl = BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 100 + String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
102 101
103 tempUrl = tempUrl 102 tempUrl = tempUrl
104 + "?web_id=" + WarpUtils.getWebId(this) 103 + "?web_id=" + WarpUtils.getWebId(this)
105 + "&app_uuid=" + WarplyProperty.getAppUuid(this) 104 + "&app_uuid=" + WarplyProperty.getAppUuid(this)
106 + "&api_key=" + WarpUtils.getApiKey(this) 105 + "&api_key=" + WarpUtils.getApiKey(this)
107 - + "&session_uuid=" + BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() 106 + + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
108 + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token") 107 + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
109 + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token") 108 + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
110 + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id") 109 + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
111 + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret"); 110 + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
112 111
113 - if (BaseFragment.getConsumer() != null) 112 + if (BaseFragmentActivity.getConsumer() != null)
114 - tempUrl = tempUrl + "&auth_token=" + (BaseFragment.getConsumer().getUuid()); 113 + tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
115 else 114 else
116 tempUrl = tempUrl + "&auth_token="; 115 tempUrl = tempUrl + "&auth_token=";
117 116
......
...@@ -16,7 +16,6 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -16,7 +16,6 @@ import androidx.recyclerview.widget.RecyclerView;
16 import java.io.Serializable; 16 import java.io.Serializable;
17 17
18 import ly.warp.sdk.R; 18 import ly.warp.sdk.R;
19 -import ly.warp.sdk.fragments.BaseFragment;
20 import ly.warp.sdk.views.adapters.HomeCouponAdapter; 19 import ly.warp.sdk.views.adapters.HomeCouponAdapter;
21 20
22 21
...@@ -90,15 +89,15 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -90,15 +89,15 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
90 // =========================================================== 89 // ===========================================================
91 90
92 private void initViews() { 91 private void initViews() {
93 - if (BaseFragment.getConsumer() != null) 92 + if (BaseFragmentActivity.getConsumer() != null)
94 mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name), 93 mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name),
95 - BaseFragment.getConsumer().getFirstName(), BaseFragment.getConsumer().getLastName())); 94 + BaseFragmentActivity.getConsumer().getFirstName(), BaseFragmentActivity.getConsumer().getLastName()));
96 95
97 mIvBack.setOnClickListener(this); 96 mIvBack.setOnClickListener(this);
98 mTvAnalysisButton.setOnClickListener(this); 97 mTvAnalysisButton.setOnClickListener(this);
99 98
100 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); 99 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
101 - mAdapterCoupons = new HomeCouponAdapter(this, BaseFragment.getCouponList()); 100 + mAdapterCoupons = new HomeCouponAdapter(this, BaseFragmentActivity.getCouponList());
102 mRecyclerCoupons.setAdapter(mAdapterCoupons); 101 mRecyclerCoupons.setAdapter(mAdapterCoupons);
103 mAdapterCoupons.getPositionClicks() 102 mAdapterCoupons.getPositionClicks()
104 .doOnNext(coupon -> { 103 .doOnNext(coupon -> {
...@@ -111,7 +110,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener, ...@@ -111,7 +110,7 @@ public class LoyaltyActivity extends Activity implements View.OnClickListener,
111 .subscribe(); 110 .subscribe();
112 111
113 mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)); 112 mRecyclerBurntCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
114 - mAdapterBurntCoupons = new HomeCouponAdapter(this, BaseFragment.getCouponList(), true); 113 + mAdapterBurntCoupons = new HomeCouponAdapter(this, BaseFragmentActivity.getCouponList(), true);
115 mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons); 114 mRecyclerBurntCoupons.setAdapter(mAdapterBurntCoupons);
116 115
117 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, 116 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
......
...@@ -20,6 +20,7 @@ import org.json.JSONException; ...@@ -20,6 +20,7 @@ import org.json.JSONException;
20 import java.io.Serializable; 20 import java.io.Serializable;
21 21
22 import ly.warp.sdk.R; 22 import ly.warp.sdk.R;
23 +import ly.warp.sdk.activities.BaseFragmentActivity;
23 import ly.warp.sdk.activities.BillPaymentActivity; 24 import ly.warp.sdk.activities.BillPaymentActivity;
24 import ly.warp.sdk.activities.CouponInfoActivity; 25 import ly.warp.sdk.activities.CouponInfoActivity;
25 import ly.warp.sdk.activities.WarpViewActivity; 26 import ly.warp.sdk.activities.WarpViewActivity;
...@@ -31,7 +32,7 @@ import ly.warp.sdk.utils.WarplyProperty; ...@@ -31,7 +32,7 @@ import ly.warp.sdk.utils.WarplyProperty;
31 import ly.warp.sdk.views.adapters.HomeCampaignAdapter; 32 import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
32 import ly.warp.sdk.views.adapters.HomeCouponAdapter; 33 import ly.warp.sdk.views.adapters.HomeCouponAdapter;
33 34
34 -public class HomeFragment extends BaseFragment implements View.OnClickListener { 35 +public class HomeFragment extends Fragment implements View.OnClickListener {
35 36
36 private RelativeLayout mOptionOne, mOptionTwo, mOptionThree; 37 private RelativeLayout mOptionOne, mOptionTwo, mOptionThree;
37 private RecyclerView mRecyclerCampaigns, mRecyclerCoupons; 38 private RecyclerView mRecyclerCampaigns, mRecyclerCoupons;
...@@ -41,10 +42,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener { ...@@ -41,10 +42,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
41 private TextView mTvUsername; 42 private TextView mTvUsername;
42 43
43 @Override 44 @Override
44 - public View onCreateView( 45 + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
45 - LayoutInflater inflater, ViewGroup container,
46 - Bundle savedInstanceState
47 - ) {
48 return inflater.inflate(R.layout.fragment_home, container, false); 46 return inflater.inflate(R.layout.fragment_home, container, false);
49 } 47 }
50 48
...@@ -73,30 +71,30 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener { ...@@ -73,30 +71,30 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
73 mLlBillPayment.setOnClickListener(this); 71 mLlBillPayment.setOnClickListener(this);
74 72
75 mTvUsername = view.findViewById(R.id.welcome_user_txt); 73 mTvUsername = view.findViewById(R.id.welcome_user_txt);
76 - if (BaseFragment.getConsumer() != null) 74 + if (BaseFragmentActivity.getConsumer() != null)
77 mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user), 75 mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user),
78 - BaseFragment.getConsumer().getFirstName() + " " + BaseFragment.getConsumer().getLastName())); 76 + BaseFragmentActivity.getConsumer().getFirstName() + " " + BaseFragmentActivity.getConsumer().getLastName()));
79 77
80 mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns); 78 mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns);
81 mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 79 mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
82 - mAdapterCampaigns = new HomeCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("homescreen")); 80 + mAdapterCampaigns = new HomeCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("homescreen"));
83 mRecyclerCampaigns.setAdapter(mAdapterCampaigns); 81 mRecyclerCampaigns.setAdapter(mAdapterCampaigns);
84 mAdapterCampaigns.getPositionClicks() 82 mAdapterCampaigns.getPositionClicks()
85 .doOnNext(campaign -> { 83 .doOnNext(campaign -> {
86 - String tempUrl = BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 84 + String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
87 85
88 tempUrl = tempUrl 86 tempUrl = tempUrl
89 + "?web_id=" + WarpUtils.getWebId(getContext()) 87 + "?web_id=" + WarpUtils.getWebId(getContext())
90 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) 88 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
91 + "&api_key=" + WarpUtils.getApiKey(getContext()) 89 + "&api_key=" + WarpUtils.getApiKey(getContext())
92 - + "&session_uuid=" + BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() 90 + + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
93 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") 91 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
94 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") 92 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
95 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") 93 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
96 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret"); 94 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
97 95
98 - if (BaseFragment.getConsumer() != null) 96 + if (BaseFragmentActivity.getConsumer() != null)
99 - tempUrl = tempUrl + "&auth_token=" + (BaseFragment.getConsumer().getUuid()); 97 + tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
100 else 98 else
101 tempUrl = tempUrl + "&auth_token="; 99 tempUrl = tempUrl + "&auth_token=";
102 100
...@@ -108,7 +106,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener { ...@@ -108,7 +106,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
108 106
109 mRecyclerCoupons = view.findViewById(R.id.rv_home_coupons); 107 mRecyclerCoupons = view.findViewById(R.id.rv_home_coupons);
110 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 108 mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
111 - mAdapterCoupons = new HomeCouponAdapter(getContext(), BaseFragment.getCouponList()); 109 + mAdapterCoupons = new HomeCouponAdapter(getContext(), BaseFragmentActivity.getCouponList());
112 mRecyclerCoupons.setAdapter(mAdapterCoupons); 110 mRecyclerCoupons.setAdapter(mAdapterCoupons);
113 mAdapterCoupons.getPositionClicks() 111 mAdapterCoupons.getPositionClicks()
114 .doOnNext(coupon -> { 112 .doOnNext(coupon -> {
......
...@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; ...@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
15 import androidx.recyclerview.widget.RecyclerView; 15 import androidx.recyclerview.widget.RecyclerView;
16 16
17 import ly.warp.sdk.R; 17 import ly.warp.sdk.R;
18 +import ly.warp.sdk.activities.BaseFragmentActivity;
18 import ly.warp.sdk.activities.LoyaltyActivity; 19 import ly.warp.sdk.activities.LoyaltyActivity;
19 import ly.warp.sdk.activities.WarpViewActivity; 20 import ly.warp.sdk.activities.WarpViewActivity;
20 import ly.warp.sdk.db.WarplyDBHelper; 21 import ly.warp.sdk.db.WarplyDBHelper;
...@@ -22,7 +23,7 @@ import ly.warp.sdk.utils.WarpUtils; ...@@ -22,7 +23,7 @@ import ly.warp.sdk.utils.WarpUtils;
22 import ly.warp.sdk.utils.WarplyProperty; 23 import ly.warp.sdk.utils.WarplyProperty;
23 import ly.warp.sdk.views.adapters.ProfileCampaignAdapter; 24 import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
24 25
25 -public class LoyaltyFragment extends BaseFragment implements View.OnClickListener { 26 +public class LoyaltyFragment extends Fragment implements View.OnClickListener {
26 27
27 // =========================================================== 28 // ===========================================================
28 // Constants 29 // Constants
...@@ -55,9 +56,9 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -55,9 +56,9 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
55 mClRewardsWallet.setOnClickListener(this); 56 mClRewardsWallet.setOnClickListener(this);
56 57
57 mTvUsername = view.findViewById(R.id.tv_name); 58 mTvUsername = view.findViewById(R.id.tv_name);
58 - if (BaseFragment.getConsumer() != null) 59 + if (BaseFragmentActivity.getConsumer() != null)
59 mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_name), 60 mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_name),
60 - BaseFragment.getConsumer().getFirstName() + " " + BaseFragment.getConsumer().getLastName())); 61 + BaseFragmentActivity.getConsumer().getFirstName() + " " + BaseFragmentActivity.getConsumer().getLastName()));
61 62
62 mLlMoreDeals = view.findViewById(R.id.ll_more); 63 mLlMoreDeals = view.findViewById(R.id.ll_more);
63 mLlMoreDeals.setOnClickListener(this); 64 mLlMoreDeals.setOnClickListener(this);
...@@ -68,24 +69,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -68,24 +69,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
68 69
69 mRecyclerDeals = view.findViewById(R.id.rv_deals); 70 mRecyclerDeals = view.findViewById(R.id.rv_deals);
70 mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 71 mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
71 - mAdapterDeals = new ProfileCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("deals")); 72 + mAdapterDeals = new ProfileCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("deals"));
72 mRecyclerDeals.setAdapter(mAdapterDeals); 73 mRecyclerDeals.setAdapter(mAdapterDeals);
73 mAdapterDeals.getPositionClicks() 74 mAdapterDeals.getPositionClicks()
74 .doOnNext(deal -> { 75 .doOnNext(deal -> {
75 - String tempUrl = BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 76 + String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
76 77
77 tempUrl = tempUrl 78 tempUrl = tempUrl
78 + "?web_id=" + WarpUtils.getWebId(getContext()) 79 + "?web_id=" + WarpUtils.getWebId(getContext())
79 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) 80 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
80 + "&api_key=" + WarpUtils.getApiKey(getContext()) 81 + "&api_key=" + WarpUtils.getApiKey(getContext())
81 - + "&session_uuid=" + BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() 82 + + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
82 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") 83 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
83 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") 84 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
84 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") 85 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
85 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret"); 86 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
86 87
87 - if (BaseFragment.getConsumer() != null) 88 + if (BaseFragmentActivity.getConsumer() != null)
88 - tempUrl = tempUrl + "&auth_token=" + (BaseFragment.getConsumer().getUuid()); 89 + tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
89 else 90 else
90 tempUrl = tempUrl + "&auth_token="; 91 tempUrl = tempUrl + "&auth_token=";
91 92
...@@ -97,24 +98,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -97,24 +98,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
97 98
98 mRecyclerGifts = view.findViewById(R.id.rv_gifts); 99 mRecyclerGifts = view.findViewById(R.id.rv_gifts);
99 mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 100 mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
100 - mAdapterGifts = new ProfileCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("gifts")); 101 + mAdapterGifts = new ProfileCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("gifts"));
101 mRecyclerGifts.setAdapter(mAdapterGifts); 102 mRecyclerGifts.setAdapter(mAdapterGifts);
102 mAdapterGifts.getPositionClicks() 103 mAdapterGifts.getPositionClicks()
103 .doOnNext(gift -> { 104 .doOnNext(gift -> {
104 - String tempUrl = BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 105 + String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
105 106
106 tempUrl = tempUrl 107 tempUrl = tempUrl
107 + "?web_id=" + WarpUtils.getWebId(getContext()) 108 + "?web_id=" + WarpUtils.getWebId(getContext())
108 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) 109 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
109 + "&api_key=" + WarpUtils.getApiKey(getContext()) 110 + "&api_key=" + WarpUtils.getApiKey(getContext())
110 - + "&session_uuid=" + BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() 111 + + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
111 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") 112 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
112 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") 113 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
113 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") 114 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
114 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret"); 115 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
115 116
116 - if (BaseFragment.getConsumer() != null) 117 + if (BaseFragmentActivity.getConsumer() != null)
117 - tempUrl = tempUrl + "&auth_token=" + (BaseFragment.getConsumer().getUuid()); 118 + tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
118 else 119 else
119 tempUrl = tempUrl + "&auth_token="; 120 tempUrl = tempUrl + "&auth_token=";
120 121
...@@ -126,24 +127,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -126,24 +127,24 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
126 127
127 mRecyclerMore = view.findViewById(R.id.rv_more); 128 mRecyclerMore = view.findViewById(R.id.rv_more);
128 mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 129 mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
129 - mAdapterMore = new ProfileCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("more")); 130 + mAdapterMore = new ProfileCampaignAdapter(getContext(), BaseFragmentActivity.getUniqueCampaignList().get("more"));
130 mRecyclerMore.setAdapter(mAdapterMore); 131 mRecyclerMore.setAdapter(mAdapterMore);
131 mAdapterMore.getPositionClicks() 132 mAdapterMore.getPositionClicks()
132 .doOnNext(more -> { 133 .doOnNext(more -> {
133 - String tempUrl = BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); 134 + String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
134 135
135 tempUrl = tempUrl 136 tempUrl = tempUrl
136 + "?web_id=" + WarpUtils.getWebId(getContext()) 137 + "?web_id=" + WarpUtils.getWebId(getContext())
137 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) 138 + "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
138 + "&api_key=" + WarpUtils.getApiKey(getContext()) 139 + "&api_key=" + WarpUtils.getApiKey(getContext())
139 - + "&session_uuid=" + BaseFragment.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() 140 + + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
140 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") 141 + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
141 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") 142 + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
142 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") 143 + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
143 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret"); 144 + "&client_secret=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_secret");
144 145
145 - if (BaseFragment.getConsumer() != null) 146 + if (BaseFragmentActivity.getConsumer() != null)
146 - tempUrl = tempUrl + "&auth_token=" + (BaseFragment.getConsumer().getUuid()); 147 + tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
147 else 148 else
148 tempUrl = tempUrl + "&auth_token="; 149 tempUrl = tempUrl + "&auth_token=";
149 150
......