-
Notifications
You must be signed in to change notification settings - Fork 0
Feedback about the feedback #1
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
base: submitted_solution
Are you sure you want to change the base?
Conversation
|
That's the feedback I got. Application works and looks fine, but doesn't have a wow effect. |
|
I have a problem with a proper understanding of these below four points.
|
| import timber.log.Timber; | ||
|
|
||
| //todo There’s no clear separation of architecture layer. You made a `domain` package, but inside are Android SDK dependencies. | ||
| public class LocationApiHandler extends LocationCallback { |
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.
I use this class as my data source. Is it OK from the architecture point of view?
| @@ -0,0 +1,43 @@ | |||
| package com.nowak.wjw.simplecompass.domain; | |||
|
|
|||
| import android.location.Location; | |||
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.
Reviewer comment - "There’s no clear separation of architecture layer. You made a domain package, but inside are Android SDK dependencies."
I don't understand why Location cannot be here.
I need to take it and process it.
I can understand that it shouldn't be in viewModel or fragment,- but here? - why not?
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.
Osoba która robiła ci review zwraca ci uwagę na to że warstwa domeny posiada zależności stricte z androida.
Generalnie z tego co widzę to próbujesz użyć wszystkiego na co zwrócisz uwagę na internecie, a brakuję ci wiedzy i doświadczenia żeby to wszystko spiąć w logiczną całość. Nawet radziłbym używać mniej złożonej architektury a starać się oddzielić warstwę prezentacji,danych i logiki.
| package com.nowak.wjw.simplecompass; | ||
| package com.nowak.wjw.simplecompass.ui.main; | ||
|
|
||
| public enum CompassStateEnum { |
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.
where is the place for that enum? what package?
| private ActivityResultLauncher<String> requestPermissionLauncher = | ||
| registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> { |
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.
Is this the right place for that launcher? Please confirm or explain otherwise.
| mViewModel.needScreenOrientation.observe(getViewLifecycleOwner(), isNeeded -> { | ||
| if (isNeeded) { | ||
| int mScreenRotation = requireActivity().getWindowManager().getDefaultDisplay().getRotation(); | ||
| mViewModel.provideScreenRotation(mScreenRotation); |
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.
what would be a better way to do this?
putting it inside onResume didn't work cause when you flip your phone by 180degrees there is no onCreate triggered.
| isRequestingLocationUpdates = true; | ||
| if (!foundLastLocation) configureLocation(); | ||
| findButtonClicked(); | ||
| btnClickAllowed(); |
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.
I would like to deal with the buttonClicked directly in ViewModel, but I cannot figure out how to do that.
VM registers the click and need to check if permission granted.
If yes that's awesome, easy.
But if not, he needs to notify fragment about that ,and later if permission granted, the vm.buttonClicked has to be called once again with appropriate params - I don't know how to handle it
| import com.nowak.wjw.simplecompass.domain.StartStopSensorListenerUseCase; | ||
|
|
||
| import timber.log.Timber; | ||
|
|
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.
Reviewers comment - "You use ViewModel where most of the logic dwells, but it’s strongly coupled to Android Data Binding, so I can’t take it as an MVVM."
I don't understand that
| @@ -1,24 +0,0 @@ | |||
| package com.nowak.wjw.simplecompass | |||
|
|
|||
| open class Event<out T>(private val content: T) { | |||
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.
Pisałeś sam tę klasę czy skądś brałeś ? Czemu nie piszesz w kotlinie tak w ogóle ?
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.
https://medium.com/androiddevelopers/livedata-with-snackbar-navigation-and-other-events-the-singleliveevent-case-ac2622673150
stwierdziłem, że opanuje pewne rzeczy najpierw w Javie (javaRx, dagger itp) a później będę się uczył kotlina.
Ale zaczłąem już się uczyć, bo po ogłoszeniach na pracę, widze , że bez kotlina to ciężko
|
chcesz teraz pogadać ?
czw., 23 lip 2020 o 16:36 Wojtek (Voytech) <[email protected]>
napisał(a):
… ***@***.**** commented on this pull request.
------------------------------
In app/src/main/java/com/nowak/wjw/simplecompass/Event.kt
<#1 (comment)>:
> @@ -1,24 +0,0 @@
-package com.nowak.wjw.simplecompass
-
-open class Event<out T>(private val content: T) {
https://medium.com/androiddevelopers/livedata-with-snackbar-navigation-and-other-events-the-singleliveevent-case-ac2622673150
stwierdziłem, że opanuje pewne rzeczy najpierw w Javie (javaRx, dagger
itp) a później będę się uczył kotlina.
Ale zaczłąem już się uczyć, bo po ogłoszeniach na pracę, widze , że bez
kotlina to ciężko
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEN2TVKQMANMZIDBCZKLEGLR5BDITANCNFSM4PCGJ2JA>
.
--
*Holak Mateusz*
|
holakmateusz
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.
zrobiłem ci review
| // calculate th rotation matrix | ||
| SensorManager.getRotationMatrixFromVector(rMat, event.values); | ||
| int lAzimuth = (int) (Math.toDegrees(SensorManager.getOrientation(rMat, orientation)[0]) + 360) % 360; | ||
| return lAzimuth; |
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.
return w 1 linii
app/src/main/java/com/nowak/wjw/simplecompass/data/LocationCoordinates.kt
Show resolved
Hide resolved
app/src/main/java/com/nowak/wjw/simplecompass/data/location/LocationApiHandler.java
Show resolved
Hide resolved
app/src/main/java/com/nowak/wjw/simplecompass/data/location/LocationApiHandler.java
Show resolved
Hide resolved
| public LiveData<Boolean> hideKeyBoard; | ||
| public LiveData<Boolean> showLocationError; | ||
| private MutableLiveData<Boolean> mShouldProvideRationale = new MutableLiveData<>(false); | ||
| public LiveData<Event<Boolean>> shouldProvideRationale = Transformations.map(mShouldProvideRationale, should -> new Event(should)); |
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.
lambda ?
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.
pytasz, czy sugerujesz?
jak dla mnie to lambda jest ;P
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.
można to uproscic
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.
nie jest to dla mnie widoczne na pierwszy rzut oka, zastanowie sie i dam znać
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.
chodzi mi o to że można zrobić odwołanie do elementu klasy, u ciebie by to było Event::new
| private MutableLiveData<Boolean> mStartLocationUpdates = new MutableLiveData<>(false); | ||
| private MutableLiveData<Integer> mScreenOrientation = new MutableLiveData<>(0); | ||
| private LiveData<Integer> mAzimuth; | ||
| private MutableLiveData<LocationCoordinates> mDestinationCoordinates = new MutableLiveData<>(); |
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.
generalnie mam wrażenie że tego nie wiesz ale możę się mylę: mutableLiveData jest ukrywana po to żeby nikt z zewnątrz jej nie modyfikował - wystawiamy liveData jako immutableData które można obserwować. PRzez to że wszędzie używasz dataBinding używasz liveData co jest w sumie spoko.
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.
intencjonalnie pola MutableLiveData są prywatne, a wszystko co udostępniam, udostępniam jako LiveDate - właśnie, żeby nie można było przy tym grzebać.
| public LiveData<Event<Boolean>> requestLocationPermission = Transformations.map(mRequestLocationPermission, request -> new Event<>(request)); | ||
|
|
||
|
|
||
| public MainViewModel(GetAzimuthUseCase getAzimuthUseCase, StartStopSensorListenerUseCase startStopSensorListenerUseCase, InitiateLastLocationUseCase initiateLastLocationUseCase, RequestAndStopLocationUpdatesUseCase requestAndStopLocationUpdatesUseCase, GetDestinationBearingUseCase getDestinationBearingUseCase) { |
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.
ten konstruktor jest tragicznie długi, samo formatowanie jużby pomogło.
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.
co do tego konstruktora to mam pytanie - czy inicjalizować te zmienne w konstruktorze, czy lepiej utworzyć metody które będą je ekspozycjonować, np
public LiveData getDestArrowRotation(){
return Transformations.switchMap(mDestinationBearing, b -> {
Timber.d("destArrowRotation");
if (b == null) return null;
return Transformations.map(needleRotation, r -> {
Timber.d("needleRotation");
return r + b;
});
});
tylko, że wtedy za każdym razem kiedy wywołany tę metodę to będziemy na nowo wywoływać ten kod, a tak to tylko raz go wywołujemy - plus Transformacje go wywołują, ale to i tak by się działo...
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.
po to masz blok inicjalizujący init żeby takie startowe operacje wykonać w momencie użycia viewModelu.
holakmateusz
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.
1 uwaga
| class Event<out T>(private val content: T) { | ||
|
|
||
| var hasBeenHandled = false | ||
| private set // Allow external read but not write |
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.
property jako private i setter wtedy będzie zbędny
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.
tak w ogole ta klasa dla mnie ma mały sens, funkcjonalnie ją rozumiem ale jest bez sensu napisana. JAk bym coś kopiowal to juz jakies dobre rozwiazania a nie jakis kod pisany na kolanie przez kogos.
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 ja jeszcze nie do końca potrafie odróżnić jedno od drugiego LOL
| } else { | ||
| hasBeenHandled = true | ||
| content | ||
| } |
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.
when (hasBeenHandled) {
true -> null
false -> {
hasBeenHandled = true
content
}
}
I got feedback from the reviewer, but