-
Notifications
You must be signed in to change notification settings - Fork 555
feat: Show no internet error in search activity #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
app/src/main/java/org/fossasia/openevent/general/search/SearchFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/res/values/strings.xml
Outdated
| <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> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
c1e271a to
8bd642e
Compare
app/src/main/java/org/fossasia/openevent/general/event/EventsFragment.kt
Show resolved
Hide resolved
7a6cbdf to
b10ebd4
Compare
| } | ||
| searchView.setOnQueryTextListener(queryListener) | ||
| rootView.fabSearch.setOnClickListener { | ||
| showNoInternetScreen(isNetworkConnected()) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
app/src/main/java/org/fossasia/openevent/general/data/Network.kt
Outdated
Show resolved
Hide resolved
b10ebd4 to
6a6c54d
Compare
shikhart98
left a comment
There was a problem hiding this 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.
iamareebjamal
left a comment
There was a problem hiding this 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
6a6c54d to
36f9921
Compare
|
@iamareebjamal Updated. |
| } | ||
|
|
||
| showNoInternetScreen(isNetworkConnected()) | ||
| eventsViewModel.showNoInternetScreen(rootView) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.* |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.* |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
app/src/main/res/values/dimens.xml
Outdated
| <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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very < extra
There was a problem hiding this comment.
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?
|
@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? |
|
The ViewModel should communicate with Activity/Fragment using LiveData only |
36f9921 to
3b7294b
Compare
|
@iamareebjamal Updated. |
| } | ||
|
|
||
| showNoInternetScreen(isNetworkConnected()) | ||
| showNoInternetScreen(eventsViewModel.isNetworkConnected()) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
0a124fe to
6446c16
Compare
|
@iamareebjamal Updated. |
|
@liveHarshit please resolve conflicts and update the PR. It's not nice to keep PR lying for month |
|
I will update it. Is the PR ready for merge at this solution or changes require? |
|
As far as I can see, the previous requested change is not resolved |
|
@iamareebjamal @simarsingh24 Everything is updated as suggested. Please review. |
Fixes #283
Screenshots of Eventyay and Evantbrite :