-
7app/build.gradle
-
5app/src/main/AndroidManifest.xml
-
15app/src/main/java/com/remit/jmecustomer/features/home/view/HomeActivityV2.java
-
27app/src/main/java/com/remit/jmecustomer/features/mynotifications/MyNotificationViewModelFactory.java
-
83app/src/main/java/com/remit/jmecustomer/features/mynotifications/adapter/MyNotificationListingRVAdapter.java
-
33app/src/main/java/com/remit/jmecustomer/features/mynotifications/adapter/MyNotificationListingRVViewholder.java
-
159app/src/main/java/com/remit/jmecustomer/features/mynotifications/gateway/MyNotificationGateway.java
-
140app/src/main/java/com/remit/jmecustomer/features/mynotifications/model/MyNotificationDTO.java
-
53app/src/main/java/com/remit/jmecustomer/features/mynotifications/model/MyNotificationDetailDTO.java
-
30app/src/main/java/com/remit/jmecustomer/features/mynotifications/presenter/MyNotificationGatewayInterface.java
-
43app/src/main/java/com/remit/jmecustomer/features/mynotifications/presenter/MyNotificationPresenterInterface.java
-
282app/src/main/java/com/remit/jmecustomer/features/mynotifications/presenter/MyNotificationViewModel.java
-
127app/src/main/java/com/remit/jmecustomer/features/mynotifications/view/MyNotificationActivity.java
-
107app/src/main/java/com/remit/jmecustomer/features/mynotifications/view/MyNotificationFragment.java
-
101app/src/main/java/com/remit/jmecustomer/features/mynotifications/view/MyNotificationListingFragment.java
-
2app/src/main/java/com/remit/jmecustomer/utils/https/API_URL.java
-
8app/src/main/java/com/remit/jmecustomer/utils/https/ApiEndpoints.java
-
BINapp/src/main/res/drawable-xxhdpi/notify_error_color.png
-
BINapp/src/main/res/drawable-xxhdpi/notify_error_grey.png
-
BINapp/src/main/res/drawable-xxhdpi/notify_info_color.png
-
BINapp/src/main/res/drawable-xxhdpi/notify_info_grey.png
-
BINapp/src/main/res/drawable-xxhdpi/notify_success_color.png
-
BINapp/src/main/res/drawable-xxhdpi/notify_success_grey.png
-
120app/src/main/res/layout/activity_home_v2.xml
-
13app/src/main/res/layout/activity_my_notifications.xml
-
102app/src/main/res/layout/fragment_my_notice_detail.xml
-
15app/src/main/res/layout/fragment_my_notice_listing.xml
-
12app/src/main/res/layout/fragment_notice_listing.xml
-
3app/src/main/res/layout/layout_sendmoney_toolbar.xml
-
100app/src/main/res/layout/my_notice_list_viewholder.xml
-
29app/src/main/res/layout/nav_drawer_fragment.xml
-
4app/src/main/res/values/strings.xml
@ -0,0 +1,27 @@ |
|||
package com.remit.jmecustomer.features.mynotifications; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.lifecycle.ViewModel; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import com.remit.jmecustomer.features.mynotifications.gateway.MyNotificationGateway; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationPresenterInterface; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationViewModel; |
|||
|
|||
|
|||
public class MyNotificationViewModelFactory implements ViewModelProvider.Factory { |
|||
private final MyNotificationPresenterInterface.NoticeViewContractInterface view; |
|||
|
|||
|
|||
public MyNotificationViewModelFactory(MyNotificationPresenterInterface.NoticeViewContractInterface view) { |
|||
this.view = view; |
|||
|
|||
} |
|||
|
|||
@SuppressWarnings("unchecked") |
|||
@NonNull |
|||
@Override |
|||
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { |
|||
return (T) new MyNotificationViewModel(view,new MyNotificationGateway()); |
|||
} |
|||
} |
@ -0,0 +1,83 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.adapter; |
|||
|
|||
import android.view.LayoutInflater; |
|||
import android.view.ViewGroup; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
|
|||
import com.remit.jmecustomer.R; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDTO; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class MyNotificationListingRVAdapter extends RecyclerView.Adapter<MyNotificationListingRVViewholder> { |
|||
|
|||
private final NoticeClickListener listener; |
|||
|
|||
private List<MyNotificationDTO> noticeList; |
|||
|
|||
public MyNotificationListingRVAdapter(NoticeClickListener listener) { |
|||
this.listener = listener; |
|||
noticeList = new ArrayList<>(); |
|||
|
|||
} |
|||
|
|||
@NonNull |
|||
@Override |
|||
public MyNotificationListingRVViewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
|||
return new MyNotificationListingRVViewholder(LayoutInflater.from(parent.getContext()).inflate(R.layout.my_notice_list_viewholder, parent, false)); |
|||
} |
|||
|
|||
@Override |
|||
public void onBindViewHolder(@NonNull MyNotificationListingRVViewholder holder, int position) { |
|||
MyNotificationDTO myNotificationDTO = noticeList.get(holder.getAdapterPosition()); |
|||
|
|||
holder.notice_title.setText(myNotificationDTO.getTitle()); |
|||
holder.notice_body.setText(myNotificationDTO.getBody()); |
|||
holder.notice_date.setText(myNotificationDTO.getCreateDate()); |
|||
if (myNotificationDTO.getIsRead() != null && "1".equalsIgnoreCase(myNotificationDTO.getIsRead())) { |
|||
if (myNotificationDTO.getCategory() != null && myNotificationDTO.getCategory().equalsIgnoreCase("success")) |
|||
holder.imgNotificationStat.setBackgroundResource(R.drawable.notify_success_grey); |
|||
else if (myNotificationDTO.getCategory() != null && myNotificationDTO.getCategory().equalsIgnoreCase("info")) |
|||
holder.imgNotificationStat.setBackgroundResource(R.drawable.notify_info_grey); |
|||
else if (myNotificationDTO.getCategory() != null && myNotificationDTO.getCategory().equalsIgnoreCase("error")) |
|||
holder.imgNotificationStat.setBackgroundResource(R.drawable.notify_error_grey); |
|||
} else { |
|||
if (myNotificationDTO.getCategory() != null && myNotificationDTO.getCategory().equalsIgnoreCase("success")) |
|||
holder.imgNotificationStat.setBackgroundResource(R.drawable.notify_success_color); |
|||
else if (myNotificationDTO.getCategory() != null && myNotificationDTO.getCategory().equalsIgnoreCase("info")) |
|||
holder.imgNotificationStat.setBackgroundResource(R.drawable.notify_info_color); |
|||
else if (myNotificationDTO.getCategory() != null && myNotificationDTO.getCategory().equalsIgnoreCase("error")) |
|||
holder.imgNotificationStat.setBackgroundResource(R.drawable.notify_error_color); |
|||
} |
|||
|
|||
holder.itemView.setOnClickListener(view -> { |
|||
if (listener != null) |
|||
listener.onNoticeClicked(noticeList.get(holder.getAdapterPosition())); |
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
public int getItemCount() { |
|||
return noticeList.size(); |
|||
} |
|||
|
|||
public void setData(List<MyNotificationDTO> data) { |
|||
if (data != null && data.size() > 0) { |
|||
this.noticeList.clear(); |
|||
this.noticeList.addAll(data); |
|||
notifyDataSetChanged(); |
|||
} |
|||
} |
|||
|
|||
public void resetData() { |
|||
this.noticeList = null; |
|||
notifyDataSetChanged(); |
|||
} |
|||
|
|||
public interface NoticeClickListener { |
|||
void onNoticeClicked(MyNotificationDTO itemModel); |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.adapter; |
|||
|
|||
import android.view.View; |
|||
import android.widget.ImageView; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
|
|||
import com.remit.jmecustomer.R; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
|
|||
public class MyNotificationListingRVViewholder extends RecyclerView.ViewHolder { |
|||
|
|||
@BindView(R.id.tv_notification_title) |
|||
TextView notice_title; |
|||
|
|||
@BindView(R.id.tv_notification_body) |
|||
TextView notice_body; |
|||
|
|||
@BindView(R.id.tv_notification_date) |
|||
TextView notice_date; |
|||
|
|||
@BindView(R.id.imgNotificationStat) |
|||
ImageView imgNotificationStat; |
|||
|
|||
public MyNotificationListingRVViewholder(@NonNull View itemView) { |
|||
super(itemView); |
|||
ButterKnife.bind(this,itemView); |
|||
} |
|||
} |
@ -0,0 +1,159 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.gateway; |
|||
|
|||
import com.google.gson.JsonObject; |
|||
import com.remit.jmecustomer.base.PrivilegedGateway; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDetailDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationGatewayInterface; |
|||
import com.remit.jmecustomer.utils.https.HttpClientV2; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import io.reactivex.Observable; |
|||
import okhttp3.ResponseBody; |
|||
|
|||
public class MyNotificationGateway extends PrivilegedGateway implements MyNotificationGatewayInterface { |
|||
|
|||
@Override |
|||
public Observable<ResponseBody> getNoticeList(String auth, String customerID) { |
|||
JsonObject jsonObject = new JsonObject(); |
|||
jsonObject.addProperty("customerId", customerID); |
|||
return HttpClientV2.getInstance().getMYNoticeList(auth, customerID); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public Observable<ResponseBody> getNoticeDetail(String auth, String noticeId) { |
|||
JsonObject jsonObject = new JsonObject(); |
|||
jsonObject.addProperty("rowId", noticeId); |
|||
return HttpClientV2.getInstance().getNoticeDetail(auth, jsonObject); |
|||
} |
|||
|
|||
@Override |
|||
public Observable<ResponseBody> updateNotice(String auth, String noticeId) { |
|||
return HttpClientV2.getInstance().updateMyNotice(auth, noticeId); |
|||
} |
|||
|
|||
@Override |
|||
public Observable<ResponseBody> setNoticeStatus(String auth, String tranId, String yesNo) { |
|||
return HttpClientV2.getInstance().setNoticeReadStatus(auth, tranId, yesNo); |
|||
} |
|||
|
|||
@Override |
|||
public List<MyNotificationDTO> mockNoticeList() { |
|||
List<MyNotificationDTO> noticeList = new ArrayList<>(); |
|||
|
|||
MyNotificationDTO myNotificationDTO0 = new MyNotificationDTO(); |
|||
myNotificationDTO0.setRowId("0"); |
|||
myNotificationDTO0.setTitle("Title 1"); |
|||
myNotificationDTO0.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO0.setCreateDate("2077/01/01"); |
|||
myNotificationDTO0.setIsRead("0"); |
|||
myNotificationDTO0.setType("1"); |
|||
myNotificationDTO0.setExtra("12"); |
|||
myNotificationDTO0.setCategory("success"); |
|||
myNotificationDTO0.setIsClickable("Y"); |
|||
myNotificationDTO0.setUrl("https://japanremit.com/document/deposit/lawson/HowToUse.html"); |
|||
noticeList.add(myNotificationDTO0); |
|||
|
|||
MyNotificationDTO myNotificationDTO1 = new MyNotificationDTO(); |
|||
myNotificationDTO1.setRowId("1"); |
|||
myNotificationDTO1.setTitle("Title 2"); |
|||
myNotificationDTO1.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO1.setCreateDate("2077/01/02"); |
|||
myNotificationDTO1.setIsRead("1"); |
|||
myNotificationDTO1.setType("0"); |
|||
myNotificationDTO1.setCategory("success"); |
|||
noticeList.add(myNotificationDTO1); |
|||
|
|||
|
|||
MyNotificationDTO myNotificationDTO2 = new MyNotificationDTO(); |
|||
myNotificationDTO2.setRowId("2"); |
|||
myNotificationDTO2.setTitle("Title 3"); |
|||
myNotificationDTO2.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO2.setCreateDate("2077/01/02"); |
|||
myNotificationDTO2.setIsRead("0"); |
|||
myNotificationDTO2.setType("1"); |
|||
myNotificationDTO2.setExtra("13"); |
|||
myNotificationDTO2.setCategory("error"); |
|||
noticeList.add(myNotificationDTO2); |
|||
|
|||
|
|||
MyNotificationDTO myNotificationDTO3 = new MyNotificationDTO(); |
|||
myNotificationDTO3.setRowId("3"); |
|||
myNotificationDTO3.setTitle("Title 4"); |
|||
myNotificationDTO3.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO3.setCreateDate("2077/01/03"); |
|||
myNotificationDTO3.setIsRead("1"); |
|||
myNotificationDTO3.setType("1"); |
|||
myNotificationDTO3.setExtra("14"); |
|||
myNotificationDTO3.setCategory("error"); |
|||
noticeList.add(myNotificationDTO3); |
|||
|
|||
|
|||
MyNotificationDTO myNotificationDTO4 = new MyNotificationDTO(); |
|||
myNotificationDTO4.setRowId("4"); |
|||
myNotificationDTO4.setTitle("Title 5"); |
|||
myNotificationDTO4.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO4.setCreateDate("2077/01/04"); |
|||
myNotificationDTO4.setIsRead("1"); |
|||
myNotificationDTO4.setType("0"); |
|||
myNotificationDTO4.setCategory("info"); |
|||
noticeList.add(myNotificationDTO4); |
|||
|
|||
MyNotificationDTO myNotificationDTO5 = new MyNotificationDTO(); |
|||
myNotificationDTO5.setRowId("4"); |
|||
myNotificationDTO5.setTitle("Title 5"); |
|||
myNotificationDTO5.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO5.setCreateDate("2077/01/04"); |
|||
myNotificationDTO5.setIsRead("1"); |
|||
myNotificationDTO5.setType("0"); |
|||
myNotificationDTO5.setCategory("info"); |
|||
noticeList.add(myNotificationDTO5); |
|||
|
|||
MyNotificationDTO myNotificationDTO6 = new MyNotificationDTO(); |
|||
myNotificationDTO6.setRowId("4"); |
|||
myNotificationDTO6.setTitle("Title 5"); |
|||
myNotificationDTO6.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO6.setCreateDate("2077/01/04"); |
|||
myNotificationDTO6.setIsRead("1"); |
|||
myNotificationDTO6.setType("0"); |
|||
myNotificationDTO6.setCategory("info"); |
|||
noticeList.add(myNotificationDTO6); |
|||
|
|||
|
|||
MyNotificationDTO myNotificationDTO7 = new MyNotificationDTO(); |
|||
myNotificationDTO7.setRowId("4"); |
|||
myNotificationDTO7.setTitle("Title 5"); |
|||
myNotificationDTO7.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO7.setCreateDate("2077/01/04"); |
|||
myNotificationDTO7.setIsRead("1"); |
|||
myNotificationDTO7.setType("0"); |
|||
myNotificationDTO7.setCategory("info"); |
|||
noticeList.add(myNotificationDTO7); |
|||
|
|||
|
|||
MyNotificationDTO myNotificationDTO8 = new MyNotificationDTO(); |
|||
myNotificationDTO8.setRowId("4"); |
|||
myNotificationDTO8.setTitle("Title 5"); |
|||
myNotificationDTO8.setBody("Deposit Slip of amount 10 JPY has been uploaded."); |
|||
myNotificationDTO8.setCreateDate("2077/01/04"); |
|||
myNotificationDTO8.setIsRead("1"); |
|||
myNotificationDTO8.setType("0"); |
|||
myNotificationDTO8.setCategory("info"); |
|||
noticeList.add(myNotificationDTO8); |
|||
|
|||
return noticeList; |
|||
} |
|||
|
|||
@Override |
|||
public MyNotificationDetailDTO mockNoticeDetail() { |
|||
MyNotificationDetailDTO myNotificationDetailDTO = new MyNotificationDetailDTO(); |
|||
myNotificationDetailDTO.setTitle("Title 1"); |
|||
myNotificationDetailDTO.setBody("This is Detail body of Title 1"); |
|||
myNotificationDetailDTO.setCreateDate("2077/01/01"); |
|||
myNotificationDetailDTO.setImageURL("https://p18cdn4static.sharpschool.com/UserFiles/Servers/Server_414551/Image/News/District%20News/Title%201.jpg"); |
|||
return myNotificationDetailDTO; |
|||
} |
|||
} |
@ -0,0 +1,140 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.model; |
|||
|
|||
import com.google.gson.annotations.Expose; |
|||
import com.google.gson.annotations.SerializedName; |
|||
|
|||
public class MyNotificationDTO { |
|||
|
|||
@SerializedName("rowId") |
|||
@Expose |
|||
private String rowId; |
|||
|
|||
@SerializedName("customerId") |
|||
@Expose |
|||
private String customerId; |
|||
|
|||
@SerializedName("title") |
|||
@Expose |
|||
private String title; |
|||
|
|||
@SerializedName("body") |
|||
@Expose |
|||
private String body; |
|||
|
|||
@SerializedName("createDate") |
|||
@Expose |
|||
private String createDate; |
|||
|
|||
@SerializedName("isRead")// 0 => Not Read, 1=> Read, |
|||
@Expose |
|||
private String isRead; |
|||
|
|||
@SerializedName("type")//0 => General Notice, 1=> Txn Notice |
|||
@Expose |
|||
private String type; |
|||
|
|||
@SerializedName("extra")//If type==1, then extra will have Txn id |
|||
@Expose |
|||
private String extra; |
|||
|
|||
@SerializedName("category") |
|||
@Expose |
|||
private String category; |
|||
|
|||
@SerializedName("url") |
|||
@Expose |
|||
private String url; |
|||
|
|||
@SerializedName("isClickable") |
|||
@Expose |
|||
private String isClickable; |
|||
|
|||
|
|||
|
|||
|
|||
public String getRowId() { |
|||
return rowId; |
|||
} |
|||
|
|||
public void setRowId(String rowId) { |
|||
this.rowId = rowId; |
|||
} |
|||
|
|||
public String getCustomerId() { |
|||
return customerId; |
|||
} |
|||
|
|||
public void setCustomerId(String rowId) { |
|||
this.rowId = rowId; |
|||
} |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getBody() { |
|||
return body; |
|||
} |
|||
|
|||
public void setBody(String body) { |
|||
this.body = body; |
|||
} |
|||
|
|||
public String getCreateDate() { |
|||
return createDate; |
|||
} |
|||
|
|||
public void setCreateDate(String createDate) { |
|||
this.createDate = createDate; |
|||
} |
|||
|
|||
public String getIsRead() { |
|||
return isRead; |
|||
} |
|||
|
|||
public void setIsRead(String isRead) { |
|||
this.isRead = isRead; |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public String getExtra() { |
|||
return extra; |
|||
} |
|||
|
|||
public void setExtra(String extra) { |
|||
this.extra = extra; |
|||
} |
|||
|
|||
public String getCategory() { |
|||
return category; |
|||
} |
|||
|
|||
public void setCategory(String category) { |
|||
this.category = category; |
|||
} |
|||
public String getUrl() { |
|||
return url; |
|||
} |
|||
|
|||
public void setUrl(String url) { |
|||
this.url = url; |
|||
} |
|||
public String getIsClickable() { |
|||
return isClickable; |
|||
} |
|||
|
|||
public void setIsClickable(String isClickable) { |
|||
this.isClickable = isClickable; |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.model; |
|||
|
|||
import com.google.gson.annotations.Expose; |
|||
import com.google.gson.annotations.SerializedName; |
|||
|
|||
public class MyNotificationDetailDTO { |
|||
|
|||
|
|||
@SerializedName("title") |
|||
@Expose |
|||
private String title; |
|||
@SerializedName("body") |
|||
@Expose |
|||
private String body; |
|||
@SerializedName("createDate") |
|||
@Expose |
|||
private String createDate; |
|||
@SerializedName("imageURL") |
|||
@Expose |
|||
private String imageURL; |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getBody() { |
|||
return body; |
|||
} |
|||
|
|||
public void setBody(String body) { |
|||
this.body = body; |
|||
} |
|||
|
|||
public String getCreateDate() { |
|||
return createDate; |
|||
} |
|||
|
|||
public void setCreateDate(String createDate) { |
|||
this.createDate = createDate; |
|||
} |
|||
|
|||
public String getImageURL() { |
|||
return imageURL; |
|||
} |
|||
|
|||
public void setImageURL(String imageURL) { |
|||
this.imageURL = imageURL; |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.presenter; |
|||
|
|||
|
|||
|
|||
import com.remit.jmecustomer.base.PrivilegedGatewayInterface; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDetailDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
import io.reactivex.Observable; |
|||
import okhttp3.ResponseBody; |
|||
|
|||
public interface MyNotificationGatewayInterface extends PrivilegedGatewayInterface { |
|||
|
|||
Observable<ResponseBody> getNoticeList(String auth, String customerID); |
|||
|
|||
Observable<ResponseBody> getNoticeDetail(String auth, String noticeId); |
|||
|
|||
Observable<ResponseBody> updateNotice(String auth, String noticeId); |
|||
|
|||
Observable<ResponseBody> setNoticeStatus(String auth,String tranId,String noticeStat); |
|||
|
|||
List<MyNotificationDTO> mockNoticeList(); |
|||
|
|||
MyNotificationDetailDTO mockNoticeDetail(); |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,43 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.presenter; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
|
|||
import com.remit.jmecustomer.base.BaseContractInterface; |
|||
import com.remit.jmecustomer.base.BasePresenterInterface; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDetailDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface MyNotificationPresenterInterface extends BasePresenterInterface { |
|||
|
|||
void fetchNoticeListLiveData(); |
|||
|
|||
void fetchNoticeDetail(MyNotificationDTO selectedNotice); |
|||
|
|||
LiveData<List<MyNotificationDTO>> getNoticeListLiveData(); |
|||
|
|||
LiveData<MyNotificationDetailDTO> getNoticeDetailLiveData(); |
|||
|
|||
void changeNoticeStat(); |
|||
|
|||
MyNotificationDTO getSelectedNotice(); |
|||
|
|||
void setSelectedNotice(MyNotificationDTO noticeState); |
|||
|
|||
void updateNotification(String rowId); |
|||
|
|||
interface NoticeViewContractInterface extends BaseContractInterface { |
|||
|
|||
|
|||
void lazyInitViews(); |
|||
|
|||
void showDetailScreen(); |
|||
|
|||
NoticeListContractInterface getNoticeListContract(); |
|||
|
|||
interface NoticeListContractInterface extends BaseContractInterface { |
|||
void showTranSendComplete(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,282 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.presenter; |
|||
|
|||
import androidx.lifecycle.LiveData; |
|||
import androidx.lifecycle.MutableLiveData; |
|||
|
|||
import com.google.gson.reflect.TypeToken; |
|||
import com.remit.jmecustomer.R; |
|||
import com.remit.jmecustomer.base.BaseViewModel; |
|||
import com.remit.jmecustomer.common.customwidgets.CustomAlertDialog; |
|||
import com.remit.jmecustomer.features.exrate.model.datav2.GenericApiResponseModel; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDetailDTO; |
|||
import com.remit.jmecustomer.features.sendmoney.model.SendMoneyTransactionCompleteV2ResponseBody; |
|||
import com.remit.jmecustomer.utils.Constants; |
|||
import com.remit.jmecustomer.utils.https.GenericApiObserverResponseV2; |
|||
import com.remit.jmecustomer.utils.https.GenericResponseDataModel; |
|||
|
|||
import java.lang.reflect.Type; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers; |
|||
import io.reactivex.disposables.CompositeDisposable; |
|||
import io.reactivex.schedulers.Schedulers; |
|||
|
|||
public class MyNotificationViewModel extends BaseViewModel implements MyNotificationPresenterInterface { |
|||
|
|||
|
|||
private final NoticeViewContractInterface view; |
|||
private final MyNotificationGatewayInterface gateway; |
|||
private final CompositeDisposable compositeDisposable; |
|||
|
|||
MutableLiveData<List<MyNotificationDTO>> noticeListLiveData; |
|||
MutableLiveData<MyNotificationDetailDTO> noticeDetailLiveData; |
|||
private MyNotificationDTO selectedNotice; |
|||
|
|||
public MyNotificationViewModel(NoticeViewContractInterface view, MyNotificationGatewayInterface gatewayInterface) { |
|||
this.view = view; |
|||
this.gateway = gatewayInterface; |
|||
noticeListLiveData = new MutableLiveData<>(); |
|||
noticeDetailLiveData = new MutableLiveData<>(); |
|||
this.compositeDisposable = new CompositeDisposable(); |
|||
} |
|||
|
|||
@Override |
|||
public void onViewReady() { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void onViewNotReady() { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void fetchNoticeListLiveData() { |
|||
this.compositeDisposable.add( |
|||
this.gateway.getNoticeList(gateway.getAuth(), gateway.getUserIDNumber()) |
|||
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|||
.subscribeOn(Schedulers.io()) |
|||
.observeOn(AndroidSchedulers.mainThread()) |
|||
.doFinally(() -> view.showProgressBar(false, "")) |
|||
.subscribeWith(new NoticeListObserver()) |
|||
); |
|||
} |
|||
|
|||
@Override |
|||
public void fetchNoticeDetail(MyNotificationDTO selectedNotice) { |
|||
this.compositeDisposable.add( |
|||
this.gateway.getNoticeDetail(gateway.getAuth(), selectedNotice.getRowId()) |
|||
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|||
.subscribeOn(Schedulers.io()) |
|||
.observeOn(AndroidSchedulers.mainThread()) |
|||
.doFinally(() -> view.showProgressBar(false, "")) |
|||
.subscribeWith(new NoticeDetailObserver()) |
|||
); |
|||
} |
|||
|
|||
@Override |
|||
public void updateNotification(String rowId) { |
|||
this.compositeDisposable.add( |
|||
this.gateway.updateNotice(gateway.getAuth(), selectedNotice.getRowId()) |
|||
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|||
.subscribeOn(Schedulers.io()) |
|||
.observeOn(AndroidSchedulers.mainThread()) |
|||
.doFinally(() -> view.showProgressBar(false, "")) |
|||
.subscribeWith(new UpdateNoticeObserver()) |
|||
); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public LiveData<List<MyNotificationDTO>> getNoticeListLiveData() { |
|||
return noticeListLiveData; |
|||
} |
|||
|
|||
@Override |
|||
public LiveData<MyNotificationDetailDTO> getNoticeDetailLiveData() { |
|||
return noticeDetailLiveData; |
|||
} |
|||
|
|||
@Override |
|||
public void changeNoticeStat() { |
|||
this.compositeDisposable.add( |
|||
this.gateway.setNoticeStatus(gateway.getAuth(), selectedNotice.getExtra(), "Y") |
|||
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|||
.subscribeOn(Schedulers.io()) |
|||
.observeOn(AndroidSchedulers.mainThread()) |
|||
.doFinally(() -> view.showProgressBar(false, "")) |
|||
.subscribeWith(new NoticeStatUpdateObserver()) |
|||
); |
|||
} |
|||
|
|||
@Override |
|||
public MyNotificationDTO getSelectedNotice() { |
|||
return selectedNotice; |
|||
} |
|||
|
|||
@Override |
|||
public void setSelectedNotice(MyNotificationDTO noticeState) { |
|||
this.selectedNotice = noticeState; |
|||
} |
|||
|
|||
private void sortNoticeList(List<MyNotificationDTO> data) { |
|||
// DateFormat df = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a"); |
|||
// Collections.sort(data, (o1, o2) -> { |
|||
// try { |
|||
// return df.parse(o1.getCreateDate()).compareTo(df.parse(o2.getCreateDate())); |
|||
// } catch (Exception pe) { |
|||
// Collections.reverse(data); |
|||
// } |
|||
// return 0; |
|||
// }); |
|||
// if (data != null) |
|||
// Collections.reverse(data); |
|||
noticeListLiveData.setValue(data); |
|||
|
|||
} |
|||
|
|||
public class NoticeListObserver extends GenericApiObserverResponseV2<List<MyNotificationDTO>> { |
|||
|
|||
@Override |
|||
protected Type getDataType() { |
|||
return TypeToken.getParameterized(List.class, MyNotificationDTO.class).getType(); |
|||
} |
|||
|
|||
@Override |
|||
protected void onSuccess(GenericResponseDataModel<List<MyNotificationDTO>> t) { |
|||
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|||
//sortNoticeList(gateway.mockNoticeList()); |
|||
if (t.getData() != null && t.getData().size() > 0) { |
|||
view.lazyInitViews(); |
|||
sortNoticeList(t.getData()); |
|||
} else |
|||
view.showPopUpMessage(view.getContext().getResources().getString(R.string.donot_have_notification_text), CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); |
|||
|
|||
} else { |
|||
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void onFailed(String message) { |
|||
// view.lazyInitViews(); |
|||
// sortNoticeList(gateway.mockNoticeList()); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); |
|||
} |
|||
|
|||
@Override |
|||
protected void onConnectionNotEstablished(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
protected void unauthorizedAccess(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.logout()); |
|||
|
|||
} |
|||
} |
|||
|
|||
public class NoticeDetailObserver extends GenericApiObserverResponseV2<MyNotificationDetailDTO> { |
|||
@Override |
|||
protected Type getDataType() { |
|||
return TypeToken.getParameterized(MyNotificationDetailDTO.class).getType(); |
|||
} |
|||
|
|||
@Override |
|||
protected void onSuccess(GenericResponseDataModel<MyNotificationDetailDTO> t) { |
|||
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|||
noticeDetailLiveData.setValue(t.getData()); |
|||
view.showDetailScreen(); |
|||
} else { |
|||
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void onFailed(String message) { |
|||
// noticeDetailLiveData.setValue(gateway.mockNoticeDetail()); |
|||
// view.showDetailScreen(); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void onConnectionNotEstablished(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void unauthorizedAccess(String message) { |
|||
gateway.clearAllUserData(); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.logout()); |
|||
} |
|||
} |
|||
|
|||
public class NoticeStatUpdateObserver extends GenericApiObserverResponseV2<SendMoneyTransactionCompleteV2ResponseBody> { |
|||
@Override |
|||
protected Type getDataType() { |
|||
return TypeToken.getParameterized(MyNotificationDetailDTO.class).getType(); |
|||
} |
|||
|
|||
@Override |
|||
protected void onSuccess(GenericResponseDataModel<SendMoneyTransactionCompleteV2ResponseBody> t) { |
|||
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|||
view.getNoticeListContract().showTranSendComplete(); |
|||
} else { |
|||
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void onFailed(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void onConnectionNotEstablished(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void unauthorizedAccess(String message) { |
|||
gateway.clearAllUserData(); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.logout()); |
|||
} |
|||
} |
|||
|
|||
public class UpdateNoticeObserver extends GenericApiObserverResponseV2<List<MyNotificationDTO>> { |
|||
@Override |
|||
protected Type getDataType() { |
|||
return TypeToken.getParameterized(UpdateNoticeObserver.class).getType(); |
|||
} |
|||
|
|||
@Override |
|||
protected void onSuccess(GenericResponseDataModel<List<MyNotificationDTO>> t) { |
|||
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|||
//noticeListLiveData.setValue(t.); |
|||
} else { |
|||
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void onFailed(String message) { |
|||
// noticeDetailLiveData.setValue(gateway.mockNoticeDetail()); |
|||
// view.showDetailScreen(); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void onConnectionNotEstablished(String message) { |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); |
|||
} |
|||
|
|||
@Override |
|||
protected void unauthorizedAccess(String message) { |
|||
gateway.clearAllUserData(); |
|||
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.logout()); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,127 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.view; |
|||
|
|||
import android.content.Intent; |
|||
import android.os.Bundle; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.fragment.app.Fragment; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
import androidx.viewpager.widget.ViewPager; |
|||
|
|||
import com.remit.jmecustomer.R; |
|||
import com.remit.jmecustomer.base.BaseActivity; |
|||
import com.remit.jmecustomer.common.customwidgets.GenericViewPagerAdapter; |
|||
import com.remit.jmecustomer.features.home.view.HomeActivityV2; |
|||
import com.remit.jmecustomer.features.mynotifications.MyNotificationViewModelFactory; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationPresenterInterface; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationViewModel; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
import butterknife.OnClick; |
|||
|
|||
public class MyNotificationActivity extends BaseActivity implements MyNotificationPresenterInterface.NoticeViewContractInterface, ViewPager.OnPageChangeListener { |
|||
|
|||
@BindView(R.id.myNoticeViewPager) |
|||
ViewPager myNoticeViewPager; |
|||
|
|||
|
|||
@BindView(R.id.toolbar_title) |
|||
TextView toolbar_title; |
|||
|
|||
private GenericViewPagerAdapter noticeViewPagerAdapter; |
|||
private MyNotificationListingFragment noticeListingFragment; |
|||
private MyNotificationFragment noticeDetailFragment; |
|||
|
|||
|
|||
@Override |
|||
protected void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_my_notifications); |
|||
ButterKnife.bind(this); |
|||
initialize(); |
|||
} |
|||
|
|||
private void initialize() { |
|||
toolbar_title.setText(getString(R.string.my_notification_text)); |
|||
MyNotificationViewModelFactory noticeViewModelFactory = new MyNotificationViewModelFactory(this); |
|||
MyNotificationViewModel viewModel = new ViewModelProvider(this, noticeViewModelFactory).get(MyNotificationViewModel.class); |
|||
viewModel.fetchNoticeListLiveData(); |
|||
setupViewPager(); |
|||
|
|||
} |
|||
|
|||
|
|||
private void setupViewPager() { |
|||
|
|||
List<Fragment> fragments = new ArrayList<>(); |
|||
|
|||
noticeListingFragment = new MyNotificationListingFragment(); |
|||
noticeDetailFragment = new MyNotificationFragment(); |
|||
|
|||
|
|||
fragments.add(noticeListingFragment); |
|||
fragments.add(noticeDetailFragment); |
|||
|
|||
noticeViewPagerAdapter = new GenericViewPagerAdapter(getSupportFragmentManager(),fragments); |
|||
|
|||
|
|||
myNoticeViewPager.setOffscreenPageLimit(2); |
|||
|
|||
myNoticeViewPager.addOnPageChangeListener(this); |
|||
|
|||
myNoticeViewPager.setAdapter(noticeViewPagerAdapter); |
|||
|
|||
|
|||
} |
|||
|
|||
@OnClick(R.id.iv_back) |
|||
public void backButtonPressed() { |
|||
this.onBackPressed(); |
|||
} |
|||
|
|||
@Override |
|||
public void lazyInitViews() { |
|||
setupViewPager(); |
|||
} |
|||
|
|||
@Override |
|||
public void showDetailScreen() { |
|||
myNoticeViewPager.setCurrentItem(1); |
|||
} |
|||
|
|||
@Override |
|||
public NoticeListContractInterface getNoticeListContract() { |
|||
return noticeListingFragment; |
|||
} |
|||
|
|||
@Override |
|||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void onPageSelected(int position) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void onPageScrollStateChanged(int state) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void onBackPressed() { |
|||
if (myNoticeViewPager.getCurrentItem() == 0) { |
|||
Intent redirectIntent = new Intent(this, HomeActivityV2.class); |
|||
redirectIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
|||
redirectIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
|||
startActivity(redirectIntent); |
|||
finish(); |
|||
} else |
|||
myNoticeViewPager.setCurrentItem(myNoticeViewPager.getCurrentItem() - 1); |
|||
} |
|||
} |
@ -0,0 +1,107 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.view; |
|||
|
|||
import android.graphics.Bitmap; |
|||
import android.graphics.drawable.Drawable; |
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.ImageView; |
|||
import android.widget.ProgressBar; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.annotation.Nullable; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
|
|||
import com.bumptech.glide.Glide; |
|||
import com.bumptech.glide.request.target.CustomTarget; |
|||
import com.bumptech.glide.request.transition.Transition; |
|||
import com.remit.jmecustomer.R; |
|||
import com.remit.jmecustomer.base.BaseFragment; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDetailDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationViewModel; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
|
|||
public class MyNotificationFragment extends BaseFragment { |
|||
|
|||
@BindView(R.id.tv_my_notification_date) |
|||
TextView noticeDate; |
|||
|
|||
@BindView(R.id.tv_my_notification_title) |
|||
TextView noticeTitle; |
|||
|
|||
@BindView(R.id.tv_my_notification_body) |
|||
TextView noticeBody; |
|||
|
|||
@BindView(R.id.my_notice_image) |
|||
ImageView noticeImage; |
|||
|
|||
@BindView(R.id.my_progressBar) |
|||
ProgressBar imageProgessBar; |
|||
|
|||
|
|||
|
|||
@Override |
|||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
|||
return inflater.inflate(R.layout.fragment_my_notice_detail, container, false); |
|||
} |
|||
|
|||
@Override |
|||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
|||
super.onViewCreated(view, savedInstanceState); |
|||
ButterKnife.bind(this, view); |
|||
init(); |
|||
performDefaultAction(savedInstanceState); |
|||
} |
|||
|
|||
|
|||
private void init() { |
|||
|
|||
|
|||
} |
|||
|
|||
private void performDefaultAction(Bundle savedInstance) { |
|||
|
|||
MyNotificationViewModel myNotificationViewModel = new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class); |
|||
|
|||
myNotificationViewModel.getNoticeDetailLiveData().observe(getViewLifecycleOwner(),this::updateNoticeDEtail); |
|||
|
|||
} |
|||
|
|||
private void updateNoticeDEtail(MyNotificationDetailDTO noticeDetail) |
|||
{ |
|||
String date=getActivity().getResources().getString(R.string.date_text)+": "+noticeDetail.getCreateDate(); |
|||
noticeDate.setText(date); |
|||
noticeTitle.setText(noticeDetail.getTitle()); |
|||
noticeBody.setText(noticeDetail.getBody()); |
|||
if(noticeDetail.getImageURL()==null||noticeDetail.getImageURL().length()==0) |
|||
{ |
|||
imageProgessBar.setVisibility(View.GONE); |
|||
noticeImage.setVisibility(View.GONE); |
|||
} |
|||
else |
|||
{ |
|||
imageProgessBar.setVisibility(View.VISIBLE); |
|||
Glide.with(this) |
|||
.asBitmap() |
|||
.load(noticeDetail.getImageURL()) |
|||
.into(new CustomTarget<Bitmap>() { |
|||
@Override |
|||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { |
|||
// imageProgessBar.setVisibility(View.GONE); |
|||
// noticeImage.setImageBitmap(resource); |
|||
} |
|||
|
|||
@Override |
|||
public void onLoadCleared(@Nullable Drawable placeholder) { |
|||
|
|||
} |
|||
}); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,101 @@ |
|||
package com.remit.jmecustomer.features.mynotifications.view; |
|||
|
|||
import android.content.Intent; |
|||
import android.net.Uri; |
|||
import android.os.Bundle; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
|
|||
import androidx.annotation.Nullable; |
|||
import androidx.lifecycle.ViewModelProvider; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
|
|||
import com.remit.jmecustomer.R; |
|||
import com.remit.jmecustomer.base.BaseFragment; |
|||
import com.remit.jmecustomer.features.mynotifications.adapter.MyNotificationListingRVAdapter; |
|||
import com.remit.jmecustomer.features.mynotifications.model.MyNotificationDTO; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationPresenterInterface; |
|||
import com.remit.jmecustomer.features.mynotifications.presenter.MyNotificationViewModel; |
|||
import com.remit.jmecustomer.features.sendmoney.view.SendMoneyV2TransactionCompleteActivity; |
|||
|
|||
import java.util.LinkedList; |
|||
import java.util.List; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
|
|||
public class MyNotificationListingFragment extends BaseFragment implements MyNotificationListingRVAdapter.NoticeClickListener, MyNotificationPresenterInterface.NoticeViewContractInterface.NoticeListContractInterface { |
|||
|
|||
|
|||
@BindView(R.id.myNoticeRv) |
|||
RecyclerView myNoticeRv; |
|||
|
|||
MyNotificationListingRVAdapter myNotificationListingRVAdapter; |
|||
|
|||
|
|||
@Override |
|||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
|||
return inflater.inflate(R.layout.fragment_my_notice_listing, container, false); |
|||
} |
|||
|
|||
@Override |
|||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
|||
super.onViewCreated(view, savedInstanceState); |
|||
ButterKnife.bind(this, view); |
|||
init(); |
|||
performDefaultAction(savedInstanceState); |
|||
} |
|||
|
|||
|
|||
private void init() { |
|||
myNotificationListingRVAdapter = new MyNotificationListingRVAdapter(this); |
|||
myNoticeRv.setAdapter(myNotificationListingRVAdapter); |
|||
// noticeRv.addItemDecoration(new LineDividerItemDecoration(noticeRv.getContext(), LineDividerItemDecoration.VERTICAL_LIST)); |
|||
} |
|||
|
|||
private void performDefaultAction(Bundle savedInstance) { |
|||
|
|||
MyNotificationViewModel myNotificationViewModel = new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class); |
|||
; |
|||
|
|||
myNotificationViewModel.getNoticeListLiveData().observe(getViewLifecycleOwner(), this::updateNoticeList); |
|||
} |
|||
|
|||
private void updateNoticeList(List<MyNotificationDTO> noticeList) { |
|||
myNotificationListingRVAdapter.setData(noticeList); |
|||
} |
|||
|
|||
@Override |
|||
public void onNoticeClicked(MyNotificationDTO itemModel) { |
|||
new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).setSelectedNotice(itemModel); |
|||
handleNoticeClicked(itemModel); |
|||
} |
|||
|
|||
private void handleNoticeClicked(MyNotificationDTO itemModel) { |
|||
if (itemModel.getIsClickable() != null && itemModel.getIsClickable().equals("Y")) { |
|||
new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).updateNotification(itemModel.getRowId()); |
|||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(itemModel.getUrl())); |
|||
startActivity(browserIntent); |
|||
} |
|||
// if (itemModel.getType().equals("0")) { |
|||
// new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).fetchNoticeDetail(itemModel); |
|||
// } else if (itemModel.getType().equals("1")) { |
|||
// if(itemModel.getIsRead().equals("1")){ |
|||
// showTranSendComplete(); |
|||
// }else{ |
|||
// new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).changeNoticeStat(); |
|||
// } |
|||
// |
|||
// } |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void showTranSendComplete() { |
|||
MyNotificationDTO selectedNotice = new ViewModelProvider(getActivity()).get(MyNotificationViewModel.class).getSelectedNotice(); |
|||
Intent startReceiptActivity = new Intent(getActivity(), SendMoneyV2TransactionCompleteActivity.class); |
|||
startReceiptActivity.putExtra(SendMoneyV2TransactionCompleteActivity.SEND_MONEY_TID_BUNDLE_KEY, selectedNotice.getExtra()); |
|||
startActivity(startReceiptActivity); |
|||
} |
|||
} |
After Width: 512 | Height: 512 | Size: 8.9 KiB |
After Width: 512 | Height: 512 | Size: 16 KiB |
After Width: 512 | Height: 512 | Size: 20 KiB |
After Width: 512 | Height: 512 | Size: 26 KiB |
After Width: 512 | Height: 512 | Size: 17 KiB |
After Width: 512 | Height: 512 | Size: 22 KiB |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:orientation="vertical" |
|||
> |
|||
<include layout="@layout/layout_sendmoney_toolbar" /> |
|||
<com.remit.jmecustomer.common.customwidgets.SwipeDisabledViewPager |
|||
android:id="@+id/myNoticeViewPager" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="0dp" |
|||
android:layout_weight="1"/> |
|||
</androidx.appcompat.widget.LinearLayoutCompat> |
@ -0,0 +1,102 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<ScrollView 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:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:background="@color/gray"> |
|||
|
|||
<androidx.constraintlayout.widget.ConstraintLayout |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:background="@color/bright_gray2" |
|||
android:padding="@dimen/_8sdp"> |
|||
|
|||
<com.remit.jmecustomer.common.customwidgets.JmeTextView |
|||
android:id="@+id/tv_my_notification_date" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:gravity="end" |
|||
android:textColor="@color/darkgray2" |
|||
android:textSize="@dimen/_10ssp" |
|||
app:layout_constraintBottom_toTopOf="@+id/tv_my_notification_title" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintHorizontal_bias="0.5" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent" |
|||
app:txtfontName="@string/regular" |
|||
tools:text="@string/date_text" /> |
|||
|
|||
<com.remit.jmecustomer.common.customwidgets.JmeTextView |
|||
android:id="@+id/tv_my_notification_title" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="@dimen/_5sdp" |
|||
android:ellipsize="end" |
|||
android:gravity="start" |
|||
android:maxLines="1" |
|||
android:textColor="@color/darkgray" |
|||
android:textSize="@dimen/_13ssp" |
|||
app:layout_constraintBottom_toTopOf="@+id/view16" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintHorizontal_bias="0.5" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/tv_my_notification_date" |
|||
|
|||
app:txtfontName="@string/bold" |
|||
tools:text="When developed " /> |
|||
|
|||
|
|||
<View |
|||
android:id="@+id/view16" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="@dimen/_1sdp" |
|||
android:layout_marginTop="@dimen/_8sdp" |
|||
android:layout_marginBottom="@dimen/_8sdp" |
|||
android:background="@color/gray" |
|||
app:layout_constraintBottom_toTopOf="@+id/tv_my_notification_body" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
|
|||
app:layout_constraintHorizontal_bias="0.5" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/tv_my_notification_title" /> |
|||
|
|||
|
|||
<com.remit.jmecustomer.common.customwidgets.JmeTextView |
|||
android:id="@+id/tv_my_notification_body" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:gravity="start" |
|||
android:textColor="@color/darkgray" |
|||
android:textSize="@dimen/_12ssp" |
|||
app:layout_constraintBottom_toTopOf="@+id/my_notice_image" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintHorizontal_bias="0.5" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/view16" |
|||
app:txtfontName="@string/regular" |
|||
tools:text="When developed " /> |
|||
|
|||
<ImageView |
|||
android:id="@+id/my_notice_image" |
|||
android:layout_width="0dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="@dimen/_8sdp" |
|||
android:minHeight="@dimen/_120sdp" |
|||
app:layout_constraintBottom_toTopOf="@+id/tv_my_notification_date" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintHorizontal_bias="0.5" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/tv_my_notification_body" /> |
|||
|
|||
<ProgressBar |
|||
android:id="@+id/my_progressBar" |
|||
android:layout_width="@dimen/_25sdp" |
|||
android:layout_height="@dimen/_25sdp" |
|||
app:layout_constraintBottom_toBottomOf="@+id/my_notice_image" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@+id/tv_my_notification_body" /> |
|||
|
|||
</androidx.constraintlayout.widget.ConstraintLayout> |
|||
</ScrollView> |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<androidx.recyclerview.widget.RecyclerView android:layout_height="match_parent" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:scrollbars="none" |
|||
android:id="@+id/myNoticeRv" |
|||
android:background="@color/body_light_grey" |
|||
xmlns:android="http://schemas.android.com/apk/res/android" |
|||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |
|||
android:orientation="vertical" |
|||
android:layout_width="match_parent" |
|||
android:paddingBottom="@dimen/_15sdp"/> |
|||
|
|||
|
|||
|
@ -1,14 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
|
|||
<androidx.recyclerview.widget.RecyclerView android:layout_height="match_parent" |
|||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:scrollbars="none" |
|||
android:id="@+id/noticeRv" |
|||
android:background="@color/bright_gray2" |
|||
xmlns:android="http://schemas.android.com/apk/res/android" |
|||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:background="@color/body_light_grey" |
|||
android:orientation="vertical" |
|||
android:layout_width="match_parent" /> |
|||
android:scrollbars="none" |
|||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
|||
|
|||
|
|||
|
@ -0,0 +1,100 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<com.google.android.material.card.MaterialCardView 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:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginLeft="@dimen/_15sdp" |
|||
android:layout_marginTop="@dimen/_15sdp" |
|||
android:layout_marginRight="@dimen/_15sdp" |
|||
android:outlineAmbientShadowColor="@color/black" |
|||
android:outlineSpotShadowColor="@color/black" |
|||
app:cardBackgroundColor="@color/white" |
|||
app:cardCornerRadius="@dimen/_12sdp"> |
|||
|
|||
<androidx.constraintlayout.widget.ConstraintLayout |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:padding="@dimen/_5sdp" |
|||
android:paddingLeft="@dimen/_8sdp" |
|||
android:paddingRight="@dimen/_8sdp"> |
|||
|
|||
<LinearLayout |
|||
android:id="@+id/jmeDepositLayout" |
|||
android:layout_width="wrap_content" |
|||
android:layout_height="wrap_content" |
|||
android:orientation="vertical" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toEndOf="@id/imgNotificationStat" |
|||
app:layout_constraintTop_toTopOf="parent"> |
|||
|
|||
<com.remit.jmecustomer.common.customwidgets.JmeTextView |
|||
android:id="@+id/tv_notification_title" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="@dimen/_5sdp" |
|||
android:ellipsize="end" |
|||
android:gravity="start" |
|||
android:maxLines="10" |
|||
android:textColor="@color/darkgray" |
|||
android:textSize="@dimen/_13sdp" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toEndOf="@id/imgNotificationStat" |
|||
app:layout_constraintTop_toTopOf="parent" |
|||
app:txtfontName="@string/bold" |
|||
tools:text="When developed " /> |
|||
|
|||
<com.remit.jmecustomer.common.customwidgets.JmeTextView |
|||
android:id="@+id/tv_notification_body" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="@dimen/_5sdp" |
|||
android:ellipsize="end" |
|||
android:gravity="start" |
|||
android:maxLines="10" |
|||
android:textColor="@color/darkgray" |
|||
android:textSize="@dimen/_12sdp" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toEndOf="@id/imgNotificationStat" |
|||
app:layout_constraintTop_toBottomOf="@+id/tv_notification_title" |
|||
tools:text="When developed " /> |
|||
|
|||
<com.remit.jmecustomer.common.customwidgets.JmeTextView |
|||
android:id="@+id/tv_notification_date" |
|||
android:layout_width="385dp" |
|||
android:layout_height="wrap_content" |
|||
android:layout_marginTop="@dimen/_4sdp" |
|||
android:layout_marginBottom="@dimen/_5sdp" |
|||
android:gravity="start" |
|||
android:textColor="#757575" |
|||
android:textSize="@dimen/_10ssp" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="@+id/tv_notification_title" |
|||
app:layout_constraintTop_toBottomOf="@+id/tv_notification_body" |
|||
app:txtfontName="@string/regular" |
|||
tools:text="@string/date_text" /> |
|||
</LinearLayout> |
|||
|
|||
|
|||
|
|||
|
|||
<ImageView |
|||
android:id="@+id/imgNotificationStat" |
|||
android:layout_width="@dimen/_18sdp" |
|||
android:layout_height="@dimen/_18sdp" |
|||
android:layout_marginLeft="@dimen/_50sdp" |
|||
android:layout_marginRight="@dimen/commonMargin" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintEnd_toStartOf="@+id/jmeDepositLayout" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent" |
|||
app:layout_constraintVertical_bias="0.1" |
|||
android:contentDescription="TODO" /> |
|||
|
|||
</androidx.constraintlayout.widget.ConstraintLayout> |
|||
|
|||
</com.google.android.material.card.MaterialCardView> |
|||
|
|||
|
|||
|