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 14:33:44 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a187c60a4716ff59c4028ae247c3edf980e94cb3
a187c60a
1 parent
3978fb53
fixed home
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
49 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
a187c60
package
ly
.
warp
.
sdk
.
activities
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.view.MenuItem
;
import
androidx.annotation.NonNull
;
...
...
@@ -10,6 +12,8 @@ import androidx.fragment.app.FragmentActivity;
import
com.google.android.material.bottomnavigation.BottomNavigationView
;
import
com.google.android.material.navigation.NavigationBarView
;
import
org.json.JSONException
;
import
java.util.HashMap
;
import
ly.warp.sdk.R
;
...
...
@@ -61,19 +65,19 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
}).
start
();
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
Warply
.
getInbox
(
new
WarplyInboxRequest
().
setUseCache
(
false
),
mInboxReceiver
);
}
}).
start
();
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getUserCoupons
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
}).
start
();
initViews
();
//
new Thread(() -> {
//
if (!Thread.currentThread().isInterrupted()) {
//
Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
//
}
//
}).start();
//
//
new Thread(() -> {
//
if (!Thread.currentThread().isInterrupted()) {
//
WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
//
}
//
}).start();
//
initViews();
}
@Override
...
...
@@ -145,7 +149,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
public
void
onSuccess
(
Consumer
result
)
{
mConsumer
=
result
;
Thread
.
currentThread
().
interrupt
();
// Thread.currentThread().interrupt();
Warply
.
getInbox
(
new
WarplyInboxRequest
().
setUseCache
(
false
),
mInboxReceiver
);
}
@Override
...
...
@@ -154,43 +159,45 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
};
private
final
CallbackReceiver
<
CampaignList
>
mInboxReceiver
=
new
CallbackReceiver
<
CampaignList
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
for
(
Campaign
campaign
:
result
)
{
if
(
mUniqueCampaignList
.
containsKey
(
campaign
.
getOfferCategory
().
trim
()))
{
CampaignList
tempCampaignList
=
(
CampaignList
)
mUniqueCampaignList
.
get
(
campaign
.
getOfferCategory
().
trim
());
tempCampaignList
.
add
(
campaign
);
mUniqueCampaignList
.
put
(
campaign
.
getOfferCategory
().
trim
(),
tempCampaignList
);
}
else
{
CampaignList
tempCampaignList
=
new
CampaignList
();
tempCampaignList
.
add
(
campaign
);
mUniqueCampaignList
.
put
(
campaign
.
getOfferCategory
().
trim
(),
tempCampaignList
);
}
}
Thread
.
currentThread
().
interrupt
();
private
final
CallbackReceiver
<
CampaignList
>
mInboxReceiver
=
new
CallbackReceiver
<
CampaignList
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
for
(
Campaign
campaign
:
result
)
{
if
(
mUniqueCampaignList
.
containsKey
(
campaign
.
getOfferCategory
().
trim
()))
{
CampaignList
tempCampaignList
=
(
CampaignList
)
mUniqueCampaignList
.
get
(
campaign
.
getOfferCategory
().
trim
());
tempCampaignList
.
add
(
campaign
);
mUniqueCampaignList
.
put
(
campaign
.
getOfferCategory
().
trim
(),
tempCampaignList
);
}
else
{
CampaignList
tempCampaignList
=
new
CampaignList
();
tempCampaignList
.
add
(
campaign
);
mUniqueCampaignList
.
put
(
campaign
.
getOfferCategory
().
trim
(),
tempCampaignList
);
}
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
mCouponList
=
result
;
Thread
.
currentThread
().
interrupt
();
}
// Thread.currentThread().interrupt();
WarplyManager
.
getUserCoupons
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
mCouponList
=
result
;
Thread
.
currentThread
().
interrupt
();
new
Handler
(
Looper
.
getMainLooper
()).
post
(()
->
{
initViews
();
});
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
}
...
...
Please
register
or
login
to post a comment