Skip to content

Conversation

@liveHarshit
Copy link
Member

@liveHarshit liveHarshit commented Sep 27, 2018

Fixes #283

Screenshots of Eventyay and Evantbrite :

@liveHarshit
Copy link
Member Author

liveHarshit commented Sep 27, 2018

onClickListner{} fot TextView is not working when TextView is outside android.support.v4.widget.NestedScrollView . Please suggest me what should I do?

@liveHarshit liveHarshit changed the title feat: Show no internet error in search activity (#283) feat: Show no internet error in search activity Sep 27, 2018
<string name="no_search_results">Hmmm, we\'\re not getting\nany results. Our bad - try\nanother search</string>
<string name="event_details">Event details</string>
<string name="see_maps">See maps</string>
<string name="error_message">There was an error. Tab here to try again.</string>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check whether the message is similar in EventBrite

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is similar in the updated version of EventBrite.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please attach a screenshot of how it looks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please attach a screenshot of how it looks?

Uploaded in PR description.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liveHarshit "Tap" here to try again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liveHarshit "Tap" here to try again

Updated.

@liveHarshit liveHarshit force-pushed the issue283 branch 2 times, most recently from 7a6cbdf to b10ebd4 Compare September 28, 2018 05:30
}
searchView.setOnQueryTextListener(queryListener)
rootView.fabSearch.setOnClickListener {
showNoInternetScreen(isNetworkConnected())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move logic to view model, see how its done in login fragment and login fragment vm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move logic to view model, see how its done in login fragment and login fragment vm

But in event fragment it in not done in view model for check network connection, so I did the same. Shold I change it?

Copy link
Contributor

@shikhart98 shikhart98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an XML content_no_internet. You can use that instead.

Copy link
Member

@iamareebjamal iamareebjamal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all logic to ViewModels of respective fragments

@liveHarshit
Copy link
Member Author

@iamareebjamal Updated.

}

showNoInternetScreen(isNetworkConnected())
eventsViewModel.showNoInternetScreen(rootView)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View should not be passed to ViewModel


import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import android.view.View
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No android imports in ViewModel

import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.content_no_internet.view.*
import kotlinx.android.synthetic.main.fragment_events.view.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


private val compositeDisposable = CompositeDisposable()
private val tokenKey = "LOCATION"
private val networkData = Network()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inject instead of initializing

import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.fragment_search.view.*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

val progress = MutableLiveData<Boolean>()
val events = MutableLiveData<List<Event>>()
val error = MutableLiveData<String>()
private val networkData = Network()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

<dimen name="layout_margin_moderate">10dp</dimen>
<dimen name="layout_margin_large">16dp</dimen>
<dimen name="layout_margin_extra_large">32dp</dimen>
<dimen name="layout_margin_very_large">56dp</dimen>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very < extra

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I change extra large 32dp to very large line 19 or take extra extra large for 56dp?

@liveHarshit
Copy link
Member Author

@iamareebjamal If all these conditions, Which logic should I move in view model. For check network state, Network class is there. The only logic I use is showing no internet display and I did the same as done before in EvnetFragment. In event fragment I remove only one method of check internet state because it is already written in Network class and I call it directly. Now please suggest exactly what should I do?

@iamareebjamal
Copy link
Member

The ViewModel should communicate with Activity/Fragment using LiveData only

@liveHarshit
Copy link
Member Author

@iamareebjamal Updated.

simarsingh24
simarsingh24 previously approved these changes Sep 30, 2018
}

showNoInternetScreen(isNetworkConnected())
showNoInternetScreen(eventsViewModel.isNetworkConnected())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The viewmodel should push the change to the observing fragment instead of you querying the viewmodel

Copy link
Member Author

@liveHarshit liveHarshit Sep 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The viewmodel should push the change to the observing fragment instead of you querying the viewmodel

Then which logic should I move in respective ViewModels? Here I can direct check network connection from network class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I call it like showNoInternetScreen(searchViewModel.network.isNetworkConnected()) directly and make val network: Network insted of private val network: Network in view model?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at how we are communicating with LiveData in other places

@liveHarshit
Copy link
Member Author

@iamareebjamal Updated.

@fossasia fossasia deleted a comment Oct 16, 2018
@fossasia fossasia deleted a comment Oct 16, 2018
@simarsingh24
Copy link
Member

@liveHarshit please resolve conflicts and update the PR. It's not nice to keep PR lying for month

@liveHarshit
Copy link
Member Author

I will update it. Is the PR ready for merge at this solution or changes require?

@iamareebjamal
Copy link
Member

As far as I can see, the previous requested change is not resolved

@liveHarshit
Copy link
Member Author

@iamareebjamal @simarsingh24 Everything is updated as suggested. Please review.

@iamareebjamal iamareebjamal merged commit 179dc99 into fossasia:development Dec 7, 2018
@liveHarshit liveHarshit deleted the issue283 branch January 6, 2019 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants