44import android .content .Context ;
55import android .content .DialogInterface ;
66import android .content .Intent ;
7+ import android .graphics .Typeface ;
78import android .os .Bundle ;
89import android .os .Handler ;
910import android .os .Looper ;
2526import androidx .viewpager .widget .ViewPager ;
2627
2728import com .google .gson .Gson ;
29+ import com .skydoves .powerspinner .PowerSpinnerView ;
2830
2931import java .text .DecimalFormat ;
32+ import java .util .ArrayList ;
33+ import java .util .List ;
3034import java .util .concurrent .Executor ;
3135
3236import dev .samstevens .totp .code .CodeGenerator ;
@@ -82,6 +86,9 @@ public class BootpayBioActivity extends FragmentActivity implements BootpayBioRe
8286 BioWalletData data ;
8387 CardViewPager card_pager ;
8488 CardPagerAdapter cardPagerAdapter ;
89+ PowerSpinnerView quota_spinner ;
90+ LinearLayout quota_layout ;
91+ View quota_line ;
8592 int currentIndex = 0 ;
8693
8794 @ Override
@@ -102,6 +109,28 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
102109 initBiometricAuth ();
103110 setNameViews ();
104111 setPriceViews ();
112+ setQuotaValue ();
113+ }
114+
115+ void setQuotaValue () {
116+ if (request == null ) return ;
117+ quota_layout .setVisibility (request .getPrice () < 50000 ? View .GONE : View .VISIBLE );
118+ quota_line .setVisibility (request .getPrice () < 50000 ? View .GONE : View .VISIBLE );
119+ if (request .getPrice () < 50000 ) return ;
120+ List <String > array = getQuotaList ();
121+ if (array == null ) return ;
122+ quota_spinner .setItems (array );
123+ quota_spinner .selectItemByIndex (0 );
124+ }
125+
126+ List <String > getQuotaList () {
127+ List <String > result = new ArrayList <>();
128+ if (request .getBootExtra (this ) == null || request .getBootExtra (this ).getQuotas () == null ) return null ;
129+ for (Integer i : request .getBootExtra (this ).getQuotas ()) {
130+ if (i == 0 ) result .add ("일시불" );
131+ else result .add ((i +1 ) + "개월" );
132+ }
133+ return result ;
105134 }
106135
107136 @ Override
@@ -124,6 +153,9 @@ void initView() {
124153 prices = findViewById (R .id .prices );
125154 msg = findViewById (R .id .msg );
126155 card_pager = findViewById (R .id .card_pager );
156+ quota_layout = findViewById (R .id .quota_layout );
157+ quota_spinner = findViewById (R .id .quota_spinner );
158+ quota_line = findViewById (R .id .quota_line );
127159 cardPagerAdapter = new CardPagerAdapter (getSupportFragmentManager (), this .context );
128160 cardPagerAdapter .setParent (this );
129161// cardPagerAdapter.setDialog(bootpayBioDialog);
@@ -219,11 +251,37 @@ private void setPriceViews() {
219251 layout .addView (right );
220252 prices .addView (layout );
221253 }
254+
255+ LinearLayout layout = new LinearLayout (context );
256+ LinearLayout .LayoutParams params = new LinearLayout .LayoutParams (LinearLayout .LayoutParams .MATCH_PARENT , LinearLayout .LayoutParams .WRAP_CONTENT );
257+ layout .setOrientation (LinearLayout .HORIZONTAL );
258+ layout .setLayoutParams (params );
259+
260+
261+ TextView left = new TextView (context );
262+ LinearLayout .LayoutParams params1 = new LinearLayout .LayoutParams (0 , LinearLayout .LayoutParams .WRAP_CONTENT , 1.0f );
263+ left .setLayoutParams (params1 );
264+ left .setTextSize (TypedValue .COMPLEX_UNIT_SP , 16 );
265+ left .setTypeface (left .getTypeface (), Typeface .BOLD );
266+ left .setText ("총 결제금액" );
267+ left .setTextColor (getResources ().getColor (R .color .black , null ));
268+ layout .addView (left );
269+
270+ TextView right = new TextView (context );
271+ LinearLayout .LayoutParams params2 = new LinearLayout .LayoutParams (0 , LinearLayout .LayoutParams .WRAP_CONTENT , 1.0f );
272+ right .setLayoutParams (params2 );
273+ right .setTextAlignment (TEXT_ALIGNMENT_TEXT_END );
274+ right .setTextSize (TypedValue .COMPLEX_UNIT_SP , 16 );
275+ right .setTypeface (left .getTypeface (), Typeface .BOLD );
276+ right .setText (getComma (request .getPrice ()));
277+ right .setTextColor (getResources ().getColor (R .color .black , null ));
278+ layout .addView (right );
279+ prices .addView (layout );
222280 }
223281
224282 private String getComma (double value ) {
225283 DecimalFormat myFormatter = new DecimalFormat ("###,###" );
226- return myFormatter .format (value );
284+ return myFormatter .format (value ) + "원" ;
227285 }
228286
229287 public void setCardPager (final BioWalletData data ) {
0 commit comments