Preyea Regmi
5 years ago
9 changed files with 283 additions and 26 deletions
-
5.idea/modules.xml
-
2app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/view/SelectedRedBorderDecoration.java
-
85app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/adapter/PayoutModeSelectionRVAdapter.java
-
15app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/presenter/SplashScreenPresenter.java
-
3app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/presenter/SplashScreenPresenterInterface.java
-
44app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/view/PayoutModeSelectionItemViewHolder.java
-
38app/src/main/java/com/gmeremit/online/gmeremittance_native/splash_screen/view/SplashScreen.java
-
72app/src/main/res/layout/activity_splash_screen_key_1.xml
-
45app/src/main/res/layout/splash_exchange_paymentmode_rv_viewholder.xml
@ -0,0 +1,85 @@ |
|||
package com.gmeremit.online.gmeremittance_native.splash_screen.adapter; |
|||
|
|||
import android.support.annotation.NonNull; |
|||
import android.support.v7.widget.RecyclerView; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
|
|||
import com.gmeremit.online.gmeremittance_native.R; |
|||
import com.gmeremit.online.gmeremittance_native.exchange_rate.model.PaymentModeMapper; |
|||
import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.PaymentMode; |
|||
import com.gmeremit.online.gmeremittance_native.exchange_rate.view.PaymentModeViewHolder; |
|||
import com.gmeremit.online.gmeremittance_native.exchange_rate.view.SelectedRedBorderDecoration; |
|||
import com.gmeremit.online.gmeremittance_native.splash_screen.view.PayoutModeSelectionItemViewHolder; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class PayoutModeSelectionRVAdapter extends RecyclerView.Adapter<PayoutModeSelectionItemViewHolder> implements SelectedRedBorderDecoration.RedItemSelectionListener { |
|||
|
|||
private final OnPaymentModeSelectionListener listener; |
|||
private int selectedItemPosition; |
|||
private List<PaymentMode> data; |
|||
|
|||
public PayoutModeSelectionRVAdapter(OnPaymentModeSelectionListener listener) { |
|||
this.listener = listener; |
|||
this.data=new ArrayList<>(); |
|||
this.selectedItemPosition=-1; |
|||
} |
|||
@NonNull |
|||
@Override |
|||
public PayoutModeSelectionItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { |
|||
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.splash_exchange_paymentmode_rv_viewholder, viewGroup, false); |
|||
return new PayoutModeSelectionItemViewHolder(view); |
|||
} |
|||
|
|||
@Override |
|||
public void onBindViewHolder(@NonNull PayoutModeSelectionItemViewHolder payoutModeSelectionItemViewHolder, int i) { |
|||
payoutModeSelectionItemViewHolder.itemView.setOnClickListener(new View.OnClickListener() { |
|||
@Override |
|||
public void onClick(View v) { |
|||
setSelectedItem(payoutModeSelectionItemViewHolder.getAdapterPosition()); |
|||
} |
|||
}); |
|||
payoutModeSelectionItemViewHolder.setImage(PaymentModeMapper.getPaymentModeImageFromId(data.get(payoutModeSelectionItemViewHolder.getAdapterPosition()).getId())); |
|||
payoutModeSelectionItemViewHolder.setTitle(data.get(payoutModeSelectionItemViewHolder.getAdapterPosition()).getText()); |
|||
} |
|||
|
|||
public void setSelectedItem(int position) |
|||
{ |
|||
if(position!=-1) |
|||
{ |
|||
this.selectedItemPosition=position; |
|||
if(listener!=null) |
|||
{ |
|||
notifyItemChanged(selectedItemPosition); |
|||
listener.onPaymentModeSelected(data.get(selectedItemPosition)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public int getSelectedRedItemPosition() { |
|||
return this.selectedItemPosition; |
|||
} |
|||
|
|||
public void setData(List<PaymentMode> data) |
|||
{ |
|||
if(data!=null&&data.size()>0) |
|||
{ |
|||
this.data=data; |
|||
notifyDataSetChanged(); |
|||
} |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public int getItemCount() { |
|||
return data.size(); |
|||
} |
|||
|
|||
public interface OnPaymentModeSelectionListener { |
|||
void onPaymentModeSelected(PaymentMode selectedData); |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.gmeremit.online.gmeremittance_native.splash_screen.view; |
|||
|
|||
import android.support.annotation.NonNull; |
|||
import android.support.v7.widget.RecyclerView; |
|||
import android.view.View; |
|||
import android.widget.ImageView; |
|||
import android.widget.TextView; |
|||
|
|||
import com.gmeremit.online.gmeremittance_native.R; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
|
|||
public class PayoutModeSelectionItemViewHolder extends RecyclerView.ViewHolder { |
|||
@BindView(R.id.paymentModeTitleTxt) |
|||
TextView paymentModeTitle; |
|||
|
|||
|
|||
|
|||
@BindView(R.id.paymentModeLogo) |
|||
ImageView paymentModeLogo; |
|||
|
|||
|
|||
public PayoutModeSelectionItemViewHolder(@NonNull View itemView) { |
|||
super(itemView); |
|||
ButterKnife.bind(this,itemView); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
public void setImage(int resId) { |
|||
if(resId!=-1) |
|||
paymentModeLogo.setImageResource(resId); |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
paymentModeTitle.setText(title); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
xmlns:tools="http://schemas.android.com/tools" |
|||
android:id="@+id/relativeLayout6" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_margin="4dp" |
|||
android:background="@drawable/ic_rounded_white"> |
|||
|
|||
<ImageView |
|||
android:id="@+id/paymentModeLogo" |
|||
android:layout_width="@dimen/_25sdp" |
|||
android:layout_height="@dimen/_25sdp" |
|||
android:layout_marginStart="8dp" |
|||
android:layout_marginTop="8dp" |
|||
android:layout_marginEnd="8dp" |
|||
android:layout_marginBottom="8dp" |
|||
android:scaleType="centerCrop" |
|||
android:visibility="gone" |
|||
android:src="@drawable/ic_home_delivery" |
|||
app:layout_constraintBottom_toTopOf="@+id/paymentModeTitleTxt" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent" /> |
|||
|
|||
<com.gmeremit.online.gmeremittance_native.customwidgets.GmeTextView |
|||
android:id="@+id/paymentModeTitleTxt" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginStart="8dp" |
|||
android:layout_marginTop="8dp" |
|||
android:layout_marginEnd="8dp" |
|||
android:layout_marginBottom="8dp" |
|||
android:gravity="center" |
|||
android:text="Home Delivery" |
|||
android:textColor="@color/darkgray" |
|||
android:textSize="@dimen/_11ssp" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/paymentModeLogo" /> |
|||
|
|||
|
|||
</android.support.constraint.ConstraintLayout> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue