Skip to content
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

Switch location #82

Merged
merged 8 commits into from Mar 16, 2020
Merged

Conversation

jeevansurendran
Copy link
Contributor

Everything other than the main page where the location needs to be shown is implemented i guess.

Signed-off-by: Jeevan Surendran <jvns67@gmail.com>
Signed-off-by: Jeevan Surendran <jvns67@gmail.com>
Signed-off-by: Jeevan Surendran <jvns67@gmail.com>
liveViewModel.clearCartData.observe(this, Observer { })

mViewModel.setCityId(getCityId())
Copy link
Member

Choose a reason for hiding this comment

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

You're calling fetchNearbyRestaurants twice because of setCityId call. No need to waste mobile data twice in getting the same data.

cityListener { _ ->
val preferences = requireActivity().getSharedPreferences(Constants.LOCATION_CITY_FILE, Context.MODE_PRIVATE)
with(preferences.edit()) {
putInt(Constants.LOCATION_CITY_ID, model.id)
Copy link
Member

Choose a reason for hiding this comment

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

The coding pattern is really wrong here.
You're using a model variable bound to the one in loop. It's better to use the interface I mentioned above and declare the parameters for city data

Copy link
Member

Choose a reason for hiding this comment

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

You still didn't change that. I already mentioned to properly use interface and use the parameters in the interface

@jeevansurendran
Copy link
Contributor Author

Current location shouldn't be shown when typed

Copy link
Member

@shivanshs9 shivanshs9 left a comment

Choose a reason for hiding this comment

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

There's still stuff to clean up.

cityListener { _ ->
val preferences = requireActivity().getSharedPreferences(Constants.LOCATION_CITY_FILE, Context.MODE_PRIVATE)
with(preferences.edit()) {
putInt(Constants.LOCATION_CITY_ID, model.id)
Copy link
Member

Choose a reason for hiding this comment

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

You still didn't change that. I already mentioned to properly use interface and use the parameters in the interface

val homeViewModel: HomeViewModel by activityViewModels()
@BindView(R.id.et_user_location)
internal lateinit var etUserLocation: EditText

Copy link
Member

Choose a reason for hiding this comment

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

Don't waste lines in between View fields... Fix that in all the files (like holder)


class UserLocationFragment : BaseFragment() {
override val rootLayout = R.layout.fragment_user_location_switch
val viewModel: UserLocationViewModel by viewModels()
Copy link
Member

Choose a reason for hiding this comment

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

Declare these variables after all the UI views are declared. Always keep rootLayout at the top, though.


@BindView(R.id.tv_user_location_state)
internal lateinit var tvStateLocation: TextView

Copy link
Member

Choose a reason for hiding this comment

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

Lots of needless blank lines here too. Always try and keep your code compact.

Signed-off-by: Jeevan Surendran <jvns67@gmail.com>
shivanshs9 added a commit that referenced this pull request Mar 16, 2020
- Added swipe refresh in closed sessions listing
- Cleaned Util logic to format duration
- Fixed bug in UserLocationFragment not attached when selecting any option
- Used default SharedPreferences for location too
- Used proper way to use appbar by mentioning theme in manifest
- Used the core manifest for new screens

Signed-off-by: Shivansh Saini <shivanshs9@gmail.com>
@shivanshs9 shivanshs9 merged commit 5a803fc into checkin-team:develop Mar 16, 2020
@jeevansurendran jeevansurendran deleted the switch-location branch March 16, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants