Showing
3 changed files
with
79 additions
and
0 deletions
| ... | @@ -5,6 +5,7 @@ import android.content.Context; | ... | @@ -5,6 +5,7 @@ import android.content.Context; |
| 5 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | import android.os.Handler; | 7 | import android.os.Handler; |
| 8 | +import android.os.Looper; | ||
| 8 | import android.text.SpannableStringBuilder; | 9 | import android.text.SpannableStringBuilder; |
| 9 | import android.text.Spanned; | 10 | import android.text.Spanned; |
| 10 | import android.view.View; | 11 | import android.view.View; |
| ... | @@ -13,6 +14,7 @@ import android.widget.RelativeLayout; | ... | @@ -13,6 +14,7 @@ import android.widget.RelativeLayout; |
| 13 | import android.widget.TextView; | 14 | import android.widget.TextView; |
| 14 | 15 | ||
| 15 | import org.greenrobot.eventbus.EventBus; | 16 | import org.greenrobot.eventbus.EventBus; |
| 17 | +import org.greenrobot.eventbus.Subscribe; | ||
| 16 | 18 | ||
| 17 | import java.util.Locale; | 19 | import java.util.Locale; |
| 18 | 20 | ||
| ... | @@ -75,6 +77,19 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList | ... | @@ -75,6 +77,19 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList |
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | @Override | 79 | @Override |
| 80 | + public void onStart() { | ||
| 81 | + super.onStart(); | ||
| 82 | + if (!EventBus.getDefault().isRegistered(this)) | ||
| 83 | + EventBus.getDefault().register(this); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @Override | ||
| 87 | + public void onDestroy() { | ||
| 88 | + super.onDestroy(); | ||
| 89 | + EventBus.getDefault().unregister(this); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @Override | ||
| 78 | public void onResume() { | 93 | public void onResume() { |
| 79 | super.onResume(); | 94 | super.onResume(); |
| 80 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "HistoryScreen"); | 95 | WarplyAnalyticsManager.logTrackersEvent(this, "screen", "HistoryScreen"); |
| ... | @@ -106,6 +121,13 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList | ... | @@ -106,6 +121,13 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList |
| 106 | } | 121 | } |
| 107 | } | 122 | } |
| 108 | 123 | ||
| 124 | + @Subscribe() | ||
| 125 | + public void onMessageEvent(WarplyEventBusManager event) { | ||
| 126 | + if (event.getNavigateBackEventModel() != null) { | ||
| 127 | + onBackPressed(); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + | ||
| 109 | @Override | 131 | @Override |
| 110 | public void onClick(View view) { | 132 | public void onClick(View view) { |
| 111 | if (view.getId() == R.id.iv_loyalty_history_close) { | 133 | if (view.getId() == R.id.iv_loyalty_history_close) { | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
| 3 | + * | ||
| 4 | + * Redistribution and use in source and binary forms, without modification, are | ||
| 5 | + * permitted provided that the following conditions are met: | ||
| 6 | + * | ||
| 7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
| 8 | + * this list of conditions and the following disclaimer. | ||
| 9 | + * | ||
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 11 | + * this list of conditions and the following disclaimer in the documentation | ||
| 12 | + * and/or other materials provided with the distribution. | ||
| 13 | + * | ||
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
| 15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
| 17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
| 20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| 23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +package ly.warp.sdk.io.models; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * Created by Panagiotis Triantafyllou on 11-Apr-24. | ||
| 31 | + */ | ||
| 32 | + | ||
| 33 | +public class WarplyNavigateBackEventModel { | ||
| 34 | + private boolean goBack; | ||
| 35 | + | ||
| 36 | + public WarplyNavigateBackEventModel() { | ||
| 37 | + this.goBack = true; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public boolean isGoBack() { | ||
| 41 | + return goBack; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setGoBack(boolean goBack) { | ||
| 45 | + this.goBack = goBack; | ||
| 46 | + } | ||
| 47 | +} |
| ... | @@ -24,6 +24,7 @@ import ly.warp.sdk.io.models.VouchersServiceUnavailableEventModel; | ... | @@ -24,6 +24,7 @@ import ly.warp.sdk.io.models.VouchersServiceUnavailableEventModel; |
| 24 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; | 24 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; |
| 25 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 25 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; |
| 26 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 26 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
| 27 | +import ly.warp.sdk.io.models.WarplyNavigateBackEventModel; | ||
| 27 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; | 28 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; |
| 28 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; | 29 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; |
| 29 | import ly.warp.sdk.io.models.WarplyPacingEventModel; | 30 | import ly.warp.sdk.io.models.WarplyPacingEventModel; |
| ... | @@ -56,6 +57,7 @@ public class WarplyEventBusManager { | ... | @@ -56,6 +57,7 @@ public class WarplyEventBusManager { |
| 56 | private RefreshVouchersEventModel vouchersRefreshed; | 57 | private RefreshVouchersEventModel vouchersRefreshed; |
| 57 | private UnifiedCouponsEventModel unifiedCouponsAdded; | 58 | private UnifiedCouponsEventModel unifiedCouponsAdded; |
| 58 | private RefreshUnifiedCouponsEventModel refreshUnifiedCouponsAdded; | 59 | private RefreshUnifiedCouponsEventModel refreshUnifiedCouponsAdded; |
| 60 | + private WarplyNavigateBackEventModel navigateBackEvent; | ||
| 59 | private LoyaltyEventModel campaignsAdded; | 61 | private LoyaltyEventModel campaignsAdded; |
| 60 | private HealthEventModel healthAdded; | 62 | private HealthEventModel healthAdded; |
| 61 | private WarplyCouponsChangedEventModel couponsChanged; | 63 | private WarplyCouponsChangedEventModel couponsChanged; |
| ... | @@ -127,6 +129,10 @@ public class WarplyEventBusManager { | ... | @@ -127,6 +129,10 @@ public class WarplyEventBusManager { |
| 127 | this.refreshUnifiedCouponsAdded = refreshUnifiedCouponsAdded; | 129 | this.refreshUnifiedCouponsAdded = refreshUnifiedCouponsAdded; |
| 128 | } | 130 | } |
| 129 | 131 | ||
| 132 | + public WarplyEventBusManager(WarplyNavigateBackEventModel navigateBackEvent) { | ||
| 133 | + this.navigateBackEvent = navigateBackEvent; | ||
| 134 | + } | ||
| 135 | + | ||
| 130 | public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) { | 136 | public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) { |
| 131 | this.widgetChanged = widgetChanged; | 137 | this.widgetChanged = widgetChanged; |
| 132 | } | 138 | } |
| ... | @@ -321,6 +327,10 @@ public class WarplyEventBusManager { | ... | @@ -321,6 +327,10 @@ public class WarplyEventBusManager { |
| 321 | return serviceUnavailable; | 327 | return serviceUnavailable; |
| 322 | } | 328 | } |
| 323 | 329 | ||
| 330 | + public WarplyNavigateBackEventModel getNavigateBackEventModel() { | ||
| 331 | + return navigateBackEvent; | ||
| 332 | + } | ||
| 333 | + | ||
| 324 | public RefreshVouchersEventModel getRefreshVouchersEventModel() { | 334 | public RefreshVouchersEventModel getRefreshVouchersEventModel() { |
| 325 | return vouchersRefreshed; | 335 | return vouchersRefreshed; |
| 326 | } | 336 | } | ... | ... |
-
Please register or login to post a comment