Improve layout

This commit is contained in:
Nezumi
2023-04-04 21:33:31 +07:00
parent e763d07c7e
commit d8a35888a1
14 changed files with 34 additions and 73 deletions
@@ -72,7 +72,7 @@ import vn.zalopay.sdk.listeners.PayOrderListener;
public class OrderCheckOutActivity extends AppCompatActivity {
private static final String TAKE_FOOD_FROM_SHOP = "Đến shop lấy";
private static final String ZALO_PAYMENT_METHOD = "ZALO PAY";
private static final String ZALO_PAYMENT_METHOD = "Zalo Pay";
private static final String CASH_PAYMENT = "CASH";
private static Double LAT_SHOP = 0.0;
private static Double LNG_SHOP = 0.0;
@@ -216,7 +216,7 @@ public class SignUpActivity extends AppCompatActivity {
signUp(user);
} else {
loadCompleted();
Toast.makeText(SignUpActivity.this, "Email or Phone exist!", Toast.LENGTH_SHORT).show();
Toast.makeText(SignUpActivity.this, "Địa chỉ email hoặc số điện thoại đã trùng, vui lòng kiểm tra lại!", Toast.LENGTH_SHORT).show();
}
}
@@ -250,6 +250,7 @@ public class VerifyAccountActivity extends AppCompatActivity {
progressLayout.setVisibility(View.GONE);
//Create user success;
Toast.makeText(VerifyAccountActivity.this, "Tạo tài khoản thành công!", Toast.LENGTH_SHORT).show();
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(VerifyAccountActivity.this, SignInActivity.class));
finish();
} else {
@@ -57,14 +57,7 @@ public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.FoodViewHolder
return;
}
String foodName = food.getName();
if(foodName.length() >= 24){
StringBuilder stringBuilder = new StringBuilder(food.getName());
stringBuilder.replace(24, food.getName().length(), "..." );
holder.name.setText(stringBuilder);
} else {
holder.name.setText(foodName);
}
holder.name.setText(food.getName());
//When food does not have image
if(food.getImages().size() == 0){
@@ -56,25 +56,9 @@ public class FoodSearchAdapter extends RecyclerView.Adapter<FoodSearchAdapter.Fo
}
//Init data
String foodName = food.getName();
if(foodName.length() >= LENGTH_CHARACTER){
StringBuilder stringBuilder = new StringBuilder(food.getName());
stringBuilder.replace(LENGTH_CHARACTER, food.getName().length(), "..." );
holder.name.setText(stringBuilder);
} else {
holder.name.setText(foodName);
}
String shopName = food.getShop().getName();
if(shopName.length() >= 18){
StringBuilder stringBuilder = new StringBuilder(food.getShop().getName());
stringBuilder.replace(18, food.getShop().getName().length(), "..." );
holder.shopName.setText(stringBuilder);
} else {
holder.shopName.setText(shopName);
}
holder.name.setText(food.getName());
holder.shopName.setText(food.getShop().getName());
//When food does not have image
if(food.getImages().size() == 0){
@@ -61,23 +61,9 @@ public class FoodShopAdapter extends RecyclerView.Adapter<FoodShopAdapter.FoodSh
}
holder.price.setText(Common.changeCurrencyUnit(food.getCost()));
String foodName = food.getName();
if(foodName.length() >= MAX_CHARACTER){
StringBuilder stringBuilder = new StringBuilder(food.getName());
stringBuilder.replace(MAX_CHARACTER, food.getName().length(), "..." );
holder.foodName.setText(stringBuilder);
} else {
holder.foodName.setText(foodName);
}
holder.foodName.setText(food.getName());
String description = food.getDescription();
if(description.length() >= MAX_CHARACTER){
StringBuilder stringBuilder = new StringBuilder(food.getDescription());
stringBuilder.replace(MAX_CHARACTER, food.getDescription().length(), "..." );
holder.description.setText(stringBuilder);
} else {
holder.description.setText(description);
}
holder.description.setText(food.getDescription());
//Check value discountPercent
float cost;
@@ -46,26 +46,9 @@ public class OrderDetailAdapter extends RecyclerView.Adapter<OrderDetailAdapter.
holder.shop_name.setText(food.getShopName());
holder.quantity.setText("Số lượng: " + food.getQuantity());
String foodName = food.getName();
if(foodName.length() >= 35){
StringBuilder stringBuilder = new StringBuilder(food.getName());
stringBuilder.replace(35, food.getName().length(), "..." );
holder.food_name.setText(stringBuilder);
} else {
holder.food_name.setText(foodName);
}
String shopName = food.getShopName();
if(shopName.length() >= 18){
StringBuilder stringBuilder = new StringBuilder(food.getShopName());
stringBuilder.replace(18, food.getShopName().length(), "..." );
holder.shop_name.setText(stringBuilder);
} else {
holder.shop_name.setText(shopName);
}
holder.food_name.setText(food.getName());
holder.shop_name.setText(food.getShopName());
//Check value discountPercent
float cost = 0;
@@ -50,15 +50,7 @@ public class ShopAdapter extends RecyclerView.Adapter<ShopAdapter.ShopViewHolder
//Init data
Picasso.get().load(shop.getImageUrl()).into(holder.imageView);
String shopName = shop.getName();
if(shopName.length() >= 24){
StringBuilder stringBuilder = new StringBuilder(shop.getName());
stringBuilder.replace(24, shop.getName().length(), "..." );
holder.shopName.setText(stringBuilder);
} else {
holder.shopName.setText(shopName);
}
holder.shopName.setText(shop.getName());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
@@ -78,6 +78,8 @@
android:layout_marginEnd="10dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
android:maxLines="2"
android:ellipsize="end"
/>
<LinearLayout
@@ -105,6 +107,8 @@
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_1"
android:maxLines="1"
android:ellipsize="end"
/>
<LinearLayout
@@ -76,6 +76,8 @@
android:layout_marginTop="5dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
android:maxLines="2"
android:ellipsize="end"
/>
<TextView
@@ -90,6 +92,8 @@
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_1"
android:maxLines="1"
android:ellipsize="end"
/>
<LinearLayout
@@ -43,6 +43,8 @@
android:layout_marginTop="5dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
android:maxLines="2"
android:ellipsize="end"
/>
<LinearLayout
@@ -63,6 +65,8 @@
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_1"
android:maxLines="1"
android:ellipsize="end"
/>
<LinearLayout
+5 -1
View File
@@ -78,6 +78,8 @@
android:layout_marginEnd="10dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
android:maxLines="2"
android:ellipsize="end"
/>
<LinearLayout
@@ -96,7 +98,7 @@
<TextView
android:id="@+id/description"
android:text="Descriptionssssssssssssssssssssssssssss"
android:text="Description"
android:textSize="14sp"
android:textColor="@color/gray"
android:fontFamily="@font/opensans"
@@ -105,6 +107,8 @@
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_1"
android:maxLines="2"
android:ellipsize="end"
/>
<LinearLayout
@@ -43,6 +43,8 @@
android:layout_weight="0.4"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toTopOf="parent"
android:maxLines="2"
android:ellipsize="end"
/>
<LinearLayout
@@ -71,6 +73,8 @@
android:layout_marginTop="2dp"
app:layout_constraintStart_toEndOf="@id/image_view"
app:layout_constraintTop_toBottomOf="@id/text_view_1"
android:maxLines="1"
android:ellipsize="end"
/>
<LinearLayout
+2
View File
@@ -41,6 +41,8 @@
android:layout_marginTop="3dp"
app:layout_constraintTop_toBottomOf="@id/imageView"
app:layout_constraintStart_toStartOf="parent"
android:maxLines="2"
android:ellipsize="end"
/>
</androidx.constraintlayout.widget.ConstraintLayout>