-
Notifications
You must be signed in to change notification settings - Fork 4
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
Iteration 3 review #132
Iteration 3 review #132
Conversation
main to dev
…т хинта (через код в дальнейшем)
Внесены доп исправления
Приведение в порядок
И созданы начальные фрагменты
… работы (страна, регион) А также поведение поля "Ожидаемая зарплата на экране фильтров."
Career hub filter fragment
Добавил новые suspend-методы классы Request и Response DTO модели м и тд
Интерактор для фильтров и di
Фикс отступа экран выбор старны
…fixes Career hub epic4 5 search fixes
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.
) : SharedPrefsRepository { | ||
override suspend fun readSharedPrefs(): SaveFiltersSharedPrefs? { | ||
val json = sharedPreferences.getString(HISTORY, null) ?: return null | ||
/*SaveFiltersSharedPrefs( |
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.
Закоментированный код лучше сразу удалять. Хранить закоментированный код в проекте - плохая практика, в случае чего этот код можно восстановить с помощью истории гита
val newList = ArrayList<Industries>() | ||
list.value.forEach { industryItem -> | ||
if (industryItem.id == industry.id) { | ||
newList.add(industryItem.copy(isChecked = true)) | ||
_selectedIndustry.postValue(industryItem) | ||
_hasSelected.postValue(true) | ||
selectedId = industryItem.id | ||
} else { | ||
newList.add(industryItem) | ||
} |
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.
Здесь можно newList
заменить на mapNotNull
, чтобы не создавать новый мьютабельный список
val sortedList = mutableListOf<Industries>() | ||
val newSortedList = mutableListOf<Industries>() | ||
sortedList.addAll(listOfIndustries) | ||
sortedList.removeAll { | ||
!it.name.contains(request, true) | ||
} | ||
sortedList.forEach { | ||
if (it.id == selectedId) { | ||
newSortedList.add(Industries(it.id, it.name, true)) | ||
_selectedIndustry.postValue(it) | ||
_hasSelected.postValue(true) | ||
} else { | ||
newSortedList.add(it) | ||
} | ||
} |
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.
Здесь тоже лучше через map
сделать, а не через копирование списка и его модификацию, либо filter
, либо map
} | ||
|
||
fun getCountryName(region: Region, isSaving: Boolean) { | ||
viewModelScope.launch(Dispatchers.IO) { |
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.
переключение потоков на IO должен выполнять репозиторий, а не вьюмодель. Вьюмодель не должна знать, из какого источника приходят данные
} | ||
|
||
private fun onItemClicked(country: Country) { | ||
val json = Gson().toJson(country) |
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.
Gson
- тяжёлый объект, его лучше не создавать так часто, а создать такой объект один раз и переиспользовать
import ru.practicum.android.diploma.util.REGION_REQUEST_KEY | ||
|
||
class FilterPlaceOfWorkFragment : Fragment() { | ||
private val binding: FragmentSelectPlaceOfWorkBinding by viewBinding(CreateMethod.INFLATE) |
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.
При использовании viewBinding
во фрагментах обязательно нужно обнулять _binding
в onDestroyView
, иначе будет утечка памяти. Почитать о том, как использовать эту фичу во фрагментах можно тут - https://developer.android.com/topic/libraries/view-binding#fragments. Почитать подробнее про утечку можно здесь - https://stackoverflow.com/questions/65295104/android-view-binding-clear-binding-in-fragment-lifecycle
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.
Не стоит константы хранить в одном общедоступном месте, их следует хранить максимально близко к месту использования и с максимально ограниченной видимостью, желательно private
https://github.com/users/ElchinGasymov/projects/1/views/1
Ссылка на доску
Все поставленные задачи Epic 4,5 выполнены
Количество людей в команде: 5
Первоначальная оценка времени 7 дней, затраченной время 7 дней