Commit 4d6e9821 authored by jianglx's avatar jianglx

修改订单倒计时,修改活动规则,修改我的推广

parent 9dcedc84
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
flavorDimensions "default" flavorDimensions "default"
versionCode 148 versionCode 150
versionName "1.4.8" versionName "1.5.0"
multiDexEnabled true multiDexEnabled true
ndk { ndk {
......
...@@ -93,6 +93,8 @@ public class ApiConfig { ...@@ -93,6 +93,8 @@ public class ApiConfig {
public static String HTTP_URL_CONSUME_LIST = RvFrameConfig.HOST + "/api/admin/walletDetail/page"; public static String HTTP_URL_CONSUME_LIST = RvFrameConfig.HOST + "/api/admin/walletDetail/page";
public static String HTTP_URL_GROUP_INCOME = RvFrameConfig.HOST + "/api/admin/team/teams" ;
/** /**
* 用户收益 * 用户收益
*/ */
......
package com.rv.home.rv.module.ui.main.home.order.adapter; package com.rv.home.rv.module.ui.main.home.order.adapter;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -55,10 +56,10 @@ public class ForPaymentAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity ...@@ -55,10 +56,10 @@ public class ForPaymentAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity
helper.setText(R.id.tv_order_state, mContext.getString(R.string.rv_order_for_payment)); helper.setText(R.id.tv_order_state, mContext.getString(R.string.rv_order_for_payment));
String icon =""; String icon = "";
if (!TextUtils.isEmpty(dataBean.getCoverPic())){ if (!TextUtils.isEmpty(dataBean.getCoverPic())) {
icon = dataBean.getCoverPic(); icon = dataBean.getCoverPic();
}else { } else {
icon = dataBean.getIcon(); icon = dataBean.getIcon();
} }
helper.loadRoundImage(mContext, icon, (ImageView) helper.getView(R.id.iv_goods), 8); helper.loadRoundImage(mContext, icon, (ImageView) helper.getView(R.id.iv_goods), 8);
...@@ -136,7 +137,7 @@ public class ForPaymentAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity ...@@ -136,7 +137,7 @@ public class ForPaymentAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity
} }
} else { } else {
helper.setText(R.id.tv_order_state, mContext.getString(R.string.rv_order_for_payment)); helper.setText(R.id.tv_order_state, mContext.getString(R.string.rv_order_for_payment));
((MyTimerView) helper.itemView.findViewById(R.id.tv_remain_time)).setTime(effTime, date.getTime(), timerListener); ((MyTimerView) helper.itemView.findViewById(R.id.tv_remain_time)).setTime(effTime, date.getTime(), helper, timerListener);
} }
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -153,8 +154,16 @@ public class ForPaymentAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity ...@@ -153,8 +154,16 @@ public class ForPaymentAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity
public MyTimerView.TimerListener timerListener = new MyTimerView.TimerListener() { public MyTimerView.TimerListener timerListener = new MyTimerView.TimerListener() {
@Override @Override
public void onTimeFinish() { public void onTimeFinish(RecyclerView.ViewHolder holder) {
if (holder != null) {
if(getData().size() == 1){
getData().remove(holder.getAdapterPosition());
notifyDataSetChanged(); notifyDataSetChanged();
}else{
getData().remove(holder.getAdapterPosition());
notifyItemRemoved(holder.getAdapterPosition());
}
}
} }
}; };
} }
package com.rv.home.rv.module.ui.main.home.order.adapter; package com.rv.home.rv.module.ui.main.home.order.adapter;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -48,10 +49,10 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, ...@@ -48,10 +49,10 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity,
if (dataBean.getOrderRentVehicleDetail() != null && dataBean.getOrderRentVehicleDetail().getStart_city_name() != null) { if (dataBean.getOrderRentVehicleDetail() != null && dataBean.getOrderRentVehicleDetail().getStart_city_name() != null) {
helper.setText(R.id.tv_city, dataBean.getOrderRentVehicleDetail().getStart_city_name()); helper.setText(R.id.tv_city, dataBean.getOrderRentVehicleDetail().getStart_city_name());
} }
String icon =""; String icon = "";
if (!TextUtils.isEmpty(dataBean.getCoverPic())){ if (!TextUtils.isEmpty(dataBean.getCoverPic())) {
icon = dataBean.getCoverPic(); icon = dataBean.getCoverPic();
}else { } else {
icon = dataBean.getIcon(); icon = dataBean.getIcon();
} }
helper.loadRoundImage(mContext, icon, (ImageView) helper.getView(R.id.iv_goods), 8); helper.loadRoundImage(mContext, icon, (ImageView) helper.getView(R.id.iv_goods), 8);
...@@ -185,17 +186,17 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, ...@@ -185,17 +186,17 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity,
case TYPE_TO_MEMBER: case TYPE_TO_MEMBER:
OrderListBean.DataBeanX.DataBean dataBean3 = (OrderListBean.DataBeanX.DataBean) item; OrderListBean.DataBeanX.DataBean dataBean3 = (OrderListBean.DataBeanX.DataBean) item;
if (dataBean3 ==null){ if (dataBean3 == null) {
return; return;
} }
if (dataBean3.getOrderMemberDetail() ==null){ if (dataBean3.getOrderMemberDetail() == null) {
return; return;
} }
helper.setText(R.id.tv_order_time, String.format("%1$s%2$s", mContext.getString(R.string.rv_order_time), dataBean3.getCrtTime())); helper.setText(R.id.tv_order_time, String.format("%1$s%2$s", mContext.getString(R.string.rv_order_time), dataBean3.getCrtTime()));
helper.loadRoundImage(mContext, dataBean3.getPicture(), (ImageView) helper.getView(R.id.iv_goods), 8); helper.loadRoundImage(mContext, dataBean3.getPicture(), (ImageView) helper.getView(R.id.iv_goods), 8);
helper.setText(R.id.tv_name, dataBean3.getName()); helper.setText(R.id.tv_name, dataBean3.getName());
helper.setText(R.id.tv_content,dataBean3.getOrderMemberDetail().getContent() ); helper.setText(R.id.tv_content, dataBean3.getOrderMemberDetail().getContent());
helper.setText(R.id.tv_price, String.format("¥%1$s", dataBean3.getRealAmount())); helper.setText(R.id.tv_price, String.format("¥%1$s", dataBean3.getRealAmount()));
/** /**
...@@ -267,7 +268,7 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, ...@@ -267,7 +268,7 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity,
} }
} else { } else {
helper.setText(R.id.tv_order_state, mContext.getString(R.string.rv_order_for_payment)); helper.setText(R.id.tv_order_state, mContext.getString(R.string.rv_order_for_payment));
((MyTimerView) helper.itemView.findViewById(R.id.tv_remain_time)).setTime(effTime, date.getTime(), timerListener); ((MyTimerView) helper.itemView.findViewById(R.id.tv_remain_time)).setTime(effTime, date.getTime(), helper, timerListener);
} }
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -278,8 +279,16 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, ...@@ -278,8 +279,16 @@ public class OrderListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity,
public MyTimerView.TimerListener timerListener = new MyTimerView.TimerListener() { public MyTimerView.TimerListener timerListener = new MyTimerView.TimerListener() {
@Override @Override
public void onTimeFinish() { public void onTimeFinish(RecyclerView.ViewHolder holder) {
if (holder != null) {
if(getData().size() == 1){
getData().remove(holder.getAdapterPosition());
notifyDataSetChanged(); notifyDataSetChanged();
}else{
getData().remove(holder.getAdapterPosition());
notifyItemRemoved(holder.getAdapterPosition());
}
}
} }
}; };
} }
...@@ -4,10 +4,12 @@ import android.content.Context; ...@@ -4,10 +4,12 @@ import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import com.rv.home.rv.module.ui.main.home.order.bean.OrderListBean;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
...@@ -17,6 +19,7 @@ public class MyTimerView extends TextView { ...@@ -17,6 +19,7 @@ public class MyTimerView extends TextView {
private long crTime; private long crTime;
private Timer timer; private Timer timer;
private TimerListener mListener; private TimerListener mListener;
private RecyclerView.ViewHolder holder;
public MyTimerView(Context context, AttributeSet attrs) { public MyTimerView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
...@@ -29,10 +32,11 @@ public class MyTimerView extends TextView { ...@@ -29,10 +32,11 @@ public class MyTimerView extends TextView {
* 创建时间 * 创建时间
* @param listener * @param listener
*/ */
public void setTime(long efftiveTime, long crTime, TimerListener listener) { public void setTime(long efftiveTime, long crTime, RecyclerView.ViewHolder holder, TimerListener listener) {
this.efftiveTime = efftiveTime; this.efftiveTime = efftiveTime;
this.crTime = crTime; this.crTime = crTime;
this.mListener = listener; this.mListener = listener;
this.holder = holder;
showEffTime(); showEffTime();
startTimer(); startTimer();
} }
...@@ -69,7 +73,7 @@ public class MyTimerView extends TextView { ...@@ -69,7 +73,7 @@ public class MyTimerView extends TextView {
setVisibility(VISIBLE); setVisibility(VISIBLE);
} else { } else {
if (mListener != null) { if (mListener != null) {
mListener.onTimeFinish(); mListener.onTimeFinish(this.holder);
} }
setVisibility(GONE); setVisibility(GONE);
if (timer != null) { if (timer != null) {
...@@ -105,16 +109,15 @@ public class MyTimerView extends TextView { ...@@ -105,16 +109,15 @@ public class MyTimerView extends TextView {
*/ */
public void startTimer() { public void startTimer() {
timer = new Timer(); timer = new Timer();
timer.schedule(new RemindTask(), 0, 1000); timer.schedule(schedule, 0, 1000);
} }
class RemindTask extends TimerTask { private TimerTask schedule = new TimerTask() {
@Override @Override
public void run() { public void run() {
handler.sendEmptyMessage(0); handler.sendEmptyMessage(0);
} }
} };
private Handler handler = new Handler(Looper.getMainLooper()) { private Handler handler = new Handler(Looper.getMainLooper()) {
@Override @Override
...@@ -124,7 +127,7 @@ public class MyTimerView extends TextView { ...@@ -124,7 +127,7 @@ public class MyTimerView extends TextView {
}; };
public interface TimerListener { public interface TimerListener {
void onTimeFinish(); void onTimeFinish(RecyclerView.ViewHolder holder);
} }
} }
...@@ -81,6 +81,9 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -81,6 +81,9 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
private String targetUserId; private String targetUserId;
private String targetName; private String targetName;
private int startPosition;
private int endPosition;
private String[] recordPermissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE}; private String[] recordPermissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE};
private String[] callPermissions = {Manifest.permission.RECORD_AUDIO, Manifest.permission.CALL_PHONE, Manifest.permission.CAMERA}; private String[] callPermissions = {Manifest.permission.RECORD_AUDIO, Manifest.permission.CALL_PHONE, Manifest.permission.CAMERA};
...@@ -243,6 +246,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -243,6 +246,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
@Override @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent); super.loadData(savedInstanceState, intent);
startPosition = ((ChatPresenterImp) presenter).getDbService().getPages(targetUserId);
getData(); getData();
} }
...@@ -377,7 +381,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -377,7 +381,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
mInputManager.hideSoftInputFromWindow(chatEdit.getApplicationWindowToken(), 0); mInputManager.hideSoftInputFromWindow(chatEdit.getApplicationWindowToken(), 0);
} }
private void openPhotoDialog(){ private void openPhotoDialog() {
Dialog bottomDialog = new Dialog(this, R.style.BottomDialog); Dialog bottomDialog = new Dialog(this, R.style.BottomDialog);
View contentView = LayoutInflater.from(this).inflate(R.layout.dialog_select_media, null); View contentView = LayoutInflater.from(this).inflate(R.layout.dialog_select_media, null);
bottomDialog.setContentView(contentView); bottomDialog.setContentView(contentView);
...@@ -499,6 +503,13 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -499,6 +503,13 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
} }
private void getData() { private void getData() {
// if (startPosition < 20) {
// endPosition = 1;
// } else {
// endPosition = startPosition - startPosition % 10 - 10;
// }
// if (totalPages > 0) {
List<ChatMessage> lists = ((ChatPresenterImp) presenter).getDbService().getAllMessage(targetUserId); List<ChatMessage> lists = ((ChatPresenterImp) presenter).getDbService().getAllMessage(targetUserId);
if (lists != null) { if (lists != null) {
messages.clear(); messages.clear();
...@@ -508,6 +519,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -508,6 +519,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
recycleContent.smoothScrollToPosition(messages.size() - 1); recycleContent.smoothScrollToPosition(messages.size() - 1);
} }
} }
// }
} }
private TextWatcher watcher = new TextWatcher() { private TextWatcher watcher = new TextWatcher() {
......
...@@ -8,6 +8,7 @@ import android.os.IBinder; ...@@ -8,6 +8,7 @@ import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.ruiwenliu.wrapper.MessageEventRemoteLogin;
import com.rv.im.broadcast.MessageReceiver; import com.rv.im.broadcast.MessageReceiver;
import com.rv.im.db.table.ChatMessage; import com.rv.im.db.table.ChatMessage;
import com.rv.im.enums.CallTypeEnum; import com.rv.im.enums.CallTypeEnum;
...@@ -85,6 +86,7 @@ public class ImService extends Service { ...@@ -85,6 +86,7 @@ public class ImService extends Service {
Log.e(TAG, "连接异常==" + e.getMessage()); Log.e(TAG, "连接异常==" + e.getMessage());
if (e.getMessage().contains("conflict")) { if (e.getMessage().contains("conflict")) {
Log.e(TAG, "连接异常==被挤下线了"); Log.e(TAG, "连接异常==被挤下线了");
EventBus.getDefault().post(new MessageEventRemoteLogin());
} else { } else {
init(); init();
} }
...@@ -167,90 +169,6 @@ public class ImService extends Service { ...@@ -167,90 +169,6 @@ public class ImService extends Service {
public void getLastChatHistory() { public void getLastChatHistory() {
// Map<String, String> params = new HashMap();
// params.put("access_token", ImSetting.getImToken());
// long syncTimeLen = PreferenceUtils.getLong(ImSetting.getContext(), Constants.OFFLINE_TIME + mLoginUserId, 0);
// params.put("startTime", String.valueOf(syncTimeLen));
//
//
// OkGoUtil
//
// AppConfig appConfig = (AppConfig) RvCache.getInstance(getApplicationContext()).get(CacheEnum.IM_CONFIG);
// OkGoUtil.postJson(appConfig.GET_LAST_CHAT_LIST, params, new StringCallback() {
// @Override
// public void onSuccess(Response<String> response) {
// String string = response.body();
//
// }
// });
// new.url(CoreManager.requireConfig(this).GET_LAST_CHAT_LIST)
// .params(params)
// .build()
// .execute(new ListCallback<LastChatHistoryList>(LastChatHistoryList.class) {
// @Override
// public void onResponse(ArrayResult<LastChatHistoryList> result) {
// if (result.getResultCode() == 1 && result.getData() != null) {
// final List<LastChatHistoryList> data = result.getData();
// new Thread(new Runnable() {
// @Override
// public void run() {
// for (int i = 0; i < data.size(); i++) {
// LastChatHistoryList mLastChatHistoryList = data.get(i);
//
// if (mLastChatHistoryList.getIsRoom() == 1) {// 群组消息
// // 取出该群组最后一条消息
// ChatMessage mLocalLastMessage = ChatMessageDao.getInstance().getLastChatMessage(mLoginUserId, mLastChatHistoryList.getJid());
// if (mLocalLastMessage == null
// || mLocalLastMessage.getPacketId().equals(mLastChatHistoryList.getMessageId())) {
// // 最后一条消息为空(代表本地为空)
// // || 最后一条消息的msgId==服务端记录的该群组最后一条消息msgId(代表离线期间无消息产生 理论上服务端这个情况服务端是不会返回的) 不需要生成任务
// } else {
// // 生成一条群组漫游任务,存入任务表
// MsgRoamTask mMsgRoamTask = new MsgRoamTask();
// mMsgRoamTask.setTaskId(System.currentTimeMillis());
// mMsgRoamTask.setOwnerId(mLoginUserId);
// mMsgRoamTask.setUserId(mLastChatHistoryList.getJid());
// mMsgRoamTask.setStartTime(mLocalLastMessage.getTimeSend());
// mMsgRoamTask.setStartMsgId(mLocalLastMessage.getPacketId());
// MsgRoamTaskDao.getInstance().createMsgRoamTask(mMsgRoamTask);
// }
// }
// // 更新朋友表部分字段,用于显示
// String str;
// if (mLastChatHistoryList.getIsEncrypt() == 1) {// 需要解密
// String content = mLastChatHistoryList.getContent().replaceAll("\n", "");
// String decryptKey = Md5Util.toMD5(AppConfig.apiKey + mLastChatHistoryList.getTimeSend() + mLastChatHistoryList.getMessageId());
// try {
// str = DES.decryptDES(content, decryptKey);
// } catch (Exception e) {
// str = mLastChatHistoryList.getContent();
// e.printStackTrace();
// }
// } else {
// str = mLastChatHistoryList.getContent();
// }
//
// FriendDao.getInstance().updateApartDownloadTime(mLastChatHistoryList.getUserId(), mLastChatHistoryList.getJid(),
// str, mLastChatHistoryList.getType(), mLastChatHistoryList.getTimeSend(),
// mLastChatHistoryList.getIsRoom(), mLastChatHistoryList.getFrom(), mLastChatHistoryList.getFromUserName(),
// mLastChatHistoryList.getToUserName());
// }
// MsgBroadcast.broadcastMsgUiUpdate(MyApplication.getContext());
// // 以上任务生成之后,在通知XMPP加入群组 获取群组离线消息
// joinExistGroup();
// }
// }).start();
// } else {// 数据异常,也需要调用XMPP加入群组
// joinExistGroup();
// }
// }
//
// @Override
// public void onError(Call call, Exception e) {
// // 同上
// joinExistGroup();
// }
// });
} }
......
...@@ -155,7 +155,7 @@ public class CustomerDao { ...@@ -155,7 +155,7 @@ public class CustomerDao {
return false; return false;
} }
try { try {
List<Customer> lists = dao.queryForEq("id", customer.getId()); List<Customer> lists = dao.queryForEq("customerId", customer.getCustomerId());
return lists == null ? false : lists.size() == 0 ? false : true; return lists == null ? false : lists.size() == 0 ? false : true;
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
......
package com.rv.im.db.dao; package com.rv.im.db.dao;
import android.content.Context; import android.content.Context;
import android.database.Cursor;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao; import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager; import com.j256.ormlite.dao.DaoManager;
import com.j256.ormlite.dao.GenericRawResults;
import com.rv.im.db.SQLiteHelper; import com.rv.im.db.SQLiteHelper;
import com.rv.im.db.table.ChatMessage; import com.rv.im.db.table.ChatMessage;
import com.rv.im.enums.MessageStatusEnum; import com.rv.im.enums.MessageStatusEnum;
...@@ -18,15 +21,15 @@ import java.util.List; ...@@ -18,15 +21,15 @@ import java.util.List;
public class MessageDao { public class MessageDao {
private static final String TAG = MessageDao.class.getSimpleName(); private static final String TAG = MessageDao.class.getSimpleName();
private static MessageDao instance = null;
public Dao<ChatMessage, Integer> dao; public Dao<ChatMessage, Integer> dao;
// private SQLiteHelper mHelper;
private OrmLiteSqliteOpenHelper mHelper;
private Context mContext; private Context mContext;
public MessageDao(Context context) { public MessageDao(Context context) {
try { try {
this.mContext = context; this.mContext = context;
// mHelper = OpenHelperManager.getHelper(mContext, SQLiteHelper.class); mHelper = SQLiteHelper.getInstance(context);
dao = DaoManager.createDao(SQLiteHelper.getInstance(context).getConnectionSource(), ChatMessage.class); dao = DaoManager.createDao(SQLiteHelper.getInstance(context).getConnectionSource(), ChatMessage.class);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -37,17 +40,6 @@ public class MessageDao { ...@@ -37,17 +40,6 @@ public class MessageDao {
return new MessageDao(context); return new MessageDao(context);
} }
// public static final MessageDao getInstance(Context context) {
// if (instance == null) {
// synchronized (MessageDao.class) {
// if (instance == null) {
// instance = new MessageDao(context);
// }
// }
// }
// return instance;
// }
@Override @Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
super.finalize(); super.finalize();
...@@ -55,6 +47,14 @@ public class MessageDao { ...@@ -55,6 +47,14 @@ public class MessageDao {
} }
public int getPages(String userId) {
String sql_page = "select count(*) from tb_message where fromUserId=? or toUserId=?";
Cursor cursor;
cursor = mHelper.getReadableDatabase().rawQuery(sql_page, new String[]{userId, userId});
cursor.moveToLast();
return cursor.getInt(0);
}
/******* /*******
* 插入消息 * 插入消息
* @param message * @param message
...@@ -141,8 +141,9 @@ public class MessageDao { ...@@ -141,8 +141,9 @@ public class MessageDao {
} }
List<ChatMessage> chatMessages = null; List<ChatMessage> chatMessages = null;
try { try {
chatMessages = dao.queryBuilder().orderBy("timeReceive", false).where(). chatMessages = dao.queryBuilder().orderBy("timeSend", true)
eq("fromUserId", targetId) .where()
.eq("fromUserId", targetId)
.or() .or()
.eq("toUserId", targetId) .eq("toUserId", targetId)
.query(); .query();
...@@ -152,6 +153,7 @@ public class MessageDao { ...@@ -152,6 +153,7 @@ public class MessageDao {
return chatMessages; return chatMessages;
} }
public void setMsgSuccess(String receiptId) { public void setMsgSuccess(String receiptId) {
try { try {
List<ChatMessage> chatMessages = dao.queryBuilder().orderBy("timeSend", false).where().eq("packId", receiptId).query(); List<ChatMessage> chatMessages = dao.queryBuilder().orderBy("timeSend", false).where().eq("packId", receiptId).query();
......
...@@ -23,7 +23,7 @@ public class ChatMessageServiceImp implements IChatMessageService { ...@@ -23,7 +23,7 @@ public class ChatMessageServiceImp implements IChatMessageService {
public static ChatMessageServiceImp getInstance(Context context) { public static ChatMessageServiceImp getInstance(Context context) {
if (instance == null) { if (instance == null) {
instance = new ChatMessageServiceImp(context); instance = new ChatMessageServiceImp(context.getApplicationContext());
} }
return instance; return instance;
} }
...@@ -82,12 +82,17 @@ public class ChatMessageServiceImp implements IChatMessageService { ...@@ -82,12 +82,17 @@ public class ChatMessageServiceImp implements IChatMessageService {
@Override @Override
public void setMsgRead(String targetUserId) { public void setMsgRead(String targetUserId) {
dao.setMessageRead(targetUserId) ; dao.setMessageRead(targetUserId);
} }
@Override @Override
public void setVoicePlay(String packId) { public void setVoicePlay(String packId) {
dao.setVoicePlay(packId) ; dao.setVoicePlay(packId);
}
@Override
public int getPages(String userId) {
return dao.getPages(userId);
} }
public void release() { public void release() {
......
package com.rv.im.db.service; package com.rv.im.db.service;
import com.rv.im.db.table.ChatConversation;
import com.rv.im.db.table.ChatMessage; import com.rv.im.db.table.ChatMessage;
import java.util.List; import java.util.List;
...@@ -29,4 +28,6 @@ public interface IChatMessageService { ...@@ -29,4 +28,6 @@ public interface IChatMessageService {
void setVoicePlay(String packId); void setVoicePlay(String packId);
int getPages(String userId);
} }
package com.rv.im.db.table; package com.rv.im.db.table;
import com.google.gson.annotations.SerializedName;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;
import com.rv.im.enums.MessageTypeEnum; import com.rv.im.enums.MessageTypeEnum;
@DatabaseTable(tableName = "tb_customer") @DatabaseTable(tableName = "tb_customer")
public class Customer { public class Customer {
@DatabaseField(columnName = "_id", dataType = DataType.INTEGER, generatedId = true)
private int _id;
@SerializedName(value = "id")
@DatabaseField @DatabaseField
private String id; private int customerId;
@DatabaseField @DatabaseField
private String name; private String name;
@DatabaseField @DatabaseField
...@@ -19,16 +26,24 @@ public class Customer { ...@@ -19,16 +26,24 @@ public class Customer {
@DatabaseField @DatabaseField
private String createTime; private String createTime;
private String lastMsg ; private String lastMsg;
private long lastMsgTimes; private long lastMsgTimes;
public String getId() { public int get_id() {
return id; return _id;
}
public void set_id(int _id) {
this._id = _id;
}
public int getCustomerId() {
return customerId;
} }
public void setId(String id) { public void setCustomerId(int customerId) {
this.id = id; this.customerId = customerId;
} }
public String getName() { public String getName() {
......
...@@ -133,11 +133,9 @@ public class XmppConnectionManager { ...@@ -133,11 +133,9 @@ public class XmppConnectionManager {
msg.obj = e; msg.obj = e;
msg.sendToTarget(); msg.sendToTarget();
// EventBus.getDefault().post(new MessageEventBG(false));
if (e.getMessage().contains("conflict")) { if (e.getMessage().contains("conflict")) {
// XmppConnManager.getInstance().closeConnection(); // XmppConnManager.getInstance().closeConnection();
// 当message为END_DOCUMENT或Broken pipe时,正常的login以及reconnect都连接不上XMPP了,必须退出当前账号||退出程序 重进才可以,这里我们发送一个广播进行特殊的重连 // 当message为END_DOCUMENT或Broken pipe时,正常的login以及reconnect都连接不上XMPP了,必须退出当前账号||退出程序 重进才可以,这里我们发送一个广播进行特殊的重连
// mContext.sendBroadcast(new Intent(Constants.ACTIONS.ACTION_RECEIVE_REMOTE_LOGIN)); // mContext.sendBroadcast(new Intent(Constants.ACTIONS.ACTION_RECEIVE_REMOTE_LOGIN));
} else { } else {
// 切换网络之后,应该会立即回调到该方法内,网络改变监听才监听到网络改变, // 切换网络之后,应该会立即回调到该方法内,网络改变监听才监听到网络改变,
...@@ -265,19 +263,6 @@ public class XmppConnectionManager { ...@@ -265,19 +263,6 @@ public class XmppConnectionManager {
mContext.registerReceiver(mNetWorkChangeReceiver, intentFilter); mContext.registerReceiver(mNetWorkChangeReceiver, intentFilter);
} }
private boolean isGprsOrWifiConnected() {
if (!NetworkUtil.isNetworkAvailable(mContext)) {
logout();
} else {
if (!TextUtils.isEmpty(ImSetting.getUserId())
&& !TextUtils.isEmpty(ImSetting.getUserPassword()))
login(ImSetting.getUserId(), ImSetting.getUserPassword());
}
return true;
}
public synchronized void login(final String userId, final String password) { public synchronized void login(final String userId, final String password) {
if (mConnection.isAuthenticated()) { if (mConnection.isAuthenticated()) {
/*// 如果已经登陆 /*// 如果已经登陆
......
...@@ -2,45 +2,47 @@ package com.rv.share; ...@@ -2,45 +2,47 @@ package com.rv.share;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.support.v4.view.ViewPager;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.text.TextUtils;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ruiwenliu.wrapper.adapter.TabAdapter; import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.ruiwenliu.wrapper.weight.horizontal.GallerySnapHelper;
import com.ruiwenliu.wrapper.weight.horizontal.SpaceItemDecoration;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.home.rv.module.ui.main.home.adapter.OrderMenuAdapter; import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.rv.share.fragment.ActivationFragment; import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.share.fragment.InComeRecordFragment; import com.rv.home.rv.module.ApiConfig;
import com.rv.share.fragment.InviteFragment; import com.rv.share.adapter.PopularizeListAdapter;
import com.rv.share.bean.PopularizeBean;
import com.yuyife.okgo.OkGoUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.HashMap;
import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
public class PopularizeActivity extends BaseStatusActivity<CommonPresenter> { public class PopularizeActivity extends BaseStatusActivity<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
@BindView(R2.id.recyclerview) @BindView(R2.id.recyclerView)
RecyclerView recyclerView; RecyclerView recyclerView;
@BindView(R2.id.viewpager)
ViewPager viewpager;
private OrderMenuAdapter menuAdapter; @BindView(R2.id.refresh)
private TabAdapter mAdapter; SimpleRefreshLayout refresh;
private int menuPosition;
private PopularizeListAdapter listAdapter;
private int currentPage = 1;
private int pageSize = 10;
private int pageTotal = 0;
public static Intent getIntent(Context context, int position) { public static Intent getIntent(Context context) {
Intent intent = new Intent(context, PopularizeActivity.class); Intent intent = new Intent(context, PopularizeActivity.class);
intent.putExtra("position", position);
return intent; return intent;
} }
...@@ -52,73 +54,68 @@ public class PopularizeActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -52,73 +54,68 @@ public class PopularizeActivity extends BaseStatusActivity<CommonPresenter> {
@Override @Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle("我的推广"); titleView.setTitle("我的推广");
menuPosition = intent.getIntExtra("position", 0); recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
initRecyclerView(); listAdapter = new PopularizeListAdapter(new ArrayList<PopularizeBean.PopularizeItem>());
initViewpager(); refresh.setHeaderView(new SimpleRefreshView(this));
refresh.setOnSimpleRefreshListener(this);
recyclerView.setAdapter(listAdapter);
} }
@Override @Override
public void onShowResult(int requestType, BaseBean result) { protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent);
getData();
} }
/** private void getData() {
* 初始化RecyclerView
*/
private void initRecyclerView() {
recyclerView.setLayoutManager(new GridLayoutManager(mActivity, 3));
menuAdapter = new OrderMenuAdapter();
recyclerView.setAdapter(menuAdapter);
recyclerView.addItemDecoration(new SpaceItemDecoration(3));
GallerySnapHelper snapHelper = new GallerySnapHelper();
snapHelper.attachToRecyclerView(recyclerView);
List<String> list = new ArrayList<>();
String[] strs = getResources().getStringArray(R.array.popularize_list);
for (String a : strs) {
list.add(a);
}
menuAdapter.setNewData(list);
menuAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
menuAdapter.setSelectItem(position);
viewpager.setCurrentItem(position);
}
});
}
/** if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
* 初始化Viewpager Map<String, Object> header = new HashMap<>();
*/ header.put("Authorization", OkGoUtil.getToken());
private void initViewpager() {
mAdapter = new TabAdapter(getSupportFragmentManager(), getListFragment());
viewpager.setAdapter(mAdapter);
viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
Map<String, Object> map = new HashMap<>();
map.put("pageNo", currentPage);
map.put("pageSize", pageSize);
mPresenter.getData(RvFrameConfig.HOST, 0, ApiConfig.HTTP_URL_GROUP_INCOME, PopularizeBean.class, map, header, true);
}
} }
@Override @Override
public void onPageSelected(int position) { public void onShowResult(int requestType, BaseBean result) {
menuAdapter.setSelectItem(position); if (requestType == 0) {
PopularizeBean bean = (PopularizeBean) result;
if (bean.isRel() && bean.getData() != null && bean.getData().getUserTeamMemberBos() != null) {
if (currentPage == 1) {
pageTotal = bean.getData().getPageNum();
refresh.onRefreshComplete();
if (bean.getData().getUserTeamMemberBos().size() == 0) {
listAdapter.setEmptyView(getEmptyView(recyclerView, -1, getString(R.string.rv_select_not_data)));
listAdapter.notifyDataSetChanged();
} else {
listAdapter.setNewData(bean.getData().getUserTeamMemberBos());
}
} else {
listAdapter.addData(bean.getData().getUserTeamMemberBos());
listAdapter.loadMoreComplete();
}
}
}
} }
@Override @Override
public void onPageScrollStateChanged(int state) { public void onLoadMoreRequested() {
if (currentPage >= pageTotal) {
listAdapter.loadMoreEnd();
} else {
currentPage++;
getData();
} }
});
viewpager.setOffscreenPageLimit(mAdapter.getCount());
menuAdapter.setSelectItem(menuPosition);
viewpager.setCurrentItem(menuPosition);
} }
private List<BaseFragment> getListFragment() { @Override
List<BaseFragment> list = new ArrayList<>(); public void onRefresh() {
list.add(InComeRecordFragment.getInstance()); currentPage = 1;
list.add(InviteFragment.getInstance()); getData();
list.add(ActivationFragment.getInstance());
return list;
} }
} }
package com.rv.share; package com.rv.share;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Bundle; import android.os.Bundle;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
...@@ -71,16 +73,19 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> { ...@@ -71,16 +73,19 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
private void setView(PersonShareBean.PersonShareInfo data) { private void setView(PersonShareBean.PersonShareInfo data) {
Resources resource= getBaseContext().getResources();
ColorStateList csl= resource.getColorStateList(R.color.share_number_color);
SpannableStringBuilder spanBuilder = new SpannableStringBuilder(data.getTotalIncome() + "元"); SpannableStringBuilder spanBuilder = new SpannableStringBuilder(data.getTotalIncome() + "元");
spanBuilder.setSpan(new TextAppearanceSpan(null, Typeface.BOLD, DisplayUtil.sp2px(this, 18), null, null), 0, data.getTotalIncome().toString().length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); spanBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(this, 24), csl, null), 0, data.getTotalIncome().toString().length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tvAmount.setText(spanBuilder); tvAmount.setText(spanBuilder);
SpannableStringBuilder spanBuilder1 = new SpannableStringBuilder(data.getInviteNumber() + "人"); SpannableStringBuilder spanBuilder1 = new SpannableStringBuilder(data.getInviteNumber() + "人");
spanBuilder1.setSpan(new TextAppearanceSpan(null, Typeface.BOLD, DisplayUtil.sp2px(this, 18), null, null), 0, String.valueOf(data.getInviteNumber()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); spanBuilder1.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(this, 24), csl, null), 0, String.valueOf(data.getInviteNumber()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tvPersonInval.setText(spanBuilder1); tvPersonInval.setText(spanBuilder1);
SpannableStringBuilder spanBuilder2 = new SpannableStringBuilder(data.getActivatedNumber() + "人"); SpannableStringBuilder spanBuilder2 = new SpannableStringBuilder(data.getActivatedNumber() + "人");
spanBuilder2.setSpan(new TextAppearanceSpan(null, Typeface.BOLD, DisplayUtil.sp2px(this, 18), null, null), 0, String.valueOf(data.getActivatedNumber()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); spanBuilder2.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(this, 24), csl, null), 0, String.valueOf(data.getActivatedNumber()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tvPersonUse.setText(spanBuilder2); tvPersonUse.setText(spanBuilder2);
if (TextUtils.isEmpty(data.getLeaderHeadUrl()) && TextUtil.isEmpty(data.getLeaderUsername())) { if (TextUtils.isEmpty(data.getLeaderHeadUrl()) && TextUtil.isEmpty(data.getLeaderUsername())) {
((View) tvParentPhone.getParent().getParent()).setVisibility(View.INVISIBLE); ((View) tvParentPhone.getParent().getParent()).setVisibility(View.INVISIBLE);
...@@ -137,13 +142,13 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> { ...@@ -137,13 +142,13 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
} else if (id == R.id.tv_more) { } else if (id == R.id.tv_more) {
mPresenter.shareMore(shareUrl, "新人专享大礼包,快去领!", " "); mPresenter.shareMore(shareUrl, "新人专享大礼包,快去领!", " ");
} else if (id == R.id.tv_more_detail) { } else if (id == R.id.tv_more_detail) {
startActivity(PopularizeActivity.getIntent(getApplicationContext(), 0)); startActivity(PopularizeActivity.getIntent(getApplicationContext()));
} else if (id == R.id.ll_activation) { } else if (id == R.id.ll_activation) {
startActivity(PopularizeActivity.getIntent(getApplicationContext(), 2)); startActivity(PopularizeActivity.getIntent(getApplicationContext()));
} else if (id == R.id.ll_invite) { } else if (id == R.id.ll_invite) {
startActivity(PopularizeActivity.getIntent(getApplicationContext(), 1)); startActivity(PopularizeActivity.getIntent(getApplicationContext()));
} else if (id == R.id.ll_comein) { } else if (id == R.id.ll_comein) {
startActivity(PopularizeActivity.getIntent(getApplicationContext(), 0)); startActivity(PopularizeActivity.getIntent(getApplicationContext()));
} else if (id == R.id.tv_ruler) { } else if (id == R.id.tv_ruler) {
startActivity(new Intent(getApplicationContext(), ShareRulerActivity.class)); startActivity(new Intent(getApplicationContext(), ShareRulerActivity.class));
} }
......
package com.rv.share.adapter;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.base.utils.ui.image.round.RoundImageView;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.component.utils.DateUtils;
import com.rv.share.R;
import com.rv.share.bean.IncomeRecordsBean;
import com.rv.share.bean.PopularizeBean;
import java.util.List;
public class PopularizeListAdapter extends BaseQuickAdapter<PopularizeBean.PopularizeItem, BaseViewHolder> {
public PopularizeListAdapter(@Nullable List<PopularizeBean.PopularizeItem> data) {
super(R.layout.item_popularize_view, data);
}
@Override
protected void convert(BaseViewHolder helper, PopularizeBean.PopularizeItem item) {
helper.setText(R.id.tv_number, "" + (getData().indexOf(item) + 1));
if (!TextUtils.isEmpty(item.getHeadUrl())) {
GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), (RoundImageView) helper.itemView.findViewById(R.id.iv_header));
}
helper.setText(R.id.tv_name, !TextUtils.isEmpty(item.getRealName()) ? item.getRealName() : dealPhone(item.getUserName()));
helper.setText(R.id.tv_value, "共" + item.getIncome() + "元");
}
private String dealPhone(String name) {
if (!TextUtils.isEmpty(name)) {
if (name.length() == 11) {
return name.substring(0, 3) + "****" + name.substring(7, name.length());
}
}
return name;
}
}
package com.rv.share.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.math.BigDecimal;
import java.util.List;
public class PopularizeBean extends BaseBean {
private boolean rel;
private PopularizeList data;
public boolean isRel() {
return rel;
}
public void setRel(boolean rel) {
this.rel = rel;
}
public PopularizeList getData() {
return data;
}
public void setData(PopularizeList data) {
this.data = data;
}
public class PopularizeList {
private BigDecimal totalIncome;
private int pageNum ;
private int pageSize ;
private List<PopularizeItem> userTeamMemberBos ;
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public List<PopularizeItem> getUserTeamMemberBos() {
return userTeamMemberBos;
}
public void setUserTeamMemberBos(List<PopularizeItem> userTeamMemberBos) {
this.userTeamMemberBos = userTeamMemberBos;
}
}
public static class PopularizeItem {
private BigDecimal income;
private String nickName;
private String headUrl;
private String userName;
private String realName ;
private long userId;
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getHeadUrl() {
return headUrl;
}
public void setHeadUrl(String headUrl) {
this.headUrl = headUrl;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
}
}
...@@ -68,6 +68,23 @@ public class SharePresenter extends CommonPresenter { ...@@ -68,6 +68,23 @@ public class SharePresenter extends CommonPresenter {
} }
public void shareQQ(String mUrl, String mTitle, String mDescript) {
if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
}
UMImage image = new UMImage(getPresenterContext(), R.drawable.icon_share);
UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图
web.setDescription(mDescript);//描述
shareAction.setPlatform(SHARE_MEDIA.QQ)//传入平台
.withMedia(web);
shareAction.share();
}
/****** /******
* 分享地址 * 分享地址
*/ */
...@@ -150,7 +167,7 @@ public class SharePresenter extends CommonPresenter { ...@@ -150,7 +167,7 @@ public class SharePresenter extends CommonPresenter {
@Override @Override
public void qqShare() { public void qqShare() {
if (!TextUtil.isEmpty(mUrl)) { if (!TextUtil.isEmpty(mUrl)) {
// shareQQ(SHARE_MEDIA.QQ, mUrl); shareQQ(mUrl, mTitle, mDescript);
} }
} }
......
...@@ -104,18 +104,42 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -104,18 +104,42 @@ public class WebViewPresenter extends CommonPresenter {
} }
// /******
//// * 分享文件
//// * @param var1
//// * @param var2
//// */
//// private void shareQQ(SHARE_MEDIA var1, String var2) {
//// if (shareAction == null) {
//// shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
//// }
//// shareAction.setPlatform(var1)//传入平台
//// .withText(var2);//分享内容
//// shareAction.share();
//// }
/****** /******
* 分享文件 * 分享地址
* @param var1
* @param var2
*/ */
private void shareQQ(SHARE_MEDIA var1, String var2) { private void shareQQ() {
if (shareAction == null) { if (shareAction == null) {
shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener); shareAction = new ShareAction((Activity) getPresenterContext()).setCallback(shareListener);
} }
shareAction.setPlatform(var1)//传入平台 UMImage image;
.withText(var2);//分享内容 if (!TextUtils.isEmpty(mImgUrl)) {
image = new UMImage(getPresenterContext(), mImgUrl);
} else {
image = new UMImage(getPresenterContext(), R.drawable.icon_share);
}
UMWeb web = new UMWeb(mUrl);
web.setTitle(mTitle);//标题
web.setThumb(image); //缩略图
web.setDescription(mDescript);//描述
shareAction.setPlatform(SHARE_MEDIA.QQ)//传入平台
.withMedia(web);
shareAction.share(); shareAction.share();
} }
...@@ -187,7 +211,8 @@ public class WebViewPresenter extends CommonPresenter { ...@@ -187,7 +211,8 @@ public class WebViewPresenter extends CommonPresenter {
@Override @Override
public void qqShare() { public void qqShare() {
if (!TextUtil.isEmpty(mUrl)) { if (!TextUtil.isEmpty(mUrl)) {
shareQQ(SHARE_MEDIA.QQ, mUrl); // shareQQ(SHARE_MEDIA.QQ, mUrl);
shareQQ();
} }
} }
......
...@@ -155,7 +155,8 @@ public class ShareChoiceDialog implements View.OnClickListener { ...@@ -155,7 +155,8 @@ public class ShareChoiceDialog implements View.OnClickListener {
} }
public Builder setQQVisiable(boolean b) { public Builder setQQVisiable(boolean b) {
dialog.isShowQQ = false;
dialog.isShowQQ = b;
return this; return this;
} }
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="@color/colorMain"/>
<item android:state_focused="true" android:color="@color/colorMain"/>
<item android:color="@color/colorMain"/>
</selector>
\ No newline at end of file
...@@ -9,17 +9,19 @@ ...@@ -9,17 +9,19 @@
<include layout="@layout/common_line" /> <include layout="@layout/common_line" />
<android.support.v7.widget.RecyclerView <include layout="@layout/common_refresh" />
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWrite" />
<include layout="@layout/common_line" /> <!--<android.support.v7.widget.RecyclerView-->
<!--android:id="@+id/recyclerview"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="@color/colorWrite" />-->
<android.support.v4.view.ViewPager <!--<include layout="@layout/common_line" />-->
android:id="@+id/viewpager"
android:layout_width="match_parent" <!--<android.support.v4.view.ViewPager-->
android:layout_height="match_parent" /> <!--android:id="@+id/viewpager"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent" />-->
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -64,9 +64,7 @@ ...@@ -64,9 +64,7 @@
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="分享方式" android:text="分享方式"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_18" android:textSize="@dimen/text_18" />
android:textStyle="bold"
/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -93,8 +91,8 @@ ...@@ -93,8 +91,8 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:drawablePadding="@dimen/size_5"
android:drawableTop="@drawable/icon_share_wx_circle" android:drawableTop="@drawable/icon_share_wx_circle"
android:drawablePadding="@dimen/size_5"
android:gravity="center" android:gravity="center"
android:text="朋友圈" /> android:text="朋友圈" />
...@@ -114,9 +112,9 @@ ...@@ -114,9 +112,9 @@
android:id="@+id/tv_more" android:id="@+id/tv_more"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="@dimen/size_5"
android:layout_weight="1" android:layout_weight="1"
android:drawableTop="@drawable/icon_share_more" android:drawableTop="@drawable/icon_share_more"
android:drawablePadding="@dimen/size_5"
android:gravity="center" android:gravity="center"
android:text="更多" /> android:text="更多" />
...@@ -155,8 +153,7 @@ ...@@ -155,8 +153,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="我的推广" android:text="我的推广"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_18" android:textSize="@dimen/text_18" />
android:textStyle="bold"/>
<TextView <TextView
android:id="@+id/tv_more_detail" android:id="@+id/tv_more_detail"
...@@ -177,7 +174,7 @@ ...@@ -177,7 +174,7 @@
android:layout_marginBottom="@dimen/size_15" android:layout_marginBottom="@dimen/size_15"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:weightSum="3"> android:weightSum="2">
<LinearLayout <LinearLayout
android:id="@+id/ll_comein" android:id="@+id/ll_comein"
...@@ -219,13 +216,15 @@ ...@@ -219,13 +216,15 @@
android:id="@+id/tv_person_inval" android:id="@+id/tv_person_inval"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="0人" /> android:gravity="center"
/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="待激活" android:gravity="center"
android:text="我的团队"
android:textColor="@color/gray_707070" /> android:textColor="@color/gray_707070" />
</LinearLayout> </LinearLayout>
...@@ -233,7 +232,8 @@ ...@@ -233,7 +232,8 @@
<View <View
android:layout_width="0.1dp" android:layout_width="0.1dp"
android:layout_height="@dimen/size_50" android:layout_height="@dimen/size_50"
android:background="@color/tv_gr999999" /> android:background="@color/tv_gr999999"
android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/ll_activation" android:id="@+id/ll_activation"
...@@ -241,7 +241,8 @@ ...@@ -241,7 +241,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_person_use" android:id="@+id/tv_person_use"
...@@ -287,7 +288,7 @@ ...@@ -287,7 +288,7 @@
android:text="我的推广人" android:text="我的推广人"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="@dimen/text_15" android:textSize="@dimen/text_15"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_parent_phone" android:id="@+id/tv_parent_phone"
...@@ -296,7 +297,6 @@ ...@@ -296,7 +297,6 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:text="12345678910"
android:textColor="@color/tv_gr999999" android:textColor="@color/tv_gr999999"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
android:src="@drawable/banner_share_ruler_top" /> android:src="@drawable/banner_share_ruler_top" />
<TextView <TextView
android:visibility="gone"
android:layout_width="@dimen/size_80" android:layout_width="@dimen/size_80"
android:layout_height="@dimen/size_30" android:layout_height="@dimen/size_30"
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="@dimen/size_10"
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
android:textSize="@dimen/sp_16" /> android:textSize="@dimen/sp_16" />
<TextView <TextView
android:visibility="gone"
android:id="@+id/tv_ac_time" android:id="@+id/tv_ac_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_10" android:layout_marginRight="@dimen/size_10"
android:text=" 分享你的推广码或专属链接给您的好友,邀请好友下载进入APP体验并注册。在好友注册的时间开始算2个月,每当您的1位好友完成1次租车或房车游行程或购买会员并支付订单,您便可获得好友支付订单金额(不包括租车押金)的5%提成作为邀请奖励。您邀请下单的好友越多,您获得的奖励越多,奖励现金可提现。" android:text=" 分享你的邀请码或专属链接给您的好友,邀请好友下载并进入【滴房车】APP完成注册。每当您的1位好友完成1次租车或房车游行程或购买会员并支付订单,您即可获得好友支付订单金额(不包括租车押金)的3%提成作为邀请奖励。您邀请下单的好友越多,您获得的奖励越多,奖励现金可提现。"
android:textColor="#ff666666" android:textColor="#ff666666"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -165,7 +167,7 @@ ...@@ -165,7 +167,7 @@
android:layout_marginRight="@dimen/size_50" android:layout_marginRight="@dimen/size_50"
android:background="@drawable/bg_income_item" android:background="@drawable/bg_income_item"
android:gravity="center" android:gravity="center"
android:text="该好友成功支付订单并完成行程(2个月内)" /> android:text="该好友成功支付订单并完成行程" />
<ImageView <ImageView
android:layout_width="5dp" android:layout_width="5dp"
...@@ -183,7 +185,7 @@ ...@@ -183,7 +185,7 @@
android:layout_marginRight="@dimen/size_50" android:layout_marginRight="@dimen/size_50"
android:background="@drawable/bg_income_item" android:background="@drawable/bg_income_item"
android:gravity="center" android:gravity="center"
android:text="您获得邀请奖励:订单5%的提成" /> android:text="您获得邀请奖励:订单3%的提成" />
</LinearLayout> </LinearLayout>
...@@ -205,20 +207,21 @@ ...@@ -205,20 +207,21 @@
android:layout_marginLeft="@dimen/size_10" android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_10" android:layout_marginRight="@dimen/size_10"
android:text="1、满足下列条件的好友,可通过您分享的推广链接/码,领取的房车新人专享优惠券(券有效期15~60天):\n android:text="1、满足下列条件的好友,可通过您分享的邀请链接/码,领取的房车新人专享优惠券:\n
a、好友有下载APP;\n a、好友有下载APP;\n
b、好友为新用户并未进行过注册;\n b、好友为新用户并未进行过注册;\n
c、好友的当前账号中无滴房车新手券。\n c、好友的当前账号中无滴房车新手券。\n
\n \n
2、您的好友在注册后2个月内体验的房车,确认行程并完成支付,您可获得邀请奖励;奖励将在您的好友成功支付订单后24小时内到账。\n 2、在您登录的状态下,分享房车、旅游、营地、拍拍等APP内的分享,都有同等效果。\n
\n \n
3、拥有相同设备(手机)、账号、手机号、微信号、IP、银行卡或其他同理将视为同一用户(适用于您与您的好友),本活动仅对成功邀请好友完成并支付订单的用户发放邀请奖励。\n 3、您的好友在注册后,确定推荐人您后,您好友在APP进行付费操作,如租房车,确认行程并完成支付,您可获得对应的奖励;奖励将在您的好友成功支付订单后24小时内到账。\n
\n \n
4、您获得的现金奖励可以在我的钱包页面“我的—我的钱包—提现”中进行提现。\n 4、拥有相同设备(手机)、账号、手机号、微信号、IP、银行卡或其他同理将视为同一用户(适用于您与您的好友),本活动仅对成功邀请好友完成并支付订单的用户发放邀请奖励。\n
\n \n
5、针对违规骗取邀请奖励的行为,将不予发放邀请奖励、追回相关奖励或封停账号,并依法追究法律责任。\n 5、您获得的现金奖励可以在我的钱包页面“我的—我的钱包—提现”中进行提现。\n
\n \n
6、活动详情咨询:400-0369-369 " 6、针对违规骗取邀请奖励的行为,将不予发放邀请奖励、追回相关奖励或封停账号,并依法追究法律责任。 \n
7、活动详情咨询:400-0369-369 "
android:textColor="#ff666666" android:textColor="#ff666666"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/size_60"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:text="1"
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_16" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:background="@drawable/bg_income_item"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.base.utils.ui.image.round.RoundImageView
android:id="@+id/iv_header"
android:layout_width="@dimen/size_30"
android:layout_height="@dimen/size_30"
android:layout_marginLeft="@dimen/dp_10" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_5"
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_16" />
<TextView
android:id="@+id/tv_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:text="14sp" />
</LinearLayout>
</LinearLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment