mirror of
https://github.com/lucasroyerdev/stock-pignon.git
synced 2026-05-10 11:02:26 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4be7a90eb | |||
| 2c225f6821 |
@@ -10,8 +10,8 @@ android {
|
|||||||
applicationId "com.stock.pignon"
|
applicationId "com.stock.pignon"
|
||||||
minSdkVersion 17
|
minSdkVersion 17
|
||||||
targetSdkVersion 36
|
targetSdkVersion 36
|
||||||
versionCode 4
|
versionCode 6
|
||||||
versionName "0.4.0"
|
versionName "0.5.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.stock.pignon;
|
|||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
@@ -111,8 +110,8 @@ public class CartActionHelper {
|
|||||||
*/
|
*/
|
||||||
private static void saveCartToExternalFile(List<CartItem> cartItems) {
|
private static void saveCartToExternalFile(List<CartItem> cartItems) {
|
||||||
File dir = new File(Environment.getExternalStorageDirectory(), Config.EXTERNAL_DIR_NAME);
|
File dir = new File(Environment.getExternalStorageDirectory(), Config.EXTERNAL_DIR_NAME);
|
||||||
File stockFile = new File(dir, Config.OUPUT_JSON_NAME);
|
File stockFile = new File(dir, Config.OUTPUT_JSON_NAME);
|
||||||
File csvFile = new File(dir, Config.OUPUT_CSV_NAME);
|
File csvFile = new File(dir, Config.OUTPUT_CSV_NAME);
|
||||||
|
|
||||||
String today = DateHelper.getTodayIso();
|
String today = DateHelper.getTodayIso();
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|||||||
@@ -22,17 +22,16 @@ import java.util.List;
|
|||||||
public class CartViewHelper {
|
public class CartViewHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the entire cart side-panel or list
|
* Refreshes cart UI by synchronizing the visual list with the current CartManager state
|
||||||
* Clears everything and rebuild on current CartManager data
|
|
||||||
*/
|
*/
|
||||||
public static void updateCartView(LinearLayout cartList, Context context) {
|
public static void updateCartView(LinearLayout cartList, Context context) {
|
||||||
if (cartList == null) return;
|
if (cartList == null) return;
|
||||||
|
|
||||||
// Clear and get current items
|
// Clean item lists
|
||||||
cartList.removeAllViews();
|
cartList.removeAllViews();
|
||||||
List<CartItem> cartItems = CartManager.getItems();
|
List<CartItem> cartItems = CartManager.getItems();
|
||||||
|
|
||||||
// If empty cart, show it to user
|
// Manage empty cart
|
||||||
if (cartItems.isEmpty()) {
|
if (cartItems.isEmpty()) {
|
||||||
TextView empty = new TextView(context);
|
TextView empty = new TextView(context);
|
||||||
empty.setText(context.getString(R.string.cart_empty));
|
empty.setText(context.getString(R.string.cart_empty));
|
||||||
@@ -40,36 +39,20 @@ public class CartViewHelper {
|
|||||||
empty.setGravity(Gravity.CENTER);
|
empty.setGravity(Gravity.CENTER);
|
||||||
empty.setPadding(0, 50, 0, 0);
|
empty.setPadding(0, 50, 0, 0);
|
||||||
cartList.addView(empty);
|
cartList.addView(empty);
|
||||||
|
|
||||||
updateTotalDisplay(context, 0, 0);
|
updateTotalDisplay(context, 0, 0);
|
||||||
return;
|
} else {
|
||||||
}
|
// Create list if not empty
|
||||||
|
|
||||||
// Build list and calculate total at the same time
|
|
||||||
int totalMin = 0;
|
int totalMin = 0;
|
||||||
int totalMax = 0;
|
int totalMax = 0;
|
||||||
|
|
||||||
for (CartItem item : cartItems) {
|
for (CartItem item : cartItems) {
|
||||||
totalMin += item.getTotalMin();
|
totalMin += item.getTotalMin();
|
||||||
totalMax += item.getTotalMax();
|
totalMax += item.getTotalMax();
|
||||||
|
|
||||||
// Create and add the row view
|
// Create a line for each item
|
||||||
cartList.addView(createCartItemView(item, cartList, context));
|
cartList.addView(createCartItemView(item, cartList, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display global price range at the end
|
|
||||||
updateTotalDisplay(context, totalMin, totalMax);
|
updateTotalDisplay(context, totalMin, totalMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the global price range at the bottom of the screen
|
|
||||||
*/
|
|
||||||
private static void updateTotalDisplay(Context context, int min, int max) {
|
|
||||||
TextView totalView = ((Activity) context).findViewById(R.id.totalView);
|
|
||||||
if (totalView != null) {
|
|
||||||
// Using string resources
|
|
||||||
totalView.setText(context.getString(R.string.price_range, min, max, "€"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +64,6 @@ public class CartViewHelper {
|
|||||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
row.setGravity(Gravity.CENTER_VERTICAL);
|
row.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
|
|
||||||
// Layout parameters
|
|
||||||
LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
@@ -90,13 +72,13 @@ public class CartViewHelper {
|
|||||||
|
|
||||||
// Image
|
// Image
|
||||||
ImageView image = new ImageView(context);
|
ImageView image = new ImageView(context);
|
||||||
ImageLoader.loadImage(image, item.getImageFile(),200,200);
|
ImageLoader.loadImage(image, item.getImageFile(), 200, 200);
|
||||||
LinearLayout.LayoutParams imgParams = new LinearLayout.LayoutParams(100, 100);
|
LinearLayout.LayoutParams imgParams = new LinearLayout.LayoutParams(100, 100);
|
||||||
imgParams.setMargins(0, 0, 20, 0);
|
imgParams.setMargins(0, 0, 20, 0);
|
||||||
image.setLayoutParams(imgParams);
|
image.setLayoutParams(imgParams);
|
||||||
row.addView(image);
|
row.addView(image);
|
||||||
|
|
||||||
// Sublayout for name + [quantity + price]
|
// Sublayout infos
|
||||||
LinearLayout infoLayout = new LinearLayout(context);
|
LinearLayout infoLayout = new LinearLayout(context);
|
||||||
infoLayout.setOrientation(LinearLayout.VERTICAL);
|
infoLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
infoLayout.setLayoutParams(new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
|
infoLayout.setLayoutParams(new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1f));
|
||||||
@@ -108,7 +90,7 @@ public class CartViewHelper {
|
|||||||
nameView.setTypeface(null, Typeface.BOLD);
|
nameView.setTypeface(null, Typeface.BOLD);
|
||||||
infoLayout.addView(nameView);
|
infoLayout.addView(nameView);
|
||||||
|
|
||||||
// Quantity and price range
|
// Quantity / price
|
||||||
TextView detailsView = new TextView(context);
|
TextView detailsView = new TextView(context);
|
||||||
String details = context.getString(R.string.cart_item, item.getQuantity(), item.getTotalMin(), item.getTotalMax());
|
String details = context.getString(R.string.cart_item, item.getQuantity(), item.getTotalMin(), item.getTotalMax());
|
||||||
detailsView.setText(details);
|
detailsView.setText(details);
|
||||||
@@ -124,42 +106,35 @@ public class CartViewHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the delete button
|
* Creates the delete button for each item
|
||||||
*/
|
*/
|
||||||
private static Button createRemoveButton(CartItem item, LinearLayout cartList, Context context) {
|
private static Button createRemoveButton(CartItem item, LinearLayout cartList, Context context) {
|
||||||
Button btn = new Button(context);
|
Button btn = new Button(context);
|
||||||
btn.setText("✖");
|
btn.setText("✖");
|
||||||
btn.setTextSize(18);
|
|
||||||
btn.setTextColor(Color.WHITE);
|
btn.setTextColor(Color.WHITE);
|
||||||
btn.setGravity(Gravity.CENTER);
|
|
||||||
|
|
||||||
// Conversion DP to PX for consistent size on all screens
|
|
||||||
float scale = context.getResources().getDisplayMetrics().density;
|
float scale = context.getResources().getDisplayMetrics().density;
|
||||||
int sizePx = (int) (48 * scale + 0.5f);
|
int sizePx = (int) (48 * scale + 0.5f);
|
||||||
|
btn.setLayoutParams(new LinearLayout.LayoutParams(sizePx, sizePx));
|
||||||
|
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(sizePx, sizePx);
|
|
||||||
btn.setLayoutParams(params);
|
|
||||||
|
|
||||||
// Background: grey rounded rectangle (API 17 fallback)
|
|
||||||
GradientDrawable shape = new GradientDrawable();
|
GradientDrawable shape = new GradientDrawable();
|
||||||
shape.setColor(Color.parseColor("#E53935")); // Reddish to indicate delete
|
shape.setColor(Color.parseColor("#E53935"));
|
||||||
shape.setCornerRadius(4 * scale);
|
shape.setCornerRadius(4 * scale);
|
||||||
btn.setBackground(shape);
|
btn.setBackground(shape);
|
||||||
|
|
||||||
btn.setOnClickListener(v -> {
|
btn.setOnClickListener(v -> {
|
||||||
// setting quantity to 0 removes the item
|
CartManager.addOrUpdateItem(item.getName(), item.getMinPrice(), item.getMaxPrice(), 0, item.getImageFile());
|
||||||
CartManager.addOrUpdateItem(
|
|
||||||
item.getName(),
|
|
||||||
item.getMinPrice(),
|
|
||||||
item.getMaxPrice(),
|
|
||||||
0, // Setting quantity to 0 triggers removal
|
|
||||||
item.getImageFile()
|
|
||||||
);
|
|
||||||
|
|
||||||
// visual refresh of the cart list
|
|
||||||
updateCartView(cartList, context);
|
updateCartView(cartList, context);
|
||||||
});
|
});
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage price range for whole cart
|
||||||
|
*/
|
||||||
|
private static void updateTotalDisplay(Context context, int min, int max) {
|
||||||
|
TextView totalView = ((Activity) context).findViewById(R.id.totalView);
|
||||||
|
if (totalView != null) {
|
||||||
|
totalView.setText(context.getString(R.string.price_range, min, max, "€"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,8 @@ public class Config {
|
|||||||
public static final String INPUT_JSON_NAME = "pieces.json";
|
public static final String INPUT_JSON_NAME = "pieces.json";
|
||||||
|
|
||||||
// Output json
|
// Output json
|
||||||
public static final String OUPUT_JSON_NAME = "stock.json";
|
public static final String OUTPUT_JSON_NAME = "stock.json";
|
||||||
|
|
||||||
// Output json
|
// Output json
|
||||||
public static final String OUPUT_CSV_NAME = "stock.csv";
|
public static final String OUTPUT_CSV_NAME = "stock.csv";
|
||||||
}
|
}
|
||||||
@@ -42,16 +42,16 @@ public class ControlServer extends NanoHTTPD {
|
|||||||
return downloadFile(Config.INPUT_JSON_NAME);
|
return downloadFile(Config.INPUT_JSON_NAME);
|
||||||
|
|
||||||
case "/output_json":
|
case "/output_json":
|
||||||
return viewFile(Config.OUPUT_JSON_NAME);
|
return viewFile(Config.OUTPUT_JSON_NAME);
|
||||||
|
|
||||||
case "/download_output_json":
|
case "/download_output_json":
|
||||||
return downloadFile(Config.OUPUT_JSON_NAME);
|
return downloadFile(Config.OUTPUT_JSON_NAME);
|
||||||
|
|
||||||
case "/output_csv":
|
case "/output_csv":
|
||||||
return viewFile(Config.OUPUT_CSV_NAME);
|
return viewFile(Config.OUTPUT_CSV_NAME);
|
||||||
|
|
||||||
case "/download_output_csv":
|
case "/download_output_csv":
|
||||||
return downloadFile(Config.OUPUT_CSV_NAME);
|
return downloadFile(Config.OUTPUT_CSV_NAME);
|
||||||
|
|
||||||
case "/":
|
case "/":
|
||||||
case "/index.html":
|
case "/index.html":
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.widget.Button;
|
|||||||
import android.widget.GridLayout;
|
import android.widget.GridLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -35,7 +36,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
// UI components
|
// UI components
|
||||||
private LinearLayout cartList;
|
private LinearLayout cartList;
|
||||||
private LinearLayout homeLayout;
|
private LinearLayout homeLayout;
|
||||||
private LinearLayout categoryItemsLayout;
|
private FrameLayout categoryItemsLayout;
|
||||||
private LinearLayout categoriesLayout;
|
private LinearLayout categoriesLayout;
|
||||||
private GridLayout gridPieces;
|
private GridLayout gridPieces;
|
||||||
private ImageView mainImage;
|
private ImageView mainImage;
|
||||||
@@ -61,12 +62,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
gridPieces = findViewById(R.id.gridPieces);
|
gridPieces = findViewById(R.id.gridPieces);
|
||||||
mainImage = findViewById(R.id.mainImage);
|
mainImage = findViewById(R.id.mainImage);
|
||||||
|
|
||||||
// Setup Back Button
|
|
||||||
Button backBtn = findViewById(R.id.backToHomeBtn);
|
|
||||||
if (backBtn != null) {
|
|
||||||
backBtn.setOnClickListener(v -> showHome());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy assets to sd card if not founded
|
// Copy assets to sd card if not founded
|
||||||
copyAssetsIfEmpty();
|
copyAssetsIfEmpty();
|
||||||
// Get data from sd card
|
// Get data from sd card
|
||||||
@@ -86,7 +81,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get app version
|
// Get app version
|
||||||
String versionName = "";
|
String versionName;
|
||||||
try {
|
try {
|
||||||
versionName = "App v" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
|
versionName = "App v" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -99,7 +94,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
server.start();
|
server.start();
|
||||||
String url = "http://" + getDeviceIP() + ":8080";
|
String url = "http://" + getDeviceIP() + ":8080";
|
||||||
|
|
||||||
// On met l'URL directement dans le sous-titre de l'ActionBar
|
// Print URL in action bar for user
|
||||||
if (getSupportActionBar() != null) {
|
if (getSupportActionBar() != null) {
|
||||||
getSupportActionBar().setSubtitle("Serveur en ligne : " + url + " - " + versionName);
|
getSupportActionBar().setSubtitle("Serveur en ligne : " + url + " - " + versionName);
|
||||||
}
|
}
|
||||||
@@ -109,6 +104,24 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
getSupportActionBar().setSubtitle("Erreur serveur" + " - " + versionName);
|
getSupportActionBar().setSubtitle("Erreur serveur" + " - " + versionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Back button (blue)
|
||||||
|
Button btnBack = findViewById(R.id.btnBackFromCategory);
|
||||||
|
if (btnBack != null) {
|
||||||
|
btnBack.setOnClickListener(v -> showHome());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Empty button (red)
|
||||||
|
Button btnClear = findViewById(R.id.clearCartBtn);
|
||||||
|
if (btnClear != null) {
|
||||||
|
btnClear.setOnClickListener(v -> CartActionHelper.emptyCart(cartList, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate button (green)
|
||||||
|
Button btnValidate = findViewById(R.id.validateCartBtn);
|
||||||
|
if (btnValidate != null) {
|
||||||
|
btnValidate.setOnClickListener(v -> CartActionHelper.validateCart(cartList, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -276,14 +289,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
ImageLoader.loadImage(mainImage, "_velo", 800,800);
|
ImageLoader.loadImage(mainImage, "_velo", 800,800);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void emptyCart(View view) {
|
|
||||||
CartActionHelper.emptyCart(cartList, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void validateCart(View view) {
|
|
||||||
CartActionHelper.validateCart(cartList, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int dpToPx(int dp) {
|
private int dpToPx(int dp) {
|
||||||
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
|
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
|
||||||
}
|
}
|
||||||
@@ -309,8 +314,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check stock.json and stock.csv output files to avoid control server error
|
// Check stock.json and stock.csv output files to avoid control server error
|
||||||
checkOrCreateEmptyFile(new File(rootDir, Config.OUPUT_JSON_NAME), "[]");
|
checkOrCreateEmptyFile(new File(rootDir, Config.OUTPUT_JSON_NAME), "[]");
|
||||||
checkOrCreateEmptyFile(new File(rootDir, Config.OUPUT_CSV_NAME), "");
|
checkOrCreateEmptyFile(new File(rootDir, Config.OUTPUT_CSV_NAME), "");
|
||||||
|
|
||||||
// Check images folder
|
// Check images folder
|
||||||
File imgDir = new File(rootDir, Config.IMAGES_SUBDIR_NAME);
|
File imgDir = new File(rootDir, Config.IMAGES_SUBDIR_NAME);
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- activity_main.xml -->
|
<!-- activity_main.xml -->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:background="#ffffff">
|
android:background="#ffffff"
|
||||||
|
android:baselineAligned="false"> <FrameLayout
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/contentFrame"
|
android:id="@+id/contentFrame"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -17,9 +18,9 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="20dp">
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
<LinearLayout
|
tools:ignore="RtlSymmetry"> <LinearLayout
|
||||||
android:id="@+id/categoriesLayout"
|
android:id="@+id/categoriesLayout"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -31,34 +32,41 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:scaleType="fitCenter" />
|
android:scaleType="fitCenter"
|
||||||
</LinearLayout>
|
android:contentDescription="@string/app_name" /> </LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:id="@+id/categoryItemsLayout"
|
android:id="@+id/categoryItemsLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:visibility="gone">
|
||||||
android:visibility="gone"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/backToHomeBtn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="← Retour" />
|
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:padding="10dp">
|
||||||
<GridLayout
|
<GridLayout
|
||||||
android:id="@+id/gridPieces"
|
android:id="@+id/gridPieces"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:columnCount="4" />
|
android:columnCount="4" />
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
|
||||||
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
|
android:id="@+id/btnBackFromCategory"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_gravity="bottom|start"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:text="@string/cart_back_btn"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
app:backgroundTint="#1E88E5"
|
||||||
|
android:elevation="8dp"
|
||||||
|
tools:targetApi="l" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<include layout="@layout/partial_cart" />
|
<include layout="@layout/partial_cart" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- partial_panier.xml -->
|
<!-- partial_panier.xml -->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/cartContainer"
|
android:id="@+id/cartContainer"
|
||||||
android:layout_width="350dp"
|
android:layout_width="350dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -56,29 +57,29 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:weightSum="2">
|
android:weightSum="2">
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/clearCartBtn"
|
android:id="@+id/clearCartBtn"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="60dp"
|
android:layout_height="70dp"
|
||||||
android:text="@string/cart_empty_btn"
|
android:text="@string/cart_empty_btn"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:background="#E53935"
|
app:backgroundTint="#E53935"
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="5dp"/>
|
||||||
android:onClick="emptyCart"/>
|
|
||||||
|
|
||||||
<Button
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/validateCartBtn"
|
android:id="@+id/validateCartBtn"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="60dp"
|
android:layout_height="70dp"
|
||||||
android:text="@string/cart_validate_btn"
|
android:text="@string/cart_validate_btn"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:background="#43A047"
|
app:backgroundTint="#43A047"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"/>
|
||||||
android:onClick="validateCart"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<string name="cart_name">Mes sacoches</string>
|
<string name="cart_name">Mes sacoches</string>
|
||||||
<string name="cart_validate_btn">Valider</string>
|
<string name="cart_validate_btn">Valider</string>
|
||||||
|
<string name="cart_back_btn">Retour</string>
|
||||||
<string name="cart_empty_btn">Vider</string>
|
<string name="cart_empty_btn">Vider</string>
|
||||||
<string name="cart_empty">C\'est vide !</string>
|
<string name="cart_empty">C\'est vide !</string>
|
||||||
<string name="cart_item">Quantité : %1$d (%2$d - %3$d €)</string>
|
<string name="cart_item">Quantité : %1$d (%2$d - %3$d €)</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user