-
Notifications
You must be signed in to change notification settings - Fork 0
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
Mvp screens #3
base: development
Are you sure you want to change the base?
Mvp screens #3
Conversation
public static final String PROFILE_ACTIVITY = "profile"; | ||
public static final String EVENTS_ACTIVITY = "events"; | ||
public static final String PEOPLE_ACTIVITY = "people"; | ||
public static final String DIRECTIONS_FRAGMENT = "category"; |
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 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.
переименовал все Category в Directions, кроме этого места
@@ -12,7 +12,7 @@ | |||
@InjectViewState | |||
public final class LoginPresenter extends MvpPresenter<LoginView> { | |||
private final StyleruRouter mRouter; | |||
public AuthorizationInteractor mInteractor; | |||
private AuthorizationInteractor mInteractor; |
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.
Лучше еще и final
MainActivityPresenter(StyleruRouter router){this.mRouter = router;} | ||
|
||
void changeScreen(String key){ | ||
switch (key) { |
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 item = inflater.inflate(R.layout.item_category, mLinearLayout, false); | ||
TextView directionName = item.findViewById(R.id.category_name); | ||
directionName.setText(element); | ||
mLinearLayout.addView(item); |
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 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.
заполняет направления (добавляет в layout каждое направление)
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 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.
зачем? там всего 4 направления...их все равно не будет больше, чем поместится на экране
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 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 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.
Эм, сделать производительность хуже, чем 4 х (inflate + findViewById) сложно
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.
Увидел дизайн.
Нужен ресайклер, тк направления в теории могут добавляться/изчезать/фильтроваться итд.
Ну и эта реализация максимально плохая по производительности
@Override | ||
public void onDestroyView() { | ||
super.onDestroyView(); | ||
mUnbinder.unbind(); |
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.
Зачем unbind?
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 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.
Фрагменты сами справятся со своим уничтожением, там все ок
mPresenter.changeScreen(menuItem); | ||
return true;} | ||
); | ||
return 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.
Все листенеры и другие несрочные действия лучше сделать в onViewCreated
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.
Это для всех фрагментов
|
||
@InjectViewState | ||
public final class DirectionsPresenter extends MvpPresenter<DirectionsView> { | ||
private StyleruRouter mRouter; |
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.
final
EventItem sampleProfile = new EventItem("https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Bufotes_oblongus.jpg/275px-Bufotes_oblongus.jpg", "java meetup", "31.12.2018", "red square"); | ||
List<EventItem> mProfiles = new ArrayList<>(); | ||
for (int i = 0; i < 100; i++){ | ||
mProfiles.add(sampleProfile); |
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.
Используй fill
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.
нет такого метода (для mProfiles)
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.
Collections.fill
break; | ||
case R.id.profile_menu: | ||
mRouter.replaceScreen(ScreenKeys.PROFILE_FRAGMENT); | ||
break; |
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.
Я тут подумал, что презентер теперь слишком сильно привязан к конкретной реализации, это плохо.
Принимать ключ тоже не очень хорошо, вдруг надо сделать что-то перед уходом на конкретный экран.
Сделай в таких кейсах отдельный метод презентера для каждого следующего экрана и дергай его
@@ -100,14 +111,6 @@ private void setLinks(HashMap<String, String> links, View view){ | |||
linkTextViewID = R.id.textView2; | |||
linkEditTextID = R.id.editText2; | |||
break; |
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 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 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 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 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 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 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 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.
А что именно он сказал? Что это за ссылки? Обязательно ли их создавать таким говнокодом или сюда тоже можно ресайклер?
android:layout_width="0dp" | ||
<android.support.design.widget.BottomNavigationView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/bottom_navigation" |
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.
А зачем во фрагменте свой навбар? Он один в MainActivity
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.
там меняется название, а еще ConstraintLayout не поддерживает нормально Include...
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 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.
хз, я bottomnavigation пытался заинклюдить, всегда вверх улетает...
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 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 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.
Размеры ему задай
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip |
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.
Это надо в gitignore
No description provided.