Browse Source

View flow for country list done

master
preyearegmi 6 years ago
parent
commit
5cf88fbff9
  1. 5
      app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/countrylistingdialog/CountryFlagMapper.java
  2. 26
      app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/countrylistingdialog/CountryListingDialog.java
  3. 8
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/adapter/PaymentModeRvAdapter.java
  4. 5
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/model/PaymentModeMapper.java
  5. 16
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/ExchangeMethodV2Activity.java
  6. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/PaymentModeViewHolder.java
  7. 2
      app/src/main/res/layout/activity_exchange_method_v2.xml
  8. 8
      app/src/main/res/layout/dialog_country_listing.xml

5
app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/countrylistingdialog/CountryFlagMapper.java

@ -32,6 +32,11 @@ public class CountryFlagMapper {
return R.drawable.flag_srilanka; return R.drawable.flag_srilanka;
case "SG": case "SG":
return R.drawable.flag_singapore; return R.drawable.flag_singapore;
case "VN":
return R.drawable.flag_vietnam;
case "RU":
return R.drawable.flag_vietnam;
default: default:
return -1; return -1;
} }

26
app/src/main/java/com/gmeremit/online/gmeremittance_native/customwidgets/countrylistingdialog/CountryListingDialog.java

@ -10,6 +10,7 @@ import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText; import android.widget.EditText;
import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.R;
@ -28,6 +29,8 @@ public class CountryListingDialog extends DialogFragment implements View.OnClick
private EditText noCountryFoundView; private EditText noCountryFoundView;
private EditText searchEditTextView; private EditText searchEditTextView;
private CountryListingRvAdapter countryListingRvAdapter; private CountryListingRvAdapter countryListingRvAdapter;
private Window window;
private boolean windowHieghtNotFixed=true;
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
@ -42,8 +45,9 @@ public class CountryListingDialog extends DialogFragment implements View.OnClick
Dialog dialog = builder.create(); Dialog dialog = builder.create();
try { try {
Window window = dialog.getWindow();
this.window = dialog.getWindow();
window.setBackgroundDrawableResource(R.drawable.ic_rounded_white); window.setBackgroundDrawableResource(R.drawable.ic_rounded_white);
} catch (NullPointerException e) { } catch (NullPointerException e) {
} }
@ -72,6 +76,22 @@ public class CountryListingDialog extends DialogFragment implements View.OnClick
} }
} }
@Override
public void onStart() {
super.onStart();
if(windowHieghtNotFixed&&window!=null)
{
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(window.getAttributes());
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
float multi = getActivity().getResources().getDisplayMetrics().density;
lp.verticalMargin=10*multi;
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
window.setAttributes(lp);
windowHieghtNotFixed=false;
}
}
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
@ -93,10 +113,10 @@ public class CountryListingDialog extends DialogFragment implements View.OnClick
if (action) { if (action) {
int rvHeight = countryListRv.getHeight(); int rvHeight = countryListRv.getHeight();
noCountryFoundView.setHeight(rvHeight); noCountryFoundView.setHeight(rvHeight);
countryListRv.setVisibility(View.GONE);
countryListRv.setVisibility(View.INVISIBLE);
noCountryFoundView.setVisibility(View.VISIBLE); noCountryFoundView.setVisibility(View.VISIBLE);
} else { } else {
noCountryFoundView.setVisibility(View.GONE);
noCountryFoundView.setVisibility(View.INVISIBLE);
countryListRv.setVisibility(View.VISIBLE); countryListRv.setVisibility(View.VISIBLE);
} }
} }

8
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/adapter/PaymentModeRvAdapter.java

