Skip to content

Commit 53fb740

Browse files
committed
카드 추가나 삭제시 UI미변경 버그 개선
1 parent bb1a0b3 commit 53fb740

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

bootpay/src/main/java/kr/co/bootpay/bio/activity/BootpayBioActivity.java

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,17 @@ public void onClick(View view) {
237237
findViewById(R.id.barcode).setOnClickListener(new View.OnClickListener() {
238238
@Override
239239
public void onClick(View view) {
240-
if(data == null || data.wallets == null || data.wallets.card == null || data.wallets.card.size() <= currentIndex) return;
241-
if(data.wallets.card.get(currentIndex).wallet_type == -1) {
242-
startBioPay(data.user, data.wallets.card.get(currentIndex));
243-
} else if(data.wallets.card.get(currentIndex).wallet_type == 1) {
244-
goNewCardActivity();
245-
} else if(data.wallets.card.get(currentIndex).wallet_type == 2) {
246-
goOtherActivity();
247-
}
240+
241+
clearCardPager();
242+
243+
// if(data == null || data.wallets == null || data.wallets.card == null || data.wallets.card.size() <= currentIndex) return;
244+
// if(data.wallets.card.get(currentIndex).wallet_type == -1) {
245+
// startBioPay(data.user, data.wallets.card.get(currentIndex));
246+
// } else if(data.wallets.card.get(currentIndex).wallet_type == 1) {
247+
// goNewCardActivity();
248+
// } else if(data.wallets.card.get(currentIndex).wallet_type == 2) {
249+
// goOtherActivity();
250+
// }
248251
}
249252
});
250253
// getFra
@@ -330,12 +333,12 @@ private String getComma(double value) {
330333
}
331334

332335
public void clearCardPager() {
333-
this.data = data;
334336
Handler handler = new Handler(Looper.getMainLooper());
335337
handler.post(new Runnable() {
336338
@Override
337339
public void run() {
338340
cardPagerAdapter.removeData();
341+
339342
cardPagerAdapter.notifyDataSetChanged();
340343
}
341344
});
@@ -353,6 +356,14 @@ public void run() {
353356
});
354357
}
355358

359+
// @Override
360+
// protected void onPostResume() {
361+
// super.onPostResume();
362+
// if(this.cardPagerAdapter != null){
363+
// this.cardPagerAdapter.notifyDataSetChanged();
364+
// }
365+
// }
366+
356367
// @Override
357368
// protected void onStart() {
358369
// super.onStart();
@@ -373,7 +384,7 @@ void getEasyCardWalletList() {
373384
if(uuid == null || "".equals(uuid)) { Log.d("bootpay", "uuid 값이 없습니다"); return; }
374385
if(userToken == null || "".equals(userToken)) { Log.d("bootpay", "userToken 값이 없습니다"); return; }
375386

376-
clearCardPager();
387+
// clearCardPager();
377388
presenter.getEasyCardWallet(uuid, userToken);
378389
}
379390

@@ -718,6 +729,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
718729
vibrator.vibrate(10);
719730
finish();
720731
}
732+
} else {
733+
CurrentBioRequest.getInstance().type = CurrentBioRequest.REQUEST_TYPE_RESULT_FAILED;
734+
getEasyCardWalletList();
721735
}
722736
}
723737
}

bootpay/src/main/java/kr/co/bootpay/bio/memory/CurrentBioRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class CurrentBioRequest {
3939
public static final int REQUEST_TYPE_ENABLE_DEVICE = 5; //해당 기기 활성화
4040
public static final int REQUEST_TYPE_OTHER = 6; //다른 결제수단
4141
public static final int REQUEST_TYPE_PASSWORD_PAY = 7; //생체인증 이용 불가시 비밀번호로 간편결제
42+
public static final int REQUEST_TYPE_RESULT_FAILED = -100; //생체인증 이용 불가시 비밀번호로 간편결제
4243

4344
public static CurrentBioRequest getInstance() {
4445
if(instance == null) instance = new CurrentBioRequest();

bootpay/src/main/java/kr/co/bootpay/bio/pager/CardPagerAdapter.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
import androidx.fragment.app.Fragment;
66
import androidx.fragment.app.FragmentManager;
77
import androidx.fragment.app.FragmentStatePagerAdapter;
8+
import androidx.viewpager.widget.PagerAdapter;
89

910
import java.util.ArrayList;
1011

1112
import kr.co.bootpay.bio.BootpayBioDialog;
1213
import kr.co.bootpay.bio.activity.BootpayBioActivity;
14+
import kr.co.bootpay.model.bio.BioDeviceUse;
1315
import kr.co.bootpay.model.bio.BioWallet;
1416
import kr.co.bootpay.model.bio.BioWalletData;
17+
import kr.co.bootpay.model.bio.BioWalletList;
1518

1619
public class CardPagerAdapter extends FragmentStatePagerAdapter {
1720

@@ -26,13 +29,15 @@ public CardPagerAdapter(FragmentManager fm, Context context) {
2629
}
2730

2831
public void removeData() {
29-
if(this.data == null) return;
30-
if(this.data.wallets == null) return;
31-
if(this.data.wallets.card == null) this.data.wallets.card = new ArrayList<>();
32-
data.wallets.card.clear();
32+
33+
data = new BioWalletData();
34+
data.wallets = new BioWalletList();
35+
data.wallets.card = new ArrayList<>();
36+
data.user = new BioDeviceUse();
3337
}
3438

3539

40+
3641
public void setData(BioWalletData data) {
3742
this.data = data;
3843
if(this.data == null) return;
@@ -63,6 +68,12 @@ public Fragment getItem(int position) {
6368
return obj;
6469
}
6570

71+
@Override
72+
public int getItemPosition(Object object) {
73+
// refresh all fragments when data set changed
74+
return PagerAdapter.POSITION_NONE;
75+
}
76+
6677
@Override
6778
public int getCount() {
6879
if(data == null) return 0;

0 commit comments

Comments
 (0)