Commit 7b00871f authored by 赵鹏翔's avatar 赵鹏翔

基础ui抽取

parent 488b87a0
......@@ -9,6 +9,8 @@ import androidx.lifecycle.ViewModelProvider
import com.fastcashier.lib_common.base.BaseActivity
import com.fastcashier.lib_common.config.IntentExtra
import com.fastcashier.lib_common.ui.dialog.CommonDialog
import com.fastcashier.lib_common.ui.widget.DecimalKeyboard.DELETE
import com.fastcashier.lib_common.ui.widget.DecimalKeyboard.DOT
import com.fastcashier.lib_common.util.StringPriceFormatUtils
import com.fastcashier.lib_common.util.clickWithTrigger
import com.miya.fastcashier.R
......@@ -18,13 +20,11 @@ import com.miya.fastcashier.ui.dialog.PayChooseDialog.GeneratePayCodeClickListen
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.WordUtil
import com.miya.fastcashier.viewmodel.PayViewModel
import com.miya.fastcashier.widget.DecimalKeyboard.DELETE
import com.miya.fastcashier.widget.DecimalKeyboard.DOT
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import java.math.BigDecimal
class PriceInputActivity : BaseActivity() {
private lateinit var viewModel: PayViewModel
private lateinit var binding: ActivityPriceInputBinding
......
......@@ -65,8 +65,7 @@ class RefundActivity : BaseActivity() {
llBack.clickWithTrigger { finish() }
val ivRefundManualInput = binding.ivRefundManualInput
ivRefundManualInput.clickWithTrigger {
binding.ivRefundManualInput.clickWithTrigger {
if (numberManualDialog == null) {
numberManualDialog = NumberManualDialog(this);
numberManualDialog!!.setNumberInputListener(object :
......
package com.miya.fastcashier.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import com.miya.fastcashier.R;
import com.miya.fastcashier.databinding.LayoutCommonPromptViewBinding;
import org.jetbrains.annotations.NotNull;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
public class CommonPromptView extends ConstraintLayout {
private LayoutCommonPromptViewBinding viewBinding;
public CommonPromptView(@NonNull @NotNull Context context) {
this(context, null);
}
public CommonPromptView(@NonNull @NotNull Context context,
@Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public CommonPromptView(@NonNull @NotNull Context context,
@Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs,
int defStyleAttr) {
super(context, attrs, defStyleAttr);
View inflate = LayoutInflater.from(getContext()).inflate(R.layout.layout_common_prompt_view, this);
viewBinding = LayoutCommonPromptViewBinding.bind(inflate);
}
public void setPromptImage(int imageResId) {
viewBinding.ivPrompt.setImageResource(imageResId);
}
public void setPromptText(String text) {
viewBinding.tvPrompt.setText(text);
}
}
package com.miya.fastcashier.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import com.miya.fastcashier.R;
/**
* 通用的RecyclerDivider
*/
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/app_keybord_btn_normal"/>
<item android:state_pressed="false" android:drawable="@drawable/app_keybord_btn_pressed"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/white"
android:startColor="@color/white" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="#E7E7EB"
android:startColor="#E7E7EB" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
......@@ -138,7 +138,7 @@
tools:visibility="visible"
android:textSize="26sp"/>
<com.miya.fastcashier.widget.DecimalKeyboard
<com.fastcashier.lib_common.ui.widget.DecimalKeyboard
android:id="@+id/numKeyboard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -10,7 +10,7 @@
android:background="@color/color_F8F8F8"
android:layout_height="match_parent" />
<com.miya.fastcashier.widget.CommonPromptView
<com.fastcashier.lib_common.ui.dialog.CommonPromptView
android:id="@+id/cpEmptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -25,6 +25,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
......
package com.fastcashier.lib_common.ui.dialog
import android.content.Context
import android.util.AttributeSet
import kotlin.jvm.JvmOverloads
import androidx.constraintlayout.widget.ConstraintLayout
import android.view.LayoutInflater
import com.fastcashier.lib_common.R
import com.fastcashier.lib_common.databinding.LayoutCommonPromptViewBinding
class CommonPromptView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private val viewBinding: LayoutCommonPromptViewBinding
init {
val inflate =
LayoutInflater.from(getContext()).inflate(R.layout.layout_common_prompt_view, this)
viewBinding = LayoutCommonPromptViewBinding.bind(inflate)
}
fun setPromptImage(imageResId: Int) {
viewBinding.ivPrompt.setImageResource(imageResId)
}
fun setPromptText(text: String?) {
viewBinding.tvPrompt.text = text
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import com.fastcashier.lib_common.R
import com.fastcashier.lib_common.ui.NumKeyboard
import com.fastcashier.lib_common.ui.widget.NumKeyboard
/**
* 数字键盘
......
package com.miya.fastcashier.widget;
package com.fastcashier.lib_common.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import com.miya.fastcashier.R;
import com.fastcashier.lib_common.R;
import java.util.ArrayList;
import java.util.List;
......@@ -27,7 +30,7 @@ public class DecimalKeyboard extends LinearLayout {
public DecimalKeyboard(Context context, AttributeSet attrs) {
super(context, attrs);
View view = LayoutInflater.from(context).inflate(R.layout.keyboard_decimal, this, true);
View view = LayoutInflater.from(context).inflate(R.layout.app_layout_keyboard_decimal, this, true);
buttons = new ArrayList<>(12);
ClickListener clickListener = new ClickListener();
btn_7 = view.findViewById(R.id.btn_7);
......
package com.fastcashier.lib_common.ui;
package com.fastcashier.lib_common.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:drawable="@drawable/app_keybord_btn_normal"/>
<item android:state_pressed="true" android:drawable="@drawable/app_keybord_btn_pressed"/>
<item android:state_pressed="false" android:drawable="@drawable/app_shape_keybord_btn_normal"/>
<item android:state_pressed="true" android:drawable="@drawable/app_shape_keybord_btn_pressed"/>
</selector>
\ No newline at end of file
......@@ -72,7 +72,7 @@
app:layout_constraintStart_toStartOf="@+id/etNumber"
app:layout_constraintTop_toBottomOf="@+id/etNumber"/>
<com.fastcashier.lib_common.ui.NumKeyboard
<com.fastcashier.lib_common.ui.widget.NumKeyboard
android:id="@+id/numKeyboard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......
......@@ -21,7 +21,7 @@
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="1"
android:textColor="#333333"
android:textSize="69sp"/>
......@@ -34,7 +34,7 @@
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="2"
android:textSize="69sp" />
......@@ -46,7 +46,7 @@
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="3"
android:textSize="69sp" />
......@@ -67,7 +67,7 @@
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="4"
android:textSize="69sp" />
......@@ -79,7 +79,7 @@
android:textColor="#333333"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="5"
android:textSize="69sp" />
......@@ -91,7 +91,7 @@
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="6"
android:textSize="69sp" />
</LinearLayout>
......@@ -111,7 +111,7 @@
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="7"
android:textSize="69sp" />
......@@ -123,7 +123,7 @@
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="8"
android:textSize="69sp" />
......@@ -135,7 +135,7 @@
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="9"
android:textSize="69sp" />
</LinearLayout>
......@@ -155,7 +155,7 @@
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="0"
android:textSize="69sp" />
......@@ -167,7 +167,7 @@
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:text="."
android:paddingBottom="30dp"
android:textSize="69sp" />
......@@ -177,7 +177,7 @@
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_selector_keybord_btn"
android:layout_margin="4dp"
android:layout_weight="1">
......@@ -186,7 +186,7 @@
android:layout_height="54dp"
android:layout_gravity="center"
android:scaleType="fitXY"
android:src="@mipmap/ic_delete" />
android:src="@mipmap/app_icon_delete" />
</FrameLayout>
</LinearLayout>
......
......@@ -9,5 +9,6 @@
<color name="transparent">#00000000</color>
<color name="color_323233">#323233</color>
<color name="color_333333">#333333</color>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment