From 37fdf104d537e2798b6f169f745a1c5075d25f39 Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Sat, 5 Jan 2019 18:21:20 +0400 Subject: [PATCH] Added others details --- .../ThirdLevelNodeViewBinder.java | 3 + .../vrcatalog/view/DetailActivity.java | 15 ++- app/src/main/res/layout/activity_detail.xml | 94 ++++++++++++++++--- 3 files changed, 97 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/ru/volgorobot/vrcatalog/nodeViewBinders/ThirdLevelNodeViewBinder.java b/app/src/main/java/ru/volgorobot/vrcatalog/nodeViewBinders/ThirdLevelNodeViewBinder.java index d7c55ae..c3365b9 100644 --- a/app/src/main/java/ru/volgorobot/vrcatalog/nodeViewBinders/ThirdLevelNodeViewBinder.java +++ b/app/src/main/java/ru/volgorobot/vrcatalog/nodeViewBinders/ThirdLevelNodeViewBinder.java @@ -75,6 +75,9 @@ public class ThirdLevelNodeViewBinder extends BaseNodeViewBinder { intent.putExtra("detailName", result.getData().getName()); intent.putExtra("detailQuantity", result.getData().getNumber().toString()); intent.putExtra("detailPrice", result.getData().getPrice()); + intent.putExtra("detailContry", result.getData().getCountry()); + intent.putExtra("detailAnalogue", result.getData().getAnalogue()); + intent.putExtra("detailDatasheet", result.getData().getDocURL()); intent.putExtra("detailNotes", result.getData().getNotes()); mView.startActivityByIntent(intent); break; diff --git a/app/src/main/java/ru/volgorobot/vrcatalog/view/DetailActivity.java b/app/src/main/java/ru/volgorobot/vrcatalog/view/DetailActivity.java index 44e90fc..5e95a3c 100644 --- a/app/src/main/java/ru/volgorobot/vrcatalog/view/DetailActivity.java +++ b/app/src/main/java/ru/volgorobot/vrcatalog/view/DetailActivity.java @@ -3,6 +3,7 @@ package ru.volgorobot.vrcatalog.view; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.text.method.LinkMovementMethod; import android.view.MenuItem; import android.widget.EditText; import android.widget.TextView; @@ -13,6 +14,9 @@ public class DetailActivity extends AppCompatActivity { TextView nameView; TextView quantityView; TextView priceView; + TextView countryView; + TextView analogueView; + TextView datasheetView; EditText notesView; @Override @@ -26,9 +30,12 @@ public class DetailActivity extends AppCompatActivity { Intent intent = getIntent(); nameView.setText(intent.getStringExtra("detailName")); - quantityView.setText(intent.getStringExtra("detailQuantity")); + quantityView.setText(intent.getStringExtra("detailQuantity").equals("0") ? "Нет на складе" : intent.getStringExtra("detailQuantity")); priceView.setText(intent.getStringExtra("detailPrice")); - notesView.setText(intent.getStringExtra("detailNotes")); + countryView.setText(intent.getStringExtra("detailCountry")); + analogueView.setText(intent.getStringExtra("detailAnalogue").equals("") ? "Нет аналогов" : intent.getStringExtra("detailAnalogue")); + datasheetView.setText(intent.getStringExtra("detailDatasheet").equals(" ") ? "Нет" : intent.getStringExtra("detailDatasheet")); + notesView.setText(intent.getStringExtra("detailNotes").equals("") ? "Нет описания" : intent.getStringExtra("detailNotes")); } void initializeViews() { @@ -36,6 +43,10 @@ public class DetailActivity extends AppCompatActivity { quantityView = findViewById(R.id.quantity); priceView = findViewById(R.id.price); notesView = findViewById(R.id.notes); + countryView = findViewById(R.id.country); + analogueView = findViewById(R.id.analogue); + datasheetView = findViewById(R.id.datasheet); + datasheetView.setMovementMethod(LinkMovementMethod.getInstance()); } @Override diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml index 1d1daf9..5727204 100644 --- a/app/src/main/res/layout/activity_detail.xml +++ b/app/src/main/res/layout/activity_detail.xml @@ -29,11 +29,11 @@ android:id="@+id/notes_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="7dp" + android:layout_marginTop="172dp" android:text="Описание: " android:textAppearance="@style/TextAppearance.AppCompat.Body1" - app:layout_constraintStart_toStartOf="@+id/price_text" - app:layout_constraintTop_toBottomOf="@+id/price_text" /> + app:layout_constraintStart_toStartOf="@+id/notes" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="@+id/name" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/notes_text"> + @@ -80,8 +86,70 @@ android:id="@+id/price" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="7dp" + android:layout_marginBottom="11dp" android:text="TextView" - app:layout_constraintStart_toEndOf="@+id/price_text" - app:layout_constraintTop_toBottomOf="@+id/quantity_text" /> + app:layout_constraintBottom_toTopOf="@+id/country_text" + app:layout_constraintStart_toEndOf="@+id/price_text" /> + + + + + + + + + + + + \ No newline at end of file