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

рефакторинг #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package ru.yandex.practicum.contacts.presentation.base;

import androidx.annotation.NonNull;

abstract public class ContactsOrderTypeUi {
protected final String type;
protected final boolean isSelected;

public ContactsOrderTypeUi(@NonNull String type, boolean isSelected) {
this.type = type;
this.isSelected = isSelected;
}

public String getType() {
return type;
}

public boolean isSelected() {
return isSelected;
}

public abstract String createLogMessage();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@

import androidx.annotation.NonNull;

public class FilterContactTypeUi {
import ru.yandex.practicum.contacts.presentation.base.ContactsOrderTypeUi;

private final String type;
private final boolean isSelected;
public class FilterContactTypeUi extends ContactsOrderTypeUi {

public FilterContactTypeUi(@NonNull String type, boolean isSelected) {
this.type = type;
this.isSelected = isSelected;
}

public String getType() {
return type;
super(type,isSelected);
}

@Override
public boolean isSelected() {
return isSelected;
return super.isSelected();
}

public String createLogMessage() {
Expand All @@ -42,3 +37,4 @@ public int hashCode() {
return result;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,15 @@

import androidx.annotation.NonNull;

public class SortTypeUI {
import ru.yandex.practicum.contacts.presentation.base.ContactsOrderTypeUi;

private final String type;
private final boolean isSelected;
public class SortTypeUI extends ContactsOrderTypeUi {

public SortTypeUI(@NonNull String type, boolean isSelected) {
this.type = type;
this.isSelected = isSelected;
}

public String getType() {
return type;
}

public boolean isSelected() {
return isSelected;
super(type, isSelected);
}

@Override
public String createLogMessage() {
return "Выбран тип сортировки: " + type;
}
Expand Down