删除家族相关代码
This commit is contained in:
@@ -46,7 +46,6 @@ import com.chwl.app.avroom.activity.AVRoomActivity;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.common.widget.CircleImageView;
|
||||
import com.chwl.app.common.widget.DragLayout;
|
||||
import com.chwl.app.family.view.activity.FamilyHomeActivity;
|
||||
import com.chwl.app.home.HomeViewModel;
|
||||
import com.chwl.app.home.dialog.NewUserHelloDialog;
|
||||
import com.chwl.app.home.dialog.ProtocolUpdateDialog;
|
||||
@@ -193,8 +192,6 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
// 跳转
|
||||
if (!StringUtil.isEmpty(linkedInfo.getRoomUid()) && linkedInfo.getType().equals("2")) {
|
||||
AVRoomActivity.start(context, Long.parseLong(linkedInfo.getRoomUid()));
|
||||
} else if (!StringUtil.isEmpty(linkedInfo.getFamilyId()) && linkedInfo.getType().equals("4")) {
|
||||
FamilyHomeActivity.start(context, linkedInfo.getFamilyId());
|
||||
} else if (!TextUtils.isEmpty(linkedInfo.getUrl()) && linkedInfo.getType().equals("3")) {
|
||||
CommonWebViewActivity.start(context, UriProvider.getLinkUrl(linkedInfo.getUrl()));
|
||||
// } else if (!TextUtils.isEmpty(linkedInfo.getWorldId()) && linkedInfo.getType().equals("5")) {
|
||||
|
@@ -1,22 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.user.bean.AttentionInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public interface IFamilyAttentionFragmentView extends IMvpBaseView{
|
||||
void onRefreshData(List<AttentionInfo> attentionInfoList);
|
||||
|
||||
void onLoadMoreData(List<AttentionInfo> attentionInfoList);
|
||||
|
||||
void onRefreshDataFail(String error);
|
||||
|
||||
void onLoadMoreDataFail(String error);
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/30
|
||||
*/
|
||||
|
||||
public interface IFamilyCurrencySearchView extends IMvpBaseView {
|
||||
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.family.bean.VMBillItemInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public interface IFamilyCurrencyView extends IMvpBaseView {
|
||||
void onLoadData(List<VMBillItemInfo> billItemInfos, int page, int dataSize);
|
||||
|
||||
void showErrorView(String message);
|
||||
|
||||
void refreshData();
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.user.bean.FansListInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public interface IFamilyFansListFragmentView extends IMvpBaseView {
|
||||
void onRefreshData(FansListInfo fansListInfo);
|
||||
|
||||
void onLoadMoreData(FansListInfo fansListInfo);
|
||||
|
||||
void onRefreshDataFail(String message);
|
||||
|
||||
void onLoadMoreDataFail(String message);
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public interface IFamilyFriendListFragmentView extends IMvpBaseView {
|
||||
|
||||
void onRefreshData(List<UserInfo> userInfos);
|
||||
|
||||
void onLoadMoreData(List<UserInfo> userInfos);
|
||||
|
||||
void onRefreshDataFail(String message);
|
||||
|
||||
void onLoadMoreDataFail(String message);
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.family.bean.FamilyGameInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/23
|
||||
*/
|
||||
|
||||
public interface IFamilyGameListActivityView extends IMvpBaseView {
|
||||
|
||||
void onLoadData(List<FamilyGameInfo> data, int page);
|
||||
|
||||
void onLoadDataFail(String error, int page);
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public interface IFamilyInfoView extends IMvpBaseView {
|
||||
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/25
|
||||
*/
|
||||
|
||||
public interface IFamilyManageActivityView extends IMvpBaseView {
|
||||
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public interface IFamilyMemberListView extends IMvpBaseView {
|
||||
void onLoadData(List<FamilyMemberInfo> memberInfoList);
|
||||
|
||||
void reloadFamilyMember();
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public interface IFamilyMemberSearchView extends IMvpBaseView {
|
||||
|
||||
void update(List<FamilyMemberInfo> memberInfos);
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/23
|
||||
*/
|
||||
|
||||
public interface IFamilyPlazaActivityView extends IMvpBaseView {
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/2
|
||||
*/
|
||||
|
||||
public interface IFamilySearchView extends IMvpBaseView {
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
package com.chwl.app.family.contract.viewinterface;
|
||||
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public interface IFamilySelectFriendActivityView extends IMvpBaseView {
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyAttentionFragmentView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.user.AttentionModel;
|
||||
import com.chwl.core.user.bean.AttentionInfo;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public class FamilyAttentionPresenter extends BaseMvpPresenter<IFamilyAttentionFragmentView> {
|
||||
private int mPage = Constants.PAGE_START;
|
||||
private boolean isLoading = false;
|
||||
|
||||
public void refreshData() {
|
||||
loadData(Constants.PAGE_START);
|
||||
}
|
||||
public void loadMoreData() {
|
||||
loadData(mPage + 1);
|
||||
}
|
||||
|
||||
private void loadData(int targetPage){
|
||||
if (isLoading){
|
||||
if (getMvpView() == null){
|
||||
return;
|
||||
}
|
||||
if (mPage == Constants.PAGE_START) {
|
||||
getMvpView().onRefreshDataFail(ResUtil.getString(R.string.family_presenter_familyattentionpresenter_01));
|
||||
} else {
|
||||
getMvpView().onLoadMoreDataFail(ResUtil.getString(R.string.family_presenter_familyattentionpresenter_02));
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.mPage = targetPage;
|
||||
isLoading = true;
|
||||
AttentionModel.get().getAttentionList(
|
||||
AuthModel.get().getCurrentUid(),
|
||||
mPage,
|
||||
Constants.PAGE_SIZE
|
||||
)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<List<AttentionInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<AttentionInfo> attentionInfos) {
|
||||
isLoading = false;
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshData(attentionInfos);
|
||||
}else {
|
||||
getMvpView().onLoadMoreData(attentionInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
isLoading = false;
|
||||
if (mPage == Constants.PAGE_START) {
|
||||
getMvpView().onRefreshDataFail(e.getMessage());
|
||||
} else {
|
||||
getMvpView().onLoadMoreDataFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -1,284 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyCurrencyView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.family.bean.BillDateDivInfo;
|
||||
import com.chwl.core.family.bean.TransactionRecordInfo;
|
||||
import com.chwl.core.family.bean.VMBillItemInfo;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.FamilyMoneyManagementInfo;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.MonthlyRecord;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.TradeMoneyRecord;
|
||||
import com.chwl.core.family.event.FamilyCurrencyUpdateEvent;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.rxbus.RxBusHelper;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public class FamilyCurrencyPresenter extends BaseMvpPresenter<IFamilyCurrencyView> {
|
||||
|
||||
private FamilyMoneyManagementInfo familyMoneyManagementInfo;
|
||||
private List<MonthlyRecord> monthlyRecordList = new ArrayList<>();
|
||||
private List<VMBillItemInfo> billItemInfos = new ArrayList<>();
|
||||
|
||||
private int page = Constants.PAGE_START;
|
||||
private boolean isLoading = false;
|
||||
|
||||
private SimpleDateFormat monthDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.family_presenter_familycurrencypresenter_01), Locale.getDefault());
|
||||
private SimpleDateFormat dayDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.family_presenter_familycurrencypresenter_02), Locale.getDefault());
|
||||
|
||||
private CompositeDisposable compositeDisposable;
|
||||
|
||||
public FamilyMoneyManagementInfo getFamilyMoneyManagementInfo() {
|
||||
return familyMoneyManagementInfo;
|
||||
}
|
||||
|
||||
public List<VMBillItemInfo> getBillItemInfos() {
|
||||
return billItemInfos;
|
||||
}
|
||||
|
||||
public FamilyCurrencyPresenter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePresenter(@Nullable Bundle saveState) {
|
||||
super.onCreatePresenter(saveState);
|
||||
this.compositeDisposable = new CompositeDisposable();
|
||||
addRxEvent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyPresenter() {
|
||||
super.onDestroyPresenter();
|
||||
if (this.compositeDisposable != null) {
|
||||
this.compositeDisposable.dispose();
|
||||
this.compositeDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addRxEvent() {
|
||||
/**
|
||||
* 转让或者贡献家族币后更新家族币信息
|
||||
*/
|
||||
RxBusHelper.doOnMainThread(FamilyCurrencyUpdateEvent.class, compositeDisposable, new Consumer<FamilyCurrencyUpdateEvent>() {
|
||||
@Override
|
||||
public void accept(FamilyCurrencyUpdateEvent familyCurrencyUpdateEvent) throws Exception {
|
||||
getMvpView().refreshData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取家族币 头部卡片信息
|
||||
* @return
|
||||
*/
|
||||
public Single<FamilyMoneyManagementInfo> loadData() {
|
||||
|
||||
return FamilyModel.Instance().loadFamilyBillSummary()
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<FamilyMoneyManagementInfo, SingleSource<FamilyMoneyManagementInfo>>() {
|
||||
@Override
|
||||
public SingleSource<FamilyMoneyManagementInfo> apply(FamilyMoneyManagementInfo response) throws Exception {
|
||||
familyMoneyManagementInfo = response;
|
||||
return Single.just(familyMoneyManagementInfo);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onRefreshRecordList(@NonNull String timeMillis){
|
||||
loadMemberRecordList(timeMillis,Constants.PAGE_START);
|
||||
}
|
||||
|
||||
public void onLoadMoreRecordList(@NonNull String timeMillis){
|
||||
loadMemberRecordList(timeMillis, this.page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个成员家族币流水
|
||||
* @param timeMillis
|
||||
*/
|
||||
private void loadMemberRecordList(@NonNull String timeMillis, int targetPage){
|
||||
long uid = AuthModel.get().getCurrentUid();
|
||||
if (uid <= 0){
|
||||
if (getMvpView() == null){
|
||||
return;
|
||||
}
|
||||
getMvpView().showErrorView(ResUtil.getString(R.string.family_presenter_familycurrencypresenter_03));
|
||||
return;
|
||||
}
|
||||
if (isLoading){
|
||||
if (getMvpView() == null){
|
||||
return;
|
||||
}
|
||||
getMvpView().showErrorView(ResUtil.getString(R.string.family_presenter_familycurrencypresenter_04));
|
||||
return;
|
||||
}
|
||||
page = targetPage;
|
||||
isLoading = true;
|
||||
FamilyModel.Instance().loadFamilyMemberBillRecordList(
|
||||
String.valueOf(uid),
|
||||
String.valueOf(page),
|
||||
String.valueOf(Constants.PAGE_SIZE),
|
||||
timeMillis
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<TradeMoneyRecord>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TradeMoneyRecord tradeMoneyRecord) {
|
||||
isLoading = false;
|
||||
if (page == Constants.PAGE_START){
|
||||
monthlyRecordList.clear();
|
||||
billItemInfos.clear();
|
||||
}
|
||||
if (tradeMoneyRecord.getRecordMonVos().size() > 0) {
|
||||
transferToViewModel(tradeMoneyRecord.getRecordMonVos());
|
||||
}
|
||||
int recordSize = 0;
|
||||
for (MonthlyRecord monthlyRecord : tradeMoneyRecord.getRecordMonVos()) {
|
||||
recordSize += monthlyRecord.getList().size();
|
||||
}
|
||||
if (page == Constants.PAGE_START && billItemInfos.isEmpty()) {
|
||||
showNoData(Long.parseLong(timeMillis));
|
||||
}
|
||||
getMvpView().onLoadData(billItemInfos, page, recordSize);
|
||||
page ++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
isLoading = false;
|
||||
getMvpView().showErrorView(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 整合月份数据,转换数据
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@NonNull
|
||||
private void transferToViewModel(List<MonthlyRecord> recordMonVos) {
|
||||
if (ListUtils.isListEmpty(recordMonVos)){
|
||||
return;
|
||||
}
|
||||
List<MonthlyRecord> recordList = new ArrayList<>(recordMonVos);
|
||||
if (monthlyRecordList.size() == 0){
|
||||
monthlyRecordList.addAll(recordList);
|
||||
}else{
|
||||
//分页的时候跨越月份了,整合起来
|
||||
MonthlyRecord monthlyRecord = monthlyRecordList.get(monthlyRecordList.size() - 1);
|
||||
if (monthlyRecord.getMonth() == recordList.get(0).getMonth()){
|
||||
MonthlyRecord monthlyRecord1 = recordList.remove(0);
|
||||
monthlyRecord.getList().addAll(monthlyRecord1.getList());
|
||||
for (MonthlyRecord.RecordItem recordItem : monthlyRecord1.getList()) {
|
||||
VMBillItemInfo<TransactionRecordInfo> item = new VMBillItemInfo<>(VMBillItemInfo.TYPE_TRANSACTION_RECORD);
|
||||
TransactionRecordInfo transactionRecordInfo = new TransactionRecordInfo();
|
||||
transactionRecordInfo.setAvatar(recordItem.getAvatar());
|
||||
transactionRecordInfo.setTitle(recordItem.getTitle());
|
||||
transactionRecordInfo.setData(recordItem.getAmount());
|
||||
transactionRecordInfo.setDate(dayDateFormat.format(new Date(recordItem.getTime())));
|
||||
transactionRecordInfo.setDesc("["+recordItem.getSource()+"]");
|
||||
transactionRecordInfo.setMoneyName(monthlyRecord.getMoneyName());
|
||||
transactionRecordInfo.setType(recordItem.getType());
|
||||
transactionRecordInfo.setUid(recordItem.getUid());
|
||||
item.setData(transactionRecordInfo);
|
||||
billItemInfos.add(item);
|
||||
}
|
||||
}
|
||||
monthlyRecordList.addAll(recordList);
|
||||
}
|
||||
|
||||
for (MonthlyRecord monthlyRecord : recordList) {
|
||||
VMBillItemInfo<BillDateDivInfo> dataItem = new VMBillItemInfo<>(VMBillItemInfo.TYPE_DATE_DIV);
|
||||
BillDateDivInfo billDateDivInfo = new BillDateDivInfo();
|
||||
billDateDivInfo.setMoneyName(monthlyRecord.getMoneyName());
|
||||
billDateDivInfo.setDate(monthDateFormat.format(new Date(monthlyRecord.getMonth())));
|
||||
billDateDivInfo.setIncome(monthlyRecord.getIncome());
|
||||
billDateDivInfo.setExpend(monthlyRecord.getCost());
|
||||
dataItem.setData(billDateDivInfo);
|
||||
billItemInfos.add(dataItem);
|
||||
for (MonthlyRecord.RecordItem recordItem : monthlyRecord.getList()) {
|
||||
VMBillItemInfo<TransactionRecordInfo> item = new VMBillItemInfo<>(VMBillItemInfo.TYPE_TRANSACTION_RECORD);
|
||||
TransactionRecordInfo transactionRecordInfo = new TransactionRecordInfo();
|
||||
transactionRecordInfo.setAvatar(recordItem.getAvatar());
|
||||
transactionRecordInfo.setTitle(recordItem.getTitle());
|
||||
transactionRecordInfo.setData(recordItem.getAmount());
|
||||
transactionRecordInfo.setDate(dayDateFormat.format(new Date(recordItem.getTime())));
|
||||
transactionRecordInfo.setDesc("["+recordItem.getSource()+"]");
|
||||
transactionRecordInfo.setMoneyName(monthlyRecord.getMoneyName());
|
||||
transactionRecordInfo.setType(recordItem.getType());
|
||||
transactionRecordInfo.setUid(recordItem.getUid());
|
||||
item.setData(transactionRecordInfo);
|
||||
billItemInfos.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showNoData(long timeMills){
|
||||
VMBillItemInfo<BillDateDivInfo> dataItem = new VMBillItemInfo<>(VMBillItemInfo.TYPE_DATE_DIV);
|
||||
// BillDateDivInfo billDateDivInfo = new BillDateDivInfo();
|
||||
// billDateDivInfo.setMoneyName(familyMoneyManagementInfo.getMoneyName());
|
||||
// billDateDivInfo.setDate(monthDateFormat.format(new Date(timeMills)));
|
||||
// billDateDivInfo.setIncome(0.0f);
|
||||
// billDateDivInfo.setExpend(0.0f);
|
||||
// dataItem.setData(billDateDivInfo);
|
||||
// billItemInfos.add(dataItem);
|
||||
VMBillItemInfo emptyTip = new VMBillItemInfo<>(VMBillItemInfo.TYPE_EMPTY_TIP);
|
||||
billItemInfos.add(emptyTip);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 贡献家族币
|
||||
* @param count
|
||||
*/
|
||||
public Single<String> contributionCurrency(double count) {
|
||||
return FamilyModel.Instance().contributeCurrency(
|
||||
count
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyFansListFragmentView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.user.AttentionModel;
|
||||
import com.chwl.core.user.bean.FansListInfo;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public class FamilyFansListPresenter extends BaseMvpPresenter<IFamilyFansListFragmentView> {
|
||||
private int mPage = Constants.PAGE_START;
|
||||
private boolean isLoading = false;
|
||||
public void refreshData() {
|
||||
loadData(Constants.PAGE_START);
|
||||
}
|
||||
|
||||
public void loadMoreData() {
|
||||
loadData(mPage + 1);
|
||||
}
|
||||
|
||||
private void loadData(int targetPage){
|
||||
if (isLoading){
|
||||
if (getMvpView() == null){
|
||||
return;
|
||||
}
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshDataFail(ResUtil.getString(R.string.family_presenter_familyfanslistpresenter_01));
|
||||
}else {
|
||||
getMvpView().onLoadMoreDataFail(ResUtil.getString(R.string.family_presenter_familyfanslistpresenter_02));
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.mPage = targetPage;
|
||||
isLoading = true;
|
||||
AttentionModel.get().getFansList(
|
||||
AuthModel.get().getCurrentUid(),
|
||||
this.mPage,
|
||||
Constants.PAGE_SIZE
|
||||
)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<FansListInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FansListInfo fansListInfo) {
|
||||
isLoading = false;
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshData(fansListInfo);
|
||||
}else {
|
||||
getMvpView().onLoadMoreData(fansListInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
isLoading = false;
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshDataFail(e.getMessage());
|
||||
}else {
|
||||
getMvpView().onLoadMoreDataFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,80 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyFriendListFragmentView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.im.friend.IMFriendModel;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public class FamilyFriendListPresenter extends BaseMvpPresenter<IFamilyFriendListFragmentView> {
|
||||
private int mPage = Constants.PAGE_START;
|
||||
private final int pageSize = Constants.PAGE_SIZE;
|
||||
private boolean isLoading = false;
|
||||
|
||||
public void refreshData() {
|
||||
loadData(Constants.PAGE_START);
|
||||
}
|
||||
|
||||
public void loadMoreData() {
|
||||
loadData(mPage + 1);
|
||||
}
|
||||
|
||||
private void loadData(int targetPage){
|
||||
if (isLoading){
|
||||
if (getMvpView() == null){
|
||||
return;
|
||||
}
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshDataFail(ResUtil.getString(R.string.family_presenter_familyfriendlistpresenter_01));
|
||||
}else {
|
||||
getMvpView().onLoadMoreDataFail(ResUtil.getString(R.string.family_presenter_familyfriendlistpresenter_02));
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.mPage = targetPage;
|
||||
isLoading = true;
|
||||
IMFriendModel.get().getMyFriendsUserInfos(mPage, pageSize)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<List<UserInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<UserInfo> userInfos) {
|
||||
isLoading = false;
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshData(userInfos);
|
||||
}else {
|
||||
getMvpView().onLoadMoreData(userInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
isLoading = false;
|
||||
if (mPage == Constants.PAGE_START){
|
||||
getMvpView().onRefreshDataFail(e.getMessage());
|
||||
}else {
|
||||
getMvpView().onLoadMoreDataFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyGameListActivityView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.FamilyGameInfo;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/23
|
||||
*/
|
||||
|
||||
public class FamilyGameListPresenter extends BaseMvpPresenter<IFamilyGameListActivityView> {
|
||||
|
||||
private AtomicInteger curPage = new AtomicInteger(Constants.PAGE_START);
|
||||
private boolean isLoading = false;
|
||||
|
||||
public void refreshData() {
|
||||
curPage.set(Constants.PAGE_START);
|
||||
loadMoreData();
|
||||
}
|
||||
|
||||
|
||||
public void loadMoreData() {
|
||||
loadData(curPage.get())
|
||||
.subscribe((familyGameInfos, throwable) -> {
|
||||
if (throwable == null) {
|
||||
getMvpView().onLoadData(familyGameInfos, curPage.getAndIncrement());
|
||||
} else {
|
||||
getMvpView().onLoadDataFail(throwable.getMessage(), curPage.get());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private Single<List<FamilyGameInfo>> loadData(int targetPage){
|
||||
FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (familyInfo == null){
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familygamelistpresenter_01)));
|
||||
}
|
||||
|
||||
if (isLoading){
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familygamelistpresenter_02)));
|
||||
}
|
||||
isLoading = true;
|
||||
return FamilyModel.Instance().loadFamilyGameList(
|
||||
familyInfo.getFamilyId(),
|
||||
targetPage,
|
||||
Constants.PAGE_SIZE
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<List<FamilyGameInfo>, SingleSource<List<FamilyGameInfo>>>() {
|
||||
@Override
|
||||
public SingleSource<List<FamilyGameInfo>> apply(List<FamilyGameInfo> familyGameInfos) throws Exception {
|
||||
isLoading = false;
|
||||
return Single.just(familyGameInfos);
|
||||
}
|
||||
})
|
||||
.doOnError(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
isLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@@ -1,180 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.home.view.IFamilyHomeActivityView;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.event.FamilyCurrencyUpdateEvent;
|
||||
import com.chwl.core.family.event.FamilyMemberUpdateEvent;
|
||||
import com.chwl.core.family.event.FamilyUpdateEvent;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.rxbus.RxBusHelper;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/23
|
||||
*/
|
||||
|
||||
public class FamilyHomePresenter extends BaseMvpPresenter<IFamilyHomeActivityView> {
|
||||
|
||||
private FamilyInfo familyInfo;
|
||||
private CompositeDisposable compositeDisposable;
|
||||
|
||||
public FamilyInfo getFamilyInfo() {
|
||||
return familyInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePresenter(@Nullable Bundle saveState) {
|
||||
super.onCreatePresenter(saveState);
|
||||
compositeDisposable = new CompositeDisposable();
|
||||
addEvent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyPresenter() {
|
||||
super.onDestroyPresenter();
|
||||
if (compositeDisposable != null){
|
||||
compositeDisposable.dispose();
|
||||
compositeDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addEvent() {
|
||||
/**
|
||||
* 转让或者贡献家族币后更新家族信息
|
||||
*/
|
||||
RxBusHelper.doOnMainThread(FamilyCurrencyUpdateEvent.class, compositeDisposable, new Consumer<FamilyCurrencyUpdateEvent>() {
|
||||
@Override
|
||||
public void accept(FamilyCurrencyUpdateEvent familyCurrencyUpdateEvent) throws Exception {
|
||||
getMvpView().reloadMyFamilyInfo(familyInfo.getFamilyId());
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 修改家族相关信息更新家族信息事件
|
||||
*/
|
||||
RxBusHelper.doOnMainThread(FamilyUpdateEvent.class, compositeDisposable, new Consumer<FamilyUpdateEvent>() {
|
||||
@Override
|
||||
public void accept(FamilyUpdateEvent familyUpdateEvent) throws Exception {
|
||||
if (familyUpdateEvent.getFamilyInfo() != null
|
||||
&& familyInfo.getFamilyId().equals(familyUpdateEvent.getFamilyInfo().getFamilyId())) {
|
||||
familyInfo = familyUpdateEvent.getFamilyInfo();
|
||||
getMvpView().onLoadData(familyUpdateEvent.getFamilyInfo());
|
||||
} else if (familyUpdateEvent.getFamilyInfo() == null
|
||||
&& familyInfo.getEnterStatus() == FamilyInfo.STATUS_IN_FAMILY){
|
||||
getMvpView().close();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 成员更新
|
||||
*/
|
||||
RxBusHelper.doOnMainThread(FamilyMemberUpdateEvent.class, compositeDisposable, new Consumer<FamilyMemberUpdateEvent>() {
|
||||
@Override
|
||||
public void accept(FamilyMemberUpdateEvent familyMemberUpdateEvent) throws Exception {
|
||||
getMvpView().reloadMyFamilyInfo(familyInfo.getFamilyId());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
/**
|
||||
* 加载家族信息
|
||||
* @param familyId
|
||||
*/
|
||||
public Single<FamilyInfo> loadData(String familyId) {
|
||||
|
||||
return FamilyModel.Instance().loadFamilyHomeInfo(
|
||||
familyId
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<FamilyInfo, SingleSource<? extends FamilyInfo>>() {
|
||||
@Override
|
||||
public SingleSource<? extends FamilyInfo> apply(FamilyInfo familyInfo) throws Exception {
|
||||
FamilyHomePresenter.this.familyInfo = familyInfo;
|
||||
return Single.just(familyInfo);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出家族
|
||||
* @return
|
||||
*/
|
||||
public Single<String> exitFamily() {
|
||||
return FamilyModel.Instance().exitFamily()
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请加入家族
|
||||
* @return
|
||||
*/
|
||||
public Single<String> joinFamily(String str) {
|
||||
if (null == familyInfo){
|
||||
return Single.error(new Exception(ResUtil.getString(R.string.family_presenter_familyhomepresenter_01)));
|
||||
}
|
||||
|
||||
return FamilyModel.Instance().applyJoinFamily(
|
||||
familyInfo.getFamilyId(),
|
||||
str
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入家族群
|
||||
* @return
|
||||
*/
|
||||
public Single<String> joinFamilyGroup(String chatId, String message) {
|
||||
|
||||
|
||||
return FamilyModel.Instance().joinFamilyGroup(
|
||||
chatId,
|
||||
message
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<String, SingleSource<? extends String>>() {
|
||||
@Override
|
||||
public SingleSource<? extends String> apply(String response) throws Exception {
|
||||
getMvpView().reloadMyFamilyInfo(familyInfo.getFamilyId());
|
||||
return Single.just(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请朋友加入家族
|
||||
* @param friendUid
|
||||
* @return
|
||||
*/
|
||||
public Single<String> inviteFriendToFamily(long friendUid) {
|
||||
return FamilyModel.Instance().inviteIntoFamily(
|
||||
String.valueOf(friendUid)
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
|
||||
}
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyInfoView;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public class FamilyInfoPresenter extends BaseMvpPresenter<IFamilyInfoView> {
|
||||
|
||||
/**
|
||||
* 修改验证状态
|
||||
* @param isOn
|
||||
* @return
|
||||
*/
|
||||
public Single<String> changeVerifyStatus(final boolean isOn) {
|
||||
final FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (null == familyInfo){
|
||||
return Single.error(new Exception(ResUtil.getString(R.string.family_presenter_familyinfopresenter_01)));
|
||||
}
|
||||
return FamilyModel.Instance().modifyFamilyInfo(
|
||||
familyInfo.getFamilyId(),
|
||||
null,
|
||||
null,
|
||||
isOn ? "1":"0"
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家族头像
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public Single<String> changeFamilyAvatar(final String url) {
|
||||
final FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (null == familyInfo){
|
||||
return Single.error(new Exception(ResUtil.getString(R.string.family_presenter_familyinfopresenter_02)));
|
||||
}
|
||||
return FamilyModel.Instance().modifyFamilyInfo(
|
||||
familyInfo.getFamilyId(),
|
||||
null,
|
||||
url,
|
||||
null
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家族名称
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public Single<String> changeFamilyName(final String str) {
|
||||
final FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (null == familyInfo){
|
||||
return Single.error(new Exception(ResUtil.getString(R.string.family_presenter_familyinfopresenter_03)));
|
||||
}
|
||||
return FamilyModel.Instance().modifyFamilyInfo(
|
||||
familyInfo.getFamilyId(),
|
||||
str,
|
||||
null,
|
||||
null
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
}
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilySearchView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.response.RankingFamilyInfo;
|
||||
import com.chwl.core.family.bean.response.RespFamilyRankList;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/24
|
||||
*/
|
||||
|
||||
public class FamilyListPresenter extends BaseMvpPresenter<IFamilySearchView> {
|
||||
|
||||
public Single<List<RankingFamilyInfo>> refreshData() {
|
||||
return loadData();
|
||||
}
|
||||
|
||||
|
||||
private Single<List<RankingFamilyInfo>> loadData(){
|
||||
return FamilyModel.Instance().loadFamilyRankingList(
|
||||
RespFamilyRankList.TYPE_THIS_WEEK,
|
||||
String.valueOf(Constants.PAGE_START),
|
||||
String.valueOf(20)
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<RespFamilyRankList, SingleSource<? extends List<RankingFamilyInfo>>>() {
|
||||
@Override
|
||||
public SingleSource<? extends List<RankingFamilyInfo>> apply(RespFamilyRankList response) throws Exception {
|
||||
return Single.just(response.getFamilys());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyManageActivityView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/25
|
||||
*/
|
||||
|
||||
public class FamilyManagePresenter extends BaseMvpPresenter<IFamilyManageActivityView> {
|
||||
|
||||
}
|
@@ -1,210 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyCurrencyView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.BillDateDivInfo;
|
||||
import com.chwl.core.family.bean.TransactionRecordInfo;
|
||||
import com.chwl.core.family.bean.VMBillItemInfo;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.MonthlyRecord;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.TradeMoneyRecord;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public class FamilyMemberCurrencyPresenter extends BaseMvpPresenter<IFamilyCurrencyView> {
|
||||
|
||||
private List<MonthlyRecord> monthlyRecordList = new ArrayList<>();
|
||||
private List<VMBillItemInfo> billItemInfos = new ArrayList<>();
|
||||
|
||||
private int page = Constants.PAGE_START;
|
||||
private boolean isLoading = false;
|
||||
|
||||
private SimpleDateFormat monthDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.family_presenter_familymembercurrencypresenter_01), Locale.getDefault());
|
||||
private SimpleDateFormat dayDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.family_presenter_familymembercurrencypresenter_02), Locale.getDefault());
|
||||
|
||||
|
||||
|
||||
public List<VMBillItemInfo> getBillItemInfos() {
|
||||
return billItemInfos;
|
||||
}
|
||||
|
||||
public FamilyMemberCurrencyPresenter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePresenter(@Nullable Bundle saveState) {
|
||||
super.onCreatePresenter(saveState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyPresenter() {
|
||||
super.onDestroyPresenter();
|
||||
}
|
||||
|
||||
|
||||
public void onRefreshRecordList(@NonNull String timeMillis, String targetId){
|
||||
loadMemberRecordList(timeMillis, targetId, Constants.PAGE_START);
|
||||
}
|
||||
|
||||
public void onLoadMoreRecordList(@NonNull String timeMillis, String targetId){
|
||||
loadMemberRecordList(timeMillis,targetId, this.page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取某个人家族币交易记录
|
||||
*
|
||||
* @param timeMillis
|
||||
* @param targetId
|
||||
* @return
|
||||
*/
|
||||
private void loadMemberRecordList(@NonNull String timeMillis, String targetId, int targetPage){
|
||||
if (isLoading){
|
||||
if (getMvpView() == null){
|
||||
return;
|
||||
}
|
||||
getMvpView().showErrorView(ResUtil.getString(R.string.family_presenter_familymembercurrencypresenter_03));
|
||||
return;
|
||||
}
|
||||
page = targetPage;
|
||||
isLoading = true;
|
||||
FamilyModel.Instance().loadFamilyMemberBillRecordList(
|
||||
targetId,
|
||||
String.valueOf(page),
|
||||
String.valueOf(Constants.PAGE_SIZE),
|
||||
timeMillis
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<TradeMoneyRecord>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TradeMoneyRecord tradeMoneyRecord) {
|
||||
isLoading = false;
|
||||
if (page == Constants.PAGE_START){
|
||||
monthlyRecordList.clear();
|
||||
billItemInfos.clear();
|
||||
}
|
||||
if (tradeMoneyRecord.getRecordMonVos().size() > 0) {
|
||||
transferToViewModel(tradeMoneyRecord.getRecordMonVos());
|
||||
}
|
||||
if (page == Constants.PAGE_START && billItemInfos.isEmpty()) {
|
||||
showNoData(Long.parseLong(timeMillis));
|
||||
}
|
||||
getMvpView().onLoadData(billItemInfos, page, tradeMoneyRecord.getRecordMonVos().size());
|
||||
page ++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
isLoading = false;
|
||||
getMvpView().showErrorView(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 整合月份数据,转换数据
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@NonNull
|
||||
private void transferToViewModel(List<MonthlyRecord> recordMonVos) {
|
||||
if (ListUtils.isListEmpty(recordMonVos)){
|
||||
return;
|
||||
}
|
||||
if (monthlyRecordList.size() == 0){
|
||||
monthlyRecordList.addAll(recordMonVos);
|
||||
}else{
|
||||
//分页的时候跨越月份了,整合起来
|
||||
MonthlyRecord monthlyRecord = monthlyRecordList.get(monthlyRecordList.size() - 1);
|
||||
if (monthlyRecord.getMonth() == recordMonVos.get(0).getMonth()){
|
||||
MonthlyRecord monthlyRecord1 = recordMonVos.remove(0);
|
||||
monthlyRecord.getList().addAll(monthlyRecord1.getList());
|
||||
for (MonthlyRecord.RecordItem recordItem : monthlyRecord1.getList()) {
|
||||
VMBillItemInfo<TransactionRecordInfo> item = new VMBillItemInfo<>(VMBillItemInfo.TYPE_TRANSACTION_RECORD);
|
||||
TransactionRecordInfo transactionRecordInfo = new TransactionRecordInfo();
|
||||
transactionRecordInfo.setAvatar(recordItem.getAvatar());
|
||||
transactionRecordInfo.setTitle(recordItem.getTitle());
|
||||
transactionRecordInfo.setData(recordItem.getAmount());
|
||||
transactionRecordInfo.setDate(dayDateFormat.format(new Date(recordItem.getTime())));
|
||||
transactionRecordInfo.setDesc("["+recordItem.getSource()+"]");
|
||||
transactionRecordInfo.setMoneyName(monthlyRecord.getMoneyName());
|
||||
item.setData(transactionRecordInfo);
|
||||
billItemInfos.add(item);
|
||||
}
|
||||
}
|
||||
monthlyRecordList.addAll(recordMonVos);
|
||||
}
|
||||
|
||||
for (MonthlyRecord monthlyRecord : recordMonVos) {
|
||||
VMBillItemInfo<BillDateDivInfo> dataItem = new VMBillItemInfo<>(VMBillItemInfo.TYPE_DATE_DIV);
|
||||
BillDateDivInfo billDateDivInfo = new BillDateDivInfo();
|
||||
billDateDivInfo.setMoneyName(monthlyRecord.getMoneyName());
|
||||
billDateDivInfo.setDate(monthDateFormat.format(new Date(monthlyRecord.getMonth())));
|
||||
billDateDivInfo.setIncome(monthlyRecord.getIncome());
|
||||
billDateDivInfo.setExpend(monthlyRecord.getCost());
|
||||
dataItem.setData(billDateDivInfo);
|
||||
billItemInfos.add(dataItem);
|
||||
for (MonthlyRecord.RecordItem recordItem : monthlyRecord.getList()) {
|
||||
VMBillItemInfo<TransactionRecordInfo> item = new VMBillItemInfo<>(VMBillItemInfo.TYPE_TRANSACTION_RECORD);
|
||||
TransactionRecordInfo transactionRecordInfo = new TransactionRecordInfo();
|
||||
transactionRecordInfo.setAvatar(recordItem.getAvatar());
|
||||
transactionRecordInfo.setTitle(recordItem.getTitle());
|
||||
transactionRecordInfo.setData(recordItem.getAmount());
|
||||
transactionRecordInfo.setDate(dayDateFormat.format(new Date(recordItem.getTime())));
|
||||
transactionRecordInfo.setDesc("["+recordItem.getSource()+"]");
|
||||
transactionRecordInfo.setMoneyName(monthlyRecord.getMoneyName());
|
||||
item.setData(transactionRecordInfo);
|
||||
billItemInfos.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showNoData(long timeMills){
|
||||
VMBillItemInfo<BillDateDivInfo> dataItem = new VMBillItemInfo<>(VMBillItemInfo.TYPE_DATE_DIV);
|
||||
BillDateDivInfo billDateDivInfo = new BillDateDivInfo();
|
||||
if (FamilyModel.Instance().getMyFamily() != null) {
|
||||
billDateDivInfo.setMoneyName(FamilyModel.Instance().getMyFamily().getMoneyName());
|
||||
}
|
||||
billDateDivInfo.setDate(monthDateFormat.format(new Date(timeMills)));
|
||||
billDateDivInfo.setIncome(0.0f);
|
||||
billDateDivInfo.setExpend(0.0f);
|
||||
dataItem.setData(billDateDivInfo);
|
||||
billItemInfos.add(dataItem);
|
||||
VMBillItemInfo emptyTip = new VMBillItemInfo<>(VMBillItemInfo.TYPE_EMPTY_TIP);
|
||||
billItemInfos.add(emptyTip);
|
||||
}
|
||||
|
||||
}
|
@@ -1,146 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyMemberListView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.core.family.bean.response.memberList.RespFamilymember;
|
||||
import com.chwl.core.family.event.FamilyMemberUpdateEvent;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.rxbus.RxBusHelper;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public class FamilyMemberListPresenter extends BaseMvpPresenter<IFamilyMemberListView> {
|
||||
|
||||
private int page = Constants.PAGE_START;
|
||||
private boolean isLoading = false;
|
||||
private CompositeDisposable compositeDisposable;
|
||||
|
||||
@Override
|
||||
public void onCreatePresenter(@Nullable Bundle saveState) {
|
||||
super.onCreatePresenter(saveState);
|
||||
compositeDisposable = new CompositeDisposable();
|
||||
addEvent();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyPresenter() {
|
||||
super.onDestroyPresenter();
|
||||
if (null != compositeDisposable){
|
||||
compositeDisposable.dispose();
|
||||
compositeDisposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void addEvent() {
|
||||
/**
|
||||
* 成员更新
|
||||
*/
|
||||
RxBusHelper.doOnMainThread(FamilyMemberUpdateEvent.class, compositeDisposable, new Consumer<FamilyMemberUpdateEvent>() {
|
||||
@Override
|
||||
public void accept(FamilyMemberUpdateEvent familyMemberUpdateEvent) throws Exception {
|
||||
getMvpView().reloadFamilyMember();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public Single<RespFamilymember> refreshData(){
|
||||
FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (null == familyInfo) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familymemberlistpresenter_01)));
|
||||
}
|
||||
this.page = Constants.PAGE_START;
|
||||
return loadData(familyInfo.getFamilyId(),Constants.PAGE_START);
|
||||
}
|
||||
|
||||
public Single<RespFamilymember> loadMoreData() {
|
||||
FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (null == familyInfo) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familymemberlistpresenter_02)));
|
||||
}
|
||||
return loadData(familyInfo.getFamilyId(),this.page);
|
||||
}
|
||||
|
||||
private Single<RespFamilymember> loadData(String familyId, int targetPage) {
|
||||
|
||||
if (isLoading){
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familymemberlistpresenter_03)));
|
||||
}
|
||||
this.page = targetPage;
|
||||
isLoading = true;
|
||||
return FamilyModel.Instance().loadFamilyMemberList(
|
||||
familyId,
|
||||
String.valueOf(page),
|
||||
String.valueOf(Constants.PAGE_SIZE)
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<RespFamilymember, SingleSource<RespFamilymember>>() {
|
||||
@Override
|
||||
public SingleSource<RespFamilymember> apply(RespFamilymember respFamilymember) throws Exception {
|
||||
isLoading = false;
|
||||
page++;
|
||||
return Single.just(respFamilymember);
|
||||
}
|
||||
})
|
||||
.doOnError(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
isLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public FamilyInfo getFamilyInfo(){
|
||||
return FamilyModel.Instance().getMyFamily();
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除家族成员
|
||||
* @param familyMemberInfo
|
||||
*/
|
||||
public Single<String> removeFamilyMember(FamilyMemberInfo familyMemberInfo) {
|
||||
if (null == familyMemberInfo){
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familymemberlistpresenter_04)));
|
||||
}
|
||||
return FamilyModel.Instance().kickOutFamily(
|
||||
String.valueOf(familyMemberInfo.getUid())
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族币转让
|
||||
* @param familyMemberInfo
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
public Single<String> transferCurrency(FamilyMemberInfo familyMemberInfo, double count) {
|
||||
return FamilyModel.Instance().transferCurrency(
|
||||
String.valueOf(familyMemberInfo.getUid()),
|
||||
count
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
}
|
||||
}
|
@@ -1,95 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyMemberSearchView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.core.family.bean.response.memberList.RespFamilymember;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public class FamilyMemberSearchPresenter extends BaseMvpPresenter<IFamilyMemberSearchView> {
|
||||
private int page = Constants.PAGE_START;
|
||||
private String searchStr;
|
||||
|
||||
public FamilyInfo getFamilyInfo(){
|
||||
return FamilyModel.Instance().getMyFamily();
|
||||
}
|
||||
|
||||
public Single<List<FamilyMemberInfo>> search(String str) {
|
||||
page = Constants.PAGE_START;
|
||||
searchStr = str;
|
||||
return loadData(searchStr);
|
||||
}
|
||||
|
||||
private Single<List<FamilyMemberInfo>> loadData(String searchKey) {
|
||||
|
||||
FamilyInfo familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (null == familyInfo) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familymembersearchpresenter_01)));
|
||||
}
|
||||
|
||||
return FamilyModel.Instance().searchFamilyMemberList(
|
||||
familyInfo.getFamilyId(),
|
||||
null,
|
||||
null,
|
||||
searchKey
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<RespFamilymember, SingleSource<List<FamilyMemberInfo>>>() {
|
||||
@Override
|
||||
public SingleSource<List<FamilyMemberInfo>> apply(RespFamilymember respFamilymember) throws Exception {
|
||||
page++;
|
||||
return Single.just(respFamilymember.getMembers());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public Single<List<FamilyMemberInfo>> loadMoreData() {
|
||||
return loadData(searchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除家族成员
|
||||
* @param familyMemberInfo
|
||||
*/
|
||||
public Single<String> removeFamilyMember(FamilyMemberInfo familyMemberInfo) {
|
||||
if (null == familyMemberInfo){
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familymembersearchpresenter_02)));
|
||||
}
|
||||
return FamilyModel.Instance().kickOutFamily(
|
||||
String.valueOf(familyMemberInfo.getUid())
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族币转让
|
||||
* @param familyMemberInfo
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
public Single<String> transferCurrency(FamilyMemberInfo familyMemberInfo, double count) {
|
||||
return FamilyModel.Instance().transferCurrency(
|
||||
String.valueOf(familyMemberInfo.getUid()),
|
||||
count
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyPlazaActivityView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.response.RespFamilyRankList;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/23
|
||||
*/
|
||||
|
||||
public class FamilyPlazaPresenter extends BaseMvpPresenter<IFamilyPlazaActivityView> {
|
||||
|
||||
public FamilyPlazaPresenter() {
|
||||
|
||||
}
|
||||
|
||||
public Single<RespFamilyRankList> loadWeeklyRankData() {
|
||||
return FamilyModel.Instance().loadFamilyRankingList(
|
||||
RespFamilyRankList.TYPE_THIS_WEEK,
|
||||
String.valueOf(Constants.PAGE_START),
|
||||
String.valueOf(6)
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY));
|
||||
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilySearchView;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.bean.response.familyPlaza.RespFamily;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.PresenterEvent;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/24
|
||||
*/
|
||||
|
||||
public class FamilySearchPresent extends BaseMvpPresenter<IFamilySearchView> {
|
||||
|
||||
private String searchStr = null;
|
||||
|
||||
private int page = Constants.PAGE_START;
|
||||
private boolean isLoading = false;
|
||||
|
||||
public Single<List<FamilyInfo>> search(String str) {
|
||||
this.searchStr = str;
|
||||
return loadData(Constants.PAGE_START);
|
||||
}
|
||||
|
||||
public Single<List<FamilyInfo>> loadMoreData(){
|
||||
return loadData(this.page);
|
||||
}
|
||||
|
||||
|
||||
private Single<List<FamilyInfo>> loadData(int targetPage){
|
||||
if (isLoading){
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.family_presenter_familysearchpresent_01)));
|
||||
}
|
||||
this.page = targetPage;
|
||||
isLoading = true;
|
||||
return FamilyModel.Instance().searchFamilyInfos(
|
||||
this.searchStr,
|
||||
page
|
||||
)
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.flatMap(new Function<RespFamily, SingleSource<? extends List<FamilyInfo>>>() {
|
||||
@Override
|
||||
public SingleSource<? extends List<FamilyInfo>> apply(RespFamily response) throws Exception {
|
||||
isLoading = false;
|
||||
page++;
|
||||
return Single.just(response.getFamilys());
|
||||
}
|
||||
})
|
||||
.doOnError(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
isLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package com.chwl.app.family.presenter;
|
||||
|
||||
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilySelectFriendActivityView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public class FamilySelectFriendPresenter extends BaseMvpPresenter<IFamilySelectFriendActivityView> {
|
||||
}
|
@@ -1,323 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.jay.widget.StickyHeadersLinearLayoutManager;
|
||||
import com.jzxiang.pickerview.TimePickerDialog;
|
||||
import com.jzxiang.pickerview.data.Type;
|
||||
import com.jzxiang.pickerview.listener.OnDateSetListener;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyCurrencyView;
|
||||
import com.chwl.app.family.presenter.FamilyCurrencyPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyCurrencyBillAdapter;
|
||||
import com.chwl.app.family.view.dialog.FamilyContributionDialog;
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.core.family.bean.VMBillItemInfo;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.FamilyMoneyManagementInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyCurrencyPresenter.class)
|
||||
public class FamilyCurrencyActivity extends BaseMvpActivity<IFamilyCurrencyView,FamilyCurrencyPresenter>
|
||||
implements IFamilyCurrencyView, SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener, OnDateSetListener {
|
||||
|
||||
private TextView tvFamilyCurrencyLabel;
|
||||
private TextView tvFamilyCurrencyBalance;
|
||||
private ImageView ivFamilyCurrencyHelp;
|
||||
private TextView tvAction;
|
||||
private TextView tvFamilyCurrencyIncome;
|
||||
private TextView tvFamilyCurrencyExpenditure;
|
||||
private LinearLayout llSearch;
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView rvFamilyCurrency;
|
||||
private FamilyCurrencyBillAdapter adapter;
|
||||
|
||||
protected TimePickerDialog.Builder mDialogYearMonthDayBuild;
|
||||
|
||||
private String selectDate;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context, FamilyCurrencyActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_currency);
|
||||
initTitleBar("");
|
||||
|
||||
|
||||
View header = LayoutInflater.from(this).inflate(R.layout.header_famiy_currency_bill,null,false);
|
||||
tvFamilyCurrencyLabel = (TextView) header.findViewById(R.id.tv_family_currency_label);
|
||||
tvFamilyCurrencyBalance = (TextView) header.findViewById(R.id.tv_family_currency_balance);
|
||||
tvAction = (TextView) header.findViewById(R.id.tv_action);
|
||||
tvFamilyCurrencyIncome = (TextView) header.findViewById(R.id.tv_family_currency_income);
|
||||
tvFamilyCurrencyExpenditure = (TextView) header.findViewById(R.id.tv_family_currency_expenditure);
|
||||
llSearch = (LinearLayout) header.findViewById(R.id.ll_search);
|
||||
ivFamilyCurrencyHelp = (ImageView) header.findViewById(R.id.iv_family_currency_help);
|
||||
|
||||
|
||||
swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
|
||||
swipeRefresh.setOnRefreshListener(this);
|
||||
|
||||
rvFamilyCurrency = (RecyclerView) findViewById(R.id.rv_family_currency);
|
||||
rvFamilyCurrency.setItemAnimator(null);
|
||||
rvFamilyCurrency.setLayoutManager(new StickyHeadersLinearLayoutManager<FamilyCurrencyBillAdapter>(this,LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new FamilyCurrencyBillAdapter(this,null);
|
||||
adapter.addHeaderView(header);
|
||||
adapter.setEnableLoadMore(true);
|
||||
adapter.setOnLoadMoreListener(this, rvFamilyCurrency);
|
||||
adapter.setOnDateSelectListener(new FamilyCurrencyBillAdapter.OnDateSelectListener() {
|
||||
@Override
|
||||
public void onDateSelect() {
|
||||
mDialogYearMonthDayBuild.build().show(getSupportFragmentManager(), "year_month");
|
||||
}
|
||||
});
|
||||
rvFamilyCurrency.setAdapter(adapter);
|
||||
|
||||
mDialogYearMonthDayBuild = new TimePickerDialog.Builder()
|
||||
.setType(Type.YEAR_MONTH)
|
||||
.setTitleStringId(ResUtil.getString(R.string.view_activity_familycurrencyactivity_01))
|
||||
.setThemeColor(getResources().getColor(R.color.line_background))
|
||||
.setWheelItemTextNormalColor(getResources().getColor(R.color
|
||||
.timetimepicker_default_text_color))
|
||||
.setWheelItemTextSelectorColor(getResources().getColor(R.color.black))
|
||||
.setCallBack(this);
|
||||
|
||||
this.selectDate = String.valueOf(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDateSet(TimePickerDialog timePickerView, long millseconds) {
|
||||
this.selectDate = String.valueOf(millseconds);
|
||||
getMvpPresenter().onRefreshRecordList(selectDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (null == getMvpPresenter().getFamilyMoneyManagementInfo()){
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().loadData().subscribe(new SingleObserver<FamilyMoneyManagementInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FamilyMoneyManagementInfo familyMoneyManagementInfo) {
|
||||
showCard(familyMoneyManagementInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
getMvpPresenter().onRefreshRecordList(selectDate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mDialogYearMonthDayBuild != null) {
|
||||
mDialogYearMonthDayBuild.setCallBack(null);
|
||||
mDialogYearMonthDayBuild = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示头部卡片
|
||||
* @param familyMoneyManagementInfo
|
||||
*/
|
||||
private void showCard(FamilyMoneyManagementInfo familyMoneyManagementInfo) {
|
||||
|
||||
String moneyName = familyMoneyManagementInfo.getMoneyName();
|
||||
String incomeStr = FormatUtils.formatToShortDown(familyMoneyManagementInfo.getIncomeAndCost().getIncome());
|
||||
String expendStr = FormatUtils.formatToShortDown(familyMoneyManagementInfo.getIncomeAndCost().getCost());
|
||||
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
|
||||
|
||||
tvFamilyCurrencyLabel.setText(String.format(
|
||||
getString(R.string.family_currency_balance_label),
|
||||
moneyName
|
||||
));
|
||||
|
||||
|
||||
|
||||
SpannableString incomeSpan = new SpannableString(incomeStr + moneyName);
|
||||
incomeSpan.setSpan(boldSpan,0,incomeStr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
tvFamilyCurrencyIncome.setText(incomeSpan);
|
||||
|
||||
SpannableString expendSpan = new SpannableString(expendStr + moneyName);
|
||||
expendSpan.setSpan(boldSpan,0,expendStr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
tvFamilyCurrencyExpenditure.setText(expendSpan);
|
||||
|
||||
tvFamilyCurrencyBalance.setText(FormatUtils.formatToShortDown(familyMoneyManagementInfo.getTotalAmount()));
|
||||
|
||||
if (familyMoneyManagementInfo.getPosition() == FamilyMemberInfo.LEVEL_PATRIARCH){
|
||||
mTitleBar.setTitle(R.string.family_currency);
|
||||
llSearch.setVisibility(View.VISIBLE);
|
||||
llSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FamilyMemberSearchActivity.start(FamilyCurrencyActivity.this,FamilyMemberListActivity.TYPE_CHECK_MEMBER_CURRENCY);
|
||||
}
|
||||
});
|
||||
ivFamilyCurrencyHelp.setVisibility(View.VISIBLE);
|
||||
ivFamilyCurrencyHelp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CommonWebViewActivity.start(FamilyCurrencyActivity.this, UriProvider.getFamilyCurrencyHelpUrl());
|
||||
}
|
||||
});
|
||||
tvAction.setText(String.format(
|
||||
getString(R.string.family_currency_transfer),
|
||||
moneyName));
|
||||
tvAction.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FamilyMemberListActivity.start(FamilyCurrencyActivity.this,FamilyMemberListActivity.TYPE_SELECT_MEMBER);
|
||||
}
|
||||
});
|
||||
|
||||
}else {
|
||||
mTitleBar.setTitle(R.string.family_my_currency);
|
||||
llSearch.setVisibility(View.GONE);
|
||||
ivFamilyCurrencyHelp.setVisibility(View.INVISIBLE);
|
||||
tvAction.setText(String.format(
|
||||
getString(R.string.family_currency_contribution),
|
||||
moneyName));
|
||||
tvAction.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showContributeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadData(List<VMBillItemInfo> billItemInfos,int page, int dataSize) {
|
||||
if (page == Constants.PAGE_START){
|
||||
swipeRefresh.setRefreshing(false);
|
||||
if (!ListUtils.isListEmpty(billItemInfos)) {
|
||||
adapter.setNewData(billItemInfos);
|
||||
}
|
||||
}else {
|
||||
if (dataSize > 0) {
|
||||
adapter.loadMoreComplete();
|
||||
adapter.notifyDataSetChanged();
|
||||
}else {
|
||||
adapter.loadMoreEnd(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
this.selectDate = String.valueOf(System.currentTimeMillis());
|
||||
getMvpPresenter().loadData().subscribe(new SingleObserver<FamilyMoneyManagementInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FamilyMoneyManagementInfo familyMoneyManagementInfo) {
|
||||
showCard(familyMoneyManagementInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
getMvpPresenter().onRefreshRecordList(selectDate);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().onLoadMoreRecordList(selectDate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void showErrorView(String message) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
toast(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshData() {
|
||||
onRefresh();
|
||||
}
|
||||
|
||||
private void showContributeDialog(){
|
||||
FamilyContributionDialog dialog = new FamilyContributionDialog(this, getMvpPresenter().getFamilyMoneyManagementInfo());
|
||||
dialog.setOnOperationListener(new FamilyContributionDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, double count) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().contributionCurrency(count)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familycurrencyactivity_02));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
}
|
@@ -1,179 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.netease.nim.uikit.common.util.sys.NetworkUtil;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadmoreListener;
|
||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyGameListActivityView;
|
||||
import com.chwl.app.family.presenter.FamilyGameListPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyGameListAdapter;
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.FamilyGameInfo;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyGameListPresenter.class)
|
||||
public class FamilyGameListActivity extends BaseMvpActivity<IFamilyGameListActivityView, FamilyGameListPresenter>
|
||||
implements IFamilyGameListActivityView {
|
||||
|
||||
private SmartRefreshLayout swipeRefresh;
|
||||
private RecyclerView recyclerView;
|
||||
private FamilyGameListAdapter adapter;
|
||||
|
||||
|
||||
public static void start(Activity activity) {
|
||||
Intent intent = new Intent(activity, FamilyGameListActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_game_list);
|
||||
|
||||
initTitleBar(getString(R.string.family_games));
|
||||
|
||||
|
||||
swipeRefresh = findViewById(R.id.swipe_refresh);
|
||||
swipeRefresh.setEnableLoadmore(true);
|
||||
swipeRefresh.setEnableRefresh(true);
|
||||
swipeRefresh.setOnRefreshLoadmoreListener(new OnRefreshLoadmoreListener() {
|
||||
@Override
|
||||
public void onLoadmore(RefreshLayout refreshlayout) {
|
||||
if (!NetworkUtil.isNetAvailable(FamilyGameListActivity.this)) {
|
||||
swipeRefresh.finishLoadmore();
|
||||
return;
|
||||
}
|
||||
List<FamilyGameInfo> data = adapter.getData();
|
||||
if (ListUtils.isListEmpty(data)) {
|
||||
swipeRefresh.finishLoadmore();
|
||||
return;
|
||||
}
|
||||
getMvpPresenter().loadMoreData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(RefreshLayout refreshlayout) {
|
||||
if (!NetworkUtil.isNetAvailable(FamilyGameListActivity.this)) {
|
||||
swipeRefresh.finishRefresh();
|
||||
return;
|
||||
}
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
});
|
||||
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(this, 4));
|
||||
adapter = new FamilyGameListAdapter(this, null);
|
||||
View headerView = LayoutInflater.from(this).inflate(R.layout.layout_search_header, null,false);
|
||||
adapter.addHeaderView(headerView);
|
||||
adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
FamilyGameInfo familyGameInfo = (FamilyGameInfo) adapter.getData().get(position);
|
||||
if (FamilyModel.Instance().getMyFamily() != null) {
|
||||
FamilyGameInfo gameInfo = (FamilyGameInfo) adapter.getData().get(position);
|
||||
CommonWebViewActivity.start(FamilyGameListActivity.this, gameInfo.getLink());
|
||||
}else {
|
||||
toast(ResUtil.getString(R.string.view_activity_familygamelistactivity_01));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
requestFamilyInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 这里获取家族信息,决定是否能使用游戏
|
||||
*/
|
||||
private void requestFamilyInfo() {
|
||||
if (FamilyModel.Instance().getMyFamily() == null) {
|
||||
return;
|
||||
}
|
||||
FamilyModel.Instance().loadFamilySimpleInfo(
|
||||
FamilyModel.Instance().getMyFamily().getFamilyId()
|
||||
)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<FamilyInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FamilyInfo familyInfo) {
|
||||
if (!familyInfo.isOpenGame()){
|
||||
toast(ResUtil.getString(R.string.view_activity_familygamelistactivity_02));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadData(List<FamilyGameInfo> data, int page) {
|
||||
if (!ListUtils.isListEmpty(data)) {
|
||||
hideStatus();
|
||||
if (page == Constants.PAGE_START) {
|
||||
adapter.setNewData(data);
|
||||
swipeRefresh.finishRefresh();
|
||||
} else {
|
||||
adapter.addData(data);
|
||||
swipeRefresh.finishLoadmore();
|
||||
}
|
||||
} else {
|
||||
if (page == Constants.PAGE_START) {
|
||||
swipeRefresh.finishRefresh();
|
||||
showNoData(R.drawable.icon_common_failure, getText(R.string.text_my_master_and_apprentices_no_data));
|
||||
} else {
|
||||
swipeRefresh.finishLoadmore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadDataFail(String error, int page) {
|
||||
if (page == Constants.PAGE_START) {
|
||||
swipeRefresh.finishRefresh();
|
||||
showNoData(R.drawable.icon_common_failure, getText(R.string.text_my_master_and_apprentices_no_data));
|
||||
} else {
|
||||
swipeRefresh.finishLoadmore();
|
||||
}
|
||||
toast(error);
|
||||
}
|
||||
}
|
@@ -1,793 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.base.TitleBar;
|
||||
import com.chwl.library.common.util.Utils;
|
||||
import com.chwl.app.common.widget.CircleImageView;
|
||||
import com.chwl.app.constants.BundleKeys;
|
||||
import com.chwl.app.family.presenter.FamilyHomePresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyGamesAdapter;
|
||||
import com.chwl.app.family.view.adapter.FamilyGroupAdapter;
|
||||
import com.chwl.app.family.view.adapter.FamilyMemberAdapter;
|
||||
import com.chwl.app.family.view.dialog.FamilyDisbandDialog;
|
||||
import com.chwl.app.family.view.dialog.FamilyGuideDialog;
|
||||
import com.chwl.app.family.view.dialog.FamilyJoinDialog;
|
||||
import com.chwl.app.family.view.dialog.FamilyMenuDialog;
|
||||
import com.chwl.app.family.view.fragment.FamilyEmptyFragment;
|
||||
import com.chwl.app.friend.view.SelectFriendActivity;
|
||||
import com.chwl.app.home.view.IFamilyHomeActivityView;
|
||||
import com.chwl.app.team.view.CreateTeamMessageActivity;
|
||||
import com.chwl.app.team.view.NimTeamMessageActivity;
|
||||
import com.chwl.app.ui.user.activity.UserInfoActivity;
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity;
|
||||
import com.chwl.app.ui.widget.ShareDialog;
|
||||
import com.chwl.app.ui.widget.recyclerview.decoration.ColorDecoration;
|
||||
import com.chwl.app.ui.widget.recyclerview.layoutmanager.FullyLinearLayoutManager;
|
||||
import com.chwl.core.family.bean.FamilyGameInfo;
|
||||
import com.chwl.core.family.bean.FamilyGroupInfo;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.core.manager.IMNetEaseManager;
|
||||
import com.chwl.core.share.ShareModel;
|
||||
import com.chwl.core.share.bean.SessionType;
|
||||
import com.chwl.core.utils.SharedPreferenceUtils;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
import com.chwl.library.utils.log.MLog;
|
||||
import com.chwl.library.widget.DrawableCenterTextView;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyHomePresenter.class)
|
||||
public class FamilyHomeActivity extends BaseMvpActivity<IFamilyHomeActivityView, FamilyHomePresenter>
|
||||
implements IFamilyHomeActivityView, View.OnClickListener, ShareDialog.OnShareDialogItemClick {
|
||||
|
||||
private final String share_pref_is_first_in_family = "share_pref_is_first_in_family";
|
||||
|
||||
private ImageView ivFamilyBg;
|
||||
private RoundedImageView rivCover;
|
||||
private TextView tvName;
|
||||
private TextView tvId;
|
||||
private TextView tvMemberCount;
|
||||
private DrawableCenterTextView tvFamilyManage;
|
||||
private LinearLayout llMyFamilyCurrency;
|
||||
private TextView tvMyFamilyCurrency;
|
||||
private LinearLayout llFamilyPatriarch;
|
||||
private CircleImageView civPatriarchAvatar;
|
||||
private TextView tvPatriarchName;
|
||||
private LinearLayout llFamilyGames;
|
||||
private LinearLayout llFamilyMember;
|
||||
private TextView tvFamilyMemberTitle;
|
||||
private TextView tvFamilyGroupTitle;
|
||||
private TextView tvCreateGroup;
|
||||
private RecyclerView rvFamilyGroupList;
|
||||
private LinearLayout llNoGroup;
|
||||
private DrawableCenterTextView rlJoinFamily;
|
||||
private TextView tvAllMember;
|
||||
|
||||
private FamilyGamesAdapter gamesAdapter;
|
||||
private FamilyMemberAdapter memberAdapter;
|
||||
private FamilyGroupAdapter groupAdapter;
|
||||
|
||||
private String familyId;
|
||||
private ShareDialog shareDialog;
|
||||
|
||||
public static void start(Context activity,String familyId) {
|
||||
Intent intent = new Intent(activity,FamilyHomeActivity.class);
|
||||
if(familyId != null){
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(BundleKeys.KEY_EXTRA_1, familyId);
|
||||
intent.putExtras(bundle);
|
||||
}
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
familyId = getIntent().getStringExtra(BundleKeys.KEY_EXTRA_1);
|
||||
if(familyId == null){
|
||||
showNoData();
|
||||
} else {
|
||||
showLoading();
|
||||
loadFamilyInfo(familyId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
familyId = getIntent().getStringExtra(BundleKeys.KEY_EXTRA_1);
|
||||
setContentView(R.layout.activity_family_home);
|
||||
initTitleBar("");
|
||||
|
||||
ivFamilyBg = findViewById(R.id.iv_family_bg);
|
||||
rivCover = findViewById(R.id.riv_cover);
|
||||
tvName = findViewById(R.id.tv_name);
|
||||
tvId = findViewById(R.id.tv_id);
|
||||
tvMemberCount = findViewById(R.id.tv_member_count);
|
||||
|
||||
tvFamilyManage = findViewById(R.id.tv_family_manage);
|
||||
|
||||
llMyFamilyCurrency = findViewById(R.id.ll_my_family_currency);
|
||||
tvMyFamilyCurrency = findViewById(R.id.tv_my_family_currency);
|
||||
|
||||
llFamilyPatriarch = findViewById(R.id.ll_family_patriarch);
|
||||
civPatriarchAvatar = findViewById(R.id.civ_patriarch_avatar);
|
||||
tvPatriarchName = findViewById(R.id.tv_patriarch_name);
|
||||
|
||||
llFamilyGames = findViewById(R.id.ll_family_games);
|
||||
RecyclerView rvFamilyGameList = findViewById(R.id.rv_family_game_list);
|
||||
|
||||
tvAllMember = findViewById(R.id.tv_all_member);
|
||||
llFamilyMember = findViewById(R.id.ll_family_member);
|
||||
tvFamilyMemberTitle = findViewById(R.id.tv_family_member_title);
|
||||
RecyclerView rvFamilyMemberList = findViewById(R.id.rv_family_member_list);
|
||||
|
||||
tvFamilyGroupTitle = findViewById(R.id.tv_family_group_title);
|
||||
tvCreateGroup = findViewById(R.id.tv_create_group);
|
||||
rvFamilyGroupList = findViewById(R.id.rv_family_group_list);
|
||||
llNoGroup = findViewById(R.id.ll_no_group);
|
||||
|
||||
rlJoinFamily = findViewById(R.id.rl_join_family);
|
||||
|
||||
rvFamilyGameList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
rvFamilyGameList.addItemDecoration(new ColorDecoration(Color.TRANSPARENT, Utils.dip2px(this, 20), 0, false));
|
||||
gamesAdapter = new FamilyGamesAdapter(this, null);
|
||||
gamesAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
if (getMvpPresenter().getFamilyInfo().getEnterStatus() == FamilyInfo.STATUS_IN_FAMILY) {
|
||||
FamilyGameInfo gameInfo = (FamilyGameInfo) adapter.getData().get(position);
|
||||
CommonWebViewActivity.start(FamilyHomeActivity.this, gameInfo.getLink());
|
||||
} else {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_01));
|
||||
}
|
||||
});
|
||||
rvFamilyGameList.setAdapter(gamesAdapter);
|
||||
|
||||
rvFamilyMemberList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
rvFamilyMemberList.addItemDecoration(new ColorDecoration(Color.TRANSPARENT, Utils.dip2px(this, 20), 0, false));
|
||||
memberAdapter = new FamilyMemberAdapter(this, null);
|
||||
memberAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
FamilyMemberInfo memberInfo = (FamilyMemberInfo) adapter.getData().get(position);
|
||||
UserInfoActivity.Companion.start(FamilyHomeActivity.this, memberInfo.getUid());
|
||||
});
|
||||
rvFamilyMemberList.setAdapter(memberAdapter);
|
||||
|
||||
rvFamilyGroupList.setLayoutManager(new FullyLinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
|
||||
rvFamilyGroupList.addItemDecoration(new ColorDecoration(getResources().getColor(R.color.color_F1F1F1), 0, 1, false));
|
||||
groupAdapter = new FamilyGroupAdapter(this, null);
|
||||
groupAdapter.setActionListener(new FamilyGroupAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onJoin(FamilyGroupInfo groupInfo) {
|
||||
joinFamilyGroup(groupInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGotoGroup(FamilyGroupInfo groupInfo) {
|
||||
NimTeamMessageActivity.start(FamilyHomeActivity.this, groupInfo.getTid());
|
||||
}
|
||||
});
|
||||
|
||||
rvFamilyGroupList.setAdapter(groupAdapter);
|
||||
|
||||
}
|
||||
|
||||
private void showFamilyManage(boolean isShow) {
|
||||
if (isShow) {
|
||||
tvFamilyManage.setVisibility(View.VISIBLE);
|
||||
tvFamilyManage.setOnClickListener(this);
|
||||
} else {
|
||||
tvFamilyManage.setVisibility(View.GONE);
|
||||
tvFamilyManage.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void showFamilyView(FamilyInfo data) {
|
||||
if (null == data) {
|
||||
return;
|
||||
}
|
||||
if (!TextUtils.isEmpty(data.getBackground())) {
|
||||
GlideApp.with(this)
|
||||
.load(data.getBackground())
|
||||
.dontAnimate()
|
||||
.into(ivFamilyBg);
|
||||
} else {
|
||||
GlideApp.with(this)
|
||||
.load(R.mipmap.bg_family_home)
|
||||
.dontAnimate()
|
||||
.into(ivFamilyBg);
|
||||
}
|
||||
|
||||
GlideApp.with(this)
|
||||
.load(data.getFamilyIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.into(rivCover);
|
||||
tvName.setText(data.getFamilyName());
|
||||
tvId.setText(data.getFamilyId());
|
||||
tvMemberCount.setText(String.valueOf(data.getMemberCount()));
|
||||
|
||||
if (ListUtils.isListEmpty(data.getGames()) || !data.isOpenGame()) {
|
||||
llFamilyGames.setVisibility(View.GONE);
|
||||
} else {
|
||||
llFamilyGames.setVisibility(View.VISIBLE);
|
||||
gamesAdapter.setNewData(data.getGames());
|
||||
}
|
||||
|
||||
|
||||
if (FamilyInfo.STATUS_NOT_IN_FAMILY == data.getEnterStatus()) {
|
||||
showFamilyManage(false);
|
||||
|
||||
llMyFamilyCurrency.setVisibility(View.GONE);
|
||||
llFamilyPatriarch.setVisibility(View.VISIBLE);
|
||||
llFamilyMember.setVisibility(View.GONE);
|
||||
rlJoinFamily.setVisibility(View.VISIBLE);
|
||||
rlJoinFamily.setOnClickListener(this);
|
||||
showTitleBar(data.getFamilyName(), false);
|
||||
|
||||
tvCreateGroup.setVisibility(View.GONE);
|
||||
|
||||
FamilyMemberInfo patriarch = data.getLeader();
|
||||
GlideApp.with(this)
|
||||
.load(patriarch.getIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.into(civPatriarchAvatar);
|
||||
|
||||
tvPatriarchName.setText(patriarch.getName());
|
||||
llFamilyPatriarch.setOnClickListener(v ->
|
||||
UserInfoActivity.Companion.start(FamilyHomeActivity.this, patriarch.getUid())
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
llMyFamilyCurrency.setVisibility(View.VISIBLE);
|
||||
llMyFamilyCurrency.setOnClickListener(this);
|
||||
llFamilyPatriarch.setVisibility(View.GONE);
|
||||
llFamilyMember.setVisibility(View.VISIBLE);
|
||||
tvAllMember.setOnClickListener(this);
|
||||
rlJoinFamily.setVisibility(View.GONE);
|
||||
|
||||
showTitleBar(getString(R.string.family_mine), true);
|
||||
|
||||
if (data.getPosition() == FamilyInfo.LEVEL_PATRIARCH) {
|
||||
showFamilyManage(true);
|
||||
tvCreateGroup.setVisibility(View.VISIBLE);
|
||||
tvCreateGroup.setOnClickListener(this);
|
||||
showFamilyGuide();
|
||||
|
||||
} else {
|
||||
showFamilyManage(false);
|
||||
tvCreateGroup.setVisibility(View.GONE);
|
||||
tvCreateGroup.setOnClickListener(null);
|
||||
}
|
||||
|
||||
if (data.isOpenMoney()) {
|
||||
llMyFamilyCurrency.setVisibility(View.VISIBLE);
|
||||
tvMyFamilyCurrency.setText(String.format(
|
||||
getResources().getString(R.string.family_currency_count),
|
||||
FormatUtils.formatToShortDown(data.getFamilyMoney()),
|
||||
data.getMoneyName()));
|
||||
} else {
|
||||
llMyFamilyCurrency.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
tvFamilyMemberTitle.setText(String.format(
|
||||
getResources().getString(R.string.family_member_title),
|
||||
String.valueOf(data.getMemberCount())
|
||||
));
|
||||
memberAdapter.setNewData(data.getMembers());
|
||||
|
||||
}
|
||||
|
||||
tvFamilyGroupTitle.setText(String.format(
|
||||
getResources().getString(R.string.family_group_title),
|
||||
String.valueOf(data.getGroups().size())
|
||||
));
|
||||
|
||||
if (!ListUtils.isListEmpty(data.getGroups())) {
|
||||
llNoGroup.setVisibility(View.GONE);
|
||||
rvFamilyGroupList.setVisibility(View.VISIBLE);
|
||||
groupAdapter.setNewData(data.getGroups());
|
||||
} else {
|
||||
llNoGroup.setVisibility(View.VISIBLE);
|
||||
rvFamilyGroupList.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showTitleBar(String title, boolean isMore) {
|
||||
mTitleBar.setTitle(title);
|
||||
mTitleBar.removeAllActions();
|
||||
|
||||
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_family_share) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
shareDialog = new ShareDialog(FamilyHomeActivity.this);
|
||||
shareDialog.setOnShareDialogItemClick(FamilyHomeActivity.this);
|
||||
shareDialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
if (isMore)
|
||||
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_family_more) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
showMenuDialog(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showMenuDialog(View view) {
|
||||
FamilyMenuDialog dialog = new FamilyMenuDialog(this, getMvpPresenter().getFamilyInfo(), view);
|
||||
dialog.setOnMenuClickListener(new FamilyMenuDialog.OnMenuClickListener() {
|
||||
@Override
|
||||
public void onExitFamily(DialogInterface dialog, FamilyInfo familyInfo) {
|
||||
dialog.dismiss();
|
||||
getDialogManager().showOkCancelWithTitleDialog(new String[]{ResUtil.getString(R.string.view_activity_familyhomeactivity_02), ResUtil.getString(R.string.view_activity_familyhomeactivity_03), ResUtil.getString(R.string.view_activity_familyhomeactivity_04)},
|
||||
() -> getMvpPresenter().exitFamily().subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_05));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
// Toast.makeText(FamilyHomeActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(e.getMessage());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisbandFamily(DialogInterface dialog, FamilyInfo familyInfo) { //解散家族
|
||||
dialog.dismiss();
|
||||
FamilyDisbandDialog disbandFamilyDialog = new FamilyDisbandDialog(FamilyHomeActivity.this);
|
||||
disbandFamilyDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInviteFriends(DialogInterface dialog, FamilyInfo familyInfo) {
|
||||
FamilySelectFriendActivity.start(FamilyHomeActivity.this, (activity, uid) ->
|
||||
getMvpPresenter().inviteFriendToFamily(uid)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_06));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
}));
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if(familyId == null){
|
||||
showNoData();
|
||||
} else {
|
||||
showLoading();
|
||||
loadFamilyInfo(familyId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == SelectFriendActivity.CODE_REQUEST_TO_SHARE_FAMILY &&
|
||||
resultCode == RESULT_OK) {
|
||||
String targetUid = data.getStringExtra(SelectFriendActivity.EXTRA_TARGET_UID);
|
||||
String nick = data.getStringExtra(SelectFriendActivity.EXTRA_TARGET_NAME);
|
||||
int sessionType = data.getIntExtra(SelectFriendActivity.EXTRA_SESSION_TYPE, SessionType.P2P);
|
||||
IMNetEaseManager.get().sendSharingFamilyMessage(sessionType, targetUid, getMvpPresenter().getFamilyInfo());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadData(FamilyInfo data) {
|
||||
hideStatus();
|
||||
showFamilyView(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNoData(int drawable, CharSequence charSequence) {
|
||||
if (!checkActivityValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
View status = findViewById(R.id.status_layout);
|
||||
if (status == null || status.getId() <= 0) {
|
||||
MLog.error(this, "xuwakao, had not set layout id ");
|
||||
return;
|
||||
}
|
||||
|
||||
FamilyEmptyFragment fragment = FamilyEmptyFragment.newInstance(0 - mTitleBar.getmHeight());
|
||||
fragment.setOnClickListener(v -> FamilyPlazaActivity.start(FamilyHomeActivity.this));
|
||||
getSupportFragmentManager().beginTransaction().replace(status.getId(), fragment, STATUS_TAG).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showErrorView(String message) {
|
||||
toast(message);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadMyFamilyInfo(String familyId) {
|
||||
loadFamilyInfo(familyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void loadFamilyInfo(String familyId) {
|
||||
getMvpPresenter().loadData(familyId).subscribe(new SingleObserver<FamilyInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FamilyInfo familyInfo) {
|
||||
mTitleBar.setVisibility(View.VISIBLE);
|
||||
onLoadData(familyInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
hideStatus();
|
||||
showErrorView(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == tvFamilyManage.getId()) {
|
||||
FamilyManageActivity.start(this);
|
||||
} else if (id == llMyFamilyCurrency.getId()) {
|
||||
FamilyCurrencyActivity.start(this);
|
||||
} else if (id == tvAllMember.getId()) {
|
||||
FamilyMemberListActivity.start(this, FamilyMemberListActivity.TYPE_SHOW_MEMBER);
|
||||
} else if (id == tvCreateGroup.getId()) {
|
||||
//去创建群组
|
||||
CreateTeamMessageActivity.start(this);
|
||||
} else if (id == rlJoinFamily.getId()) {
|
||||
joinFamily(getMvpPresenter().getFamilyInfo());
|
||||
}
|
||||
}
|
||||
|
||||
private void joinFamily(FamilyInfo familyInfo) {
|
||||
if (null != FamilyModel.Instance().getMyFamily()) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_08));
|
||||
return;
|
||||
}
|
||||
if (familyInfo.getVerifyType() == FamilyInfo.VERIFY_ON) {
|
||||
showJoinFamilyDialog(getMvpPresenter().getFamilyInfo());
|
||||
} else {
|
||||
getMvpPresenter().joinFamily(null)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_09));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入家族验证弹框
|
||||
*/
|
||||
private void showJoinFamilyDialog(FamilyInfo familyInfo) {
|
||||
FamilyJoinDialog dialog = new FamilyJoinDialog(this);
|
||||
String str = String.format(getResources().getString(R.string.family_join_tip),
|
||||
"\"" + familyInfo.getFamilyName() + "\"");
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
StyleSpan styleSpan = new StyleSpan(Typeface.BOLD);
|
||||
spannableString.setSpan(styleSpan, str.indexOf("\""), str.lastIndexOf("\"") + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
dialog.setTipMessage(spannableString);
|
||||
dialog.setDefaultVerifyMessage(getResources().getString(R.string.family_join_hint));
|
||||
dialog.setOnOperationListener(new FamilyJoinDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, String str) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().joinFamily(str)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_010));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void joinFamilyGroup(FamilyGroupInfo groupInfo) {
|
||||
if (getMvpPresenter().getFamilyInfo().getEnterStatus() == FamilyInfo.STATUS_IN_FAMILY) {
|
||||
if (groupInfo.isVerify()) {
|
||||
showInFamilyJoinDialog(groupInfo);
|
||||
} else {
|
||||
getMvpPresenter().joinFamilyGroup(
|
||||
String.valueOf(groupInfo.getId()),
|
||||
""
|
||||
).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_011));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
} else if (getMvpPresenter().getFamilyInfo().getEnterStatus() == FamilyInfo.STATUS_NOT_IN_FAMILY) {
|
||||
if (null != FamilyModel.Instance().getMyFamily()) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_012));
|
||||
return;
|
||||
}
|
||||
if (getMvpPresenter().getFamilyInfo().getVerifyType() == FamilyInfo.VERIFY_ON || groupInfo.isVerify()) {
|
||||
//凡是有一个需要验证,弹出验证dailog
|
||||
showNotInFamilyJoinDialog(groupInfo);
|
||||
} else {
|
||||
//都不需要验证的情况 直接进群
|
||||
getMvpPresenter().joinFamilyGroup(
|
||||
String.valueOf(groupInfo.getId()),
|
||||
null
|
||||
).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_013));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 在家族中加入需要验证的群组
|
||||
*/
|
||||
private void showInFamilyJoinDialog(FamilyGroupInfo groupInfo) {
|
||||
FamilyJoinDialog dialog = new FamilyJoinDialog(this);
|
||||
String str = String.format(getResources().getString(R.string.family_join_tip),
|
||||
"\"" + groupInfo.getName() + "\"");
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
StyleSpan styleSpan = new StyleSpan(Typeface.BOLD);
|
||||
spannableString.setSpan(styleSpan, str.indexOf("\""), str.lastIndexOf("\"") + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
dialog.setTipMessage(spannableString);
|
||||
dialog.setDefaultVerifyMessage(getResources().getString(R.string.family_group_join_hint));
|
||||
dialog.setOnOperationListener(new FamilyJoinDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, String str) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().joinFamilyGroup(
|
||||
String.valueOf(groupInfo.getId()),
|
||||
str
|
||||
).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_014));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 不在家族中加入家族的群
|
||||
*/
|
||||
private void showNotInFamilyJoinDialog(FamilyGroupInfo groupInfo) {
|
||||
FamilyJoinDialog dialog = new FamilyJoinDialog(this);
|
||||
String str = String.format(getResources().getString(R.string.family_group_join_tip_1),
|
||||
"\"" + getMvpPresenter().getFamilyInfo().getFamilyName() + "\"");
|
||||
SpannableString spannableString = new SpannableString(str);
|
||||
StyleSpan styleSpan = new StyleSpan(Typeface.BOLD);
|
||||
spannableString.setSpan(styleSpan, str.indexOf("\""), str.lastIndexOf("\"") + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
dialog.setTipMessage(spannableString);
|
||||
dialog.setDefaultVerifyMessage(getResources().getString(R.string.family_group_join_hint));
|
||||
|
||||
dialog.setOnOperationListener(new FamilyJoinDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, String str) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().joinFamilyGroup(
|
||||
String.valueOf(groupInfo.getId()),
|
||||
str
|
||||
).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyhomeactivity_015));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInAppSharingItemClick() {
|
||||
if (shareDialog != null && shareDialog.isShowing()) {
|
||||
shareDialog.dismiss();
|
||||
}
|
||||
SelectFriendActivity.startForSharingFamily(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharePlatformClick(Platform platform) {
|
||||
FamilyInfo familyInfo = getMvpPresenter().getFamilyInfo();
|
||||
if (familyInfo != null) {
|
||||
ShareModel.get().shareFamily(
|
||||
platform, familyInfo.getFamilyId(),
|
||||
familyInfo.getFamilyIcon(),
|
||||
familyInfo.getFamilyName()
|
||||
)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void showFamilyGuide() {
|
||||
if (!isFirstInFamily()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FamilyGuideDialog guideDialog = new FamilyGuideDialog(this);
|
||||
guideDialog.show();
|
||||
|
||||
setFirstInFamily(false);
|
||||
}
|
||||
|
||||
private boolean isFirstInFamily() {
|
||||
// return (boolean) SharedPreferenceUtils.get(share_pref_is_first_in_family, new Boolean(true));
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setFirstInFamily(boolean firstInFamily) {
|
||||
SharedPreferenceUtils.put(share_pref_is_first_in_family, new Boolean(firstInFamily));
|
||||
}
|
||||
|
||||
}
|
@@ -1,227 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.jph.takephoto.model.TResult;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.ErbanTakePhotoActivity;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyInfoView;
|
||||
import com.chwl.app.family.presenter.FamilyInfoPresenter;
|
||||
import com.chwl.app.family.view.dialog.FamilyDisbandDialog;
|
||||
import com.chwl.app.ui.widget.ButtonItem;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.core.file.FileModel;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.widget.IOSSwitchView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyInfoPresenter.class)
|
||||
public class FamilyInfoActivity extends BaseMvpActivity<IFamilyInfoView,FamilyInfoPresenter>
|
||||
implements IFamilyInfoView, View.OnClickListener,ErbanTakePhotoActivity.TakePhotoCallBack {
|
||||
|
||||
private LinearLayout llFamilyAvatar;
|
||||
private RoundedImageView rivFamilyCover;
|
||||
private LinearLayout llFamilyName;
|
||||
private TextView tvFamilyName;
|
||||
private TextView tvFamilyDisband;
|
||||
private IOSSwitchView svIdentityCheck;
|
||||
|
||||
private FamilyInfo familyInfo;
|
||||
|
||||
public static void start(Activity activity) {
|
||||
Intent intent = new Intent(activity, FamilyInfoActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_info);
|
||||
initTitleBar(getString(R.string.family_info));
|
||||
|
||||
|
||||
llFamilyAvatar = (LinearLayout) findViewById(R.id.ll_family_avatar);
|
||||
rivFamilyCover = (RoundedImageView) findViewById(R.id.riv_family_cover);
|
||||
llFamilyName = (LinearLayout) findViewById(R.id.ll_family_name);
|
||||
tvFamilyName = (TextView) findViewById(R.id.tv_family_name);
|
||||
tvFamilyDisband = (TextView) findViewById(R.id.tv_family_disband);
|
||||
svIdentityCheck = (IOSSwitchView) findViewById(R.id.sv_identity_check);
|
||||
|
||||
|
||||
llFamilyAvatar.setOnClickListener(this);
|
||||
llFamilyName.setOnClickListener(this);
|
||||
tvFamilyDisband.setOnClickListener(this);
|
||||
svIdentityCheck.setOnSwitchStateChangeListener(new IOSSwitchView.OnSwitchStateChangeListener() {
|
||||
@Override
|
||||
public void onStateSwitched(boolean isOn) {
|
||||
svIdentityCheck.setEnabled(false);
|
||||
getMvpPresenter().changeVerifyStatus(isOn).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyinfoactivity_01));
|
||||
svIdentityCheck.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
svIdentityCheck.setEnabled(true);
|
||||
toast(e.getMessage());
|
||||
svIdentityCheck.setOn(!isOn,true,false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
initData();
|
||||
|
||||
}
|
||||
|
||||
private void initData(){
|
||||
familyInfo = FamilyModel.Instance().getMyFamily();
|
||||
if (familyInfo == null) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyinfoactivity_02));
|
||||
return;
|
||||
}
|
||||
GlideApp.with(this)
|
||||
.load(familyInfo.getFamilyIcon())
|
||||
.dontAnimate()
|
||||
.into(rivFamilyCover);
|
||||
|
||||
tvFamilyName.setText(familyInfo.getFamilyName());
|
||||
if (FamilyInfo.VERIFY_ON == familyInfo.getVerifyType()){
|
||||
svIdentityCheck.setOn(true,false);
|
||||
}else {
|
||||
svIdentityCheck.setOn(false,false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == llFamilyAvatar.getId()){
|
||||
ButtonItem buttonItem = new ButtonItem(ResUtil.getString(R.string.view_activity_familyinfoactivity_03), ()->{
|
||||
ErbanTakePhotoActivity.startToTakePhoto(this,this);
|
||||
});
|
||||
ButtonItem buttonItem1 = new ButtonItem(ResUtil.getString(R.string.view_activity_familyinfoactivity_04), () -> {
|
||||
ErbanTakePhotoActivity.startToSelectPhoto(this,this);
|
||||
});
|
||||
List<ButtonItem> buttonItems = new ArrayList<>();
|
||||
buttonItems.add(buttonItem);
|
||||
buttonItems.add(buttonItem1);
|
||||
getDialogManager().showCommonPopupDialog(buttonItems, ResUtil.getString(R.string.view_activity_familyinfoactivity_05), false);
|
||||
|
||||
}else if (id == llFamilyName.getId()){
|
||||
FamilyTextInputActivity.start(this, familyInfo.getFamilyName(), new FamilyTextInputActivity.CallBack() {
|
||||
@Override
|
||||
public void onModify(String str) {
|
||||
getMvpPresenter().changeFamilyName(str).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
tvFamilyName.setText(str);
|
||||
toast(ResUtil.getString(R.string.view_activity_familyinfoactivity_06));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}else if (id == tvFamilyDisband.getId()){
|
||||
FamilyDisbandDialog disbandFamilyDialog = new FamilyDisbandDialog(this);
|
||||
disbandFamilyDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************* 照相上传逻辑 ******************************************************/
|
||||
|
||||
public void onUpload(String url) {
|
||||
getDialogManager().dismissDialog();
|
||||
GlideApp.with(FamilyInfoActivity.this)
|
||||
.load(url)
|
||||
.error(R.drawable.default_avatar)
|
||||
.into(rivFamilyCover);
|
||||
|
||||
|
||||
getMvpPresenter().changeFamilyAvatar(url).subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyinfoactivity_07));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onUploadFail() {
|
||||
toast(ResUtil.getString(R.string.view_activity_familyinfoactivity_08));
|
||||
getDialogManager().dismissDialog();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void takeSuccess(TResult result) {
|
||||
getDialogManager().showProgressDialog(FamilyInfoActivity.this, ResUtil.getString(R.string.view_activity_familyinfoactivity_09));
|
||||
FileModel.get()
|
||||
.uploadFile(result.getImage().getCompressPath())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe((url, throwable) -> {
|
||||
if (throwable != null) {
|
||||
onUploadFail();
|
||||
} else {
|
||||
onUpload(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeFail(TResult result, String msg) {
|
||||
toast(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeCancel() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,140 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.base.TitleBar;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilySearchView;
|
||||
import com.chwl.app.family.presenter.FamilyListPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyWeeklyRankBoardAdapter;
|
||||
import com.chwl.app.ui.widget.recyclerview.decoration.ColorDecoration;
|
||||
import com.chwl.core.family.bean.response.RankingFamilyInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.SizeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyListPresenter.class)
|
||||
public class FamilyListActivity extends BaseMvpActivity<IFamilySearchView,FamilyListPresenter>
|
||||
implements IFamilySearchView,SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView recyclerView;
|
||||
private FamilyWeeklyRankBoardAdapter adapter;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context,FamilyListActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_list);
|
||||
initTitleBar(getString(R.string.family_weekly_rank_board));
|
||||
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_family_list_search) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
FamilySearchActivity.start(FamilyListActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
swipeRefresh = findViewById(R.id.swipe_refresh);
|
||||
swipeRefresh.setOnRefreshListener(this);
|
||||
|
||||
recyclerView = findViewById(R.id.recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL,false));
|
||||
if (recyclerView.getItemDecorationCount() == 0) {
|
||||
int marginStart = SizeUtils.dp2px(this, 16);
|
||||
recyclerView.addItemDecoration(new ColorDecoration(getResources().getColor(R.color.color_F1F1F1),
|
||||
0,1, false, marginStart, marginStart));
|
||||
}
|
||||
adapter = new FamilyWeeklyRankBoardAdapter(this, null);
|
||||
// View headerView = LayoutInflater.from(this).inflate(R.layout.layout_search_header, null,false);
|
||||
// adapter.addHeaderView(headerView);
|
||||
adapter.setOnItemClickListener((adapter1, view, position) -> {
|
||||
RankingFamilyInfo familyInfo = adapter.getData().get(position);
|
||||
FamilyHomeActivity.start(FamilyListActivity.this,familyInfo.getId());
|
||||
});
|
||||
adapter.setEnableLoadMore(false);
|
||||
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ListUtils.isListEmpty(adapter.getData())){
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().refreshData().subscribe(new SingleObserver<List<RankingFamilyInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<RankingFamilyInfo> familyInfoList) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
if (familyInfoList != null && familyInfoList.size() > 0) {
|
||||
hideStatus();
|
||||
adapter.setNewData(familyInfoList);
|
||||
adapter.notifyDataSetChanged();
|
||||
} else {
|
||||
showNoData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
showNetworkErr();
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
getMvpPresenter().refreshData().subscribe(new SingleObserver<List<RankingFamilyInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<RankingFamilyInfo> familyInfoList) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
if (familyInfoList != null && familyInfoList.size() > 0) {
|
||||
hideStatus();
|
||||
adapter.setNewData(familyInfoList);
|
||||
adapter.notifyDataSetChanged();
|
||||
} else {
|
||||
showNoData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
showNetworkErr();
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -1,91 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyManageActivityView;
|
||||
import com.chwl.app.family.presenter.FamilyManagePresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyManageAdapter;
|
||||
import com.chwl.core.family.bean.FamilyManageItemInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CreatePresenter(FamilyManagePresenter.class)
|
||||
public class FamilyManageActivity extends BaseMvpActivity<IFamilyManageActivityView,FamilyManagePresenter>
|
||||
implements IFamilyManageActivityView, BaseQuickAdapter.OnItemClickListener{
|
||||
|
||||
private RecyclerView rvFamilyManage;
|
||||
private FamilyManageAdapter familyManageAdapter;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context,FamilyManageActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_manage_activty);
|
||||
initTitleBar(getString(R.string.family_manage_title));
|
||||
|
||||
rvFamilyManage = (RecyclerView) findViewById(R.id.rv_family_manage);
|
||||
rvFamilyManage.setLayoutManager(new LinearLayoutManager(this));
|
||||
//rvFamilyManage.addItemDecoration(new ColorDecoration(getResources().getColor(R.color.color_F5F5F5),1,1,false));
|
||||
|
||||
List<FamilyManageItemInfo> manageItemInfos = new ArrayList<>();
|
||||
|
||||
if (FamilyModel.Instance().getMyFamily().isOpenMoney()) {
|
||||
FamilyManageItemInfo itemInfo = new FamilyManageItemInfo();
|
||||
itemInfo.setId(FamilyManageItemInfo.ID_FAMILY_MANAGE_CURRENCY);
|
||||
itemInfo.setName(ResUtil.getString(R.string.view_activity_familymanageactivity_01));
|
||||
itemInfo.setImg(R.drawable.ic_family_manage_currency);
|
||||
manageItemInfos.add(itemInfo);
|
||||
}
|
||||
|
||||
FamilyManageItemInfo itemInfo2 = new FamilyManageItemInfo();
|
||||
itemInfo2.setId(FamilyManageItemInfo.ID_FAMILY_MANAGE_MEMBER);
|
||||
itemInfo2.setName(ResUtil.getString(R.string.view_activity_familymanageactivity_02));
|
||||
itemInfo2.setImg(R.drawable.ic_family_manage_member);
|
||||
manageItemInfos.add(itemInfo2);
|
||||
|
||||
FamilyManageItemInfo itemInfo3 = new FamilyManageItemInfo();
|
||||
itemInfo3.setId(FamilyManageItemInfo.ID_FAMILY_MANAGE_INFO);
|
||||
itemInfo3.setName(ResUtil.getString(R.string.view_activity_familymanageactivity_03));
|
||||
itemInfo3.setImg(R.drawable.ic_family_manage_info);
|
||||
manageItemInfos.add(itemInfo3);
|
||||
|
||||
familyManageAdapter = new FamilyManageAdapter(manageItemInfos);
|
||||
familyManageAdapter.setOnItemClickListener(this);
|
||||
rvFamilyManage.setAdapter(familyManageAdapter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
FamilyManageItemInfo itemInfo = (FamilyManageItemInfo) adapter.getData().get(position);
|
||||
if (FamilyManageItemInfo.ID_FAMILY_MANAGE_CURRENCY == itemInfo.getId()){
|
||||
FamilyCurrencyActivity.start(this);
|
||||
|
||||
}else if (FamilyManageItemInfo.ID_FAMILY_MANAGE_MEMBER == itemInfo.getId()){
|
||||
FamilyMemberListActivity.start(this,FamilyMemberListActivity.TYPE_REMOVE_MEMBER);
|
||||
|
||||
}else if (FamilyManageItemInfo.ID_FAMILY_MANAGE_INFO == itemInfo.getId()){
|
||||
FamilyInfoActivity.start(this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,137 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.jay.widget.StickyHeadersLinearLayoutManager;
|
||||
import com.jzxiang.pickerview.TimePickerDialog;
|
||||
import com.jzxiang.pickerview.data.Type;
|
||||
import com.jzxiang.pickerview.listener.OnDateSetListener;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.constants.BundleKeys;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyCurrencyView;
|
||||
import com.chwl.app.family.presenter.FamilyMemberCurrencyPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyCurrencyBillAdapter;
|
||||
import com.chwl.core.Constants;
|
||||
import com.chwl.core.family.bean.VMBillItemInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CreatePresenter(FamilyMemberCurrencyPresenter.class)
|
||||
public class FamilyMemberCurrencyActivity extends BaseMvpActivity<IFamilyCurrencyView,FamilyMemberCurrencyPresenter>
|
||||
implements IFamilyCurrencyView, SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener, OnDateSetListener {
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView rvFamilyCurrency;
|
||||
private FamilyCurrencyBillAdapter adapter;
|
||||
|
||||
protected TimePickerDialog.Builder mDialogYearMonthDayBuild;
|
||||
|
||||
private String selectDate;
|
||||
private long uid;
|
||||
|
||||
public static void start(Context context, long uid) {
|
||||
Intent intent = new Intent(context, FamilyMemberCurrencyActivity.class);
|
||||
intent.putExtra(BundleKeys.KEY_EXTRA_1, uid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
uid = getIntent().getLongExtra(BundleKeys.KEY_EXTRA_1,0);
|
||||
setContentView(R.layout.activity_family_member_currency);
|
||||
|
||||
initTitleBar(getString(R.string.family_currency));
|
||||
|
||||
swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
|
||||
swipeRefresh.setOnRefreshListener(this);
|
||||
|
||||
rvFamilyCurrency = (RecyclerView) findViewById(R.id.rv_family_currency);
|
||||
rvFamilyCurrency.setItemAnimator(null);
|
||||
rvFamilyCurrency.setLayoutManager(new StickyHeadersLinearLayoutManager<FamilyCurrencyBillAdapter>(this, LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new FamilyCurrencyBillAdapter(this,null);
|
||||
adapter.setEnableLoadMore(true);
|
||||
adapter.setOnLoadMoreListener(this, rvFamilyCurrency);
|
||||
adapter.setOnDateSelectListener(new FamilyCurrencyBillAdapter.OnDateSelectListener() {
|
||||
@Override
|
||||
public void onDateSelect() {
|
||||
mDialogYearMonthDayBuild.build().show(getSupportFragmentManager(), "year_month");
|
||||
}
|
||||
});
|
||||
rvFamilyCurrency.setAdapter(adapter);
|
||||
|
||||
mDialogYearMonthDayBuild = new TimePickerDialog.Builder()
|
||||
.setType(Type.YEAR_MONTH)
|
||||
.setTitleStringId(ResUtil.getString(R.string.view_activity_familymembercurrencyactivity_01))
|
||||
.setThemeColor(getResources().getColor(R.color.line_background))
|
||||
.setWheelItemTextNormalColor(getResources().getColor(R.color
|
||||
.timetimepicker_default_text_color))
|
||||
.setWheelItemTextSelectorColor(getResources().getColor(R.color.black))
|
||||
.setCallBack(this);
|
||||
|
||||
this.selectDate = String.valueOf(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ListUtils.isListEmpty(getMvpPresenter().getBillItemInfos())){
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().onRefreshRecordList(selectDate, String.valueOf(uid));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
this.selectDate = String.valueOf(System.currentTimeMillis());
|
||||
getMvpPresenter().onRefreshRecordList(selectDate, String.valueOf(uid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().onLoadMoreRecordList(selectDate, String.valueOf(uid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDateSet(TimePickerDialog timePickerView, long millseconds) {
|
||||
this.selectDate = String.valueOf(millseconds);
|
||||
getMvpPresenter().onRefreshRecordList(selectDate, String.valueOf(uid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadData(List<VMBillItemInfo> billItemInfos, int page, int dataSize) {
|
||||
if (page == Constants.PAGE_START){
|
||||
swipeRefresh.setRefreshing(false);
|
||||
adapter.setNewData(billItemInfos);
|
||||
}else {
|
||||
if (dataSize > 0) {
|
||||
adapter.loadMoreComplete();
|
||||
adapter.notifyDataSetChanged();
|
||||
}else {
|
||||
adapter.loadMoreEnd(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showErrorView(String message) {
|
||||
toast(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshData() {
|
||||
|
||||
}
|
||||
}
|
@@ -1,299 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.base.TitleBar;
|
||||
import com.chwl.app.constants.BundleKeys;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyMemberListView;
|
||||
import com.chwl.app.family.presenter.FamilyMemberListPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyMemberListAdapter;
|
||||
import com.chwl.app.family.view.dialog.FamilyTransferDialog;
|
||||
import com.chwl.app.ui.user.activity.UserInfoActivity;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.core.family.bean.response.memberList.RespFamilymember;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyMemberListPresenter.class)
|
||||
public class FamilyMemberListActivity extends BaseMvpActivity<IFamilyMemberListView, FamilyMemberListPresenter>
|
||||
implements IFamilyMemberListView, View.OnClickListener, BaseQuickAdapter.RequestLoadMoreListener, SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
public static final int TYPE_SHOW_MEMBER = 1;// 查看成员方式
|
||||
public static final int TYPE_SELECT_MEMBER = 2;//选择成员方式
|
||||
public static final int TYPE_REMOVE_MEMBER = 3;//移除成员方式
|
||||
public static final int TYPE_CHECK_MEMBER_CURRENCY = 4;//查看家族成员家族币记录
|
||||
|
||||
private LinearLayout llSearch;
|
||||
private TextView tvMemberCount;
|
||||
private RecyclerView rvMember;
|
||||
private FamilyMemberListAdapter familyMemberListAdapter;
|
||||
private int optType = TYPE_SHOW_MEMBER;
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
|
||||
private TitleBar.Action searchAction = new TitleBar.Action() {
|
||||
@Override
|
||||
public String getText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrawable() {
|
||||
return R.drawable.ic_family_search;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextColor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextDrawableLeft() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
FamilyMemberSearchActivity.start(FamilyMemberListActivity.this, optType);
|
||||
}
|
||||
};
|
||||
public static void start(Activity activity, int optType) {
|
||||
Intent intent = new Intent(activity, FamilyMemberListActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt(BundleKeys.KEY_EXTRA_1, optType);
|
||||
intent.putExtras(b);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
optType = getIntent().getIntExtra(BundleKeys.KEY_EXTRA_1, TYPE_SHOW_MEMBER);
|
||||
setContentView(R.layout.activity_family_list_member);
|
||||
|
||||
initTitleBar(getString(R.string.family_member_list));
|
||||
|
||||
llSearch = (LinearLayout) findViewById(R.id.ll_search);
|
||||
tvMemberCount = (TextView) findViewById(R.id.tv_member_count);
|
||||
rvMember = (RecyclerView) findViewById(R.id.rv_member);
|
||||
|
||||
|
||||
swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh);
|
||||
swipeRefresh.setOnRefreshListener(this);
|
||||
rvMember.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
|
||||
familyMemberListAdapter = new FamilyMemberListAdapter(this, null, optType);
|
||||
familyMemberListAdapter.setEnableLoadMore(true);
|
||||
familyMemberListAdapter.setOnLoadMoreListener(this, rvMember);
|
||||
familyMemberListAdapter.setActionListener(new FamilyMemberListAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onRemoveMember(FamilyMemberInfo familyMemberInfo) {
|
||||
//移除成员
|
||||
showRemoveFamilyMemberDialog(familyMemberInfo);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransferCurrency(FamilyMemberInfo familyMemberInfo) {
|
||||
showTransferDialog(familyMemberInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickAvatar(FamilyMemberInfo item) {
|
||||
UserInfoActivity.Companion.start(FamilyMemberListActivity.this, item.getUid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckMemberCurrency(FamilyMemberInfo item) {
|
||||
|
||||
}
|
||||
});
|
||||
rvMember.setAdapter(familyMemberListAdapter);
|
||||
|
||||
mTitleBar.addAction(searchAction);
|
||||
llSearch.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ListUtils.isListEmpty(this.familyMemberListAdapter.getData())) {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void refreshData() {
|
||||
showLoading();
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().refreshData()
|
||||
.subscribe(new SingleObserver<RespFamilymember>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(RespFamilymember respFamilymember) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
tvMemberCount.setText(String.format(
|
||||
getString(R.string.family_member_label2),
|
||||
String.valueOf(respFamilymember.getCount())
|
||||
));
|
||||
|
||||
onLoadData(respFamilymember.getMembers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
swipeRefresh.setRefreshing(false);
|
||||
showNetworkErr();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == llSearch.getId()) {
|
||||
FamilyMemberSearchActivity.start(this, optType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadData(List<FamilyMemberInfo> memberInfoList) {
|
||||
if (!ListUtils.isListEmpty(memberInfoList)) {
|
||||
hideStatus();
|
||||
familyMemberListAdapter.setNewData(memberInfoList);
|
||||
familyMemberListAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
showNoData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadDate() {
|
||||
super.onReloadDate();
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadFamilyMember() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().loadMoreData()
|
||||
.subscribe(new SingleObserver<RespFamilymember>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(RespFamilymember respFamilymember) {
|
||||
List<FamilyMemberInfo> memberInfos = respFamilymember.getMembers();
|
||||
if (!ListUtils.isListEmpty(memberInfos)) {
|
||||
familyMemberListAdapter.addData(memberInfos);
|
||||
familyMemberListAdapter.loadMoreComplete();
|
||||
} else {
|
||||
familyMemberListAdapter.loadMoreEnd(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
|
||||
private void showTransferDialog(FamilyMemberInfo familyMemberInfo) {
|
||||
FamilyTransferDialog dialog = new FamilyTransferDialog(this, getMvpPresenter().getFamilyInfo(), familyMemberInfo);
|
||||
dialog.setOnOperationListener(new FamilyTransferDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, FamilyMemberInfo familyMemberInfo, double count) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().transferCurrency(familyMemberInfo, count)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(getResources().getString(R.string.family_transfer_currency_success));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
private void showRemoveFamilyMemberDialog(FamilyMemberInfo familyMemberInfo) {
|
||||
getDialogManager().showOkCancelWithTitleDialog(new String[]{ResUtil.getString(R.string.view_activity_familymemberlistactivity_01), ResUtil.getString(R.string.view_activity_familymemberlistactivity_02), ResUtil.getString(R.string.view_activity_familymemberlistactivity_03),
|
||||
familyMemberInfo.getName(), ResUtil.getString(R.string.view_activity_familymemberlistactivity_04)},
|
||||
() -> getMvpPresenter().removeFamilyMember(familyMemberInfo)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familymemberlistactivity_05));
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,317 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.constants.BundleKeys;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyMemberSearchView;
|
||||
import com.chwl.app.family.presenter.FamilyMemberSearchPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyMemberListAdapter;
|
||||
import com.chwl.app.family.view.dialog.FamilyRemoveMemberDialog;
|
||||
import com.chwl.app.family.view.dialog.FamilyTransferDialog;
|
||||
import com.chwl.app.ui.user.activity.UserInfoActivity;
|
||||
import com.chwl.app.ui.widget.recyclerview.decoration.ColorDecoration;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyMemberSearchPresenter.class)
|
||||
public class FamilyMemberSearchActivity extends BaseMvpActivity<IFamilyMemberSearchView,FamilyMemberSearchPresenter>
|
||||
implements IFamilyMemberSearchView, View.OnClickListener, BaseQuickAdapter.RequestLoadMoreListener {
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private FamilyMemberListAdapter searchAdapter;
|
||||
private EditText searchEdit;
|
||||
private ImageView ivBack;
|
||||
private TextView tvSearch;
|
||||
private ImageView ivClearText;
|
||||
private int optType;
|
||||
private String searchStr;
|
||||
|
||||
public static void start(Context context,int optType) {
|
||||
Intent intent = new Intent(context,FamilyMemberSearchActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt(BundleKeys.KEY_EXTRA_1,optType);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
optType = getIntent().getIntExtra(BundleKeys.KEY_EXTRA_1,FamilyMemberListActivity.TYPE_SHOW_MEMBER);
|
||||
setContentView(R.layout.activity_family_member_search);
|
||||
|
||||
initView();
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||
searchEdit = (EditText) findViewById(R.id.search_edit);
|
||||
searchEdit.addTextChangedListener(textWatcher);
|
||||
searchEdit.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
|
||||
searchEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || (event!=null && event.getKeyCode()== KeyEvent.KEYCODE_ENTER)) {
|
||||
String str = v.getText().toString();
|
||||
if (TextUtils.isEmpty(str)){
|
||||
// Toast.makeText(v.getContext(),ResUtil.getString(R.string.view_activity_familymembersearchactivity_01),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_activity_familymembersearchactivity_02));
|
||||
return true;
|
||||
}
|
||||
searchStr = str;
|
||||
search(str);
|
||||
hideIME();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
|
||||
if (recyclerView.getItemDecorationCount() == 0) {
|
||||
recyclerView.addItemDecoration(new ColorDecoration(getResources().getColor(R.color.color_F1F1F1), 0,1, false));
|
||||
}
|
||||
searchAdapter = new FamilyMemberListAdapter(this, null,optType);
|
||||
View headerView = LayoutInflater.from(this).inflate(R.layout.layout_search_header, null,false);
|
||||
searchAdapter.addHeaderView(headerView);
|
||||
searchAdapter.setActionListener(new FamilyMemberListAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onRemoveMember(FamilyMemberInfo familyMemberInfo) {
|
||||
showRemoveFamilyMemberDialog(familyMemberInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransferCurrency(FamilyMemberInfo familyMemberInfo) {
|
||||
showTransferDialog(familyMemberInfo);
|
||||
}
|
||||
@Override
|
||||
public void onClickAvatar(FamilyMemberInfo item) {
|
||||
UserInfoActivity.Companion.start(FamilyMemberSearchActivity.this, item.getUid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckMemberCurrency(FamilyMemberInfo item) {
|
||||
FamilyMemberCurrencyActivity.start(FamilyMemberSearchActivity.this, item.getUid());
|
||||
}
|
||||
});
|
||||
//搜索去掉分页
|
||||
// searchAdapter.setEnableLoadMore(true);
|
||||
// searchAdapter.setOnLoadMoreListener(this,recyclerView);
|
||||
recyclerView.setAdapter(searchAdapter);
|
||||
|
||||
ivBack = (ImageView) findViewById(R.id.iv_back);
|
||||
ivBack.setOnClickListener(this);
|
||||
|
||||
tvSearch = (TextView) findViewById(R.id.tv_search);
|
||||
tvSearch.setOnClickListener(this);
|
||||
|
||||
ivClearText = (ImageView) findViewById(R.id.iv_clear_text);
|
||||
ivClearText.setOnClickListener(this);
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
private TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (TextUtils.isEmpty(s.toString())) {
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
} else {
|
||||
ivClearText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == ivBack.getId()){
|
||||
finish();
|
||||
}else if (id == tvSearch.getId()){
|
||||
String str = searchEdit.getText().toString();
|
||||
if (TextUtils.isEmpty(str)){
|
||||
// Toast.makeText(this,ResUtil.getString(R.string.view_activity_familymembersearchactivity_03),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_activity_familymembersearchactivity_04));
|
||||
return;
|
||||
}
|
||||
searchStr = str;
|
||||
search(str);
|
||||
hideIME();
|
||||
|
||||
}else if (id == ivClearText.getId()){
|
||||
searchEdit.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void search(String str){
|
||||
getMvpPresenter().search(str)
|
||||
.subscribe(new SingleObserver<List<FamilyMemberInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FamilyMemberInfo> memberInfos) {
|
||||
update(memberInfos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(List<FamilyMemberInfo> memberInfos) {
|
||||
if (memberInfos != null && memberInfos.size() > 0) {
|
||||
hideStatus();
|
||||
searchAdapter.setNewData(memberInfos);
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
showNoData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
// getMvpPresenter().loadMoreData()
|
||||
// .subscribe(new SingleObserver<List<FamilyMemberInfo>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// mCompositeDisposable.add(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(List<FamilyMemberInfo> memberInfos) {
|
||||
// if (!ListUtils.isListEmpty(memberInfos)){
|
||||
// searchAdapter.addData(memberInfos);
|
||||
// searchAdapter.loadMoreComplete();
|
||||
// }else {
|
||||
// searchAdapter.loadMoreEnd(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// toast(e.getMessage());
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void showTransferDialog(FamilyMemberInfo familyMemberInfo) {
|
||||
FamilyTransferDialog dialog = new FamilyTransferDialog(this, getMvpPresenter().getFamilyInfo(),familyMemberInfo);
|
||||
dialog.setOnOperationListener(new FamilyTransferDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, FamilyMemberInfo familyMemberInfo, double count) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().transferCurrency(familyMemberInfo, count)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(getResources().getString(R.string.family_transfer_currency_success));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
private void showRemoveFamilyMemberDialog(FamilyMemberInfo familyMemberInfo) {
|
||||
FamilyRemoveMemberDialog familyRemoveMemberDialog = new FamilyRemoveMemberDialog(this,familyMemberInfo);
|
||||
familyRemoveMemberDialog.setOnOperationListener(new FamilyRemoveMemberDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog, FamilyMemberInfo familyMemberInfo) {
|
||||
dialog.dismiss();
|
||||
getMvpPresenter().removeFamilyMember(familyMemberInfo)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
toast(ResUtil.getString(R.string.view_activity_familymembersearchactivity_05));
|
||||
search(searchStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
familyRemoveMemberDialog.show();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,143 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.base.TitleBar;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyPlazaActivityView;
|
||||
import com.chwl.app.family.presenter.FamilyPlazaPresenter;
|
||||
import com.chwl.app.family.view.adapter.FamilyWeeklyRankBoardAdapter;
|
||||
import com.chwl.app.ui.widget.recyclerview.decoration.ColorDecoration;
|
||||
import com.chwl.app.ui.widget.recyclerview.layoutmanager.FullyLinearLayoutManager;
|
||||
import com.chwl.core.family.bean.response.RankingFamilyInfo;
|
||||
import com.chwl.core.family.bean.response.RespFamilyRankList;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.SizeUtils;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilyPlazaPresenter.class)
|
||||
public class FamilyPlazaActivity extends BaseMvpActivity<IFamilyPlazaActivityView,FamilyPlazaPresenter>
|
||||
implements IFamilyPlazaActivityView,View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
|
||||
|
||||
|
||||
private SwipeRefreshLayout srlRefreshContainer;
|
||||
private LinearLayout llFamilyContainer;
|
||||
private TextView tvGetMore;
|
||||
|
||||
private FamilyWeeklyRankBoardAdapter familyWeeklyRankBoardAdapter;
|
||||
|
||||
private boolean isFirstLoad = true;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context,FamilyPlazaActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_plaza);
|
||||
initTitleBar(getString(R.string.family_plaza));
|
||||
|
||||
mTitleBar.addAction(new TitleBar.ImageAction(R.drawable.ic_family_list_search) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
FamilySearchActivity.start(FamilyPlazaActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
srlRefreshContainer = findViewById(R.id.srl_refresh_container);
|
||||
|
||||
llFamilyContainer = findViewById(R.id.ll_family_container);
|
||||
RecyclerView rvList = findViewById(R.id.rv_list);
|
||||
tvGetMore = findViewById(R.id.tv_get_more);
|
||||
|
||||
srlRefreshContainer.setOnRefreshListener(this);
|
||||
|
||||
rvList.setItemAnimator(null);
|
||||
rvList.setFocusable(false);
|
||||
rvList.setLayoutManager(new FullyLinearLayoutManager(this, LinearLayoutManager.VERTICAL,false));
|
||||
if (rvList.getItemDecorationCount() == 0) {
|
||||
int marginStart = SizeUtils.dp2px(this, 16);
|
||||
rvList.addItemDecoration(new ColorDecoration(getResources().getColor(R.color.color_F1F1F1),
|
||||
0,1, false, marginStart, marginStart));
|
||||
}
|
||||
familyWeeklyRankBoardAdapter = new FamilyWeeklyRankBoardAdapter(this, null);
|
||||
familyWeeklyRankBoardAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
RankingFamilyInfo familyInfo = (RankingFamilyInfo) adapter.getData().get(position);
|
||||
FamilyHomeActivity.start(FamilyPlazaActivity.this, familyInfo.getId());
|
||||
});
|
||||
rvList.setAdapter(familyWeeklyRankBoardAdapter);
|
||||
|
||||
tvGetMore.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (isFirstLoad){
|
||||
isFirstLoad = false;
|
||||
srlRefreshContainer.setRefreshing(true);
|
||||
loadData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == tvGetMore.getId()) {
|
||||
FamilyListActivity.start(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
loadData();
|
||||
}
|
||||
|
||||
private void loadData(){
|
||||
getMvpPresenter().loadWeeklyRankData()
|
||||
.doAfterTerminate(() -> srlRefreshContainer.setRefreshing(false))
|
||||
.subscribe(new SingleObserver<RespFamilyRankList>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(RespFamilyRankList respFamily) {
|
||||
if (ListUtils.isListEmpty(respFamily.getFamilys())){
|
||||
llFamilyContainer.setVisibility(View.GONE);
|
||||
tvGetMore.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
llFamilyContainer.setVisibility(View.VISIBLE);
|
||||
if (respFamily.getCount() <= 6){
|
||||
tvGetMore.setVisibility(View.GONE);
|
||||
}
|
||||
familyWeeklyRankBoardAdapter.setNewData(respFamily.getFamilys());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -1,222 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilySearchView;
|
||||
import com.chwl.app.family.presenter.FamilySearchPresent;
|
||||
import com.chwl.app.family.view.adapter.FamilyAdapter;
|
||||
import com.chwl.app.ui.widget.recyclerview.decoration.ColorDecoration;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@CreatePresenter(FamilySearchPresent.class)
|
||||
public class FamilySearchActivity extends BaseMvpActivity<IFamilySearchView,FamilySearchPresent>
|
||||
implements IFamilySearchView, View.OnClickListener, BaseQuickAdapter.RequestLoadMoreListener {
|
||||
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private FamilyAdapter searchAdapter;
|
||||
private EditText searchEdit;
|
||||
private ImageView ivBack;
|
||||
private TextView tvSearch;
|
||||
private ImageView ivClearText;
|
||||
|
||||
private String searchText;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context,FamilySearchActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_search);
|
||||
|
||||
initView();
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||
searchEdit = (EditText) findViewById(R.id.search_edit);
|
||||
searchEdit.addTextChangedListener(textWatcher);
|
||||
searchEdit.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
|
||||
searchEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || (event!=null && event.getKeyCode()== KeyEvent.KEYCODE_ENTER)) {
|
||||
searchText = v.getText().toString();
|
||||
if (TextUtils.isEmpty(searchText)){
|
||||
// Toast.makeText(v.getContext(),ResUtil.getString(R.string.view_activity_familysearchactivity_01),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_activity_familysearchactivity_02));
|
||||
return true;
|
||||
}
|
||||
searchFamily(searchText);
|
||||
hideIME();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
|
||||
if (recyclerView.getItemDecorationCount() == 0) {
|
||||
recyclerView.addItemDecoration(new ColorDecoration(getResources().getColor(R.color.color_F1F1F1), 0,1, false));
|
||||
}
|
||||
searchAdapter = new FamilyAdapter(this, null);
|
||||
View headerView = LayoutInflater.from(this).inflate(R.layout.layout_search_header, null,false);
|
||||
searchAdapter.addHeaderView(headerView);
|
||||
searchAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
FamilyInfo familyInfo = (FamilyInfo) adapter.getData().get(position);
|
||||
FamilyHomeActivity.start(FamilySearchActivity.this,familyInfo.getFamilyId());
|
||||
}
|
||||
});
|
||||
//搜索去掉分页
|
||||
// searchAdapter.setEnableLoadMore(true);
|
||||
// searchAdapter.setOnLoadMoreListener(this, recyclerView);
|
||||
recyclerView.setAdapter(searchAdapter);
|
||||
|
||||
ivBack = (ImageView) findViewById(R.id.iv_back);
|
||||
ivBack.setOnClickListener(this);
|
||||
|
||||
tvSearch = (TextView) findViewById(R.id.tv_search);
|
||||
tvSearch.setOnClickListener(this);
|
||||
|
||||
ivClearText = (ImageView) findViewById(R.id.iv_clear_text);
|
||||
ivClearText.setOnClickListener(this);
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
private TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (TextUtils.isEmpty(s.toString())) {
|
||||
ivClearText.setVisibility(View.GONE);
|
||||
} else {
|
||||
ivClearText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == ivBack.getId()){
|
||||
finish();
|
||||
}else if (id == tvSearch.getId()){
|
||||
searchText = searchEdit.getText().toString();
|
||||
if (TextUtils.isEmpty(searchText)){
|
||||
// Toast.makeText(this,ResUtil.getString(R.string.view_activity_familysearchactivity_03),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_activity_familysearchactivity_04));
|
||||
return;
|
||||
}
|
||||
hideIME();
|
||||
searchFamily(searchText);
|
||||
|
||||
}else if (id == ivClearText.getId()){
|
||||
searchEdit.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadDate() {
|
||||
super.onReloadDate();
|
||||
// searchFamily(searchText);
|
||||
}
|
||||
|
||||
private void searchFamily(String key){
|
||||
showLoading();
|
||||
getMvpPresenter().search(key).subscribe(new SingleObserver<List<FamilyInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FamilyInfo> familyInfoList) {
|
||||
if (familyInfoList != null && familyInfoList.size() > 0) {
|
||||
hideStatus();
|
||||
searchAdapter.setNewData(familyInfoList);
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
showNoData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
showNetworkErr();
|
||||
toast(e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().loadMoreData().subscribe(new SingleObserver<List<FamilyInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FamilyInfo> familyInfoList) {
|
||||
if (ListUtils.isListEmpty(familyInfoList)){
|
||||
searchAdapter.loadMoreEnd(true);
|
||||
return;
|
||||
}
|
||||
searchAdapter.addData(familyInfoList);
|
||||
searchAdapter.loadMoreComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
toast(e.getMessage());
|
||||
searchAdapter.loadMoreComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -1,149 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.base.TitleBar;
|
||||
import com.chwl.app.common.ViewPagerAdapter;
|
||||
import com.chwl.app.decoration.view.widgets.CarMagicIndicator;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilySelectFriendActivityView;
|
||||
import com.chwl.app.family.presenter.FamilySelectFriendPresenter;
|
||||
import com.chwl.app.family.view.dialog.FamilyInviteConfirmDialog;
|
||||
import com.chwl.app.family.view.fragment.FamilyAttentionFragment;
|
||||
import com.chwl.app.family.view.fragment.FamilyFansListFragment;
|
||||
import com.chwl.app.family.view.fragment.FamilyFriendListFragment;
|
||||
import com.chwl.app.ui.widget.magicindicator.MagicIndicator;
|
||||
import com.chwl.app.ui.widget.magicindicator.ViewPagerHelper;
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator;
|
||||
import com.chwl.core.home.bean.TabInfo;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CreatePresenter(FamilySelectFriendPresenter.class)
|
||||
public class FamilySelectFriendActivity extends BaseMvpActivity<IFamilySelectFriendActivityView,FamilySelectFriendPresenter>
|
||||
implements IFamilySelectFriendActivityView, CarMagicIndicator.OnItemSelectListener {
|
||||
|
||||
private TitleBar titleBar;
|
||||
private MagicIndicator viewIndicator;
|
||||
private ViewPager viewpager;
|
||||
|
||||
private static SelectFriendCallBack callBack;
|
||||
|
||||
private int pageLimitSize = 3;
|
||||
private String[] titles = {ResUtil.getString(R.string.view_activity_familyselectfriendactivity_01), ResUtil.getString(R.string.view_activity_familyselectfriendactivity_02), ResUtil.getString(R.string.view_activity_familyselectfriendactivity_03)};
|
||||
|
||||
public static void start(Context context,SelectFriendCallBack selectFriendCallBack) {
|
||||
callBack = selectFriendCallBack;
|
||||
Intent intent = new Intent(context,FamilySelectFriendActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_family_select_friend);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
titleBar = findViewById(R.id.title_bar);
|
||||
initTitleBar(getString(R.string.title_select_friend));
|
||||
// titleBar.addAction(new TitleBar.Action() {
|
||||
// @Override
|
||||
// public String getText() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getDrawable() {
|
||||
// return R.drawable.ic_send_search;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void performAction(View view) {
|
||||
// AitFriendsSearchActivity.startForSharing(FamilySelectFriendActivity.this);
|
||||
// }
|
||||
// });
|
||||
|
||||
viewIndicator = findViewById(R.id.view_indicator);
|
||||
viewpager = findViewById(R.id.viewpager);
|
||||
|
||||
viewpager.setOffscreenPageLimit(pageLimitSize);
|
||||
viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), getFragment(), titles));
|
||||
|
||||
List<TabInfo> tabInfoList = new ArrayList<>(2);
|
||||
tabInfoList.add(new TabInfo(1, getString(R.string.tab_title_friends)));
|
||||
tabInfoList.add(new TabInfo(2, getString(R.string.tab_title_attentions)));
|
||||
tabInfoList.add(new TabInfo(3, getString(R.string.tab_title_fans)));
|
||||
CommonNavigator commonNavigator = new CommonNavigator(this);
|
||||
commonNavigator.setAdjustMode(true);
|
||||
CarMagicIndicator indicator = new CarMagicIndicator(this, tabInfoList, 0);
|
||||
indicator.setOnItemSelectListener(this);
|
||||
commonNavigator.setAdapter(indicator);
|
||||
viewIndicator.setNavigator(commonNavigator);
|
||||
ViewPagerHelper.bind(viewIndicator, viewpager);
|
||||
}
|
||||
|
||||
private List<Fragment> getFragment() {
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(FamilyFriendListFragment.newInstances());
|
||||
list.add(FamilyAttentionFragment.newInstance());
|
||||
list.add(FamilyFansListFragment.newInstances());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelect(int position) {
|
||||
viewpager.setCurrentItem(position);
|
||||
}
|
||||
|
||||
|
||||
public void onSelectFriend(UserInfo userInfo){
|
||||
showConfirmDialog(userInfo);
|
||||
}
|
||||
|
||||
private void showConfirmDialog(UserInfo userInfo) {
|
||||
FamilyInviteConfirmDialog dialog = new FamilyInviteConfirmDialog(this);
|
||||
dialog.setAvatar(userInfo.getAvatar());
|
||||
dialog.setName(userInfo.getNick());
|
||||
dialog.setOnOperationListener(new FamilyInviteConfirmDialog.OnOperationListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
if (callBack != null){
|
||||
callBack.onSelectFriend(FamilySelectFriendActivity.this, userInfo.getUid());
|
||||
}
|
||||
finish();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
callBack = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public interface SelectFriendCallBack{
|
||||
void onSelectFriend(Activity activity, long uid);
|
||||
}
|
||||
|
||||
}
|
@@ -1,74 +0,0 @@
|
||||
package com.chwl.app.family.view.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpActivity;
|
||||
import com.chwl.app.base.TitleBar;
|
||||
import com.chwl.app.constants.BundleKeys;
|
||||
import com.chwl.library.base.IMvpBaseView;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
|
||||
public class FamilyTextInputActivity extends BaseMvpActivity implements IMvpBaseView{
|
||||
|
||||
public static final String CONTENT = "content";
|
||||
private EditText etInput;
|
||||
private TitleBar titleBar;
|
||||
|
||||
private static CallBack listener;
|
||||
|
||||
|
||||
public static void start(Context context, String familyName, CallBack callBack){
|
||||
listener = callBack;
|
||||
Intent intent = new Intent(context,FamilyTextInputActivity.class);
|
||||
intent.putExtra(BundleKeys.KEY_EXTRA_1,familyName);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
String originalText = getIntent().getStringExtra(BundleKeys.KEY_EXTRA_1);
|
||||
setContentView(R.layout.activity_family_text_input);
|
||||
|
||||
titleBar = (TitleBar) findViewById(R.id.title_bar);
|
||||
etInput = (EditText) findViewById(R.id.et_input);
|
||||
etInput.setText(originalText);
|
||||
|
||||
initTitleBar(getResources().getString(R.string.family_name_hint));
|
||||
titleBar.setActionTextColor(R.color.text_color_primary);
|
||||
titleBar.addAction(new TitleBar.TextAction(ResUtil.getString(R.string.view_activity_familytextinputactivity_01)) {
|
||||
@Override
|
||||
public void performAction(View view) {
|
||||
String content = etInput.getText().toString();
|
||||
//修改个人介绍
|
||||
if (!content
|
||||
.trim()
|
||||
.replaceAll(" ","")
|
||||
.isEmpty()) {
|
||||
if (listener != null){
|
||||
listener.onModify(content);
|
||||
}
|
||||
finish();
|
||||
} else {
|
||||
toast(ResUtil.getString(R.string.view_activity_familytextinputactivity_02));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
listener = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public interface CallBack{
|
||||
void onModify(String str);
|
||||
}
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.widget.SquareImageView;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/16
|
||||
*/
|
||||
|
||||
public class FamilyAdapter extends BaseQuickAdapter<FamilyInfo, BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private int mRound = 10;
|
||||
|
||||
public FamilyAdapter(Context context, @Nullable List<FamilyInfo> data) {
|
||||
super(R.layout.item_family_list, data);
|
||||
this.mContext = context;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder baseViewHolder, FamilyInfo familyInfo) {
|
||||
SquareImageView ivCover = (SquareImageView) baseViewHolder.getView(R.id.iv_cover);
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(familyInfo.getFamilyIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.transforms(new CenterCrop(), new RoundedCorners(mRound))
|
||||
.into(ivCover);
|
||||
|
||||
TextView tvFamilyName = (TextView) baseViewHolder.getView(R.id.tv_family_name);
|
||||
TextView tvFamilyId = (TextView) baseViewHolder.getView(R.id.tv_family_id);
|
||||
TextView tvFamilyMemberCount = (TextView) baseViewHolder.getView(R.id.tv_family_member_count);
|
||||
|
||||
tvFamilyName.setText(familyInfo.getFamilyName());
|
||||
tvFamilyId.setText(String.format(mContext.getResources().getString(R.string.family_id),familyInfo.getFamilyId()));
|
||||
tvFamilyMemberCount.setText(String.format(mContext.getResources().getString(R.string.family_member_count),String.valueOf(familyInfo.getMemberCount())));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,79 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.widget.NobleAvatarView;
|
||||
import com.chwl.core.noble.NobleUtil;
|
||||
import com.chwl.core.user.bean.AttentionInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/5
|
||||
*/
|
||||
|
||||
public class FamilyAttentionListAdapter extends BaseQuickAdapter<AttentionInfo, BaseViewHolder> {
|
||||
|
||||
public FamilyAttentionListAdapter(List<AttentionInfo> attentionInfoList) {
|
||||
super(R.layout.family_attention_item, attentionInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder baseViewHolder, AttentionInfo attentionInfo) {
|
||||
if (attentionInfo == null) return;
|
||||
|
||||
baseViewHolder.setText(R.id.tv_userName, attentionInfo.getNick())
|
||||
.setText(R.id.tv_user_desc, attentionInfo.getUserDesc() != null ?
|
||||
attentionInfo.getUserDesc()
|
||||
: baseViewHolder.itemView.getContext().getResources().getString(R.string.msg_no_user_desc))
|
||||
.setVisible(R.id.view_line, baseViewHolder.getLayoutPosition() != getItemCount() - 1);
|
||||
|
||||
|
||||
AppCompatImageView ivGender = baseViewHolder.getView(R.id.iv_gender);
|
||||
if (attentionInfo.getGender() == 1) {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
|
||||
AppCompatImageView ivNobleLevel = baseViewHolder.getView(R.id.iv_noble_level);
|
||||
if (attentionInfo.nobleUsers != null) {
|
||||
ivNobleLevel.setVisibility(View.VISIBLE);
|
||||
String badgeByLevel = NobleUtil.getBadgeByLevel(attentionInfo.nobleUsers.getLevel());
|
||||
if (!TextUtils.isEmpty(badgeByLevel)) {
|
||||
NobleUtil.loadResource(badgeByLevel, ivNobleLevel);
|
||||
} else {
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
NobleAvatarView nobleAvatarView = baseViewHolder.getView(R.id.noble_avatar_view);
|
||||
nobleAvatarView.setSize(50, 75, 15);
|
||||
nobleAvatarView.setData(attentionInfo.avatar, attentionInfo.nobleUsers);
|
||||
|
||||
AppCompatImageView ivUserLevel = baseViewHolder.getView(R.id.iv_user_level);
|
||||
ivUserLevel.setVisibility(View.GONE);
|
||||
if (attentionInfo.userLevelVo != null && !TextUtils.isEmpty(attentionInfo.userLevelVo.getExperUrl())) {
|
||||
ivUserLevel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, attentionInfo.userLevelVo.getExperUrl(), ivUserLevel);
|
||||
}
|
||||
|
||||
AppCompatImageView ivCharmLevel = baseViewHolder.getView(R.id.iv_charm_level);
|
||||
ivCharmLevel.setVisibility(View.GONE);
|
||||
if (attentionInfo.userLevelVo != null && !TextUtils.isEmpty(attentionInfo.userLevelVo.getCharmUrl())) {
|
||||
ivCharmLevel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, attentionInfo.userLevelVo.getCharmUrl(), ivCharmLevel);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.avroom.activity.AVRoomActivity;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity;
|
||||
import com.chwl.app.ui.widget.rollviewpager.adapter.StaticPagerAdapter;
|
||||
import com.chwl.core.family.bean.FindBannerInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class FamilyBannerAdapter extends StaticPagerAdapter {
|
||||
private Context context;
|
||||
private List<FindBannerInfo> bannerInfoList;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public FamilyBannerAdapter(List<FindBannerInfo> bannerInfoList, Context context) {
|
||||
this.context = context;
|
||||
this.bannerInfoList = bannerInfoList;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void setNewData(List<FindBannerInfo> data){
|
||||
this.bannerInfoList = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View getView(ViewGroup container, int position) {
|
||||
FindBannerInfo bannerInfo = bannerInfoList.get(position);
|
||||
String url = bannerInfo.getSkipUri();
|
||||
ImageView imgBanner = (ImageView) mInflater.inflate(R.layout.layout_family_banner_page_item, container, false);
|
||||
//和游戏、首页tab一样,加载带大圆角的图
|
||||
ImageLoadUtils.loadGameBannerRoundBackground(context, bannerInfo.getBannerPic(), imgBanner);
|
||||
|
||||
imgBanner.setOnClickListener(v -> {
|
||||
if (TextUtils.isEmpty(url)) return;
|
||||
if (bannerInfo.getSkipType() == FindBannerInfo.SKIP_TYP_H5) {
|
||||
CommonWebViewActivity.start(context,url);
|
||||
|
||||
} else if (bannerInfo.getSkipType() == FindBannerInfo.SKIP_TYP_CHAT_ROOM) {
|
||||
if (TextUtils.isEmpty(url)) return;
|
||||
try {
|
||||
AVRoomActivity.start(context, Long.valueOf(url));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
return imgBanner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (bannerInfoList == null) {
|
||||
return 0;
|
||||
} else
|
||||
return bannerInfoList.size();
|
||||
}
|
||||
}
|
@@ -1,129 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.jay.widget.StickyHeaders;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.widget.CircleImageView;
|
||||
import com.chwl.app.ui.widget.UserInfoDialog;
|
||||
import com.chwl.core.family.bean.BillDateDivInfo;
|
||||
import com.chwl.core.family.bean.TransactionRecordInfo;
|
||||
import com.chwl.core.family.bean.VMBillItemInfo;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/30
|
||||
*/
|
||||
|
||||
public class FamilyCurrencyBillAdapter extends BaseMultiItemQuickAdapter<VMBillItemInfo,BaseViewHolder> implements StickyHeaders {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public FamilyCurrencyBillAdapter(Context context, @Nullable List<VMBillItemInfo> data) {
|
||||
super(data);
|
||||
this.mContext = context;
|
||||
addItemType(VMBillItemInfo.TYPE_DATE_DIV, R.layout.item_family_currency_bill_date);//月份分割
|
||||
addItemType(VMBillItemInfo.TYPE_TRANSACTION_RECORD, R.layout.item_family_currency_transaction_record);//交易记录
|
||||
addItemType(VMBillItemInfo.TYPE_EMPTY_TIP, R.layout.item_family_currency_empty);//无记录
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, VMBillItemInfo item) {
|
||||
if (item.getItemType() == VMBillItemInfo.TYPE_DATE_DIV){
|
||||
covertDateDIV(helper,(BillDateDivInfo) item.getData());
|
||||
} else if (item.getItemType() == VMBillItemInfo.TYPE_TRANSACTION_RECORD){
|
||||
covertTransactionRecord(helper, (TransactionRecordInfo) item.getData());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void covertDateDIV(BaseViewHolder helper, BillDateDivInfo item) {
|
||||
if (null == item) return;
|
||||
String currencyName = item.getMoneyName();
|
||||
|
||||
TextView tvDate = (TextView) helper.getView(R.id.tv_date);
|
||||
TextView tvSummary = (TextView) helper.getView(R.id.tv_summary);
|
||||
tvDate.setText(item.getDate());
|
||||
tvSummary.setText(String.format(mContext.getResources().getString(R.string.family_currency_bill_summary),
|
||||
FormatUtils.formatToShortDown(item.getExpend()),
|
||||
currencyName,
|
||||
FormatUtils.formatToShortDown(item.getIncome()),
|
||||
currencyName));
|
||||
tvDate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != onDateSelectListener){
|
||||
onDateSelectListener.onDateSelect();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void covertTransactionRecord(BaseViewHolder helper, TransactionRecordInfo item) {
|
||||
if (null == item) return;
|
||||
|
||||
CircleImageView civImg = (CircleImageView) helper.getView(R.id.civ_img);
|
||||
TextView tvDesc = (TextView) helper.getView(R.id.tv_desc);
|
||||
TextView tvFrom = (TextView) helper.getView(R.id.tv_from);
|
||||
TextView tvData = (TextView) helper.getView(R.id.tv_data);
|
||||
TextView tvTime = (TextView) helper.getView(R.id.tv_time);
|
||||
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(item.getAvatar())
|
||||
.placeholder(R.drawable.default_avatar)
|
||||
.dontAnimate()
|
||||
.into(civImg);
|
||||
|
||||
civImg.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (item.getUid() > 0) {
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext,item.getUid());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tvDesc.setText(item.getTitle());
|
||||
tvFrom.setText(item.getDesc());
|
||||
tvData.setText(FormatUtils.formatToShortDown(item.getData()) + item.getMoneyName());
|
||||
if (item.getData() >= 0) {
|
||||
tvData.setTextColor(mContext.getResources().getColor(R.color.appColor));
|
||||
}else {
|
||||
tvData.setTextColor(mContext.getResources().getColor(R.color.color_333333));
|
||||
}
|
||||
tvTime.setText(item.getDate());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStickyHeader(int i) {
|
||||
return getItemViewType(i) == VMBillItemInfo.TYPE_DATE_DIV ;
|
||||
}
|
||||
|
||||
private OnDateSelectListener onDateSelectListener;
|
||||
|
||||
public void setOnDateSelectListener(OnDateSelectListener onDateSelectListener) {
|
||||
this.onDateSelectListener = onDateSelectListener;
|
||||
}
|
||||
|
||||
public interface OnDateSelectListener{
|
||||
public void onDateSelect();
|
||||
}
|
||||
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.widget.NobleAvatarView;
|
||||
import com.chwl.core.noble.NobleUtil;
|
||||
import com.chwl.core.user.bean.FansInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/5
|
||||
*/
|
||||
|
||||
public class FamilyFansViewAdapter extends BaseQuickAdapter<FansInfo, BaseViewHolder> {
|
||||
|
||||
public FamilyFansViewAdapter(List<FansInfo> fansInfoList) {
|
||||
super(R.layout.family_fans_list_item, fansInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder baseViewHolder, FansInfo fansInfo) {
|
||||
if (fansInfo == null) return;
|
||||
baseViewHolder.setText(R.id.tv_userName, fansInfo.getNick())
|
||||
.setText(R.id.tv_user_desc, fansInfo.getUserDesc() != null ?
|
||||
fansInfo.getUserDesc()
|
||||
: baseViewHolder.itemView.getContext().getResources().getString(R.string.msg_no_user_desc))
|
||||
.setVisible(R.id.view_line, baseViewHolder.getLayoutPosition() != getItemCount() - 1);
|
||||
|
||||
NobleAvatarView nobleAvatarView = baseViewHolder.getView(R.id.noble_avatar_view);
|
||||
nobleAvatarView.setSize(50, 75, 15);
|
||||
nobleAvatarView.setData(fansInfo.getAvatar(), fansInfo.getNobleUsers());
|
||||
|
||||
AppCompatImageView ivGender = baseViewHolder.getView(R.id.iv_gender);
|
||||
if (fansInfo.getGender() == 1) {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
|
||||
AppCompatImageView ivNobleLevel = baseViewHolder.getView(R.id.iv_noble_level);
|
||||
if (fansInfo.getNobleUsers() != null) {
|
||||
ivNobleLevel.setVisibility(View.VISIBLE);
|
||||
String badgeByLevel = NobleUtil.getBadgeByLevel(fansInfo.getNobleUsers().getLevel());
|
||||
if (!TextUtils.isEmpty(badgeByLevel)) {
|
||||
NobleUtil.loadResource(badgeByLevel, ivNobleLevel);
|
||||
} else {
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
AppCompatImageView ivUserLevel = baseViewHolder.getView(R.id.iv_user_level);
|
||||
ivUserLevel.setVisibility(View.GONE);
|
||||
if (fansInfo.getUserLevelVo() != null && !TextUtils.isEmpty(fansInfo.getUserLevelVo().getExperUrl())) {
|
||||
ivUserLevel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, fansInfo.getUserLevelVo().getExperUrl(), ivUserLevel);
|
||||
}
|
||||
|
||||
AppCompatImageView ivCharmLevel = baseViewHolder.getView(R.id.iv_charm_level);
|
||||
ivCharmLevel.setVisibility(View.GONE);
|
||||
if (fansInfo.getUserLevelVo() != null && !TextUtils.isEmpty(fansInfo.getUserLevelVo().getCharmUrl())) {
|
||||
ivCharmLevel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, fansInfo.getUserLevelVo().getCharmUrl(), ivCharmLevel);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.widget.NobleAvatarView;
|
||||
import com.chwl.core.noble.NobleUtil;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
|
||||
public class FamilyFriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder> {
|
||||
private Context context;
|
||||
|
||||
public FamilyFriendListAdapter(Context context, @Nullable List<UserInfo> data) {
|
||||
super(R.layout.family_list_item_friend, data);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, UserInfo item) {
|
||||
if (item == null) return;
|
||||
|
||||
helper.setText(R.id.tv_userName, item.getNick())
|
||||
.setText(R.id.tv_user_desc, item.getUserDesc() != null ?
|
||||
item.getUserDesc()
|
||||
: helper.itemView.getContext().getResources().getString(R.string.msg_no_user_desc));
|
||||
|
||||
NobleAvatarView mNobleAvatarView = helper.getView(R.id.noble_avatar_view);
|
||||
mNobleAvatarView.setSize(47, 70, 13);
|
||||
mNobleAvatarView.setData(item.getAvatar(), item.getNobleUsers());
|
||||
|
||||
AppCompatImageView ivGender = helper.getView(R.id.iv_gender);
|
||||
if (item.getGender() == 1) {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_male);
|
||||
} else {
|
||||
ivGender.setImageResource(R.drawable.ic_gender_female);
|
||||
}
|
||||
|
||||
AppCompatImageView ivNobleLevel = helper.getView(R.id.iv_noble_level);
|
||||
if (item.getNobleUsers() != null) {
|
||||
ivNobleLevel.setVisibility(View.VISIBLE);
|
||||
String badgeByLevel = NobleUtil.getBadgeByLevel(item.getNobleUsers().getLevel());
|
||||
if (!TextUtils.isEmpty(badgeByLevel)) {
|
||||
NobleUtil.loadResource(badgeByLevel, ivNobleLevel);
|
||||
} else {
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
AppCompatImageView ivUserLevel = helper.getView(R.id.iv_user_level);
|
||||
ivUserLevel.setVisibility(View.GONE);
|
||||
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getExperUrl())) {
|
||||
ivUserLevel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getExperUrl(), ivUserLevel);
|
||||
}
|
||||
|
||||
AppCompatImageView ivCharmLevel = helper.getView(R.id.iv_charm_level);
|
||||
ivCharmLevel.setVisibility(View.GONE);
|
||||
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getCharmUrl())) {
|
||||
ivCharmLevel.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getCharmUrl(), ivCharmLevel);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.family.bean.FamilyGameInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/23
|
||||
*/
|
||||
|
||||
public class FamilyGameListAdapter extends BaseQuickAdapter<FamilyGameInfo, BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
public FamilyGameListAdapter(Context context, @Nullable List<FamilyGameInfo> data) {
|
||||
super(R.layout.item_family_game_list,data);
|
||||
this.mContext = context;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, FamilyGameInfo item) {
|
||||
RoundedImageView rivCover = (RoundedImageView) helper.getView(R.id.riv_cover);
|
||||
TextView tvName = (TextView) helper.getView(R.id.tv_name);
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(TextUtils.isEmpty(item.getIcon()) ? R.drawable.default_cover : item.getIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.error(R.drawable.default_cover)
|
||||
.into(rivCover);
|
||||
|
||||
tvName.setText(item.getName());
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.family.bean.FamilyGameInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
|
||||
public class FamilyGamesAdapter extends BaseQuickAdapter<FamilyGameInfo, BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public FamilyGamesAdapter(Context context, @Nullable List<FamilyGameInfo> data) {
|
||||
super(R.layout.item_family_games, data);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, FamilyGameInfo item) {
|
||||
RoundedImageView rivCover = helper.getView(R.id.riv_cover);
|
||||
TextView tvName = helper.getView(R.id.tv_name);
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(TextUtils.isEmpty(item.getIcon()) ? R.drawable.default_cover : item.getIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.error(R.drawable.default_cover)
|
||||
.into(rivCover);
|
||||
|
||||
tvName.setText(item.getName());
|
||||
|
||||
}
|
||||
}
|
@@ -1,86 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.widget.SquareImageView;
|
||||
import com.chwl.core.family.bean.FamilyGroupInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
public class FamilyGroupAdapter extends BaseQuickAdapter<FamilyGroupInfo,BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public FamilyGroupAdapter(Context context, @Nullable List<FamilyGroupInfo> data) {
|
||||
super(R.layout.item_family_group, data);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, FamilyGroupInfo item) {
|
||||
SquareImageView ivCover = helper.getView(R.id.iv_cover);
|
||||
TextView tvFamilyGroupName = helper.getView(R.id.tv_family_group_name);
|
||||
TextView tvFamilyGroupDesc = helper.getView(R.id.tv_family_group_desc);
|
||||
|
||||
TextView tvJoinGroup = helper.getView(R.id.tv_join_group);
|
||||
ImageView ivArrowRight = helper.getView(R.id.iv_arrow_right);
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(TextUtils.isEmpty(item.getIcon()) ? R.drawable.default_cover : item.getIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.error(R.drawable.default_cover)
|
||||
.transforms(new CenterCrop(), new RoundedCorners(10))
|
||||
.into(ivCover);
|
||||
|
||||
tvFamilyGroupName.setText(item.getName());
|
||||
tvFamilyGroupDesc.setText(String.format(
|
||||
mContext.getResources().getString(R.string.family_member_count),
|
||||
String.valueOf(item.getMemberCount())));
|
||||
|
||||
if (item.isExists()){
|
||||
tvJoinGroup.setVisibility(View.GONE);
|
||||
ivArrowRight.setVisibility(View.VISIBLE);
|
||||
helper.itemView.setOnClickListener(v -> {
|
||||
if (actionListener != null){
|
||||
actionListener.onGotoGroup(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
tvJoinGroup.setVisibility(View.VISIBLE);
|
||||
ivArrowRight.setVisibility(View.GONE);
|
||||
tvJoinGroup.setOnClickListener(v -> {
|
||||
if (actionListener != null){
|
||||
actionListener.onJoin(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ActionListener actionListener;
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
this.actionListener = actionListener;
|
||||
}
|
||||
|
||||
public interface ActionListener{
|
||||
void onJoin(FamilyGroupInfo groupInfo);
|
||||
void onGotoGroup(FamilyGroupInfo groupInfo);
|
||||
}
|
||||
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.widget.SquareImageView;
|
||||
import com.chwl.core.family.bean.FamilyManageItemInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/16
|
||||
*/
|
||||
|
||||
public class FamilyManageAdapter extends BaseQuickAdapter<FamilyManageItemInfo, BaseViewHolder> {
|
||||
|
||||
public FamilyManageAdapter( @Nullable List<FamilyManageItemInfo> data) {
|
||||
super(R.layout.item_family_manage_rv, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder baseViewHolder, FamilyManageItemInfo familyManageItemInfo) {
|
||||
SquareImageView ivImg = (SquareImageView) baseViewHolder.getView(R.id.iv_img);
|
||||
ivImg.setImageResource(familyManageItemInfo.getImg());
|
||||
TextView tvName = (TextView) baseViewHolder.getView(R.id.tv_name);
|
||||
tvName.setText(familyManageItemInfo.getName());
|
||||
}
|
||||
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.widget.CircleImageView;
|
||||
import com.chwl.library.common.util.Utils;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/25
|
||||
*/
|
||||
|
||||
public class FamilyMemberAdapter extends BaseQuickAdapter<FamilyMemberInfo,BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
|
||||
public FamilyMemberAdapter(Context context, @Nullable List<FamilyMemberInfo> data) {
|
||||
super(R.layout.item_family_member, data);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, FamilyMemberInfo item) {
|
||||
|
||||
|
||||
View view = helper.itemView;
|
||||
ViewGroup.LayoutParams lp = view.getLayoutParams();
|
||||
lp.width = (Utils.getWindowWidth(mContext) - Utils.dip2px(mContext,30 + 20*4)) / 5;
|
||||
view.setLayoutParams(lp);
|
||||
|
||||
CircleImageView rivCover = (CircleImageView) helper.getView(R.id.riv_cover);
|
||||
ImageView ivPatriarchTag = (ImageView) helper.getView(R.id.iv_patriarch_tag);
|
||||
TextView tvName = (TextView) helper.getView(R.id.tv_name);
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(TextUtils.isEmpty(item.getIcon()) ? R.drawable.default_avatar : item.getIcon())
|
||||
.placeholder(R.drawable.default_avatar)
|
||||
.error(R.drawable.default_avatar)
|
||||
.into(rivCover);
|
||||
tvName.setText(item.getName());
|
||||
if (item.getPosition() == FamilyMemberInfo.LEVEL_PATRIARCH){
|
||||
ivPatriarchTag.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
ivPatriarchTag.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -1,154 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.widget.CircleImageView;
|
||||
import com.chwl.app.family.view.activity.FamilyMemberListActivity;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.core.level.UserLevelVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/28
|
||||
*/
|
||||
|
||||
public class FamilyMemberListAdapter extends BaseQuickAdapter<FamilyMemberInfo,BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private int optType;
|
||||
|
||||
public FamilyMemberListAdapter(Context context, @Nullable List<FamilyMemberInfo> data, int optType) {
|
||||
super(R.layout.item_family_member_list,data);
|
||||
this.mContext = context;
|
||||
this.optType = optType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, FamilyMemberInfo item) {
|
||||
|
||||
CircleImageView civAvatar = (CircleImageView) helper.getView(R.id.civ_avatar);
|
||||
|
||||
ImageView ivPatriarchTag = helper.getView(R.id.iv_patriarch_tag);
|
||||
|
||||
TextView tvName = (TextView) helper.getView(R.id.tv_name);
|
||||
TextView tvErbanId = (TextView) helper.getView(R.id.tv_erban_id);
|
||||
|
||||
if (item.getGender() == 1) {
|
||||
helper.setImageResource(R.id.iv_gender, R.drawable.ic_gender_male);
|
||||
} else {
|
||||
helper.setImageResource(R.id.iv_gender, R.drawable.ic_gender_female);
|
||||
}
|
||||
|
||||
|
||||
ImageButton tvMemberRemove = helper.getView(R.id.tv_member_remove);
|
||||
UserLevelVo userLevelVo = item.getUserLevelVo();
|
||||
ImageView ivUserLevel = helper.getView(R.id.iv_user_level);
|
||||
ImageView ivUserCharm = helper.getView(R.id.iv_user_charm);
|
||||
ivUserLevel.setVisibility(userLevelVo == null ? View.GONE : View.VISIBLE);
|
||||
ivUserLevel.setVisibility(userLevelVo == null ? View.GONE : View.VISIBLE);
|
||||
if (userLevelVo != null) {
|
||||
ivUserLevel.setVisibility(TextUtils.isEmpty(userLevelVo.getExperUrl()) ? View.GONE : View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(userLevelVo.getExperUrl())) {
|
||||
ImageLoadUtils.loadImage(mContext, userLevelVo.getExperUrl(), ivUserLevel);
|
||||
}
|
||||
ivUserCharm.setVisibility(TextUtils.isEmpty(userLevelVo.getCharmUrl()) ? View.GONE : View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(userLevelVo.getCharmUrl())) {
|
||||
ivUserCharm.setVisibility(View.VISIBLE);
|
||||
ImageLoadUtils.loadImage(mContext, userLevelVo.getCharmUrl(), ivUserCharm);
|
||||
}
|
||||
}
|
||||
GlideApp.with(mContext)
|
||||
.load(TextUtils.isEmpty(item.getIcon()) ? R.drawable.default_avatar : item.getIcon())
|
||||
.placeholder(R.drawable.default_avatar)
|
||||
.error(R.drawable.default_avatar)
|
||||
.into(civAvatar);
|
||||
tvName.setText(item.getName());
|
||||
tvErbanId.setText(String.format(
|
||||
mContext.getResources().getString(R.string.family_member_erban_id),
|
||||
String.valueOf(item.getErbanNo())
|
||||
));
|
||||
|
||||
if (item.getPosition() == FamilyMemberInfo.LEVEL_PATRIARCH){
|
||||
ivPatriarchTag.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
ivPatriarchTag.setVisibility(View.GONE);
|
||||
}
|
||||
civAvatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != actionListener){
|
||||
actionListener.onClickAvatar(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (optType == FamilyMemberListActivity.TYPE_SELECT_MEMBER){
|
||||
tvMemberRemove.setVisibility(View.GONE);
|
||||
helper.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != actionListener){
|
||||
actionListener.onTransferCurrency(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else if (optType == FamilyMemberListActivity.TYPE_REMOVE_MEMBER){
|
||||
if (item.getPosition() == FamilyMemberInfo.LEVEL_PATRIARCH) {
|
||||
tvMemberRemove.setVisibility(View.GONE);
|
||||
}else {
|
||||
tvMemberRemove.setVisibility(View.VISIBLE);
|
||||
tvMemberRemove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != actionListener){
|
||||
actionListener.onRemoveMember(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}else if (optType == FamilyMemberListActivity.TYPE_SHOW_MEMBER){
|
||||
tvMemberRemove.setVisibility(View.GONE);
|
||||
|
||||
}else if (optType == FamilyMemberListActivity.TYPE_CHECK_MEMBER_CURRENCY){
|
||||
tvMemberRemove.setVisibility(View.GONE);
|
||||
helper.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (null != actionListener){
|
||||
actionListener.onCheckMemberCurrency(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ActionListener actionListener;
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
this.actionListener = actionListener;
|
||||
}
|
||||
|
||||
public interface ActionListener{
|
||||
public void onRemoveMember(FamilyMemberInfo familyMemberInfo);
|
||||
public void onTransferCurrency(FamilyMemberInfo familyMemberInfo);
|
||||
void onClickAvatar(FamilyMemberInfo item);
|
||||
void onCheckMemberCurrency(FamilyMemberInfo item);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
package com.chwl.app.family.view.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.widget.SquareImageView;
|
||||
import com.chwl.core.family.bean.response.RankingFamilyInfo;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/16
|
||||
*/
|
||||
|
||||
public class FamilyWeeklyRankBoardAdapter extends BaseQuickAdapter<RankingFamilyInfo, BaseViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private int mRound = 10;
|
||||
|
||||
public FamilyWeeklyRankBoardAdapter(Context context, @Nullable List<RankingFamilyInfo> data) {
|
||||
super(R.layout.item_family_weekly_rank_list, data);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder baseViewHolder, RankingFamilyInfo familyInfo) {
|
||||
SquareImageView ivCover = baseViewHolder.getView(R.id.iv_cover);
|
||||
|
||||
GlideApp.with(mContext)
|
||||
.load(familyInfo.getIcon())
|
||||
.placeholder(R.drawable.default_cover)
|
||||
.transforms(new CenterCrop(), new RoundedCorners(mRound))
|
||||
.into(ivCover);
|
||||
|
||||
TextView tvRanking = baseViewHolder.getView(R.id.tv_ranking);
|
||||
TextView tvCharm = baseViewHolder.getView(R.id.tv_charm);
|
||||
TextView tvCharmLabel = baseViewHolder.getView(R.id.tv_charm_label);
|
||||
TextView tvFamilyName = baseViewHolder.getView(R.id.tv_family_name);
|
||||
TextView tvFamilyId = baseViewHolder.getView(R.id.tv_family_id);
|
||||
|
||||
tvFamilyName.setText(familyInfo.getName());
|
||||
tvFamilyId.setText(String.format(mContext.getResources().getString(R.string.family_id),familyInfo.getId()));
|
||||
|
||||
int position = getItemPositionInList(getData(),familyInfo);
|
||||
if (position == 0){
|
||||
tvCharmLabel.setVisibility(View.GONE);
|
||||
tvCharm.setVisibility(View.VISIBLE);
|
||||
tvCharm.setText("No.1");
|
||||
}else {
|
||||
tvCharmLabel.setVisibility(View.VISIBLE);
|
||||
tvCharm.setVisibility(View.VISIBLE);
|
||||
RankingFamilyInfo previousOne = getData().get(position - 1);
|
||||
long charmDiff = previousOne.getFamilyCharm() - familyInfo.getFamilyCharm();
|
||||
tvCharm.setText(FormatUtils.formatToShortHalfUp(charmDiff));
|
||||
}
|
||||
|
||||
if (position == 0){
|
||||
tvRanking.setBackgroundResource(R.mipmap.ic_family_weekly_ranking_1);
|
||||
tvRanking.setText("");
|
||||
}else if (position == 1){
|
||||
tvRanking.setBackgroundResource(R.mipmap.ic_family_weekly_ranking_2);
|
||||
tvRanking.setText("");
|
||||
}else if (position == 2){
|
||||
tvRanking.setBackgroundResource(R.mipmap.ic_family_weekly_ranking_3);
|
||||
tvRanking.setText("");
|
||||
}else {
|
||||
tvRanking.setText(String.valueOf(position + 1));
|
||||
tvRanking.setBackgroundResource(R.drawable.shape_circle_gray_small);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getItemPositionInList(List<RankingFamilyInfo> list,RankingFamilyInfo familyInfo){
|
||||
int pos = -1;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (familyInfo.getId().equals(list.get(i).getId())){
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
}
|
@@ -1,171 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.family.bean.response.moneyManagement.FamilyMoneyManagementInfo;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
import com.chwl.library.utils.ImeUtil;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description 贡献家族币
|
||||
* @Date 2018/5/30
|
||||
*/
|
||||
|
||||
public class FamilyContributionDialog extends Dialog {
|
||||
|
||||
private TextView tvTitle;
|
||||
private TextView tvFamilyCurrencyBalanceTip;
|
||||
private TextView tvFamilyCurrencyBalanceValue;
|
||||
private TextView tvMemberName;
|
||||
private EditText etInput;
|
||||
private TextView tvCurrencyName;
|
||||
private TextView tvCancel;
|
||||
private TextView tvOk;
|
||||
|
||||
private FamilyMoneyManagementInfo familyMoneyManagementInfo;
|
||||
|
||||
public FamilyContributionDialog(@NonNull Context context) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
}
|
||||
|
||||
public FamilyContributionDialog(Context context, FamilyMoneyManagementInfo familyMoneyManagementInfo) {
|
||||
this(context);
|
||||
this.familyMoneyManagementInfo = familyMoneyManagementInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
setContentView(R.layout.dialog_family_currency_contribution);
|
||||
|
||||
tvTitle = (TextView) findViewById(R.id.tv_title);
|
||||
tvFamilyCurrencyBalanceTip = (TextView) findViewById(R.id.tv_family_currency_balance_tip);
|
||||
tvFamilyCurrencyBalanceValue = (TextView) findViewById(R.id.tv_family_currency_balance_value);
|
||||
tvMemberName = (TextView) findViewById(R.id.tv_member_name);
|
||||
etInput = (EditText) findViewById(R.id.et_input);
|
||||
tvCurrencyName = (TextView) findViewById(R.id.tv_currency_name);
|
||||
tvCancel = (TextView) findViewById(R.id.tv_cancel);
|
||||
tvOk = (TextView) findViewById(R.id.tv_ok);
|
||||
|
||||
tvTitle.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_currency_contribution),
|
||||
familyMoneyManagementInfo.getMoneyName()
|
||||
));
|
||||
tvFamilyCurrencyBalanceTip.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_currency_contribution_balance_tip),
|
||||
familyMoneyManagementInfo.getMoneyName()
|
||||
));
|
||||
tvFamilyCurrencyBalanceValue.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_currency_count),
|
||||
FormatUtils.formatToShortDown(familyMoneyManagementInfo.getTotalAmount()),
|
||||
familyMoneyManagementInfo.getMoneyName()
|
||||
));
|
||||
tvCurrencyName.setText(familyMoneyManagementInfo.getMoneyName());
|
||||
|
||||
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImeUtil.hideIME(getContext(),etInput);
|
||||
if (null != onOperationListener){
|
||||
onOperationListener.onCancel(FamilyContributionDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tvOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImeUtil.hideIME(getContext(),etInput);
|
||||
String str = etInput.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(str)){
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familycontributiondialog_01),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familycontributiondialog_02));
|
||||
return;
|
||||
}
|
||||
double count = Double.valueOf(str);
|
||||
if (count < 0.01f){
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familycontributiondialog_03),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familycontributiondialog_04));
|
||||
return;
|
||||
}
|
||||
if (null != onOperationListener){
|
||||
onOperationListener.onOk(FamilyContributionDialog.this, count);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
etInput.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (s.toString().contains(".")) {
|
||||
if (s.length() - 1 - s.toString().indexOf(".") > 2) {
|
||||
s = s.toString().subSequence(0,
|
||||
s.toString().indexOf(".") + 3);
|
||||
etInput.setText(s);
|
||||
etInput.setSelection(s.length());
|
||||
}
|
||||
}
|
||||
if (s.toString().trim().substring(0).equals(".")) {
|
||||
s = "0" + s;
|
||||
etInput.setText(s);
|
||||
etInput.setSelection(2);
|
||||
}
|
||||
|
||||
if (s.toString().startsWith("0")
|
||||
&& s.toString().trim().length() > 1) {
|
||||
if (!s.toString().substring(1, 2).equals(".")) {
|
||||
etInput.setText(s.subSequence(0, 1));
|
||||
etInput.setSelection(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private OnOperationListener onOperationListener;
|
||||
|
||||
public void setOnOperationListener(OnOperationListener onOperationListener) {
|
||||
this.onOperationListener = onOperationListener;
|
||||
}
|
||||
|
||||
public interface OnOperationListener{
|
||||
void onCancel(DialogInterface dialog);
|
||||
void onOk(DialogInterface dialog, double count);
|
||||
}
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.chwl.core.family.bean.CustomServiceInfo;
|
||||
import com.chwl.core.family.bean.FamilyCustomServiceInfo;
|
||||
import com.chwl.core.family.model.FamilyModel;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
|
||||
public class FamilyDisbandDialog extends Dialog {
|
||||
|
||||
private TextView tvDisbandTip;
|
||||
private CustomServiceInfo serviceInfo;
|
||||
|
||||
|
||||
public FamilyDisbandDialog(@NonNull Context context) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
setContentView(R.layout.dialog_disband_family);
|
||||
tvDisbandTip = findViewById(R.id.tv_disband_tip);
|
||||
TextView tvCancel = findViewById(R.id.tv_cancel);
|
||||
TextView tvContactService = findViewById(R.id.tv_contact_service);
|
||||
|
||||
tvCancel.setOnClickListener(v -> dismiss());
|
||||
tvContactService.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
if (null != serviceInfo) {
|
||||
NimP2PMessageActivity.start(getContext(), serviceInfo.getUid());
|
||||
}else {
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familydisbanddialog_01),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familydisbanddialog_02));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
FamilyCustomServiceInfo customServiceInfo = FamilyModel.Instance().getCustomServiceInfo();
|
||||
if (null == customServiceInfo){
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familydisbanddialog_03),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familydisbanddialog_04));
|
||||
return;
|
||||
}
|
||||
|
||||
String str = "";
|
||||
for (int i = 0; i < customServiceInfo.getServices().size(); i++) {
|
||||
CustomServiceInfo item = customServiceInfo.getServices().get(i);
|
||||
if (item.getType() == CustomServiceInfo.TYPE_ONLINE){
|
||||
serviceInfo = item;
|
||||
str = serviceInfo.getContent();
|
||||
}
|
||||
}
|
||||
|
||||
tvDisbandTip.setText(String.format(getContext().getResources().getString(R.string.family_disband_tip1), str));
|
||||
}
|
||||
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/6/19
|
||||
*/
|
||||
|
||||
public class FamilyExitTipDialog extends Dialog {
|
||||
|
||||
private TextView tvMessage;
|
||||
private TextView tvCancel;
|
||||
private TextView tvContactService;
|
||||
|
||||
private FamilyInfo familyInfo;
|
||||
|
||||
public FamilyExitTipDialog(@NonNull Context context, FamilyInfo familyInfo) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
this.familyInfo = familyInfo;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setCancelable(true);
|
||||
setCanceledOnTouchOutside(true);
|
||||
|
||||
setContentView(R.layout.dialog_family_exit);
|
||||
tvMessage = (TextView) findViewById(R.id.tv_message);
|
||||
tvCancel = (TextView) findViewById(R.id.tv_cancel);
|
||||
tvContactService = (TextView) findViewById(R.id.tv_contact_service);
|
||||
|
||||
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onOperationListener != null){
|
||||
onOperationListener.onCancel(FamilyExitTipDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
tvContactService.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onOperationListener != null){
|
||||
onOperationListener.onOk(FamilyExitTipDialog.this, familyInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private OnOperationListener onOperationListener;
|
||||
|
||||
public void setOnOperationListener(OnOperationListener onOperationListener) {
|
||||
this.onOperationListener = onOperationListener;
|
||||
}
|
||||
|
||||
public interface OnOperationListener{
|
||||
void onCancel(DialogInterface dialog);
|
||||
void onOk(DialogInterface dialog, FamilyInfo familyInfo);
|
||||
}
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/18
|
||||
*/
|
||||
|
||||
public class FamilyGuideDialog extends Dialog {
|
||||
|
||||
private ImageView ivGuide1;
|
||||
private List<Integer> guidePics = new ArrayList<>();
|
||||
private Iterator<Integer> iterator;
|
||||
|
||||
public FamilyGuideDialog(@NonNull Context context) {
|
||||
super(context, R.style.common_dialog_theme);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Window window = getWindow();
|
||||
if (window != null){
|
||||
window.getDecorView().setPadding(0,0,0,0);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
lp.gravity = Gravity.CENTER;
|
||||
window.setAttributes(lp);
|
||||
|
||||
}
|
||||
|
||||
setContentView(R.layout.dialog_family_guide);
|
||||
|
||||
|
||||
guidePics.add(R.mipmap.bg_family_guide_1);
|
||||
guidePics.add(R.mipmap.bg_family_guide_2);
|
||||
guidePics.add(R.mipmap.bg_family_guide_3);
|
||||
iterator = guidePics.iterator();
|
||||
|
||||
ivGuide1 = (ImageView) findViewById(R.id.iv_guide_1);
|
||||
GlideApp.with(getContext())
|
||||
.load(iterator.next())
|
||||
.dontAnimate()
|
||||
.into(ivGuide1);
|
||||
|
||||
ivGuide1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (iterator.hasNext()){
|
||||
GlideApp.with(getContext())
|
||||
.load(iterator.next())
|
||||
.dontAnimate()
|
||||
.into(ivGuide1);
|
||||
}else {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,98 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.widget.CircleImageView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/6/19
|
||||
*/
|
||||
|
||||
public class FamilyInviteConfirmDialog extends Dialog {
|
||||
|
||||
private CircleImageView civAvatar;
|
||||
private TextView tvMessage;
|
||||
private TextView tvCancel;
|
||||
private TextView tvContactService;
|
||||
|
||||
private String avatar;
|
||||
private CharSequence name;
|
||||
|
||||
public FamilyInviteConfirmDialog(@NonNull Context context) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setCancelable(true);
|
||||
setCanceledOnTouchOutside(true);
|
||||
setContentView(R.layout.dialog_family_invite_confirm);
|
||||
|
||||
civAvatar = (CircleImageView) findViewById(R.id.civ_avatar);
|
||||
tvMessage = (TextView) findViewById(R.id.tv_message);
|
||||
tvCancel = (TextView) findViewById(R.id.tv_cancel);
|
||||
tvContactService = (TextView) findViewById(R.id.tv_contact_service);
|
||||
|
||||
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onOperationListener != null){
|
||||
onOperationListener.onCancel(FamilyInviteConfirmDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
tvContactService.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onOperationListener != null){
|
||||
onOperationListener.onOk(FamilyInviteConfirmDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (avatar != null){
|
||||
GlideApp.with(getContext())
|
||||
.load(avatar)
|
||||
.dontAnimate()
|
||||
.into(civAvatar);
|
||||
}
|
||||
if (name != null){
|
||||
tvMessage.setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar){
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public void setName(CharSequence name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
private OnOperationListener onOperationListener;
|
||||
|
||||
public void setOnOperationListener(OnOperationListener onOperationListener) {
|
||||
this.onOperationListener = onOperationListener;
|
||||
}
|
||||
|
||||
public interface OnOperationListener{
|
||||
void onCancel(DialogInterface dialog);
|
||||
void onOk(DialogInterface dialog);
|
||||
}
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.library.utils.ImeUtil;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
public class FamilyJoinDialog extends Dialog {
|
||||
|
||||
private TextView tvFamilyJoinTip;
|
||||
private EditText etInput;
|
||||
private TextView tvCancel;
|
||||
private TextView tvOk;
|
||||
|
||||
private String defaultVerifyMessage = "";
|
||||
|
||||
public FamilyJoinDialog(@NonNull Context context) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
setContentView(R.layout.dialog_family_join);
|
||||
|
||||
|
||||
tvFamilyJoinTip = findViewById(R.id.tv_family_join_tip);
|
||||
etInput = findViewById(R.id.et_input);
|
||||
tvCancel = findViewById(R.id.tv_cancel);
|
||||
tvOk = findViewById(R.id.tv_ok);
|
||||
|
||||
etInput.setHint(getContext().getResources().getString(R.string.family_join_hint));
|
||||
|
||||
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImeUtil.hideIME(getContext(),etInput);
|
||||
if (null != onOperationListener){
|
||||
onOperationListener.onCancel(FamilyJoinDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tvOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImeUtil.hideIME(getContext(),etInput);
|
||||
String str = etInput.getText().toString();
|
||||
if (!TextUtils.isEmpty(str)){
|
||||
defaultVerifyMessage = str;
|
||||
}
|
||||
if (null != onOperationListener){
|
||||
onOperationListener.onOk(FamilyJoinDialog.this,defaultVerifyMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置提示语句
|
||||
* @param msg
|
||||
*/
|
||||
public void setTipMessage(CharSequence msg){
|
||||
tvFamilyJoinTip.setText(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认验证信息
|
||||
* @param str
|
||||
*/
|
||||
public void setDefaultVerifyMessage(String str){
|
||||
etInput.setHint(str);
|
||||
this.defaultVerifyMessage = str;
|
||||
}
|
||||
|
||||
|
||||
private OnOperationListener onOperationListener;
|
||||
|
||||
public void setOnOperationListener(OnOperationListener onOperationListener) {
|
||||
this.onOperationListener = onOperationListener;
|
||||
}
|
||||
|
||||
public interface OnOperationListener{
|
||||
void onCancel(DialogInterface dialog);
|
||||
void onOk(DialogInterface dialog, String str);
|
||||
}
|
||||
|
||||
}
|
@@ -1,98 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.library.utils.SizeUtils;
|
||||
import com.chwl.library.widget.DrawableCenterTextView;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
*/
|
||||
public class FamilyMenuDialog extends Dialog {
|
||||
|
||||
private FamilyInfo familyInfo;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public FamilyMenuDialog(@NonNull Context context, FamilyInfo familyInfo) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
mContext = context;
|
||||
this.familyInfo = familyInfo;
|
||||
init(null);
|
||||
}
|
||||
public FamilyMenuDialog(@NonNull Context context, FamilyInfo familyInfo, View attachView) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
mContext = context;
|
||||
this.familyInfo = familyInfo;
|
||||
init(attachView);
|
||||
}
|
||||
|
||||
private void init(View attachView) {
|
||||
Window window = getWindow();
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.gravity = Gravity.TOP | Gravity.END;
|
||||
if (attachView != null) {
|
||||
lp.x = attachView.getWidth() / 2 - SizeUtils.dp2px(mContext, 9);
|
||||
lp.y = attachView.getHeight() + SizeUtils.dp2px(mContext, 10);
|
||||
}
|
||||
window.setAttributes(lp);
|
||||
|
||||
setContentView(R.layout.dialog_family_menu);
|
||||
|
||||
setCanceledOnTouchOutside(true);
|
||||
|
||||
boolean isPatriarch = familyInfo.getPosition() == FamilyInfo.LEVEL_PATRIARCH;
|
||||
|
||||
DrawableCenterTextView tvMenu1 = findViewById(R.id.tv_menu1);
|
||||
View divider = findViewById(R.id.v_divider_family);
|
||||
tvMenu1.setVisibility(isPatriarch ? View.VISIBLE : View.GONE);
|
||||
divider.setVisibility(isPatriarch ? View.VISIBLE : View.GONE);
|
||||
if (isPatriarch) {
|
||||
tvMenu1.setOnClickListener(v -> {
|
||||
if (null != onMenuClickListener){
|
||||
onMenuClickListener.onInviteFriends(FamilyMenuDialog.this,familyInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DrawableCenterTextView tvMenu2 = findViewById(R.id.tv_menu2);
|
||||
tvMenu2.setText(isPatriarch ?
|
||||
getContext().getResources().getString(R.string.family_disband) : getContext().getResources().getString(R.string.family_exit_family));
|
||||
Drawable drawable = isPatriarch ?
|
||||
ContextCompat.getDrawable(mContext, R.drawable.ic_dissolve_family) : ContextCompat.getDrawable(mContext, R.drawable.ic_exit_family);
|
||||
tvMenu2.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||
tvMenu2.setOnClickListener(v -> {
|
||||
if (null != onMenuClickListener){
|
||||
if (familyInfo.getPosition() == FamilyInfo.LEVEL_PATRIARCH) {
|
||||
onMenuClickListener.onDisbandFamily(FamilyMenuDialog.this, familyInfo);
|
||||
}else {
|
||||
onMenuClickListener.onExitFamily(FamilyMenuDialog.this, familyInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private OnMenuClickListener onMenuClickListener;
|
||||
public void setOnMenuClickListener(OnMenuClickListener listener){
|
||||
this.onMenuClickListener = listener;
|
||||
}
|
||||
|
||||
public interface OnMenuClickListener{
|
||||
void onExitFamily(DialogInterface dialog, FamilyInfo familyInfo);
|
||||
void onDisbandFamily(DialogInterface dialog, FamilyInfo familyInfo);
|
||||
void onInviteFriends(DialogInterface dialog, FamilyInfo familyInfo);
|
||||
}
|
||||
}
|
@@ -1,87 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/29
|
||||
*/
|
||||
|
||||
public class FamilyRemoveMemberDialog extends Dialog {
|
||||
|
||||
private TextView tvMessage;
|
||||
private TextView tvCancel;
|
||||
private TextView tvContactService;
|
||||
|
||||
private FamilyMemberInfo familyMemberInfo;
|
||||
|
||||
|
||||
public FamilyRemoveMemberDialog(@NonNull Context context, FamilyMemberInfo familyMemberInfo) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
this.familyMemberInfo = familyMemberInfo;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
setContentView(R.layout.dialog_family_remove_member);
|
||||
tvMessage = (TextView) findViewById(R.id.tv_message);
|
||||
tvCancel = (TextView) findViewById(R.id.tv_cancel);
|
||||
tvContactService = (TextView) findViewById(R.id.tv_contact_service);
|
||||
|
||||
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onOperationListener != null){
|
||||
onOperationListener.onCancel(FamilyRemoveMemberDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
tvContactService.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onOperationListener != null){
|
||||
onOperationListener.onOk(FamilyRemoveMemberDialog.this, familyMemberInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
tvMessage.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_remove_member_tip),
|
||||
familyMemberInfo.getName()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private OnOperationListener onOperationListener;
|
||||
|
||||
public void setOnOperationListener(OnOperationListener onOperationListener) {
|
||||
this.onOperationListener = onOperationListener;
|
||||
}
|
||||
|
||||
public interface OnOperationListener{
|
||||
void onCancel(DialogInterface dialog);
|
||||
void onOk(DialogInterface dialog, FamilyMemberInfo familyMemberInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,179 +0,0 @@
|
||||
package com.chwl.app.family.view.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.family.bean.FamilyInfo;
|
||||
import com.chwl.core.family.bean.FamilyMemberInfo;
|
||||
import com.chwl.library.utils.FormatUtils;
|
||||
import com.chwl.library.utils.ImeUtil;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
import com.chwl.library.utils.SingleToastUtil;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/30
|
||||
*/
|
||||
|
||||
public class FamilyTransferDialog extends Dialog {
|
||||
|
||||
private TextView tvTitle;
|
||||
private TextView tvFamilyCurrencyBalanceTip;
|
||||
private TextView tvFamilyCurrencyBalanceValue;
|
||||
private TextView tvMemberName;
|
||||
private EditText etInput;
|
||||
private TextView tvCurrencyName;
|
||||
private TextView tvCancel;
|
||||
private TextView tvOk;
|
||||
|
||||
private FamilyInfo familyInfo;
|
||||
private FamilyMemberInfo familyMemberInfo;
|
||||
|
||||
public FamilyTransferDialog(@NonNull Context context, FamilyInfo familyInfo, FamilyMemberInfo familyMemberInfo) {
|
||||
super(context, R.style.easy_dialog_style);
|
||||
this.familyInfo = familyInfo;
|
||||
this.familyMemberInfo = familyMemberInfo;
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
setContentView(R.layout.dialog_family_currency_transfer);
|
||||
|
||||
tvTitle = (TextView) findViewById(R.id.tv_title);
|
||||
tvFamilyCurrencyBalanceTip = (TextView) findViewById(R.id.tv_family_currency_balance_tip);
|
||||
tvFamilyCurrencyBalanceValue = (TextView) findViewById(R.id.tv_family_currency_balance_value);
|
||||
tvMemberName = (TextView) findViewById(R.id.tv_member_name);
|
||||
etInput = (EditText) findViewById(R.id.et_input);
|
||||
tvCurrencyName = (TextView) findViewById(R.id.tv_currency_name);
|
||||
tvCancel = (TextView) findViewById(R.id.tv_cancel);
|
||||
tvOk = (TextView) findViewById(R.id.tv_ok);
|
||||
|
||||
tvTitle.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_currency_transfer),
|
||||
familyInfo.getMoneyName()));
|
||||
|
||||
tvFamilyCurrencyBalanceTip.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_currency_transfer_label1),
|
||||
familyInfo.getMoneyName())
|
||||
);
|
||||
tvFamilyCurrencyBalanceValue.setText(String.format(
|
||||
getContext().getResources().getString(R.string.family_currency_count),
|
||||
FormatUtils.formatToShortDown(familyInfo.getFamilyMoney()),
|
||||
familyInfo.getMoneyName()
|
||||
)
|
||||
);
|
||||
tvMemberName.setText(familyMemberInfo.getName());
|
||||
tvCurrencyName.setText(familyInfo.getMoneyName());
|
||||
|
||||
|
||||
tvCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImeUtil.hideIME(getContext(),etInput);
|
||||
if (null != onOperationListener){
|
||||
onOperationListener.onCancel(FamilyTransferDialog.this);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
tvOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ImeUtil.hideIME(getContext(),etInput);
|
||||
if (familyMemberInfo.getUid() == AuthModel.get().getCurrentUid()){
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familytransferdialog_01),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familytransferdialog_02));
|
||||
return;
|
||||
}
|
||||
String str = etInput.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(str)){
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familytransferdialog_03),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familytransferdialog_04));
|
||||
return;
|
||||
}
|
||||
double count = Double.valueOf(etInput.getText().toString().trim());
|
||||
if (count < 0.01f){
|
||||
// Toast.makeText(getContext(),ResUtil.getString(R.string.view_dialog_familytransferdialog_05),Toast.LENGTH_SHORT).show();
|
||||
SingleToastUtil.showToastShort(ResUtil.getString(R.string.view_dialog_familytransferdialog_06));
|
||||
return;
|
||||
}
|
||||
|
||||
// Toast.makeText(getContext(),getContext().getResources()
|
||||
// .getString(R.string.family_transfer_currency_insufficient),Toast.LENGTH_SHORT).show();
|
||||
|
||||
|
||||
if (null != onOperationListener){
|
||||
onOperationListener.onOk(FamilyTransferDialog.this, familyMemberInfo, count);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
etInput.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (s.toString().contains(".")) {
|
||||
if (s.length() - 1 - s.toString().indexOf(".") > 2) {
|
||||
s = s.toString().subSequence(0,
|
||||
s.toString().indexOf(".") + 3);
|
||||
etInput.setText(s);
|
||||
etInput.setSelection(s.length());
|
||||
}
|
||||
}
|
||||
if (s.toString().trim().substring(0).equals(".")) {
|
||||
s = "0" + s;
|
||||
etInput.setText(s);
|
||||
etInput.setSelection(2);
|
||||
}
|
||||
|
||||
if (s.toString().startsWith("0")
|
||||
&& s.toString().trim().length() > 1) {
|
||||
if (!s.toString().substring(1, 2).equals(".")) {
|
||||
etInput.setText(s.subSequence(0, 1));
|
||||
etInput.setSelection(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private OnOperationListener onOperationListener;
|
||||
|
||||
public void setOnOperationListener(OnOperationListener onOperationListener) {
|
||||
this.onOperationListener = onOperationListener;
|
||||
}
|
||||
|
||||
public interface OnOperationListener{
|
||||
void onCancel(DialogInterface dialog);
|
||||
void onOk(DialogInterface dialog, FamilyMemberInfo familyMemberInfo, double count);
|
||||
}
|
||||
}
|
@@ -1,147 +0,0 @@
|
||||
package com.chwl.app.family.view.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpFragment;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyAttentionFragmentView;
|
||||
import com.chwl.app.family.presenter.FamilyAttentionPresenter;
|
||||
import com.chwl.app.family.view.activity.FamilySelectFriendActivity;
|
||||
import com.chwl.app.family.view.adapter.FamilyAttentionListAdapter;
|
||||
import com.chwl.core.user.bean.AttentionInfo;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
@CreatePresenter(FamilyAttentionPresenter.class)
|
||||
public class FamilyAttentionFragment extends BaseMvpFragment<IFamilyAttentionFragmentView, FamilyAttentionPresenter>
|
||||
implements IFamilyAttentionFragmentView {
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView userLiveRecyclerView;
|
||||
|
||||
private FamilySelectFriendActivity activity;
|
||||
|
||||
private FamilyAttentionListAdapter adapter;
|
||||
|
||||
public static Fragment newInstance() {
|
||||
return new FamilyAttentionFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (activity instanceof FamilySelectFriendActivity){
|
||||
this.activity = (FamilySelectFriendActivity) activity;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_family_attention;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFindViews() {
|
||||
swipeRefresh = (SwipeRefreshLayout) getView().findViewById(R.id.swipe_refresh);
|
||||
userLiveRecyclerView = (RecyclerView) getView().findViewById(R.id.user_live_recyclerView);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
userLiveRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false));
|
||||
|
||||
adapter = new FamilyAttentionListAdapter(null);
|
||||
adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
AttentionInfo item = (AttentionInfo) adapter.getData().get(position);
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setUid(item.getUid());
|
||||
userInfo.setNick(item.getNick());
|
||||
userInfo.setAvatar(item.getAvatar());
|
||||
activity.onSelectFriend(userInfo);
|
||||
}
|
||||
});
|
||||
adapter.setEnableLoadMore(true);
|
||||
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().loadMoreData();
|
||||
}
|
||||
}, userLiveRecyclerView);
|
||||
|
||||
userLiveRecyclerView.setAdapter(adapter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (ListUtils.isListEmpty(adapter.getData())){
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshData(List<AttentionInfo> attentionInfoList) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
if (!ListUtils.isListEmpty(attentionInfoList)){
|
||||
adapter.setNewData(attentionInfoList);
|
||||
} else {
|
||||
showNoData(getString(R.string.no_attention_text));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshDataFail(String error) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
showNetworkErr();
|
||||
toast(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreData(List<AttentionInfo> attentionInfoList) {
|
||||
adapter.loadMoreComplete();
|
||||
if (!ListUtils.isListEmpty(attentionInfoList)){
|
||||
adapter.addData(attentionInfoList);
|
||||
}else {
|
||||
adapter.loadMoreEnd(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreDataFail(String error) {
|
||||
adapter.loadMoreComplete();
|
||||
adapter.loadMoreFail();
|
||||
toast(error);
|
||||
}
|
||||
}
|
@@ -1,67 +0,0 @@
|
||||
package com.chwl.app.family.view.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.AbsStatusFragment;
|
||||
|
||||
/**
|
||||
* Created by xujiexing on 14-4-9.
|
||||
*/
|
||||
public class FamilyEmptyFragment extends AbsStatusFragment {
|
||||
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private LinearLayout rlCenter;
|
||||
|
||||
/**
|
||||
* 通过设置负数top以达到有title状态下居中,无title状态下默认居中
|
||||
*/
|
||||
public static FamilyEmptyFragment newInstance(int topPx) {
|
||||
FamilyEmptyFragment fragment = new FamilyEmptyFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("topPx", topPx);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_family_empty, container, false);
|
||||
|
||||
rlCenter = view.findViewById(R.id.rl_family_empty_center);
|
||||
|
||||
Bundle bundle = this.getArguments();
|
||||
if (bundle != null) {
|
||||
int topPx = bundle.getInt("topPx", 0);
|
||||
setRlCenterTop(topPx);
|
||||
}
|
||||
|
||||
TextView textView = view.findViewById(R.id.tv_family_plaza);
|
||||
textView.setOnClickListener(v -> {
|
||||
if (mOnClickListener != null) {
|
||||
mOnClickListener.onClick(v);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param topPx px
|
||||
*/
|
||||
public void setRlCenterTop(int topPx) {
|
||||
if (rlCenter != null) {
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) rlCenter.getLayoutParams();
|
||||
layoutParams.setMargins(layoutParams.leftMargin, topPx, layoutParams.rightMargin, layoutParams.bottomMargin);
|
||||
rlCenter.setLayoutParams(layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
||||
this.mOnClickListener = onClickListener;
|
||||
}
|
||||
}
|
@@ -1,135 +0,0 @@
|
||||
package com.chwl.app.family.view.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpFragment;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyFansListFragmentView;
|
||||
import com.chwl.app.family.presenter.FamilyFansListPresenter;
|
||||
import com.chwl.app.family.view.activity.FamilySelectFriendActivity;
|
||||
import com.chwl.app.family.view.adapter.FamilyFansViewAdapter;
|
||||
import com.chwl.core.user.bean.FansInfo;
|
||||
import com.chwl.core.user.bean.FansListInfo;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
@CreatePresenter(FamilyFansListPresenter.class)
|
||||
public class FamilyFansListFragment extends BaseMvpFragment<IFamilyFansListFragmentView, FamilyFansListPresenter>
|
||||
implements IFamilyFansListFragmentView {
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView recyclerView;
|
||||
private FamilySelectFriendActivity activity;
|
||||
private FamilyFansViewAdapter adapter;
|
||||
|
||||
public static Fragment newInstances() {
|
||||
return new FamilyFansListFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (activity instanceof FamilySelectFriendActivity){
|
||||
this.activity = (FamilySelectFriendActivity) activity;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_family_fans_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFindViews() {
|
||||
swipeRefresh = (SwipeRefreshLayout) getView().findViewById(R.id.swipe_refresh);
|
||||
recyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
swipeRefresh.setOnRefreshListener(() -> {
|
||||
getMvpPresenter().refreshData();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new FamilyFansViewAdapter(null);
|
||||
adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
FansInfo item = (FansInfo) adapter.getData().get(position);
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setUid(item.getUid());
|
||||
userInfo.setNick(item.getNick());
|
||||
userInfo.setAvatar(item.getAvatar());
|
||||
activity.onSelectFriend(userInfo);
|
||||
}
|
||||
});
|
||||
adapter.setEnableLoadMore(true);
|
||||
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().loadMoreData();
|
||||
}
|
||||
},recyclerView);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (ListUtils.isListEmpty(adapter.getData())){
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshData(FansListInfo fansListInfo) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
adapter.setNewData(fansListInfo.getFansList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshDataFail(String message) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
showNetworkErr();
|
||||
toast(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreData(FansListInfo fansListInfo) {
|
||||
adapter.loadMoreComplete();
|
||||
if (!ListUtils.isListEmpty(fansListInfo.getFansList())){
|
||||
adapter.addData(fansListInfo.getFansList());
|
||||
}else {
|
||||
adapter.setEnableLoadMore(false);
|
||||
adapter.loadMoreEnd(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadMoreDataFail(String message) {
|
||||
adapter.loadMoreComplete();
|
||||
adapter.loadMoreFail();
|
||||
}
|
||||
}
|
@@ -1,147 +0,0 @@
|
||||
package com.chwl.app.family.view.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.base.BaseMvpFragment;
|
||||
import com.chwl.app.family.contract.viewinterface.IFamilyFriendListFragmentView;
|
||||
import com.chwl.app.family.presenter.FamilyFriendListPresenter;
|
||||
import com.chwl.app.family.view.activity.FamilySelectFriendActivity;
|
||||
import com.chwl.app.family.view.adapter.FamilyFriendListAdapter;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.library.base.factory.CreatePresenter;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/4
|
||||
*/
|
||||
@CreatePresenter(FamilyFriendListPresenter.class)
|
||||
public class FamilyFriendListFragment extends BaseMvpFragment<IFamilyFriendListFragmentView, FamilyFriendListPresenter>
|
||||
implements IFamilyFriendListFragmentView {
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView recyclerView;
|
||||
private FamilyFriendListAdapter adapter;
|
||||
|
||||
FamilySelectFriendActivity activity;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof FamilySelectFriendActivity) {
|
||||
activity = (FamilySelectFriendActivity) context;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_family_friend_list;
|
||||
}
|
||||
|
||||
public static Fragment newInstances() {
|
||||
return new FamilyFriendListFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFindViews() {
|
||||
swipeRefresh = (SwipeRefreshLayout) getView().findViewById(R.id.swipe_refresh);
|
||||
recyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetListener() {
|
||||
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate() {
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false));
|
||||
adapter = new FamilyFriendListAdapter(getContext(),null);
|
||||
adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
UserInfo userInfo = (UserInfo) adapter.getData().get(position);
|
||||
activity.onSelectFriend(userInfo);
|
||||
}
|
||||
});
|
||||
adapter.setEnableLoadMore(true);
|
||||
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMoreRequested() {
|
||||
getMvpPresenter().loadMoreData();
|
||||
}
|
||||
},recyclerView);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (ListUtils.isListEmpty(adapter.getData())) {
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReloadData() {
|
||||
super.onReloadData();
|
||||
swipeRefresh.setRefreshing(true);
|
||||
getMvpPresenter().refreshData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshData(List<UserInfo> userInfos) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
if (!ListUtils.isListEmpty(userInfos)) {
|
||||
adapter.setNewData(userInfos);
|
||||
}else {
|
||||
showNoData(getString(R.string.no_frenids_text));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshDataFail(String message) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
showNetworkErr();
|
||||
toast(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreData(List<UserInfo> userInfos) {
|
||||
adapter.loadMoreComplete();
|
||||
if (!ListUtils.isListEmpty(userInfos)){
|
||||
adapter.addData(userInfos);
|
||||
}else {
|
||||
adapter.setEnableLoadMore(false);
|
||||
adapter.loadMoreEnd(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoadMoreDataFail(String message) {
|
||||
adapter.loadMoreComplete();
|
||||
adapter.loadMoreFail();
|
||||
toast(message);
|
||||
}
|
||||
}
|
@@ -30,7 +30,6 @@ import com.netease.nimlib.sdk.team.model.TeamMember;
|
||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.common.widget.DragLayout;
|
||||
import com.chwl.app.family.view.activity.FamilyHomeActivity;
|
||||
import com.chwl.app.team.viewmodel.TeamVM;
|
||||
import com.chwl.app.ui.im.actions.FamilyGameAction;
|
||||
import com.chwl.app.ui.im.actions.LuckyMoneyAction;
|
||||
@@ -103,9 +102,6 @@ public class NimTeamMessageActivity extends BaseMessageActivity {
|
||||
teamAvatarLayout = (DragLayout) findViewById(R.id.avatar_image_layout);
|
||||
teamAvatar = (ImageView) findViewById(R.id.avatar_image);
|
||||
teamAvatarLayout.setOnClickListener(v -> {
|
||||
if (FamilyModel.Instance().getMyFamily() != null) {
|
||||
FamilyHomeActivity.start(this, FamilyModel.Instance().getMyFamily().getFamilyId());
|
||||
}
|
||||
});
|
||||
if (FamilyModel.Instance().getMyFamily() != null) {
|
||||
ImageLoadUtils.loadAvatar(getApplicationContext(), FamilyModel.Instance().getMyFamily().getFamilyIcon(),
|
||||
|
@@ -14,7 +14,6 @@ import com.chwl.app.base.BaseActivity;
|
||||
import com.chwl.app.base.DialogManagerInterface;
|
||||
import com.chwl.app.common.widget.dialog.DialogManager;
|
||||
import com.chwl.app.decoration.view.MyDecorationActivity;
|
||||
import com.chwl.app.family.view.activity.FamilyHomeActivity;
|
||||
import com.chwl.app.fansteam.FansTeamListActivity;
|
||||
import com.chwl.app.home.activity.CollectionRoomActivity;
|
||||
import com.chwl.app.home.activity.VisitorListActivity;
|
||||
@@ -121,10 +120,6 @@ public class RouterHandler {
|
||||
case RouterType.USER_CARD_WEAR:
|
||||
MyDecorationActivity.start(context, 3);
|
||||
break;
|
||||
case RouterType.FAMILY:
|
||||
FamilyHomeActivity.start(context, routerValue);
|
||||
break;
|
||||
|
||||
case RouterType.TEAM:
|
||||
NimTeamMessageActivity.start(context, routerValue);
|
||||
break;
|
||||
|
@@ -2,7 +2,6 @@ package com.chwl.app.ui.im.actions;
|
||||
|
||||
import com.netease.nim.uikit.business.session.actions.BaseAction;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.family.view.activity.FamilyGameListActivity;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 29/05/2018.
|
||||
@@ -26,6 +25,5 @@ public class FamilyGameAction extends BaseAction {
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
FamilyGameListActivity.start(getActivity());
|
||||
}
|
||||
}
|
||||
|
@@ -37,9 +37,6 @@ import com.chwl.app.base.BaseBindingActivity;
|
||||
import com.chwl.app.common.widget.dialog.CommonPopupDialog;
|
||||
import com.chwl.app.common.widget.dialog.DialogManager;
|
||||
import com.chwl.app.databinding.ActivityUserInfoBinding;
|
||||
import com.chwl.app.family.view.activity.FamilyHomeActivity;
|
||||
import com.chwl.app.family.view.activity.FamilyMemberListActivity;
|
||||
import com.chwl.app.family.view.activity.FamilyMemberSearchActivity;
|
||||
import com.chwl.app.ui.im.avtivity.NimFriendModel;
|
||||
import com.chwl.app.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.chwl.app.ui.user.adapter.SelfPhotoAdapter;
|
||||
@@ -807,12 +804,6 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
Intent intent = new Intent(context, UserInfoActivity.class);
|
||||
intent.putExtra("userId", userId);
|
||||
int from = FROM_TYPE_NORMAL;
|
||||
if (context instanceof FamilyHomeActivity
|
||||
|| context instanceof FamilyMemberListActivity
|
||||
|| context instanceof FamilyMemberSearchActivity) {
|
||||
//这里限制循环访问, 例如:家族->个人主页->家族->个人主页->....
|
||||
from = FROM_TYPE_FAMILY;
|
||||
}
|
||||
intent.putExtra("from", from);
|
||||
context.startActivity(intent);
|
||||
|
||||
|
@@ -22,7 +22,6 @@ import com.chwl.app.UIHelper;
|
||||
import com.chwl.app.application.IReportConstants;
|
||||
import com.chwl.app.application.ReportManager;
|
||||
import com.chwl.app.avroom.activity.AVRoomActivity;
|
||||
import com.chwl.app.family.view.activity.FamilyHomeActivity;
|
||||
import com.chwl.app.ui.im.RouterHandler;
|
||||
import com.chwl.app.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.chwl.app.ui.pay.ChargeActivity;
|
||||
@@ -375,7 +374,6 @@ public class JSInterface {
|
||||
|
||||
@JavascriptInterface
|
||||
public void openFamilyPage(String familyId) {
|
||||
FamilyHomeActivity.start(context, familyId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".family.view.activity.FamilyCurrencyActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_family_currency"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".family.view.activity.FamilyGameListActivity">
|
||||
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.chwl.app.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listItem="@layout/item_family_list"/>
|
||||
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</com.chwl.app.common.widget.StatusLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -1,410 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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/color_F5F5F5"
|
||||
android:orientation="vertical"
|
||||
tools:context=".family.view.activity.FamilyHomeActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.chwl.app.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/sv_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.chwl.app.ui.widget.RectLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hw_ratio="0.469">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_family_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/riv_cover"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="31dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:riv_border_color="@color/white"
|
||||
app:riv_border_width="3px"
|
||||
app:riv_corner_radius="@dimen/dp_5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/riv_cover"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="9dp"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="18sp"
|
||||
tools:text="@string/layout_activity_family_home_01" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@mipmap/ic_family_id"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/color_E6E6E6"
|
||||
android:textSize="12sp"
|
||||
tools:text="@string/layout_activity_family_home_02" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_member_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:drawableStart="@mipmap/ic_family_member_count"
|
||||
android:drawablePadding="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/color_E6E6E6"
|
||||
android:textSize="12sp"
|
||||
tools:text="@string/layout_activity_family_home_03" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.chwl.library.widget.DrawableCenterTextView
|
||||
android:id="@+id/tv_family_manage"
|
||||
android:layout_width="73dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:background="@drawable/bg_family_manage"
|
||||
android:drawableStart="@drawable/ic_family_manage"
|
||||
android:gravity="center"
|
||||
android:text="@string/family_manage"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="11sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</com.chwl.app.ui.widget.RectLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_my_family_currency"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/family_my_currency"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_my_family_currency"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
tools:text="@string/family_currency_count"
|
||||
android:textColor="#39EBDF"
|
||||
android:textSize="13sp"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/common_ic_more_arrow" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_patriarch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<com.chwl.app.common.widget.CircleImageView
|
||||
android:id="@+id/civ_patriarch_avatar"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
android:text="@string/family_my_currency"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_patriarch_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableEnd="@drawable/ic_patriarch_tag"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="15sp"
|
||||
tools:text="@string/layout_activity_family_home_04" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/common_ic_more_arrow" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_games"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:text="@string/family_games"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:background="@color/color_F5F5F5" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_family_game_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:layout_marginTop="13dp"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_15" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_member"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_family_member_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentStart="true"
|
||||
tools:text="@string/family_member_title"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_all_member"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:text="@string/family_all_member"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:drawableEnd="@mipmap/common_ic_more_arrow"
|
||||
android:drawablePadding="6dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:background="@color/color_F5F5F5" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_family_member_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:layout_marginTop="11dp"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_15" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_family_group_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_15"
|
||||
tools:text="@string/family_group_title"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_create_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_family_group_create"
|
||||
android:drawablePadding="@dimen/dp_5"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:text="@string/family_group_create"
|
||||
android:textColor="@color/color_FF3852"
|
||||
android:textSize="15sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:background="@color/color_F1F1F1" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_family_group_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never"
|
||||
android:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_no_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/icon_common_failure" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/family_no_group_hint"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</com.chwl.app.common.widget.StatusLayout>
|
||||
|
||||
<com.chwl.library.widget.DrawableCenterTextView
|
||||
android:id="@+id/rl_join_family"
|
||||
android:layout_width="196dp"
|
||||
android:layout_height="45dp"
|
||||
android:background="@drawable/bg_binding_button"
|
||||
android:gravity="center"
|
||||
android:text="@string/family_join_family"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:drawableStart="@mipmap/ic_join_family"
|
||||
android:drawablePadding="7dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
@@ -1,146 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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/color_F5F5F5"
|
||||
android:orientation="vertical"
|
||||
tools:context=".family.view.activity.FamilyInfoActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_avatar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/family_avatar_hint"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/riv_family_cover"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:riv_corner_radius="@dimen/dp_5" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/family_name_hint"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_family_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="15sp"
|
||||
tools:text="@string/layout_activity_family_info_01" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:background="@color/color_F5F5F5" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@color/color_white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingRight="@dimen/dp_15">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/family_join_valid_hint"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.chwl.library.widget.IOSSwitchView
|
||||
android:id="@+id/sv_identity_check"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_marginRight="6dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_family_disband"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:background="@drawable/shape_white_20dp_round"
|
||||
android:gravity="center"
|
||||
android:text="@string/family_disband"
|
||||
android:textColor="@color/color_FF1E1E"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/color_F1F1F1"
|
||||
tools:context=".family.view.activity.FamilyListActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.chwl.app.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
tools:listItem="@layout/item_family_list"/>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</com.chwl.app.common.widget.StatusLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".family.view.activity.FamilyMemberListActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/color_F5F5F5"/>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="49dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_search"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_weight="1.0"
|
||||
android:background="@drawable/bg_family_member_search_edit"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:src="@mipmap/ic_main_search" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/family_search_member_hint"
|
||||
android:maxLength="20"
|
||||
android:text=""
|
||||
android:textColor="@color/text_color_primary"
|
||||
android:textColorHint="@color/text_color_secondary"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:paddingRight="@dimen/dp_15"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:backgroundTint="@color/color_F5F5F5"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/family_member_label"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_member_count"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:gravity="right"
|
||||
tools:text="@string/family_member_label2"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="12sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.chwl.app.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_member"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</com.chwl.app.common.widget.StatusLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/color_F5F5F5"
|
||||
tools:context=".family.view.activity.FamilyManageActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_family_manage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".family.view.activity.FamilyMemberCurrencyActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_family_currency"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@@ -1,95 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".family.view.activity.FamilyMemberSearchActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center|start"
|
||||
android:background="@color/transparent"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@mipmap/common_ic_back" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="29dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_weight="1.0"
|
||||
android:background="@drawable/bg_search_edit"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/search_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:src="@mipmap/icon_little_search" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_edit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="@string/family_search_member_hint"
|
||||
android:inputType="text"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:text=""
|
||||
android:textColor="@color/text_color_primary"
|
||||
android:textColorHint="@color/text_color_secondary"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_clear_text"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:src="@mipmap/ic_text_clear" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/search"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.chwl.app.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listItem="@layout/item_family_list">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
</com.chwl.app.common.widget.StatusLayout>
|
||||
</LinearLayout>
|
@@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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/color_F5F5F5"
|
||||
android:orientation="vertical"
|
||||
tools:context=".family.view.activity.FamilyPlazaActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/srl_refresh_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.chwl.app.ui.widget.RectLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hw_ratio="0.57">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/banner_family_plaza" />
|
||||
|
||||
</com.chwl.app.ui.widget.RectLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_family_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/family_weekly_rank_board"
|
||||
android:textColor="@color/color_1A1A1A"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/color_F1F1F1" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_get_more"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:background="@drawable/bg_main_get_more"
|
||||
android:gravity="center"
|
||||
android:text="@string/get_more"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_15" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</LinearLayout>
|
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".family.view.activity.FamilySearchActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center|start"
|
||||
android:background="@color/transparent"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/arrow_left" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="29dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_weight="1.0"
|
||||
android:background="@drawable/bg_search_edit"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/search_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:src="@mipmap/icon_little_search" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_edit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="@string/family_search_hint"
|
||||
android:inputType="text"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:text=""
|
||||
android:textColor="@color/text_color_primary"
|
||||
android:textColorHint="@color/text_color_secondary"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_clear_text"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:src="@mipmap/ic_text_clear" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/search"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.chwl.app.common.widget.StatusLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:listItem="@layout/item_family_list">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
</com.chwl.app.common.widget.StatusLayout>
|
||||
</LinearLayout>
|
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".family.view.activity.FamilySelectFriendActivity" >
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<com.chwl.app.ui.widget.magicindicator.MagicIndicator
|
||||
android:id="@+id/view_indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginHorizontal="@dimen/dp_40"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/common_first_bg_color"
|
||||
tools:context=".family.view.activity.FamilyTextInputActivity">
|
||||
|
||||
<com.chwl.app.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/common_divider_color" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:inputType="text"
|
||||
android:hint="@string/family_name_hint"
|
||||
android:maxLength="15"
|
||||
android:maxLines="1"
|
||||
android:background="@color/white"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:text=""
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColorHint="@color/color_999999"
|
||||
android:textSize="13sp" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user