Update search results and item details layout

This commit is contained in:
Clayton Wilson 2020-10-08 20:54:12 -04:00
parent 379a45fcd0
commit 981fb9ebda
4 changed files with 24 additions and 33 deletions

View File

@ -52,7 +52,6 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
// Load Product object from search results activity
curProduct = (Product) getIntent().getSerializableExtra("SelectedProduct");
// Set up floating action buttons
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
linAddItem = (LinearLayout) findViewById(R.id.lin_add_item);
@ -123,8 +122,8 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
tvItemPrice = (TextView) findViewById(R.id.item_price);
tvItemPrice.setText(String.format("$%.2f", curProduct.getPrice()));
tvItemDesc = (TextView) findViewById(R.id.item_desc);
tvItemDesc.setText(curProduct.getDescription());
// tvItemDesc = (TextView) findViewById(R.id.item_desc);
// tvItemDesc.setText(curProduct.getDescription());
tvCreateNew = (TextView) findViewById(R.id.create_new_list);
tvCreateNew.setVisibility(View.INVISIBLE);

View File

@ -57,8 +57,8 @@ public class SearchResultsListAdapter extends BaseAdapter {
Product product = productList.get(position);
// TODO: If image url is broken, display @drawable/ic_baseline_broken_image_600.xml
Glide.with(activity).load(product.getImageUrl()).into(productImage);
if (product.getItemName().length() >= 35) {
itemName.setText(product.getItemName().substring(0, 35) + "...");
if (product.getItemName().length() >= 60) {
itemName.setText(product.getItemName().substring(0, 60) + "...");
} else {
itemName.setText(product.getItemName());
}

View File

@ -8,15 +8,13 @@
<TextView
android:id="@+id/item_name"
android:layout_width="307dp"
android:layout_width="fill_parent"
android:layout_height="56dp"
android:layout_marginStart="50dp"
android:layout_marginHorizontal="50dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="50dp"
android:text="@string/default_product_name"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -24,26 +22,23 @@
android:id="@+id/store_name"
android:layout_width="126dp"
android:layout_height="28dp"
android:layout_marginStart="52dp"
android:layout_marginTop="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="90dp"
android:text="@string/default_store"
app:layout_constraintBottom_toTopOf="@+id/item_image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<ImageView
android:id="@+id/item_image"
android:layout_width="307dp"
android:layout_width="match_parent"
android:layout_height="224dp"
android:layout_marginStart="50dp"
android:layout_marginTop="120dp"
android:layout_marginEnd="50dp"
android:layout_marginHorizontal="50dp"
android:foregroundGravity="center"
android:background="@color/light_gray"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.75"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/product_image_description" />
@ -56,22 +51,18 @@
android:layout_marginBottom="25dp"
android:text="@string/default__00_00"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@+id/item_desc"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/item_image" />
<TextView
android:id="@+id/item_desc"
android:layout_width="309dp"
android:layout_height="290dp"
android:layout_marginHorizontal="50dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="7dp"
android:text="@string/default_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_image"
app:layout_constraintStart_toStartOf="parent" />
<!-- <TextView-->
<!-- android:id="@+id/item_desc"-->
<!-- android:layout_width="309dp"-->
<!-- android:layout_height="290dp"-->
<!-- android:layout_marginHorizontal="50dp"-->
<!-- android:layout_marginBottom="7dp"-->
<!-- android:text="@string/default_description"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent" />-->
<!-- app:srcCompat="@drawable/ic_baseline_arrow_downward_50"-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -44,6 +44,7 @@
android:paddingTop="20dp"
android:textSize="12sp"
android:layout_toEndOf="@+id/item_image"
android:layout_alignParentBottom="true"
android:text=""/>
<!-- Only displays if the item is cheaper at another store -->