This UI operation should not be in the Repository. The repo should just return the No network message to UI. The UI should see if status error and the message is no network then call a base activity method that shows the toast: showNetworkNotAvailableMessage() ( method in base activity )
This UI operation should not be in the Repository. The repo should just return the No network message to UI. The UI should see if status error and the message is no network then call a base activity method that shows the toast: showNetworkNotAvailableMessage() ( method in base activity )
if (context instanceof LoginActivity) {
((LoginActivity) context).runOnUiThread(new Runnable() { @Override public void run() {
We don’t need this codes anymore, and the method doesn’t need to take a context parameter, as it already has a context.
if (context instanceof LoginActivity) {
((LoginActivity) context).runOnUiThread(new Runnable() {
@Override public void run() {
We don't need this codes anymore, and the method doesn't need to take a context parameter, as it already has a context.
This UI operation should not be in the Repository. The repo should just return the No network message to UI. The UI should see if status error and the message is no network then call a base activity method that shows the toast: showNetworkNotAvailableMessage() ( method in base activity )
if (context instanceof LoginActivity) {
((LoginActivity) context).runOnUiThread(new Runnable() {
@Override public void run() {
We don’t need this codes anymore, and the method doesn’t need to take a context parameter, as it already has a context.
Fix hardcode. Keep the param as static in repository class.
Swap the variables for readability. if(userStatusResource.message.equals(“no network”)){
Fix the hardcode, reuse the static property in LoginActivity too.
Reviewers
8d605ba5c1
.