@ -40,9 +40,9 @@ public class PaymentModeRvAdapter extends RecyclerView.Adapter<PaymentModeViewHo
setSelectedItem(holder.getAdapterPosition()); setSelectedItem(holder.getAdapterPosition());
} }
}); });
holder.setImage(PaymentModeMapper.getPaymentModeImageFromId(data.get(position).getId()));
holder.setTitle(data.get(position).getText());
holder.setDesc(data.get(position).getDescription());
holder.setImage(PaymentModeMapper.getPaymentModeImageFromId(data.get(holder.getAdapterPosition()).getId()));
holder.setTitle(data.get(holder.getAdapterPosition()).getText());
holder.setDesc(data.get(holder.getAdapterPosition()).getDescription());
} }
@Override @Override
@ -52,7 +52,7 @@ public class PaymentModeRvAdapter extends RecyclerView.Adapter<PaymentModeViewHo
public void setSelectedItem(int position) public void setSelectedItem(int position)
{ {
if(position!=-1&&data!=null&&data.size()>0)
if(position!=-1)
{ {
this.selectedItemPosition=position; this.selectedItemPosition=position;
if(listener!=null) if(listener!=null)

5
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/model/PaymentModeMapper.java

@ -14,9 +14,12 @@ public class PaymentModeMapper {
case "2": case "2":
return R.drawable.ic_bank_image; return R.drawable.ic_bank_image;
case "3":
case "12":
return R.drawable.ic_home_delivery; return R.drawable.ic_home_delivery;
case "13":
return R.drawable.ic_menu_wallet;
default: default:
return -1; return -1;

16
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/ExchangeMethodV2Activity.java

@ -77,7 +77,7 @@ public class ExchangeMethodV2Activity extends BaseActivity implements PaymentMod
private void performDefaultAction(Bundle savedInstanceState) { private void performDefaultAction(Bundle savedInstanceState) {
toolbarTitle.setText("Today's Rate"); toolbarTitle.setText("Today's Rate");
mockData();
// mockData();
this.presenter.getAllData(); this.presenter.getAllData();
} }
@ -101,10 +101,21 @@ public class ExchangeMethodV2Activity extends BaseActivity implements PaymentMod
this.mockedData.add(new CountryPaymentService("Nepal", "NP", "123", "NPR", paymentModeList)); this.mockedData.add(new CountryPaymentService("Nepal", "NP", "123", "NPR", paymentModeList));
paymentModeRvAdapter.setData(paymentModeList); paymentModeRvAdapter.setData(paymentModeList);
paymentModeRvAdapter.setSelectedItem(0); paymentModeRvAdapter.setSelectedItem(0);
showPaymentService(paymentModeList);
} }
private void showPaymentService(List<PaymentMode> paymentModeList)
{
if(paymentModeRvAdapter!=null)
{
paymentModeRvAdapter.setData(paymentModeList);
paymentModeRvAdapter.setSelectedItem(0);
}
}
private void setupRv() { private void setupRv() {
paymentModeRvAdapter = new PaymentModeRvAdapter(this); paymentModeRvAdapter = new PaymentModeRvAdapter(this);
paymentModeRv.setAdapter(paymentModeRvAdapter); paymentModeRv.setAdapter(paymentModeRvAdapter);
@ -144,6 +155,7 @@ public class ExchangeMethodV2Activity extends BaseActivity implements PaymentMod
Log.d("ExchangeRateV2", "Selected Country " + countryPaymentService.getCountryCode()); Log.d("ExchangeRateV2", "Selected Country " + countryPaymentService.getCountryCode());
this.selectedCountryPaymentService = countryPaymentService; this.selectedCountryPaymentService = countryPaymentService;
showSelectedRecipient(countryPaymentService.getCountryCode(), countryPaymentService.getCurrency()); showSelectedRecipient(countryPaymentService.getCountryCode(), countryPaymentService.getCurrency());
showPaymentService(countryPaymentService.getServiceAvailable());
if (this.countryListingDialog != null) if (this.countryListingDialog != null)
this.countryListingDialog.dismiss(); this.countryListingDialog.dismiss();
} }
@ -175,6 +187,7 @@ public class ExchangeMethodV2Activity extends BaseActivity implements PaymentMod
this.sendMoneyEditText.setText(""); this.sendMoneyEditText.setText("");
} }
showSelectedRecipient(defaultCountryPaymentService.getCountryCode(), defaultCountryPaymentService.getCurrency()); showSelectedRecipient(defaultCountryPaymentService.getCountryCode(), defaultCountryPaymentService.getCurrency());
showPaymentService(defaultCountryPaymentService.getServiceAvailable());
} }
else else
{ {
@ -186,6 +199,7 @@ public class ExchangeMethodV2Activity extends BaseActivity implements PaymentMod
//We are taking first item as default as we don't have any default item enlisted //We are taking first item as default as we don't have any default item enlisted
CountryPaymentService firstSelectedItem=countryPaymentServiceList.get(0); CountryPaymentService firstSelectedItem=countryPaymentServiceList.get(0);
showSelectedRecipient(firstSelectedItem.getCountryCode(), firstSelectedItem.getCurrency()); showSelectedRecipient(firstSelectedItem.getCountryCode(), firstSelectedItem.getCurrency());
showPaymentService(firstSelectedItem.getServiceAvailable());
} }
this.paymentServiceList = countryPaymentServiceList; this.paymentServiceList = countryPaymentServiceList;

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/PaymentModeViewHolder.java

@ -28,6 +28,7 @@ public class PaymentModeViewHolder extends RecyclerView.ViewHolder {
public void setImage(int resId) { public void setImage(int resId) {
if(resId!=-1)
paymentModeLogo.setImageResource(resId); paymentModeLogo.setImageResource(resId);
} }

2
app/src/main/res/layout/activity_exchange_method_v2.xml

@ -128,7 +128,7 @@
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_gravity="center"
android:layout_gravity="center_vertical|start"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" /> app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</LinearLayout> </LinearLayout>

8
app/src/main/res/layout/dialog_country_listing.xml

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -69,17 +70,16 @@
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/countryListRv" android:id="@+id/countryListRv"
android:background="@color/white"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="wrap_content" />
<com.gmeremit.online.gmeremittance_native.customwidgets.GmeEditText <com.gmeremit.online.gmeremittance_native.customwidgets.GmeEditText
android:id="@+id/noCountryFoundTextView" android:id="@+id/noCountryFoundTextView"
android:visibility="gone"
android:visibility="invisible"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_gravity="center"
android:background="@null" android:background="@null"
android:enabled="false" android:enabled="false"
android:gravity="center" android:gravity="center"

Loading…
Cancel
Save