Showing
15 changed files
with
81 additions
and
42 deletions
| ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | 
| 36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { | 
| 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 
| 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 
| 39 | - .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons | 39 | + .setGuid("7000001315"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons | 
| 40 | mLoginReceiver); | 40 | mLoginReceiver); | 
| 41 | } else { | 41 | } else { | 
| 42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... | 
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | 
| 2 | 2 | ||
| 3 | ext { | 3 | ext { | 
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' | 
| 5 | - PUBLISH_VERSION = '4.5.4-cosbeta80' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta81' | 
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 
| 7 | } | 7 | } | 
| 8 | 8 | ... | ... | 
| ... | @@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity; | ... | @@ -15,6 +15,7 @@ import androidx.fragment.app.FragmentActivity; | 
| 15 | import com.google.android.material.bottomnavigation.BottomNavigationView; | 15 | import com.google.android.material.bottomnavigation.BottomNavigationView; | 
| 16 | import com.google.android.material.navigation.NavigationBarView; | 16 | import com.google.android.material.navigation.NavigationBarView; | 
| 17 | 17 | ||
| 18 | +import java.util.ArrayList; | ||
| 18 | import java.util.HashMap; | 19 | import java.util.HashMap; | 
| 19 | 20 | ||
| 20 | import ly.warp.sdk.R; | 21 | import ly.warp.sdk.R; | 
| ... | @@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -183,9 +184,9 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | 
| 183 | } | 184 | } | 
| 184 | }; | 185 | }; | 
| 185 | 186 | ||
| 186 | - private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() { | 187 | + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | 
| 187 | @Override | 188 | @Override | 
| 188 | - public void onSuccess(CampaignList result) { | 189 | + public void onSuccess(ArrayList<Campaign> result) { | 
| 189 | WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | 190 | WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | 
| 190 | } | 191 | } | 
| 191 | 192 | ... | ... | 
| ... | @@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; | ... | @@ -21,6 +21,8 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; | 
| 21 | import org.greenrobot.eventbus.EventBus; | 21 | import org.greenrobot.eventbus.EventBus; | 
| 22 | import org.json.JSONObject; | 22 | import org.json.JSONObject; | 
| 23 | 23 | ||
| 24 | +import java.util.ArrayList; | ||
| 25 | + | ||
| 24 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 26 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 
| 25 | import ly.warp.sdk.R; | 27 | import ly.warp.sdk.R; | 
| 26 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 28 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 
| ... | @@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -290,9 +292,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | 
| 290 | } | 292 | } | 
| 291 | }; | 293 | }; | 
| 292 | 294 | ||
| 293 | - private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() { | 295 | + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | 
| 294 | @Override | 296 | @Override | 
| 295 | - public void onSuccess(CampaignList result) { | 297 | + public void onSuccess(ArrayList<Campaign> result) { | 
| 296 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 298 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 
| 297 | WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork); | 299 | WorkManager.getInstance(CouponsetInfoActivity.this).enqueue(mywork); | 
| 298 | // Thread.currentThread().interrupt(); | 300 | // Thread.currentThread().interrupt(); | ... | ... | 
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
| ... | @@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks; | ... | @@ -27,6 +27,8 @@ package ly.warp.sdk.io.callbacks; | 
| 27 | 27 | ||
| 28 | import org.json.JSONObject; | 28 | import org.json.JSONObject; | 
| 29 | 29 | ||
| 30 | +import java.util.ArrayList; | ||
| 31 | + | ||
| 30 | import ly.warp.sdk.io.models.Campaign; | 32 | import ly.warp.sdk.io.models.Campaign; | 
| 31 | import ly.warp.sdk.io.models.CampaignList; | 33 | import ly.warp.sdk.io.models.CampaignList; | 
| 32 | import ly.warp.sdk.io.models.NewCampaign; | 34 | import ly.warp.sdk.io.models.NewCampaign; | 
| ... | @@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList; | ... | @@ -38,10 +40,10 @@ import ly.warp.sdk.io.models.NewCampaignList; | 
| 38 | 40 | ||
| 39 | public class NewCampaignsHook implements CallbackReceiver<JSONObject> { | 41 | public class NewCampaignsHook implements CallbackReceiver<JSONObject> { | 
| 40 | 42 | ||
| 41 | - private final CallbackReceiver<CampaignList> mListener; | 43 | + private final CallbackReceiver<ArrayList<Campaign>> mListener; | 
| 42 | private final String mRequestSignature; | 44 | private final String mRequestSignature; | 
| 43 | 45 | ||
| 44 | - public NewCampaignsHook(CallbackReceiver<CampaignList> listener, String requestSignature) { | 46 | + public NewCampaignsHook(CallbackReceiver<ArrayList<Campaign>> listener, String requestSignature) { | 
| 45 | this.mListener = listener; | 47 | this.mListener = listener; | 
| 46 | this.mRequestSignature = requestSignature; | 48 | this.mRequestSignature = requestSignature; | 
| 47 | } | 49 | } | 
| ... | @@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> { | ... | @@ -52,7 +54,7 @@ public class NewCampaignsHook implements CallbackReceiver<JSONObject> { | 
| 52 | int status = result.optInt("status", 2); | 54 | int status = result.optInt("status", 2); | 
| 53 | if (status == 1) { | 55 | if (status == 1) { | 
| 54 | NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature); | 56 | NewCampaignList cmpList = new NewCampaignList(result, mRequestSignature); | 
| 55 | - CampaignList tempCampaigns = new CampaignList(); | 57 | + ArrayList<Campaign> tempCampaigns = new ArrayList<>(); | 
| 56 | for (NewCampaign newCamp : cmpList) { | 58 | for (NewCampaign newCamp : cmpList) { | 
| 57 | Campaign camp = new Campaign(); | 59 | Campaign camp = new Campaign(); | 
| 58 | camp.setIndexUrl(newCamp.getIndexUrl()); | 60 | camp.setIndexUrl(newCamp.getIndexUrl()); | ... | ... | 
| ... | @@ -10,9 +10,12 @@ import androidx.work.WorkerParameters; | ... | @@ -10,9 +10,12 @@ import androidx.work.WorkerParameters; | 
| 10 | 10 | ||
| 11 | import org.greenrobot.eventbus.EventBus; | 11 | import org.greenrobot.eventbus.EventBus; | 
| 12 | 12 | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | + | ||
| 13 | import ly.warp.sdk.Warply; | 15 | import ly.warp.sdk.Warply; | 
| 14 | import ly.warp.sdk.activities.CouponsetInfoActivity; | 16 | import ly.warp.sdk.activities.CouponsetInfoActivity; | 
| 15 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 17 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 
| 18 | +import ly.warp.sdk.io.models.Campaign; | ||
| 16 | import ly.warp.sdk.io.models.CampaignList; | 19 | import ly.warp.sdk.io.models.CampaignList; | 
| 17 | import ly.warp.sdk.io.models.CouponList; | 20 | import ly.warp.sdk.io.models.CouponList; | 
| 18 | import ly.warp.sdk.io.models.CouponsEventModel; | 21 | import ly.warp.sdk.io.models.CouponsEventModel; | 
| ... | @@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker { | ... | @@ -55,9 +58,9 @@ public class EventCampaignCouponService extends Worker { | 
| 55 | } | 58 | } | 
| 56 | }; | 59 | }; | 
| 57 | 60 | ||
| 58 | - private CallbackReceiver<CampaignList> mCampaignsCallback = new CallbackReceiver<CampaignList>() { | 61 | + private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | 
| 59 | @Override | 62 | @Override | 
| 60 | - public void onSuccess(CampaignList result) { | 63 | + public void onSuccess(ArrayList<Campaign> result) { | 
| 61 | LoyaltyEventModel campaignsAdded = new LoyaltyEventModel(); | 64 | LoyaltyEventModel campaignsAdded = new LoyaltyEventModel(); | 
| 62 | EventBus.getDefault().post(new WarplyEventBusManager(campaignsAdded)); | 65 | EventBus.getDefault().post(new WarplyEventBusManager(campaignsAdded)); | 
| 63 | } | 66 | } | ... | ... | 
| ... | @@ -8,8 +8,11 @@ import androidx.work.WorkerParameters; | ... | @@ -8,8 +8,11 @@ import androidx.work.WorkerParameters; | 
| 8 | 8 | ||
| 9 | import org.json.JSONObject; | 9 | import org.json.JSONObject; | 
| 10 | 10 | ||
| 11 | +import java.util.ArrayList; | ||
| 12 | + | ||
| 11 | import ly.warp.sdk.Warply; | 13 | import ly.warp.sdk.Warply; | 
| 12 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 14 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 
| 15 | +import ly.warp.sdk.io.models.Campaign; | ||
| 13 | import ly.warp.sdk.io.models.CampaignList; | 16 | import ly.warp.sdk.io.models.CampaignList; | 
| 14 | import ly.warp.sdk.io.models.Consumer; | 17 | import ly.warp.sdk.io.models.Consumer; | 
| 15 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 18 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 
| ... | @@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker { | ... | @@ -45,9 +48,9 @@ public class EventQuestionnaireService extends Worker { | 
| 45 | } | 48 | } | 
| 46 | } | 49 | } | 
| 47 | 50 | ||
| 48 | - WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { | 51 | + WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() { | 
| 49 | @Override | 52 | @Override | 
| 50 | - public void onSuccess(CampaignList result) { | 53 | + public void onSuccess(ArrayList<Campaign> result) { | 
| 51 | WarpUtils.log("SUCCESS_QUESTIONNAIRE_EVENT"); | 54 | WarpUtils.log("SUCCESS_QUESTIONNAIRE_EVENT"); | 
| 52 | } | 55 | } | 
| 53 | 56 | ... | ... | 
| ... | @@ -67,7 +67,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -67,7 +67,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | 
| 67 | private float[] velRing = new float[VEL_RING_SIZE]; | 67 | private float[] velRing = new float[VEL_RING_SIZE]; | 
| 68 | private long lastStepTimeNs = 0; | 68 | private long lastStepTimeNs = 0; | 
| 69 | private float oldVelocityEstimate = 0; | 69 | private float oldVelocityEstimate = 0; | 
| 70 | - private double eventMeters = 0.0d; | 70 | + private double eventMeters = 0.0d, pacingMeters = 0.0d; | 
| 71 | private int sumSteps = 0; | 71 | private int sumSteps = 0; | 
| 72 | 72 | ||
| 73 | // =========================================================== | 73 | // =========================================================== | 
| ... | @@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -85,10 +85,11 @@ public class WarplyHealthService extends Service implements SensorEventListener | 
| 85 | 85 | ||
| 86 | mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); | 86 | mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); | 
| 87 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); | 87 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); | 
| 88 | - registerStepSensor(); | 88 | +// registerStepSensor(); | 
| 89 | + WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback); | ||
| 89 | } | 90 | } | 
| 90 | 91 | ||
| 91 | - @RequiresApi(api = Build.VERSION_CODES.O) | 92 | + // @RequiresApi(api = Build.VERSION_CODES.O) | 
| 92 | @Override | 93 | @Override | 
| 93 | public int onStartCommand(Intent intent, int flags, int startId) { | 94 | public int onStartCommand(Intent intent, int flags, int startId) { | 
| 94 | NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); | 95 | NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); | 
| ... | @@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -141,6 +142,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | 
| 141 | WarplyManagerHelper.mStepsWebview = 0; | 142 | WarplyManagerHelper.mStepsWebview = 0; | 
| 142 | WarplyManagerHelper.mMetersWebview = 0.0d; | 143 | WarplyManagerHelper.mMetersWebview = 0.0d; | 
| 143 | eventMeters = 0.0d; | 144 | eventMeters = 0.0d; | 
| 145 | + pacingMeters = 0.0d; | ||
| 144 | sumSteps = 0; | 146 | sumSteps = 0; | 
| 145 | sendSteps(); | 147 | sendSteps(); | 
| 146 | } | 148 | } | 
| ... | @@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -222,8 +224,8 @@ public class WarplyHealthService extends Service implements SensorEventListener | 
| 222 | // healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022 | 224 | // healthSteps.setMeters((mStepsAll * 0.762)); // 16/09/2022 | 
| 223 | // healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022 | 225 | // healthSteps.setMeters(WarplyManagerHelper.mMetersWebview); // 20/09/2022 | 
| 224 | eventMeters = (sumSteps * 0.762); | 226 | eventMeters = (sumSteps * 0.762); | 
| 225 | - WarpUtils.log("WIDGET_METERS: " + String.valueOf(eventMeters)); | 227 | + WarpUtils.log("WIDGET_METERS: " + String.valueOf(pacingMeters + eventMeters)); | 
| 226 | - healthSteps.setMeters(eventMeters); | 228 | + healthSteps.setMeters(pacingMeters + eventMeters); | 
| 227 | EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); | 229 | EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); | 
| 228 | 230 | ||
| 229 | lastStepTimeNs = timeNs; | 231 | lastStepTimeNs = timeNs; | 
| ... | @@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -292,4 +294,17 @@ public class WarplyHealthService extends Service implements SensorEventListener | 
| 292 | }); | 294 | }); | 
| 293 | } | 295 | } | 
| 294 | } | 296 | } | 
| 297 | + | ||
| 298 | + private CallbackReceiver<PacingDetails> mPacingCallback = new CallbackReceiver<PacingDetails>() { | ||
| 299 | + @Override | ||
| 300 | + public void onSuccess(PacingDetails result) { | ||
| 301 | + pacingMeters = result.getMeters().getDay().getValue(); | ||
| 302 | + registerStepSensor(); | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + @Override | ||
| 306 | + public void onFailure(int errorCode) { | ||
| 307 | + | ||
| 308 | + } | ||
| 309 | + }; | ||
| 295 | } | 310 | } | ... | ... | 
| ... | @@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper; | ... | @@ -36,12 +36,13 @@ import ly.warp.sdk.utils.WarplyManagerHelper; | 
| 36 | public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> { | 36 | public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter.MergedGiftsViewHolder> { | 
| 37 | 37 | ||
| 38 | private Context mContext; | 38 | private Context mContext; | 
| 39 | - private ArrayList<MergedGifts> mMergedGifts; | 39 | + private ArrayList<MergedGifts> mMergedGifts = new ArrayList<>(); | 
| 40 | private final PublishSubject<MergedGifts> onClickSubject = PublishSubject.create(); | 40 | private final PublishSubject<MergedGifts> onClickSubject = PublishSubject.create(); | 
| 41 | 41 | ||
| 42 | public MergedGiftsAdapter(Context mContext, ArrayList<MergedGifts> mergedgifts) { | 42 | public MergedGiftsAdapter(Context mContext, ArrayList<MergedGifts> mergedgifts) { | 
| 43 | this.mContext = mContext; | 43 | this.mContext = mContext; | 
| 44 | - this.mMergedGifts = mergedgifts; | 44 | + this.mMergedGifts.clear(); | 
| 45 | + this.mMergedGifts.addAll(mergedgifts); | ||
| 45 | } | 46 | } | 
| 46 | 47 | ||
| 47 | public class MergedGiftsViewHolder extends RecyclerView.ViewHolder { | 48 | public class MergedGiftsViewHolder extends RecyclerView.ViewHolder { | 
| ... | @@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. | ... | @@ -64,6 +65,11 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. | 
| 64 | return mMergedGifts.size(); | 65 | return mMergedGifts.size(); | 
| 65 | } | 66 | } | 
| 66 | 67 | ||
| 68 | + @Override | ||
| 69 | + public long getItemId(int position) { | ||
| 70 | +// return super.getItemId(position); | ||
| 71 | + return Double.valueOf(Math.random()).longValue(); | ||
| 72 | + } | ||
| 67 | 73 | ||
| 68 | public MergedGifts getItem(int id) { | 74 | public MergedGifts getItem(int id) { | 
| 69 | return mMergedGifts.get(id); | 75 | return mMergedGifts.get(id); | ... | ... | 
| ... | @@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign; | ... | @@ -25,12 +25,13 @@ import ly.warp.sdk.io.models.Campaign; | 
| 25 | public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.MoreCampaignViewHolder> { | 25 | public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapter.MoreCampaignViewHolder> { | 
| 26 | 26 | ||
| 27 | private Context mContext; | 27 | private Context mContext; | 
| 28 | - private ArrayList<Campaign> mCampaigns; | 28 | + private ArrayList<Campaign> mCampaigns = new ArrayList<>(); | 
| 29 | private final PublishSubject<Campaign> onClickSubject = PublishSubject.create(); | 29 | private final PublishSubject<Campaign> onClickSubject = PublishSubject.create(); | 
| 30 | 30 | ||
| 31 | public MoreCampaignAdapter(Context mContext, ArrayList<Campaign> campaignList) { | 31 | public MoreCampaignAdapter(Context mContext, ArrayList<Campaign> campaignList) { | 
| 32 | this.mContext = mContext; | 32 | this.mContext = mContext; | 
| 33 | - this.mCampaigns = campaignList; | 33 | + this.mCampaigns.clear(); | 
| 34 | + this.mCampaigns.addAll(campaignList); | ||
| 34 | } | 35 | } | 
| 35 | 36 | ||
| 36 | public class MoreCampaignViewHolder extends RecyclerView.ViewHolder { | 37 | public class MoreCampaignViewHolder extends RecyclerView.ViewHolder { | 
| ... | @@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte | ... | @@ -67,6 +68,12 @@ public class MoreCampaignAdapter extends RecyclerView.Adapter<MoreCampaignAdapte | 
| 67 | } | 68 | } | 
| 68 | 69 | ||
| 69 | @Override | 70 | @Override | 
| 71 | + public long getItemId(int position) { | ||
| 72 | +// return super.getItemId(position); | ||
| 73 | + return Double.valueOf(Math.random()).longValue(); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Override | ||
| 70 | public MoreCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 77 | public MoreCampaignViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 
| 71 | View itemView; | 78 | View itemView; | 
| 72 | 79 | ... | ... | 
| ... | @@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | ... | @@ -26,12 +26,13 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 
| 26 | public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAdapter.MoreContextualViewHolder> { | 26 | public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAdapter.MoreContextualViewHolder> { | 
| 27 | 27 | ||
| 28 | private Context mContext; | 28 | private Context mContext; | 
| 29 | - private ArrayList<LoyaltyContextualOfferModel> mCampaigns; | 29 | + private ArrayList<LoyaltyContextualOfferModel> mCampaigns = new ArrayList<>(); | 
| 30 | private final PublishSubject<LoyaltyContextualOfferModel> onClickSubject = PublishSubject.create(); | 30 | private final PublishSubject<LoyaltyContextualOfferModel> onClickSubject = PublishSubject.create(); | 
| 31 | 31 | ||
| 32 | public MoreContextualAdapter(Context mContext, ArrayList<LoyaltyContextualOfferModel> campaignList) { | 32 | public MoreContextualAdapter(Context mContext, ArrayList<LoyaltyContextualOfferModel> campaignList) { | 
| 33 | this.mContext = mContext; | 33 | this.mContext = mContext; | 
| 34 | - this.mCampaigns = campaignList; | 34 | + this.mCampaigns.clear(); | 
| 35 | + this.mCampaigns.addAll(campaignList); | ||
| 35 | } | 36 | } | 
| 36 | 37 | ||
| 37 | public class MoreContextualViewHolder extends RecyclerView.ViewHolder { | 38 | public class MoreContextualViewHolder extends RecyclerView.ViewHolder { | 
| ... | @@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd | ... | @@ -56,6 +57,11 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd | 
| 56 | return mCampaigns.size(); | 57 | return mCampaigns.size(); | 
| 57 | } | 58 | } | 
| 58 | 59 | ||
| 60 | + @Override | ||
| 61 | + public long getItemId(int position) { | ||
| 62 | +// return super.getItemId(position); | ||
| 63 | + return Double.valueOf(Math.random()).longValue(); | ||
| 64 | + } | ||
| 59 | 65 | ||
| 60 | public LoyaltyContextualOfferModel getItem(int id) { | 66 | public LoyaltyContextualOfferModel getItem(int id) { | 
| 61 | return mCampaigns.get(id); | 67 | return mCampaigns.get(id); | ... | ... | 
| ... | @@ -40,7 +40,7 @@ | ... | @@ -40,7 +40,7 @@ | 
| 40 | app:layout_constraintTop_toTopOf="parent" /> | 40 | app:layout_constraintTop_toTopOf="parent" /> | 
| 41 | </androidx.constraintlayout.widget.ConstraintLayout> | 41 | </androidx.constraintlayout.widget.ConstraintLayout> | 
| 42 | 42 | ||
| 43 | - <RelativeLayout | 43 | + <LinearLayout | 
| 44 | android:layout_width="match_parent" | 44 | android:layout_width="match_parent" | 
| 45 | android:layout_height="match_parent" | 45 | android:layout_height="match_parent" | 
| 46 | android:background="@drawable/shape_cos_loyalty_no_border" | 46 | android:background="@drawable/shape_cos_loyalty_no_border" | 
| ... | @@ -97,7 +97,6 @@ | ... | @@ -97,7 +97,6 @@ | 
| 97 | android:id="@+id/rv_merged_gifts" | 97 | android:id="@+id/rv_merged_gifts" | 
| 98 | android:layout_width="match_parent" | 98 | android:layout_width="match_parent" | 
| 99 | android:layout_height="wrap_content" | 99 | android:layout_height="wrap_content" | 
| 100 | - android:layout_below="@+id/ll_gifts_popup" | ||
| 101 | android:layout_marginTop="4dp" | 100 | android:layout_marginTop="4dp" | 
| 102 | android:clipToPadding="false" | 101 | android:clipToPadding="false" | 
| 103 | android:orientation="vertical" | 102 | android:orientation="vertical" | 
| ... | @@ -213,5 +212,5 @@ | ... | @@ -213,5 +212,5 @@ | 
| 213 | <!-- app:layout_constraintRight_toRightOf="parent"--> | 212 | <!-- app:layout_constraintRight_toRightOf="parent"--> | 
| 214 | <!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />--> | 213 | <!-- app:layout_constraintTop_toBottomOf="@+id/tv_coupons_title" />--> | 
| 215 | <!-- </androidx.constraintlayout.widget.ConstraintLayout>--> | 214 | <!-- </androidx.constraintlayout.widget.ConstraintLayout>--> | 
| 216 | - </RelativeLayout> | 215 | + </LinearLayout> | 
| 217 | </LinearLayout> | 216 | </LinearLayout> | 
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... | 
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> | 
| 2 | -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 
| 4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" | 
| 5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" | 
| 6 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" | 
| 7 | android:background="@android:color/white" | 7 | android:background="@android:color/white" | 
| 8 | - android:fillViewport="true"> | 8 | + android:fillViewport="true" | 
| 9 | + android:orientation="vertical"> | ||
| 9 | 10 | ||
| 10 | <androidx.constraintlayout.widget.ConstraintLayout | 11 | <androidx.constraintlayout.widget.ConstraintLayout | 
| 11 | android:id="@+id/cl_more_header" | 12 | android:id="@+id/cl_more_header" | 
| ... | @@ -39,10 +40,9 @@ | ... | @@ -39,10 +40,9 @@ | 
| 39 | app:layout_constraintTop_toTopOf="parent" /> | 40 | app:layout_constraintTop_toTopOf="parent" /> | 
| 40 | </androidx.constraintlayout.widget.ConstraintLayout> | 41 | </androidx.constraintlayout.widget.ConstraintLayout> | 
| 41 | 42 | ||
| 42 | - <RelativeLayout | 43 | + <LinearLayout | 
| 43 | android:layout_width="match_parent" | 44 | android:layout_width="match_parent" | 
| 44 | android:layout_height="match_parent" | 45 | android:layout_height="match_parent" | 
| 45 | - android:layout_below="@+id/cl_more_header" | ||
| 46 | android:background="@drawable/shape_cos_loyalty_no_border" | 46 | android:background="@drawable/shape_cos_loyalty_no_border" | 
| 47 | android:orientation="vertical"> | 47 | android:orientation="vertical"> | 
| 48 | 48 | ||
| ... | @@ -52,7 +52,7 @@ | ... | @@ -52,7 +52,7 @@ | 
| 52 | android:fillViewport="true" | 52 | android:fillViewport="true" | 
| 53 | android:overScrollMode="never"> | 53 | android:overScrollMode="never"> | 
| 54 | 54 | ||
| 55 | - <RelativeLayout | 55 | + <LinearLayout | 
| 56 | android:layout_width="match_parent" | 56 | android:layout_width="match_parent" | 
| 57 | android:layout_height="wrap_content" | 57 | android:layout_height="wrap_content" | 
| 58 | android:orientation="vertical"> | 58 | android:orientation="vertical"> | 
| ... | @@ -107,21 +107,19 @@ | ... | @@ -107,21 +107,19 @@ | 
| 107 | <androidx.recyclerview.widget.RecyclerView | 107 | <androidx.recyclerview.widget.RecyclerView | 
| 108 | android:id="@+id/rv_more_items" | 108 | android:id="@+id/rv_more_items" | 
| 109 | android:layout_width="match_parent" | 109 | android:layout_width="match_parent" | 
| 110 | - android:layout_height="match_parent" | 110 | + android:layout_height="wrap_content" | 
| 111 | - android:layout_below="@+id/ll_more_popup" | ||
| 112 | android:layout_marginTop="4dp" | 111 | android:layout_marginTop="4dp" | 
| 113 | android:clipToPadding="false" | 112 | android:clipToPadding="false" | 
| 114 | android:orientation="vertical" | 113 | android:orientation="vertical" | 
| 114 | + android:overScrollMode="never" | ||
| 115 | android:paddingTop="44dp" | 115 | android:paddingTop="44dp" | 
| 116 | android:paddingBottom="24dp" | 116 | android:paddingBottom="24dp" | 
| 117 | - android:overScrollMode="never" | ||
| 118 | android:visibility="gone" /> | 117 | android:visibility="gone" /> | 
| 119 | 118 | ||
| 120 | <LinearLayout | 119 | <LinearLayout | 
| 121 | android:id="@+id/ll_research_items" | 120 | android:id="@+id/ll_research_items" | 
| 122 | android:layout_width="match_parent" | 121 | android:layout_width="match_parent" | 
| 123 | android:layout_height="wrap_content" | 122 | android:layout_height="wrap_content" | 
| 124 | - android:layout_below="@+id/ll_more_popup" | ||
| 125 | android:orientation="vertical" | 123 | android:orientation="vertical" | 
| 126 | android:paddingTop="44dp" | 124 | android:paddingTop="44dp" | 
| 127 | android:visibility="gone"> | 125 | android:visibility="gone"> | 
| ... | @@ -151,7 +149,6 @@ | ... | @@ -151,7 +149,6 @@ | 
| 151 | android:id="@+id/ll_exclusive_items" | 149 | android:id="@+id/ll_exclusive_items" | 
| 152 | android:layout_width="match_parent" | 150 | android:layout_width="match_parent" | 
| 153 | android:layout_height="wrap_content" | 151 | android:layout_height="wrap_content" | 
| 154 | - android:layout_below="@+id/ll_research_items" | ||
| 155 | android:orientation="vertical" | 152 | android:orientation="vertical" | 
| 156 | android:visibility="gone"> | 153 | android:visibility="gone"> | 
| 157 | 154 | ||
| ... | @@ -180,7 +177,6 @@ | ... | @@ -180,7 +177,6 @@ | 
| 180 | android:id="@+id/ll_contest_items" | 177 | android:id="@+id/ll_contest_items" | 
| 181 | android:layout_width="match_parent" | 178 | android:layout_width="match_parent" | 
| 182 | android:layout_height="wrap_content" | 179 | android:layout_height="wrap_content" | 
| 183 | - android:layout_below="@+id/ll_exclusive_items" | ||
| 184 | android:orientation="vertical" | 180 | android:orientation="vertical" | 
| 185 | android:visibility="gone"> | 181 | android:visibility="gone"> | 
| 186 | 182 | ||
| ... | @@ -209,7 +205,6 @@ | ... | @@ -209,7 +205,6 @@ | 
| 209 | android:id="@+id/ll_contextual_items" | 205 | android:id="@+id/ll_contextual_items" | 
| 210 | android:layout_width="match_parent" | 206 | android:layout_width="match_parent" | 
| 211 | android:layout_height="wrap_content" | 207 | android:layout_height="wrap_content" | 
| 212 | - android:layout_below="@+id/ll_contest_items" | ||
| 213 | android:orientation="vertical" | 208 | android:orientation="vertical" | 
| 214 | android:visibility="gone"> | 209 | android:visibility="gone"> | 
| 215 | 210 | ||
| ... | @@ -233,7 +228,7 @@ | ... | @@ -233,7 +228,7 @@ | 
| 233 | android:overScrollMode="never" | 228 | android:overScrollMode="never" | 
| 234 | android:paddingBottom="4dp" /> | 229 | android:paddingBottom="4dp" /> | 
| 235 | </LinearLayout> | 230 | </LinearLayout> | 
| 236 | - </RelativeLayout> | 231 | + </LinearLayout> | 
| 237 | </ScrollView> | 232 | </ScrollView> | 
| 238 | - </RelativeLayout> | ||
| 239 | -</RelativeLayout> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | 
| 233 | + </LinearLayout> | ||
| 234 | +</LinearLayout> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... | 
- 
Please register or login to post a comment
