From b2bec204e214e6b077c4c1901d07fabec27104e9 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 1 Apr 2020 15:04:52 -0300 Subject: [pos] automatic code cleanup --- merchant-terminal/src/main/AndroidManifest.xml | 41 ++-- .../taler/merchantpos/config/MerchantRequest.kt | 8 +- .../java/net/taler/merchantpos/order/LiveOrder.kt | 3 +- .../src/main/res/drawable/ic_cash_refund.xml | 12 +- .../src/main/res/drawable/ic_check_circle.xml | 14 +- .../main/res/drawable/ic_history_black_24dp.xml | 10 +- .../main/res/drawable/ic_launcher_background.xml | 236 +++++++++++++++------ .../src/main/res/drawable/ic_menu_manage.xml | 12 +- .../src/main/res/drawable/ic_move_money_24dp.xml | 10 +- .../src/main/res/drawable/side_nav_bar.xml | 12 +- .../src/main/res/layout/activity_main.xml | 40 ++-- .../src/main/res/layout/app_bar_main.xml | 53 +++-- .../src/main/res/layout/fragment_categories.xml | 47 ++-- .../main/res/layout/fragment_config_fetcher.xml | 45 ++-- .../main/res/layout/fragment_merchant_config.xml | 203 +++++++++--------- .../main/res/layout/fragment_merchant_history.xml | 17 +- .../src/main/res/layout/fragment_order.xml | 195 +++++++++-------- .../src/main/res/layout/fragment_order_state.xml | 59 +++--- .../main/res/layout/fragment_payment_success.xml | 99 +++++---- .../src/main/res/layout/fragment_products.xml | 43 ++-- .../src/main/res/layout/fragment_refund.xml | 166 +++++++-------- .../src/main/res/layout/list_item_category.xml | 25 ++- .../src/main/res/layout/list_item_history.xml | 134 ++++++------ .../src/main/res/layout/list_item_order.xml | 73 ++++--- .../src/main/res/layout/list_item_product.xml | 59 +++--- .../src/main/res/layout/nav_header_main.xml | 61 +++--- .../src/main/res/menu/activity_main_drawer.xml | 25 ++- .../main/res/mipmap-anydpi-v26/ic_taler_logo.xml | 4 +- .../res/mipmap-anydpi-v26/ic_taler_logo_round.xml | 4 +- 29 files changed, 898 insertions(+), 812 deletions(-) (limited to 'merchant-terminal/src') diff --git a/merchant-terminal/src/main/AndroidManifest.xml b/merchant-terminal/src/main/AndroidManifest.xml index f52995f..3d89fee 100644 --- a/merchant-terminal/src/main/AndroidManifest.xml +++ b/merchant-terminal/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - - + xmlns:tools="http://schemas.android.com/tools" + package="net.taler.merchantpos"> + android:name="android.hardware.nfc" + android:required="false" /> + android:name="android.hardware.telephony" + android:required="false" /> + android:allowBackup="true" + android:fullBackupContent="@xml/backup_descriptor" + android:icon="@mipmap/ic_taler_logo" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_taler_logo_round" + android:supportsRtl="true" + android:theme="@style/AppTheme" + tools:ignore="GoogleAppIndexingWarning"> + android:name=".MainActivity" + android:label="@string/app_name" + android:screenOrientation="landscape" + android:theme="@style/AppTheme.NoActionBar" + tools:ignore="LockedOrientationActivity"> diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/MerchantRequest.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/MerchantRequest.kt index 862dd33..6c9c741 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/MerchantRequest.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/MerchantRequest.kt @@ -32,7 +32,13 @@ class MerchantRequest( listener: Response.Listener, errorListener: LogErrorListener ) : - JsonObjectRequest(method, merchantConfig.urlFor(endpoint, params), jsonRequest, listener, errorListener) { + JsonObjectRequest( + method, + merchantConfig.urlFor(endpoint, params), + jsonRequest, + listener, + errorListener + ) { override fun getHeaders(): MutableMap { val headerMap = ArrayMap() diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt index f8d465b..a77e39b 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/order/LiveOrder.kt @@ -50,7 +50,8 @@ internal class MutableLiveOrder( ) : LiveOrder { private val availableCategories: Map get() = productsByCategory.keys.map { it.id to it }.toMap() - override val order: MutableLiveData = MutableLiveData(Order(id, currency, availableCategories)) + override val order: MutableLiveData = + MutableLiveData(Order(id, currency, availableCategories)) override val orderTotal: LiveData = Transformations.map(order) { it.total } override val restartState = MutableLiveData(DISABLED) private val selectedOrderLine = MutableLiveData() diff --git a/merchant-terminal/src/main/res/drawable/ic_cash_refund.xml b/merchant-terminal/src/main/res/drawable/ic_cash_refund.xml index 7359ca3..a053644 100644 --- a/merchant-terminal/src/main/res/drawable/ic_cash_refund.xml +++ b/merchant-terminal/src/main/res/drawable/ic_cash_refund.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="#000000" + android:pathData="M3,11H21V23H3V11M12,15A2,2 0 0,1 14,17A2,2 0 0,1 12,19A2,2 0 0,1 10,17A2,2 0 0,1 12,15M7,13A2,2 0 0,1 5,15V19A2,2 0 0,1 7,21H17A2,2 0 0,1 19,19V15A2,2 0 0,1 17,13H7M17,5V10H15.5V6.5H9.88L12.3,8.93L11.24,10L7,5.75L11.24,1.5L12.3,2.57L9.88,5H17Z" /> diff --git a/merchant-terminal/src/main/res/drawable/ic_check_circle.xml b/merchant-terminal/src/main/res/drawable/ic_check_circle.xml index 61e1b5a..08e5b50 100644 --- a/merchant-terminal/src/main/res/drawable/ic_check_circle.xml +++ b/merchant-terminal/src/main/res/drawable/ic_check_circle.xml @@ -1,10 +1,10 @@ + android:width="24dp" + android:height="24dp" + android:alpha="0.56" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:fillColor="@color/green" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z" /> diff --git a/merchant-terminal/src/main/res/drawable/ic_history_black_24dp.xml b/merchant-terminal/src/main/res/drawable/ic_history_black_24dp.xml index a61de1b..d9f75ea 100644 --- a/merchant-terminal/src/main/res/drawable/ic_history_black_24dp.xml +++ b/merchant-terminal/src/main/res/drawable/ic_history_black_24dp.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z" /> diff --git a/merchant-terminal/src/main/res/drawable/ic_launcher_background.xml b/merchant-terminal/src/main/res/drawable/ic_launcher_background.xml index 2408e30..0d025f9 100644 --- a/merchant-terminal/src/main/res/drawable/ic_launcher_background.xml +++ b/merchant-terminal/src/main/res/drawable/ic_launcher_background.xml @@ -1,74 +1,170 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:viewportHeight="108"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/merchant-terminal/src/main/res/drawable/ic_menu_manage.xml b/merchant-terminal/src/main/res/drawable/ic_menu_manage.xml index a0e423c..aeb047d 100644 --- a/merchant-terminal/src/main/res/drawable/ic_menu_manage.xml +++ b/merchant-terminal/src/main/res/drawable/ic_menu_manage.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:fillColor="#FF000000" + android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" /> \ No newline at end of file diff --git a/merchant-terminal/src/main/res/drawable/ic_move_money_24dp.xml b/merchant-terminal/src/main/res/drawable/ic_move_money_24dp.xml index 349f48f..6702c56 100644 --- a/merchant-terminal/src/main/res/drawable/ic_move_money_24dp.xml +++ b/merchant-terminal/src/main/res/drawable/ic_move_money_24dp.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M19,3L4.99,3c-1.11,0 -1.98,0.9 -1.98,2L3,19c0,1.1 0.88,2 1.99,2L19,21c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,15h-4c0,1.66 -1.35,3 -3,3s-3,-1.34 -3,-3L4.99,15L4.99,5L19,5v10zM16,10h-2L14,7h-4v3L8,10l4,4 4,-4z" /> diff --git a/merchant-terminal/src/main/res/drawable/side_nav_bar.xml b/merchant-terminal/src/main/res/drawable/side_nav_bar.xml index 50dc048..7b2e2b3 100644 --- a/merchant-terminal/src/main/res/drawable/side_nav_bar.xml +++ b/merchant-terminal/src/main/res/drawable/side_nav_bar.xml @@ -1,9 +1,9 @@ + android:shape="rectangle"> + android:angle="135" + android:centerColor="@color/colorPrimaryDark" + android:endColor="@color/colorPrimaryDark" + android:startColor="@color/colorPrimary" + android:type="linear" /> \ No newline at end of file diff --git a/merchant-terminal/src/main/res/layout/activity_main.xml b/merchant-terminal/src/main/res/layout/activity_main.xml index 6523caa..1285b19 100644 --- a/merchant-terminal/src/main/res/layout/activity_main.xml +++ b/merchant-terminal/src/main/res/layout/activity_main.xml @@ -1,5 +1,4 @@ - - - + + layout="@layout/app_bar_main" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + android:id="@+id/nav_view" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="start" + android:fitsSystemWindows="true" + app:headerLayout="@layout/nav_header_main" + app:menu="@menu/activity_main_drawer" /> diff --git a/merchant-terminal/src/main/res/layout/app_bar_main.xml b/merchant-terminal/src/main/res/layout/app_bar_main.xml index 0254c71..f6d9912 100644 --- a/merchant-terminal/src/main/res/layout/app_bar_main.xml +++ b/merchant-terminal/src/main/res/layout/app_bar_main.xml @@ -1,5 +1,4 @@ - - + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MainActivity"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:theme="@style/AppTheme.AppBarOverlay"> + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:popupTheme="@style/AppTheme.PopupOverlay" /> + android:id="@+id/navHostFragment" + android:name="androidx.navigation.fragment.NavHostFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:defaultNavHost="true" + app:layout_behavior="@string/appbar_scrolling_view_behavior" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_insetEdge="top" + app:navGraph="@navigation/nav_graph" /> diff --git a/merchant-terminal/src/main/res/layout/fragment_categories.xml b/merchant-terminal/src/main/res/layout/fragment_categories.xml index a90585f..f81bf9a 100644 --- a/merchant-terminal/src/main/res/layout/fragment_categories.xml +++ b/merchant-terminal/src/main/res/layout/fragment_categories.xml @@ -1,5 +1,4 @@ - - + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp"> + android:id="@+id/categoriesList" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:listitem="@layout/list_item_category" /> + android:id="@+id/progressBar" + style="?android:attr/progressBarStyleLarge" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> diff --git a/merchant-terminal/src/main/res/layout/fragment_config_fetcher.xml b/merchant-terminal/src/main/res/layout/fragment_config_fetcher.xml index af7dcaf..55403bd 100644 --- a/merchant-terminal/src/main/res/layout/fragment_config_fetcher.xml +++ b/merchant-terminal/src/main/res/layout/fragment_config_fetcher.xml @@ -1,5 +1,4 @@ - - + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_margin="16dp"> + android:id="@+id/titleView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:text="@string/config_fetching" + android:textAppearance="@style/TextAppearance.AppCompat.Headline" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:id="@+id/progressBar" + style="?android:attr/progressBarStyleLarge" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="16dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/titleView" /> diff --git a/merchant-terminal/src/main/res/layout/fragment_merchant_config.xml b/merchant-terminal/src/main/res/layout/fragment_merchant_config.xml index 2541887..b19f14c 100644 --- a/merchant-terminal/src/main/res/layout/fragment_merchant_config.xml +++ b/merchant-terminal/src/main/res/layout/fragment_merchant_config.xml @@ -1,5 +1,4 @@ - - + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + tools:context=".config.MerchantConfigFragment"> + android:id="@+id/configUrlView" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:hint="@string/config_url" + app:boxBackgroundColor="@android:color/transparent" + app:boxBackgroundMode="outline" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="textUri" /> + android:id="@+id/usernameView" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:hint="@string/config_username" + app:boxBackgroundColor="@android:color/transparent" + app:boxBackgroundMode="outline" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/configUrlView"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="text" /> + android:id="@+id/passwordView" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:hint="@string/config_password" + app:boxBackgroundColor="@android:color/transparent" + app:boxBackgroundMode="outline" + app:endIconMode="password_toggle" + app:layout_constraintEnd_toStartOf="@+id/forgetPasswordButton" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/usernameView"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="textWebPassword" />