Skip to content

Homework_9 (View-Resources) implementation.#63

Open
Vp-Ma wants to merge 1 commit intoAndroid-Developer-Basic:masterfrom
Vp-Ma:master
Open

Homework_9 (View-Resources) implementation.#63
Vp-Ma wants to merge 1 commit intoAndroid-Developer-Basic:masterfrom
Vp-Ma:master

Conversation

@Vp-Ma
Copy link

@Vp-Ma Vp-Ma commented Jan 7, 2026

No description provided.

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Order Total:"

Choose a reason for hiding this comment

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

Хоть репозиторий учебный, ресурсы текстовые и размерные всегда лучше выносить отдельно, как привычка

android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Order Total:"
android:textSize="28dp"

Choose a reason for hiding this comment

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

Для размеров текста нужно использовать sp (scale-independent pixels), а не dp. Это важно для доступности sp учитывает настройки масштаба текста пользователя в системе. Если пользователь увеличил размер шрифта в настройках, текст с sp автоматически станет больше, а с dp останется прежним

textCartShippingAmount = findViewById<TextView>(R.id.textCartShippingAmount)
textCartTaxAmount = findViewById<TextView>(R.id.textCartTaxAmount)

cartItemInc = findViewById<View>(R.id.сart_item_inc_1)

Choose a reason for hiding this comment

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

Один и тот же код повторяется 4 раза для установки текста элементов корзины. Это нарушает принцип DRY. Вынесите это в цикл или функцию, чтобы код был более читаемым

textCartShipping = findViewById<TextView>(R.id.textCartShipping)
textCartTax = findViewById<TextView>(R.id.textCartTax)
textCartItemCount = findViewById<TextView>(R.id.textCartItemCount)
textCartOrderTotalAmount = findViewById<TextView>(R.id.textCartOrderTotalAmount)

Choose a reason for hiding this comment

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

Переменные инициализируются, но значения устанавливаются напрямую в XML или через строковые ресурс, а не через эти переменные. Это лишний код, который усложняет понимание

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.

2 participants