Skip to content

Commit eff9ce6

Browse files
committed
fix: update the D50 nfc UI
1 parent 605af56 commit eff9ce6

8 files changed

Lines changed: 18 additions & 9 deletions

File tree

pos_android_studio_demo/pos_android_app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ android {
3131
applicationId "com.dspread.pos_android_app"
3232
minSdk 24
3333
targetSdk 34
34-
versionCode 124
35-
versionName "8.2.6-2601131600"
34+
versionCode 125
35+
versionName "8.2.7-2601141900"
3636
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3737
ndk {
3838
// Set up supported SO library architecture
@@ -60,7 +60,7 @@ android {
6060
}
6161

6262
dependencies {
63-
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: ['dspread_pos_sdk_8.2.6-min.aar'])
63+
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: ['dspread_pos_sdk_8.2.7-min.aar'])
6464
implementation 'androidx.appcompat:appcompat:1.6.1'
6565
implementation 'com.google.android.material:material:1.5.0'
6666
implementation 'androidx.gridlayout:gridlayout:1.0.0'
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

pos_android_studio_demo/pos_android_app/src/main/java/com/dspread/pos/ui/payment/PaymentActivity.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.widget.ArrayAdapter;
1111
import android.widget.ListView;
1212

13+
import androidx.constraintlayout.widget.ConstraintLayout;
1314
import androidx.databinding.DataBindingUtil;
1415

1516
import com.dspread.pos.posAPI.ConnectionServiceCallback;
@@ -69,11 +70,11 @@ public class PaymentActivity extends BaseActivity<ActivityPaymentDefaultBinding,
6970
@Override
7071
public int initContentView(Bundle savedInstanceState) {
7172
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
72-
if (DeviceUtils.getScreenSize(this) <= 3.0) {
73-
return R.layout.activity_payment_small_screen;//todo 名字
73+
if(DeviceUtils.getScreenSize(this) <=3.0){
74+
return R.layout.activity_payment_small_screen;
7475
} else if (DeviceUtils.isFrontNFCDevices()) {
75-
return R.layout.activity_payment_front_nfc;//todo
76-
} else {
76+
return R.layout.activity_payment_front_nfc;
77+
}else {
7778
return R.layout.activity_payment_default;
7879
}
7980
}
@@ -149,12 +150,16 @@ private void initFrontNFCUI() {
149150

150151
private void setupFrontNFCAnimation() {
151152
if (frontNfcBinding != null) {
153+
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams)
154+
frontNfcBinding.animationView.getLayoutParams();
152155
String deviceModel = DeviceUtils.getPhoneModel();
153156
if ("D35".equals(deviceModel)) {
157+
params.topMargin = DeviceUtils.dpToPx(this,25);//50.25mm
154158
if (frontNfcBinding.ivCardGuide != null) {
155159
frontNfcBinding.ivCardGuide.setImageResource(R.drawable.ic_payguide_d35);
156160
}
157161
} else if ("D50".equals(deviceModel)) {
162+
params.topMargin = DeviceUtils.dpToPx(this,0);//40.7mm
158163
if (frontNfcBinding.ivCardGuide != null) {
159164
frontNfcBinding.ivCardGuide.setImageResource(R.mipmap.ic_payguide_d50);
160165
}

pos_android_studio_demo/pos_android_app/src/main/java/com/dspread/pos/utils/DeviceUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public static String getPhoneDetail() {
119119
return "Brand:" + DeviceUtils.getPhoneBrand() + " || Name:" + DeviceUtils.getDeviceName() + " || Model:" + DeviceUtils.getPhoneModel() + " || Version:" + DeviceUtils.getVersionRelease();
120120
}
121121

122+
public static int dpToPx(Context context,int dp) {
123+
return (int) (dp * context.getResources().getDisplayMetrics().density);
124+
}
125+
122126
public static String convertAmountToCents(String original) {
123127
System.out.println("convertAmountToCents:" + original);
124128
String result = "";

pos_android_studio_demo/pos_android_app/src/main/res/layout/activity_payment_front_nfc.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<com.airbnb.lottie.LottieAnimationView
3333
android:id="@+id/animation_view"
3434
android:layout_width="0dp"
35-
android:layout_height="350dp"
36-
android:layout_marginTop="20dp"
35+
android:layout_height="340dp"
36+
android:layout_marginTop="0dp"
3737
android:visibility="@{viewModel.showPinpad ? View.GONE : View.VISIBLE}"
3838
app:layout_constraintEnd_toEndOf="parent"
3939
app:layout_constraintStart_toStartOf="parent"

0 commit comments

Comments
 (0)