Commit c1e243f8 authored by linfeng's avatar linfeng

Merge branch 'master-price-john' of http://113.105.137.151:22280/lify/rvapp into master-price

parents 8dee92f1 4b4a8ae9
...@@ -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 152 versionCode 153
versionName "1.5.2" versionName "1.5.3"
multiDexEnabled true multiDexEnabled true
......
...@@ -98,7 +98,7 @@ import cn.jpush.android.api.BasicPushNotificationBuilder; ...@@ -98,7 +98,7 @@ import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushInterface;
public class MainActivity extends BaseActivity<CommonPresenter> implements DownListenerManager.DownListener, ChatMessageListener,ImInitListenter { public class MainActivity extends BaseActivity<CommonPresenter> implements DownListenerManager.DownListener, ChatMessageListener, ImInitListenter {
private boolean hasGetVersionInfo = false; // 判断是否已经获取过版本信息 private boolean hasGetVersionInfo = false; // 判断是否已经获取过版本信息
...@@ -144,7 +144,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL ...@@ -144,7 +144,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
private boolean hasBindService = false; //是否已经绑定了服务 private boolean hasBindService = false; //是否已经绑定了服务
private ImService mService; // private ImService mService;
private String imToken; private String imToken;
...@@ -631,7 +631,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL ...@@ -631,7 +631,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
private ServiceConnection mConnection = new ServiceConnection() { private ServiceConnection mConnection = new ServiceConnection() {
@Override @Override
public void onServiceConnected(ComponentName name, IBinder service) { public void onServiceConnected(ComponentName name, IBinder service) {
mService = ((ImService.ImServiceBinder) service).getService(); // mService = ((ImService.ImServiceBinder) service).getService();
imServiceConnection = this; imServiceConnection = this;
} }
...@@ -639,7 +639,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL ...@@ -639,7 +639,7 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
public void onServiceDisconnected(ComponentName name) { public void onServiceDisconnected(ComponentName name) {
LogUtil.e("MainActivity", "onServiceDisconnected() called with: name = [" + name + "]"); LogUtil.e("MainActivity", "onServiceDisconnected() called with: name = [" + name + "]");
imServiceConnection = null; imServiceConnection = null;
mService = null; // mService = null;
} }
}; };
...@@ -647,11 +647,11 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL ...@@ -647,11 +647,11 @@ public class MainActivity extends BaseActivity<CommonPresenter> implements DownL
public void logout(MessageEventLogout bean) { public void logout(MessageEventLogout bean) {
hasBindService = false; hasBindService = false;
ImSetting.logout(); ImSetting.logout();
if (mService != null) { // if (mService != null) {
mService.logout(); // mService.logout();
unbindService(imServiceConnection); unbindService(imServiceConnection);
mService = null; // mService = null;
} // }
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
......
...@@ -14,6 +14,8 @@ public class AppCookie { ...@@ -14,6 +14,8 @@ public class AppCookie {
public final static String KEY_PRERENT_DAYS = "key_prerent_days" ; // 提前租车天数的key public final static String KEY_PRERENT_DAYS = "key_prerent_days" ; // 提前租车天数的key
public static final String OFFLINE_TIME = "offline_time";
private static SharedPreferences preferences; private static SharedPreferences preferences;
private static WeakReference<Context> weakReference = null; private static WeakReference<Context> weakReference = null;
......
...@@ -459,8 +459,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa ...@@ -459,8 +459,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements Observa
} }
if (DateUtils.formatDate20(begTime) > DateUtils.formatDate20("19:30")) { //如果当前时间大于 19:30,日期往后加一,时间改成早上8:00 if (DateUtils.formatDate20(begTime) > DateUtils.formatDate20("19:30")) { //如果当前时间大于 19:30,日期往后加一,时间改成早上8:00
begDate = MyUtils.getFetureDate(1) + " " + "08:00"; begDate = MyUtils.getFetureDate(1) + " " + "08:30";
endDate = MyUtils.getFetureDate(3) + " " + "08:00"; endDate = MyUtils.getFetureDate(3) + " " + "08:30";
} else { } else {
begDate = MyUtils.getFetureDate(0) + " " + begTime; begDate = MyUtils.getFetureDate(0) + " " + begTime;
endDate = MyUtils.getFetureDate(2) + " " + begTime; endDate = MyUtils.getFetureDate(2) + " " + begTime;
......
...@@ -7,7 +7,8 @@ import android.content.Intent; ...@@ -7,7 +7,8 @@ import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull; import android.os.Looper;
import android.os.Message;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
...@@ -33,6 +34,8 @@ import com.ruiwenliu.wrapper.base.BaseStatusActivity; ...@@ -33,6 +34,8 @@ import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.util.permission.RxPermission; import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.component.utils.CacheEnum; import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.RvCache; import com.rv.component.utils.RvCache;
import com.rv.im.adapter.ChatContentAdapter; import com.rv.im.adapter.ChatContentAdapter;
...@@ -42,7 +45,6 @@ import com.rv.im.audio_x.VoicePlayer; ...@@ -42,7 +45,6 @@ import com.rv.im.audio_x.VoicePlayer;
import com.rv.im.bean.User; import com.rv.im.bean.User;
import com.rv.im.db.service.ChatMessageServiceImp; import com.rv.im.db.service.ChatMessageServiceImp;
import com.rv.im.db.table.ChatMessage; import com.rv.im.db.table.ChatMessage;
import com.rv.im.db.table.Customer;
import com.rv.im.enums.MessageStatusEnum; import com.rv.im.enums.MessageStatusEnum;
import com.rv.im.enums.MessageTypeEnum; import com.rv.im.enums.MessageTypeEnum;
import com.rv.im.mucfile.RvDownManager; import com.rv.im.mucfile.RvDownManager;
...@@ -68,7 +70,7 @@ import java.util.Timer; ...@@ -68,7 +70,7 @@ import java.util.Timer;
import pub.devrel.easypermissions.AppSettingsDialog; import pub.devrel.easypermissions.AppSettingsDialog;
public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements IChatView, ChatMessageListener, View.OnClickListener, RecordListener { public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements IChatView, ChatMessageListener, View.OnClickListener, RecordListener, SimpleRefreshLayout.OnSimpleRefreshListener {
private ImageButton voiceImgBtn; private ImageButton voiceImgBtn;
private ImageButton ibKeyword; private ImageButton ibKeyword;
...@@ -78,6 +80,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -78,6 +80,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
private ImageButton ibPhoto; private ImageButton ibPhoto;
private Button sendBtn; private Button sendBtn;
private RecyclerView recycleContent; private RecyclerView recycleContent;
private SimpleRefreshLayout refreshLayout;
private ViewStub mChatFaceViewStub; private ViewStub mChatFaceViewStub;
private String mLoginUserId; private String mLoginUserId;
...@@ -95,9 +98,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -95,9 +98,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
private Timer timer; private Timer timer;
private RvImTimerTask timerTask; private RvImTimerTask timerTask;
private int startPosition;
private int endPosition;
private ChatContentAdapter.OnClickItemListener clickItemListener = new ChatContentAdapter.OnClickItemListener() { private ChatContentAdapter.OnClickItemListener clickItemListener = new ChatContentAdapter.OnClickItemListener() {
@Override @Override
public void onClick(int resId, ChatMessage message) { public void onClick(int resId, ChatMessage message) {
...@@ -271,7 +271,6 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -271,7 +271,6 @@ 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();
} }
...@@ -288,6 +287,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -288,6 +287,7 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
} }
private void initWidget() { private void initWidget() {
refreshLayout = findViewById(R.id.refresh);
voiceImgBtn = findViewById(R.id.voice_img_btn); voiceImgBtn = findViewById(R.id.voice_img_btn);
ibKeyword = findViewById(R.id.ib_keyword); ibKeyword = findViewById(R.id.ib_keyword);
chatEdit = findViewById(R.id.chat_edit); chatEdit = findViewById(R.id.chat_edit);
...@@ -295,24 +295,14 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -295,24 +295,14 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
emotionBtn = findViewById(R.id.emotion_btn); emotionBtn = findViewById(R.id.emotion_btn);
ibPhoto = findViewById(R.id.ib_photo); ibPhoto = findViewById(R.id.ib_photo);
sendBtn = findViewById(R.id.send_btn); sendBtn = findViewById(R.id.send_btn);
// chatToolsViewStub = findViewById(R.id.chat_tools_view_stub);
mChatFaceViewStub = findViewById(R.id.chat_face_view_stub); mChatFaceViewStub = findViewById(R.id.chat_face_view_stub);
recycleContent = findViewById(R.id.recycle_content); recycleContent = findViewById(R.id.recyclerView);
recycleContent.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); recycleContent.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recycleContent.setItemAnimator(new DefaultItemAnimator()); recycleContent.setItemAnimator(new DefaultItemAnimator());
adapter = new ChatContentAdapter(getApplicationContext(), mLoginUserId, messages, clickItemListener); adapter = new ChatContentAdapter(getApplicationContext(), mLoginUserId, messages, clickItemListener);
recycleContent.setAdapter(adapter); recycleContent.setAdapter(adapter);
recycleContent.addOnScrollListener(new RecyclerView.OnScrollListener() { refreshLayout.setHeaderView(new SimpleRefreshView(this));
@Override refreshLayout.setOnSimpleRefreshListener(this);
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
// super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
// super.onScrolled(recyclerView, dx, dy);
}
});
} }
private void initListener() { private void initListener() {
...@@ -550,24 +540,29 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -550,24 +540,29 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
timerTask.cancel(); timerTask.cancel();
} }
private long pullTime = 0L;
private void getData() { private void getData() {
List<ChatMessage> lists;
if (pullTime == 0L) { // 加载前20条
lists = ((ChatPresenterImp) presenter).getDbService().getFirstPageMessage(targetUserId);
} else {
lists = ((ChatPresenterImp) presenter).getDbService().loadMoreMessage(targetUserId, pullTime);
}
if (lists == null || lists.size() == 0) {
refreshLayout.setPullDownEnable(false);
return;
}
// if (startPosition < 20) { if (lists.size() < 20) {
// endPosition = 1; refreshLayout.setPullDownEnable(false);
// } else {
// endPosition = startPosition - startPosition % 10 - 10;
// }
// if (totalPages > 0) {
List<ChatMessage> lists = ((ChatPresenterImp) presenter).getDbService().getAllMessage(targetUserId);
if (lists != null) {
messages.clear();
messages.addAll(lists);
adapter.notifyDataSetChanged();
if (messages.size() > 0) {
recycleContent.smoothScrollToPosition(messages.size() - 1);
} }
messages.addAll(0, lists);
adapter.notifyDataSetChanged();
if (messages.size() > 0 && pullTime == 0L) {
recycleContent.smoothScrollToPosition(lists.size() - 1);
} }
// } pullTime = lists.get(0).getTimeSend();
} }
private TextWatcher watcher = new TextWatcher() { private TextWatcher watcher = new TextWatcher() {
...@@ -755,4 +750,20 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements ...@@ -755,4 +750,20 @@ public class ChatActivity extends BaseStatusActivity<CommonPresenter> implements
params.put("userId", targetUserId); params.put("userId", targetUserId);
mPresenter.getData(1, url, User.class, params, false); mPresenter.getData(1, url, User.class, params, false);
} }
@Override
public void onRefresh() {
handler.sendEmptyMessageDelayed(0, 1000);
}
private Handler handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (!isFinishing()) {
refreshLayout.onRefreshComplete();
getData();
}
}
};
} }
...@@ -8,7 +8,15 @@ import android.os.IBinder; ...@@ -8,7 +8,15 @@ import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.google.gson.Gson;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.utils.HttpUtils;
import com.ruiwenliu.wrapper.MessageEventRemoteLogin; import com.ruiwenliu.wrapper.MessageEventRemoteLogin;
import com.rv.component.utils.AppCookie;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.RvCache;
import com.rv.im.bean.LastChatHistoryListBean;
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;
...@@ -22,12 +30,17 @@ import com.rv.im.xmpp.XChatManager; ...@@ -22,12 +30,17 @@ import com.rv.im.xmpp.XChatManager;
import com.rv.im.xmpp.XmppConnectionManager; import com.rv.im.xmpp.XmppConnectionManager;
import com.rv.im.xmpp.listener.AuthStateListener; import com.rv.im.xmpp.listener.AuthStateListener;
import com.rv.im.xmpp.listener.ChatMessageListener; import com.rv.im.xmpp.listener.ChatMessageListener;
import com.yuyife.okgo.OkGoUtil;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
public class ImService extends Service { public class ImService extends Service {
private static final String TAG = ImService.class.getSimpleName(); private static final String TAG = ImService.class.getSimpleName();
...@@ -75,13 +88,14 @@ public class ImService extends Service { ...@@ -75,13 +88,14 @@ public class ImService extends Service {
LogUtil.e(TAG, "xmpp:notifyAuthenticated"); LogUtil.e(TAG, "xmpp:notifyAuthenticated");
onAuthenticated(); onAuthenticated();
ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_SUCCESS);// 通知登陆成功 ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_SUCCESS);// 通知登陆成功
getLastChatHistory(); getChatHistory();
} }
@Override @Override
public void notifyConnectionClosedOnError(Exception e) { public void notifyConnectionClosedOnError(Exception e) {
AppCookie.save(AppCookie.OFFLINE_TIME + mLoginUserId, System.currentTimeMillis());
ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_NOT); ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_NOT);
release();
LogUtil.e(TAG, "xmpp:notifyConnectionClosedOnError"); LogUtil.e(TAG, "xmpp:notifyConnectionClosedOnError");
Log.e(TAG, "连接异常==" + e.getMessage()); Log.e(TAG, "连接异常==" + e.getMessage());
if (e.getMessage().contains("conflict")) { if (e.getMessage().contains("conflict")) {
...@@ -95,6 +109,8 @@ public class ImService extends Service { ...@@ -95,6 +109,8 @@ public class ImService extends Service {
@Override @Override
public void notifyConnectionClosed() { public void notifyConnectionClosed() {
LogUtil.e(TAG, "xmpp:notifyConnectionClosed"); LogUtil.e(TAG, "xmpp:notifyConnectionClosed");
AppCookie.save(AppCookie.OFFLINE_TIME + mLoginUserId, System.currentTimeMillis());
release();
ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_NOT); ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_NOT);
} }
}; };
...@@ -133,14 +149,14 @@ public class ImService extends Service { ...@@ -133,14 +149,14 @@ public class ImService extends Service {
} }
/* 消息回执管理 */ /* 消息回执管理 */
if (mReceiptManager == null) { if (mReceiptManager == null && mConnectionManager != null) {
mReceiptManager = new ReceiptManager(this, mConnectionManager.getConnection()); mReceiptManager = new ReceiptManager(this, mConnectionManager.getConnection());
} else { } else {
mReceiptManager.reset(); mReceiptManager.reset();
} }
// 初始化消息处理 // 初始化消息处理
if (mXChatManager == null) { if (mXChatManager == null && mConnectionManager != null) {
mXChatManager = new XChatManager(this, mConnectionManager.getConnection()); mXChatManager = new XChatManager(this, mConnectionManager.getConnection());
} else { } else {
mXChatManager.reset(); mXChatManager.reset();
...@@ -167,8 +183,39 @@ public class ImService extends Service { ...@@ -167,8 +183,39 @@ public class ImService extends Service {
} }
} }
public void getChatHistory() {
Map<String, String> params = new HashMap();
params.put("access_token", ImSetting.getImToken());
params.put("receiver", mLoginUserId);
public void getLastChatHistory() { long syncTimeLen = AppCookie.getLongValue(AppCookie.OFFLINE_TIME + mLoginUserId, 0l);
params.put("startTime", String.valueOf(syncTimeLen));
params.put("endTime", String.valueOf(System.currentTimeMillis()));
params.put("pageSize", String.valueOf(100));// 尽量传一个大的值 一次性拉下来
AppConfig appConfig = (AppConfig) RvCache.getInstance().get(CacheEnum.IM_CONFIG);
OkGoUtil.getMap(appConfig.GET_CHAT_MSG, params, new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
if (response == null) return;
int code = response.code();
String body = response.body();
if (code == 200 && !TextUtils.isEmpty(body)) {
Log.e("im_onSuccess", body);
// LastChatHistoryListBean bean = new Gson().fromJson(body, LastChatHistoryListBean.class);
// if (bean != null && bean.getResultCode() == 1) {
// if (bean.getCurrentTime() != 0l) {
// AppCookie.save(AppCookie.OFFLINE_TIME + mLoginUserId, bean.getCurrentTime());
// }
// List<LastChatHistoryListBean.ChatHistoryItem> historyItems = bean.getData();
// if (historyItems != null && historyItems.size() > 0) {
// for (LastChatHistoryListBean.ChatHistoryItem item : historyItems) {
// ListenerManager.getInstance().notifyNewMesssage(ChatMessage.historyToChatMessage(item));
// }
// }
// }
}
}
});
} }
...@@ -243,14 +290,6 @@ public class ImService extends Service { ...@@ -243,14 +290,6 @@ public class ImService extends Service {
} }
} }
public void logout() {
isInit = false;
if (mConnectionManager != null) {
mConnectionManager.logout();
}
stopSelf();
}
/** /**
* 发送聊天消息 * 发送聊天消息
*/ */
......
package com.rv.im.bean; package com.rv.im.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.util.List; import java.util.List;
public class LastChatHistoryListBean extends BaseBean { public class LastChatHistoryListBean{
private long currentTime; private long currentTime;
private List<ChatHistoryItem> data; private List<ChatHistoryItem> data;
private int resultCode ;
public long getCurrentTime() { public long getCurrentTime() {
return currentTime; return currentTime;
...@@ -25,6 +24,14 @@ public class LastChatHistoryListBean extends BaseBean { ...@@ -25,6 +24,14 @@ public class LastChatHistoryListBean extends BaseBean {
this.data = data; this.data = data;
} }
public int getResultCode() {
return resultCode;
}
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
public class ChatHistoryItem { public class ChatHistoryItem {
private String _id ; private String _id ;
private String jid; private String jid;
......
...@@ -9,6 +9,7 @@ import com.j256.ormlite.android.apptools.OpenHelperManager; ...@@ -9,6 +9,7 @@ import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper; 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.stmt.QueryBuilder;
import com.rv.im.ImSetting; import com.rv.im.ImSetting;
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;
...@@ -16,6 +17,9 @@ import com.rv.im.enums.MessageStatusEnum; ...@@ -16,6 +17,9 @@ import com.rv.im.enums.MessageStatusEnum;
import com.rv.im.log.LogUtil; import com.rv.im.log.LogUtil;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
public class MessageDao { public class MessageDao {
...@@ -163,6 +167,9 @@ public class MessageDao { ...@@ -163,6 +167,9 @@ public class MessageDao {
.or() .or()
.eq("toUserId", targetId) .eq("toUserId", targetId)
.query(); .query();
if (chatMessages != null) {
Collections.sort(chatMessages, (o1, o2) -> (int) (o1.getTimeSend() - o2.getTimeSend()));
}
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -361,4 +368,63 @@ public class MessageDao { ...@@ -361,4 +368,63 @@ public class MessageDao {
e.printStackTrace(); e.printStackTrace();
} }
} }
public List<ChatMessage> loadMoreMessage(String userId, long time) {
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return null;
}
if (TextUtils.isEmpty(userId)) {
LogUtil.e(TAG, "userId is null");
return null;
}
QueryBuilder<ChatMessage, Integer> builder = dao.queryBuilder();
List<ChatMessage> chatMessages = null;
try {
// builder.where().gt("_id", mMinId);
builder.where().eq("fromUserId", userId)
.or()
.eq("toUserId", userId);
builder.where().lt("timeSend", time);
builder.orderBy("timeSend", false);
builder.limit(20L);
builder.offset(0L);
chatMessages = dao.query(builder.prepare());
if (chatMessages != null) {
Collections.sort(chatMessages, (o1, o2) -> (int) (o1.getTimeSend() - o2.getTimeSend()));
}
} catch (SQLException e) {
e.printStackTrace();
}
return chatMessages;
}
public List<ChatMessage> getFirstPageMessage(String userId) {
if (dao == null) {
LogUtil.e(TAG, "dao is null");
return null;
}
if (TextUtils.isEmpty(userId)) {
LogUtil.e(TAG, "message is null");
return null;
}
List<ChatMessage> chatMessages = null;
try {
chatMessages = dao.queryBuilder().orderBy("timeSend", false)
.limit(20L)
.where()
.eq("fromUserId", userId)
.or()
.eq("toUserId", userId)
.query();
if (chatMessages != null) {
Collections.sort(chatMessages, (o1, o2) -> (int) (o1.getTimeSend() - o2.getTimeSend()));
}
} catch (SQLException e) {
e.printStackTrace();
}
return chatMessages;
}
} }
...@@ -105,6 +105,16 @@ public class ChatMessageServiceImp implements IChatMessageService { ...@@ -105,6 +105,16 @@ public class ChatMessageServiceImp implements IChatMessageService {
dao.deleteMessage(message); dao.deleteMessage(message);
} }
@Override
public List<ChatMessage> loadMoreMessage(String userId, long time) {
return dao.loadMoreMessage(userId, time);
}
@Override
public List<ChatMessage> getFirstPageMessage(String userId) {
return dao.getFirstPageMessage(userId);
}
public void release() { public void release() {
instance = null; instance = null;
} }
......
...@@ -34,4 +34,8 @@ public interface IChatMessageService { ...@@ -34,4 +34,8 @@ public interface IChatMessageService {
void deleteMessage(ChatMessage message) ; void deleteMessage(ChatMessage message) ;
List<ChatMessage> loadMoreMessage(String userId,long time) ;
List<ChatMessage> getFirstPageMessage(String userId);
} }
...@@ -6,6 +6,7 @@ import com.google.gson.annotations.SerializedName; ...@@ -6,6 +6,7 @@ import com.google.gson.annotations.SerializedName;
import com.j256.ormlite.field.DataType; 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.bean.LastChatHistoryListBean;
import com.rv.im.enums.CallTypeEnum; import com.rv.im.enums.CallTypeEnum;
import com.rv.im.enums.MessageStatusEnum; import com.rv.im.enums.MessageStatusEnum;
import com.rv.im.enums.MessageTypeEnum; import com.rv.im.enums.MessageTypeEnum;
...@@ -321,4 +322,32 @@ public class ChatMessage implements Serializable { ...@@ -321,4 +322,32 @@ public class ChatMessage implements Serializable {
return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(this); return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(this);
} }
/******
* TEXT(1, "文本"),
* FILE(9, "文件"),
* PIC(2, "图片"),
* VOICE(3, "语音"),
* VOLTE_CALL(5, "语音通话"),
* VIDEO_CALL(6, "视频通话"),
* @param item
* @return
*/
public static ChatMessage historyToChatMessage(LastChatHistoryListBean.ChatHistoryItem item) {
if (item != null && (item.getType() == MessageTypeEnum.TEXT.getType() || item.getType() == MessageTypeEnum.PIC.getType()
|| item.getType() == MessageTypeEnum.VOICE.getType())) {
ChatMessage chatMessage = new ChatMessage();
chatMessage.setMessageType(item.getType());
chatMessage.setContent(item.getContent());
chatMessage.setFromUserId(item.getFrom());
chatMessage.setFromUserName(item.getFromUserName());
chatMessage.setToUserId(item.getTo());
chatMessage.setToUserName(item.getToUserName());
chatMessage.setIsEncrypt(item.getIsEncrypt());
chatMessage.setPackId(item.getMessageId());
chatMessage.setTimeSend(item.getTimeSend());
return chatMessage;
}
return null;
}
} }
...@@ -102,6 +102,7 @@ public class ListenerManager { ...@@ -102,6 +102,7 @@ public class ListenerManager {
* 新消息来临 * 新消息来临
*/ */
public void notifyNewMesssage(final ChatMessage message) { public void notifyNewMesssage(final ChatMessage message) {
if (message == null) return;
NotificationMananger.showNewsNotification(ImSetting.getContext(), message.getFromId()); NotificationMananger.showNewsNotification(ImSetting.getContext(), message.getFromId());
bell(); bell();
mHandler.post(() -> { mHandler.post(() -> {
......
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:maxLines="3" android:maxLines="3"
android:paddingLeft="@dimen/dp_10" android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:paddingTop="6dp" android:paddingTop="6dp"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="6dp" android:paddingBottom="6dp"
android:textSize="@dimen/one_level_title" /> android:textSize="@dimen/one_level_title" />
...@@ -159,12 +159,14 @@ ...@@ -159,12 +159,14 @@
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
<RelativeLayout
<android.support.v7.widget.RecyclerView
android:id="@+id/recycle_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@id/rl_chat_meun" android:layout_above="@id/rl_chat_meun"
android:layout_alignParentTop="true" /> android:layout_alignParentTop="true">
<include layout="@layout/common_refresh" />
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
</com.rv.im.view.MyLinearLayout> </com.rv.im.view.MyLinearLayout>
\ No newline at end of file
...@@ -37,6 +37,7 @@ import com.ruiwenliu.wrapper.bean.UserInfoBean; ...@@ -37,6 +37,7 @@ import com.ruiwenliu.wrapper.bean.UserInfoBean;
import com.rv.member.presenter.MemberPresenter; import com.rv.member.presenter.MemberPresenter;
import com.rv.component.utils.RvCache; import com.rv.component.utils.RvCache;
import com.rv.component.utils.CacheEnum; import com.rv.component.utils.CacheEnum;
import com.rv.member.view.MemberCompareView;
import com.rv.member.view.MemberItemView; import com.rv.member.view.MemberItemView;
import com.rv.member.view.MemberTopView; import com.rv.member.view.MemberTopView;
import com.rv.tourism.bean.BeanTourOrderAliPay; import com.rv.tourism.bean.BeanTourOrderAliPay;
...@@ -46,6 +47,8 @@ import com.xxrv.coupon.api.CouponApi; ...@@ -46,6 +47,8 @@ import com.xxrv.coupon.api.CouponApi;
import com.xxrv.coupon.bean.CarCouponBean; import com.xxrv.coupon.bean.CarCouponBean;
import com.yuyife.okgo.OkGoUtil; import com.yuyife.okgo.OkGoUtil;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
...@@ -68,8 +71,12 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -68,8 +71,12 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
@BindView(R2.id.member_top_view) @BindView(R2.id.member_top_view)
MemberTopView memberTopView; MemberTopView memberTopView;
@BindView(R2.id.ll_cardview_content) @BindView(R2.id.member_compare_view)
LinearLayout ll_cardview_content; MemberCompareView compareView;
@BindView(R2.id.tv_member_discount_hint)
TextView tvMemberDisCountHint;
@BindView(R2.id.tv_member_free_day_hint)
TextView tvMemberFreeDayHint;
private IWXAPI api; private IWXAPI api;
private int memberLevel = 0; // 会员等级 private int memberLevel = 0; // 会员等级
...@@ -101,10 +108,10 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -101,10 +108,10 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
MemberListBean listBean = (MemberListBean) RvCache.getInstance().get(CacheEnum.MEMBER); MemberListBean listBean = (MemberListBean) RvCache.getInstance().get(CacheEnum.MEMBER);
if (listBean != null && listBean.getData() != null) { if (listBean != null && listBean.getData() != null) {
memberTopView.setData(listBean, memberLevel, freeUseDay, payListener); memberTopView.setData(listBean, memberLevel, freeUseDay, payListener);
addMemberList(listBean); compareView.setData(listBean.getData());
setMemberDiscountAndFreeDay(listBean);
} }
memberTopView.setLoginListener(new View.OnClickListener() { memberTopView.setLoginListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
...@@ -177,7 +184,8 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -177,7 +184,8 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
if (listBean != null && listBean.isRel() && listBean.getData() != null && !listBean.getData().isEmpty()) { if (listBean != null && listBean.isRel() && listBean.getData() != null && !listBean.getData().isEmpty()) {
RvCache.getInstance().save(listBean, CacheEnum.MEMBER); RvCache.getInstance().save(listBean, CacheEnum.MEMBER);
memberTopView.setData(listBean, memberLevel, freeUseDay, payListener); memberTopView.setData(listBean, memberLevel, freeUseDay, payListener);
addMemberList(listBean); compareView.setData(listBean.getData());
setMemberDiscountAndFreeDay(listBean);
} }
break; break;
case 1: case 1:
...@@ -222,6 +230,32 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -222,6 +230,32 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
return true; return true;
} }
private void setMemberDiscountAndFreeDay(MemberListBean listBean) {
if (listBean.getData().size() == 3) {
Integer[] discounts = new Integer[3];
Integer[] freeDays = new Integer[3];
for (int i = 0; i < listBean.getData().size(); i++) {
MemberListBean.MemberCard card = listBean.getData().get(i);
discounts[i] = card.getDiscount() / 10;
freeDays[i] = card.getNumber();
}
Arrays.sort(discounts, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2 - o1;
}
});
Arrays.sort(freeDays, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1 - o2;
}
});
tvMemberFreeDayHint.setText(String.format(getString(R.string.tv_member_free_day), freeDays));
tvMemberDisCountHint.setText(String.format(getString(R.string.tv_member_rent_discount), discounts));
}
}
@Override @Override
protected void loadData(Bundle savedInstanceState, Intent intent) { protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent); super.loadData(savedInstanceState, intent);
...@@ -268,18 +302,18 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> { ...@@ -268,18 +302,18 @@ public class MemberCenterActivity extends BaseStatusActivity<MemberPresenter> {
} }
} }
private void addMemberList(MemberListBean listBean) { // private void addMemberList(MemberListBean listBean) {
ll_cardview_content.removeAllViews(); // ll_cardview_content.removeAllViews();
for (MemberListBean.MemberCard card : listBean.getData()) { // for (MemberListBean.MemberCard card : listBean.getData()) {
MemberItemView view = new MemberItemView(this); // MemberItemView view = new MemberItemView(this);
view.setData(card); // view.setData(card);
// view.setHasAgree(hasAgree); //// view.setHasAgree(hasAgree);
view.setListener(payListener); // view.setListener(payListener);
if (listBean.getData().indexOf(card) == listBean.getData().size() - 1) // if (listBean.getData().indexOf(card) == listBean.getData().size() - 1)
view.hiddenLine(); // view.hiddenLine();
ll_cardview_content.addView(view); // ll_cardview_content.addView(view);
} // }
} // }
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
......
...@@ -15,6 +15,7 @@ import android.widget.LinearLayout; ...@@ -15,6 +15,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.rv.component.utils.DisplayUtil;
import com.rv.member.R; import com.rv.member.R;
import com.rv.member.bean.MemberListBean; import com.rv.member.bean.MemberListBean;
...@@ -82,11 +83,11 @@ public class GridMemerAdapter extends BaseAdapter { ...@@ -82,11 +83,11 @@ public class GridMemerAdapter extends BaseAdapter {
s.setSpan(new AbsoluteSizeSpan(10, true), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); s.setSpan(new AbsoluteSizeSpan(10, true), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
s.setSpan(new AbsoluteSizeSpan(20, true), 1, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); s.setSpan(new AbsoluteSizeSpan(20, true), 1, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if (selecPosition == i) { // if (selecPosition == i) {
s.setSpan(new ForegroundColorSpan(Color.parseColor("#ffffff")), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // s.setSpan(new ForegroundColorSpan(Color.parseColor("#FF5050")), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else { // } else {
s.setSpan(new ForegroundColorSpan(Color.parseColor("#999999")), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // s.setSpan(new ForegroundColorSpan(Color.parseColor("#FF5050")), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} // }
holder.tv_price.setText(s); holder.tv_price.setText(s);
holder.tv_discount.setText("永久" + memberCard.getDiscount() / 10 + "折租车"); holder.tv_discount.setText("永久" + memberCard.getDiscount() / 10 + "折租车");
...@@ -94,21 +95,24 @@ public class GridMemerAdapter extends BaseAdapter { ...@@ -94,21 +95,24 @@ public class GridMemerAdapter extends BaseAdapter {
holder.tv_type.setText(TextUtils.isEmpty(memberCard.getName()) ? " " : memberCard.getName()); holder.tv_type.setText(TextUtils.isEmpty(memberCard.getName()) ? " " : memberCard.getName());
if (selecPosition == i) { if (selecPosition == i) {
if (i == 0) { // if (i == 0) {
holder.rl_content.setBackgroundResource(R.drawable.bg_card_normal_member); // holder.rl_content.setBackgroundResource(R.drawable.bg_card_normal_member);
} else if (i == 1) { // } else if (i == 1) {
holder.rl_content.setBackgroundResource(R.drawable.bg_card_gold_member); // holder.rl_content.setBackgroundResource(R.drawable.bg_card_gold_member);
} else if (i == 2) { // } else if (i == 2) {
holder.rl_content.setBackgroundResource(R.drawable.bg_card_diamond_member); // holder.rl_content.setBackgroundResource(R.drawable.bg_card_diamond_member);
} // }
holder.tv_type.setTextColor(Color.WHITE); holder.rl_content.setBackgroundResource(R.drawable.bg_card_member_selected);
holder.tv_discount.setTextColor(Color.WHITE); holder.tv_type.setTextColor(Color.parseColor("#54311E"));
holder.tv_free_day.setTextColor(Color.WHITE); holder.tv_type.setTextSize(18);
holder.tv_discount.setTextColor(Color.parseColor("#54311E"));
holder.tv_free_day.setTextColor(Color.parseColor("#54311E"));
} else { } else {
holder.tv_type.setTextSize(16);
holder.rl_content.setBackgroundResource(R.drawable.bg_member_unselect); holder.rl_content.setBackgroundResource(R.drawable.bg_member_unselect);
holder.tv_type.setTextColor(Color.parseColor("#999999")); holder.tv_type.setTextColor(Color.parseColor("#666666"));
holder.tv_discount.setTextColor(Color.parseColor("#999999")); holder.tv_discount.setTextColor(Color.parseColor("#666666"));
holder.tv_free_day.setTextColor(Color.parseColor("#999999")); holder.tv_free_day.setTextColor(Color.parseColor("#666666"));
} }
holder.rl_content.setOnClickListener(new View.OnClickListener() { holder.rl_content.setOnClickListener(new View.OnClickListener() {
......
...@@ -46,6 +46,7 @@ public class MemberListBean extends BaseBean implements Serializable { ...@@ -46,6 +46,7 @@ public class MemberListBean extends BaseBean implements Serializable {
private int isdel; private int isdel;
private BigDecimal price; private BigDecimal price;
private int number; private int number;
private BigDecimal daysPrice ;
public int getId() { public int getId() {
return id; return id;
...@@ -126,5 +127,13 @@ public class MemberListBean extends BaseBean implements Serializable { ...@@ -126,5 +127,13 @@ public class MemberListBean extends BaseBean implements Serializable {
public void setNumber(int number) { public void setNumber(int number) {
this.number = number; this.number = number;
} }
public BigDecimal getDaysPrice() {
return daysPrice;
}
public void setDaysPrice(BigDecimal daysPrice) {
this.daysPrice = daysPrice;
}
} }
} }
...@@ -55,18 +55,18 @@ public class LoginView extends LinearLayout { ...@@ -55,18 +55,18 @@ public class LoginView extends LinearLayout {
UserInfoBean.UserInfo info = infoBean.getData(); UserInfoBean.UserInfo info = infoBean.getData();
if (info != null) { if (info != null) {
if (info.getIsMember() == 0) { if (info.getIsMember() == 0) {
llLogin.setBackgroundResource(R.drawable.bg_normal_user); llLogin.setBackgroundResource(R.drawable.shape_rv_bg_top_unlogin);
ivMemberLevel.setVisibility(INVISIBLE); ivMemberLevel.setVisibility(INVISIBLE);
} else { } else {
switch (info.getMemberLevel()) { switch (info.getMemberLevel()) {
case 1: case 1:
llLogin.setBackgroundResource(R.drawable.bg_normal_member); llLogin.setBackgroundResource(R.drawable.member_common_background);
break; break;
case 2: case 2:
llLogin.setBackgroundResource(R.drawable.bg_gold_member); llLogin.setBackgroundResource(R.drawable.member_gold_background);
break; break;
case 3: case 3:
llLogin.setBackgroundResource(R.drawable.bg_diamond_member); llLogin.setBackgroundResource(R.drawable.member_diamond_background);
break; break;
default: default:
break; break;
...@@ -76,16 +76,16 @@ public class LoginView extends LinearLayout { ...@@ -76,16 +76,16 @@ public class LoginView extends LinearLayout {
GlideManager.getInstance(getContext()).loadImage(info.getHeadimgurl(), ivAvatar); GlideManager.getInstance(getContext()).loadImage(info.getHeadimgurl(), ivAvatar);
tvNickname.setText(!TextUtils.isEmpty(info.getNickname()) ? info.getNickname() : info.getUsername()); tvNickname.setText(!TextUtils.isEmpty(info.getNickname()) ? info.getNickname() : info.getUsername());
SpannableStringBuilder recordBuilder = new SpannableStringBuilder(info.getPayCount() + "\n 消费记录"); SpannableStringBuilder recordBuilder = new SpannableStringBuilder(info.getPayCount() + "\n 消费记录/次");
recordBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(getContext(), 18), null, null), 0, String.valueOf(info.getPayCount()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); recordBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(getContext(), 18), null, null), 0, String.valueOf(info.getPayCount()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tvConsumeRecord.setText(recordBuilder); tvConsumeRecord.setText(recordBuilder);
SpannableStringBuilder rentBuilder = new SpannableStringBuilder(info.getRentFreeDays() + "\n 可免费租车 (天)"); SpannableStringBuilder rentBuilder = new SpannableStringBuilder(info.getRentFreeDays() + "\n 可免费租车/天");
rentBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(getContext(), 18), null, null), 0, String.valueOf(info.getRentFreeDays()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); rentBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(getContext(), 18), null, null), 0, String.valueOf(info.getRentFreeDays()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tvFreeDay.setText(rentBuilder); tvFreeDay.setText(rentBuilder);
SpannableStringBuilder bugBuilder = new SpannableStringBuilder(info.getBuyCount() + "\n 购买记录 (次)"); SpannableStringBuilder bugBuilder = new SpannableStringBuilder(info.getBuyCount() + "\n 购买记录/次");
bugBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(getContext(), 18), null, null), 0, String.valueOf(info.getBuyCount()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); bugBuilder.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, DisplayUtil.sp2px(getContext(), 18), null, null), 0, String.valueOf(info.getBuyCount()).length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
tvPurchaseRecord.setText(bugBuilder); tvPurchaseRecord.setText(bugBuilder);
if (!TextUtils.isEmpty(info.getBigIcon())) if (!TextUtils.isEmpty(info.getBigIcon()))
......
package com.rv.member.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import com.rv.member.R;
import com.rv.member.bean.MemberListBean;
import java.util.List;
public class MemberCompareView extends LinearLayout {
private LinearLayout llContent;
public MemberCompareView(Context context) {
super(context);
}
public MemberCompareView(Context context, AttributeSet attrs) {
super(context, attrs);
initView();
}
private void initView() {
View view = LayoutInflater.from(getContext()).inflate(R.layout.view_member_compare, null);
llContent = view.findViewById(R.id.ll_content);
addView(view);
}
private MemberRightItem itemView;
public void setData(List<MemberListBean.MemberCard> lists) {
if (lists != null && lists.size() > 0) {
llContent.removeAllViews();
for (MemberListBean.MemberCard memberCard : lists) {
if (memberCard != null) {
itemView = new MemberRightItem(getContext());
itemView.setData(memberCard, lists.indexOf(memberCard));
llContent.addView(itemView);
}
}
}
}
}
package com.rv.member.view;
import android.content.Context;
import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.rv.member.R;
import com.rv.member.bean.MemberListBean;
import java.math.BigDecimal;
public class MemberRightItem extends LinearLayout {
private TextView tvMemberLevel;
private TextView tvMemberDiscount;
private TextView tvMemberFreeDay;
public MemberRightItem(Context context) {
super(context);
initView();
}
private void initView() {
View view = LayoutInflater.from(getContext()).inflate(R.layout.view_member_right_item, null);
tvMemberLevel = view.findViewById(R.id.tv_member_level);
tvMemberDiscount = view.findViewById(R.id.tv_member_discount);
tvMemberFreeDay = view.findViewById(R.id.tv_member_free_day);
addView(view, LinearLayout.LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
public void setData(MemberListBean.MemberCard memberCard, int position) {
if (memberCard != null) {
this.tvMemberLevel.setText(TextUtils.isEmpty(memberCard.getName()) ? " " : memberCard.getName());
this.tvMemberDiscount.setText("永久" + (memberCard.getDiscount() / 10) + "折");
StringBuilder builder = new StringBuilder(memberCard.getNumber() + "天");
if (memberCard.getDaysPrice() != null) {
builder.append("\n 价值 ¥" + dealPrice(memberCard.getDaysPrice()));
}
SpannableStringBuilder rentBuilder = new SpannableStringBuilder(builder.toString());
String rentText = rentBuilder.toString();
rentBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FF5050")), rentText.indexOf("¥"), rentBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
this.tvMemberFreeDay.setText(rentBuilder);
}
if (position % 2 != 0) {
setBackgroundColor(Color.parseColor("#fff6e2"));
}
}
private String dealPrice(BigDecimal value) {
if (value == null) return "";
BigDecimal noZeros = value.stripTrailingZeros();
return noZeros.toPlainString();
}
}
...@@ -7,7 +7,6 @@ import android.graphics.Color; ...@@ -7,7 +7,6 @@ import android.graphics.Color;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -129,7 +128,7 @@ public class MemberTopView extends LinearLayout { ...@@ -129,7 +128,7 @@ public class MemberTopView extends LinearLayout {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (dialog == null) { if (dialog == null) {
dialog = new InviterPhoneDialog(getContext(),inviterPhone , new InviterPhoneDialog.InputListener() { dialog = new InviterPhoneDialog(getContext(), inviterPhone, new InviterPhoneDialog.InputListener() {
@Override @Override
public void input(String phone) { public void input(String phone) {
inviterPhone = phone; inviterPhone = phone;
...@@ -161,13 +160,14 @@ public class MemberTopView extends LinearLayout { ...@@ -161,13 +160,14 @@ public class MemberTopView extends LinearLayout {
}); });
img_agree.setImageResource(hasAgree ? R.drawable.common_icon_selected : R.drawable.common_icon_radio_unche); img_agree.setImageResource(hasAgree ? R.drawable.common_icon_selected : R.drawable.common_icon_radio_unche);
if (selectCard.getLevel() == 1) { // if (selectCard.getLevel() == 1) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member);
} else if (selectCard.getLevel() == 2) { // } else if (selectCard.getLevel() == 2) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member);
} else { // } else {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member);
} // }
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_member);
img_agree.setOnClickListener(new View.OnClickListener() { img_agree.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
...@@ -194,7 +194,7 @@ public class MemberTopView extends LinearLayout { ...@@ -194,7 +194,7 @@ public class MemberTopView extends LinearLayout {
return; return;
} }
if (listener != null) { if (listener != null) {
listener.pay(selectCard,inviterPhone); listener.pay(selectCard, inviterPhone);
} }
} }
}); });
...@@ -223,22 +223,28 @@ public class MemberTopView extends LinearLayout { ...@@ -223,22 +223,28 @@ public class MemberTopView extends LinearLayout {
switch (memberLevel) { switch (memberLevel) {
case 1: case 1:
imgDiscountTop.setImageResource(R.drawable.icon_vip_normal); imgDiscountTop.setImageResource(R.drawable.member_common_icon_discount);
imgFreedayTop.setImageResource(R.drawable.icon_car_normal); imgFreedayTop.setImageResource(R.drawable.member_common_icon_rent);
imgFreeTop.setImageResource(R.drawable.icon_outdoor_normal); imgFreeTop.setImageResource(R.drawable.member_common_icon_salon);
tvDiscountTop.setText("租车8折"); tvDiscountTop.setText("租车8折");
btnFreedayUse.setBackgroundResource(R.drawable.shape_member_common_bg_btn);
btnDisountUse.setBackgroundResource(R.drawable.shape_member_common_bg_btn);
break; break;
case 2: case 2:
imgDiscountTop.setImageResource(R.drawable.icon_vip_gold); imgDiscountTop.setImageResource(R.drawable.member_gold_icon_discount);
imgFreedayTop.setImageResource(R.drawable.icon_car_gold); imgFreedayTop.setImageResource(R.drawable.member_gold_icon_rent);
imgFreeTop.setImageResource(R.drawable.icon_outdoor_gold); imgFreeTop.setImageResource(R.drawable.member_gold_icon_salon);
tvDiscountTop.setText("租车7折"); tvDiscountTop.setText("租车7折");
btnFreedayUse.setBackgroundResource(R.drawable.shape_member_gold_bg_btn);
btnDisountUse.setBackgroundResource(R.drawable.shape_member_gold_bg_btn);
break; break;
case 3: case 3:
imgDiscountTop.setImageResource(R.drawable.icon_vip_diamond); imgDiscountTop.setImageResource(R.drawable.member_diamond_icon_discount);
imgFreedayTop.setImageResource(R.drawable.icon_car_diamond); imgFreedayTop.setImageResource(R.drawable.member_diamond_icon_rent);
imgFreeTop.setImageResource(R.drawable.icon_outdoor_diamond); imgFreeTop.setImageResource(R.drawable.member_diamond_icon_salon);
tvDiscountTop.setText("租车6折"); tvDiscountTop.setText("租车6折");
btnFreedayUse.setBackgroundResource(R.drawable.shape_member_diamond_bg_btn);
btnDisountUse.setBackgroundResource(R.drawable.shape_member_diamond_bg_btn);
break; break;
} }
} else { } else {
...@@ -276,14 +282,14 @@ public class MemberTopView extends LinearLayout { ...@@ -276,14 +282,14 @@ public class MemberTopView extends LinearLayout {
selectCard = memberCard; selectCard = memberCard;
selectPostion = bean.getData().indexOf(memberCard); selectPostion = bean.getData().indexOf(memberCard);
btn_buy.setText("立即开通" + memberCard.getName()); btn_buy.setText("立即开通" + memberCard.getName());
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_member);
if (selectCard.getLevel() == 1) { // if (selectCard.getLevel() == 1) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_normal_member);
} else if (selectCard.getLevel() == 2) { // } else if (selectCard.getLevel() == 2) {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_gold_member);
} else { // } else {
btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member); // btn_buy.setBackgroundResource(R.drawable.shape_rv_bg_open_diamond_member);
} // }
} }
}); });
} }
......
package com.rv.member.view; package com.rv.member.view;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -27,6 +29,7 @@ public class UnLoginView extends RelativeLayout { ...@@ -27,6 +29,7 @@ public class UnLoginView extends RelativeLayout {
this.onClickListener = listener; this.onClickListener = listener;
} }
@SuppressLint("ResourceAsColor")
private void initView() { private void initView() {
View view = LayoutInflater.from(getContext()).inflate(R.layout.item_unlogin_view, null); View view = LayoutInflater.from(getContext()).inflate(R.layout.item_unlogin_view, null);
tvLogin = view.findViewById(R.id.tv_login); tvLogin = view.findViewById(R.id.tv_login);
...@@ -36,6 +39,8 @@ public class UnLoginView extends RelativeLayout { ...@@ -36,6 +39,8 @@ public class UnLoginView extends RelativeLayout {
if (onClickListener != null) onClickListener.onClick(v); if (onClickListener != null) onClickListener.onClick(v);
} }
}); });
setBackgroundColor(Color.parseColor("#ffffff"));
addView(view); addView(view);
} }
} }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--空心框 圆角 少量红-->
<corners android:radius="@dimen/size_30" />
<solid android:color="#FDE7CC" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--空心框 圆角 少量红-->
<corners android:radius="@dimen/size_30" />
<solid android:color="#FFDFC9" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--空心框 圆角 少量红-->
<corners android:radius="@dimen/size_30" />
<solid android:color="#FFEBC0" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_30" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_50" />
<solid android:color="#ffb74b" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_30" /> <corners android:radius="@dimen/size_5" />
<solid android:color="@color/white" /> <solid android:color="@color/white" />
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp" />
<solid android:color="#ffffffff" />
<stroke android:width="1px" android:color="#ffeeeeee" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="20dp" /> <corners android:radius="20dp" />
<solid android:color="#cccccc" /> <solid android:color="#fff" />
<stroke
android:width="1dp"
android:color="#ffcccccc" />
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp" /> <corners android:radius="10dp" />
<solid android:color="#ffeec9" />
<gradient
android:startColor="#E5B895"
android:endColor="#F8D3B8"
android:angle="0"
/>
</shape> </shape>
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<com.rv.member.view.MemberTopView <com.rv.member.view.MemberTopView
...@@ -19,24 +20,28 @@ ...@@ -19,24 +20,28 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"
android:layout_height="15dp"
android:background="#F5F5F5" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#F2F2F2"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_12" android:layout_marginTop="@dimen/size_20"
android:layout_marginBottom="@dimen/size_12" android:layout_marginBottom="@dimen/size_30"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <!--<ImageView-->
android:layout_width="wrap_content" <!--android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!--android:layout_height="wrap_content"-->
android:src="@drawable/member_icon_small_yellow_circle" /> <!--android:src="@drawable/member_icon_small_yellow_circle" />-->
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -45,33 +50,203 @@ ...@@ -45,33 +50,203 @@
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:text="会员特权" android:text="会员特权"
android:textColor="@color/colorMain" android:textColor="@color/colorMain"
android:textSize="16sp" android:textSize="18sp" />
android:textStyle="bold" />
<!--<ImageView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="@drawable/member_icon_small_yellow_circle" />-->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_rv_bg_member_rights"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_15"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_5"
android:text="永享租车折扣"
android:textColor="#ffffa217"
android:textSize="@dimen/sp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="会员终身享有租车折扣"
android:textColor="#ff333333"
android:textSize="@dimen/text_14" />
<TextView
android:letterSpacing="0.1"
android:id="@+id/tv_member_discount_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tv_member_rent_discount"
android:textColor="#ff666666"
android:textSize="@dimen/text_12" />
</LinearLayout>
<ImageView <ImageView
android:layout_width="@dimen/size_70"
android:layout_height="@dimen/size_70"
android:src="@drawable/icon_member_discount" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_rv_bg_member_rights"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_15"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_5"
android:text="免费租车"
android:textColor="#ffffa217"
android:textSize="@dimen/sp_16" />
<TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/member_icon_small_yellow_circle" /> android:layout_marginBottom="5dp"
android:text="购买会员,立享免费租车"
android:textColor="#ff333333"
android:textSize="@dimen/text_14" />
<TextView
android:letterSpacing="0.1"
android:id="@+id/tv_member_free_day_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tv_member_free_day"
android:textColor="#ff666666"
android:textSize="@dimen/text_12" />
</LinearLayout> </LinearLayout>
<ImageView
android:layout_width="@dimen/size_70"
android:layout_height="@dimen/size_70"
android:src="@drawable/icon_member_rent" />
<android.support.v7.widget.CardView </LinearLayout>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:background="@color/white" android:layout_marginBottom="@dimen/size_20"
app:cardCornerRadius="@dimen/dp_10"> android:background="@drawable/shape_rv_bg_member_rights"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<LinearLayout <LinearLayout
android:id="@+id/ll_cardview_content" android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_15"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_5"
android:text="免费房车沙龙"
android:textColor="#ffffa217"
android:textSize="@dimen/sp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="购买会员,结识更多房车爱好者"
android:textColor="#ff333333"
android:textSize="@dimen/text_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:letterSpacing="0.1"
android:text="会员可免费参加滴房车举办的各种沙龙讲座及户外活动,结识更多的房车爱好者"
android:textColor="#ff666666"
android:textSize="@dimen/text_12" />
</LinearLayout>
<ImageView
android:layout_width="@dimen/size_70"
android:layout_height="@dimen/size_70"
android:src="@drawable/icon_member_salon" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="15dp"
android:background="#F5F5F5" />
<TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" /> android:layout_marginTop="@dimen/size_20"
android:layout_marginBottom="@dimen/size_30"
android:gravity="center"
android:text="价值对比"
android:textColor="#ff171413"
android:textSize="18sp" />
</android.support.v7.widget.CardView> <com.rv.member.view.MemberCompareView
android:id="@+id/member_compare_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" />
</LinearLayout> </LinearLayout>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:layout_toLeftOf="@+id/iv_member_level" android:layout_toLeftOf="@+id/iv_member_level"
android:textColor="@color/white" android:textColor="#54311E"
android:textSize="17sp" /> android:textSize="17sp" />
<ImageView <ImageView
...@@ -45,9 +45,7 @@ ...@@ -45,9 +45,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal">
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<TextView <TextView
android:id="@+id/tv_consume_record" android:id="@+id/tv_consume_record"
...@@ -57,9 +55,9 @@ ...@@ -57,9 +55,9 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:lines="2" android:lines="2"
android:text="0 \n 消费记录 " android:text="0 \n 消费记录/次 "
android:textColor="@color/white" android:textColor="#714C37"
android:textSize="@dimen/dp_10" /> android:textSize="11sp" />
<View <View
android:layout_width="1px" android:layout_width="1px"
...@@ -74,9 +72,9 @@ ...@@ -74,9 +72,9 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:lines="2" android:lines="2"
android:text="0 \n 可免费租车 (天) " android:text="0 \n 可免费租车/天"
android:textColor="@color/white" android:textColor="#714C37"
android:textSize="@dimen/dp_10" /> android:textSize="11sp" />
<View <View
android:layout_width="1px" android:layout_width="1px"
...@@ -91,9 +89,9 @@ ...@@ -91,9 +89,9 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal|bottom" android:gravity="center_horizontal|bottom"
android:lines="2" android:lines="2"
android:text="0 \n 购买记录 (次)" android:text="0 \n 购买记录/次"
android:textColor="@color/white" android:textColor="#714C37"
android:textSize="@dimen/dp_10" /> android:textSize="11sp" />
</LinearLayout> </LinearLayout>
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_20" android:layout_marginTop="@dimen/size_20"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp" />
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_discount" android:id="@+id/tv_discount"
...@@ -46,7 +45,7 @@ ...@@ -46,7 +45,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:textColor="@color/white" android:textColor="#FF5050"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
......
...@@ -19,16 +19,16 @@ ...@@ -19,16 +19,16 @@
<TextView <TextView
android:id="@+id/tv_login" android:id="@+id/tv_login"
android:layout_width="@dimen/size_100" android:layout_width="@dimen/size_100"
android:layout_height="33.33dp" android:layout_height="35dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginRight="@dimen/size_15" android:layout_marginRight="@dimen/size_15"
android:background="@drawable/shape_rv_bg_circle_white" android:background="@drawable/shape_rv_bg_circle_ffe3a9"
android:gravity="center" android:gravity="center"
android:text="@string/tv_login" android:text= "登 录"
android:textColor="@color/colorYellow" android:textColor="@color/white"
android:textSize="@dimen/text_14" /> android:textSize="@dimen/text_16" />
</RelativeLayout> </RelativeLayout>
<?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="wrap_content"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_member_level"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:background="#FFE8B7"
android:gravity="center"
android:text="会员等级"
android:textColor="#ff333333"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#FFC271" />
<LinearLayout
android:id="@+id/ll_member_discount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:background="#FFE8B7"
android:gravity="center"
android:text="租车折扣"
android:textColor="#ff333333"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#FFC271" />
<LinearLayout
android:id="@+id/ll_member_free_day"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:background="#FFE8B7"
android:gravity="center"
android:text="免费天数"
android:textColor="#ff333333"
android:textSize="@dimen/sp_16" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginBottom="@dimen/dp_10"
android:background="#FFC271" />
</LinearLayout>
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone" android:visibility="gone"
android:layout_marginBottom="@dimen/size_20"
android:weightSum="3"> android:weightSum="3">
<LinearLayout <LinearLayout
...@@ -30,19 +31,18 @@ ...@@ -30,19 +31,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#333333" android:textColor="#333333"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/sp_14" />
<Button <Button
android:id="@+id/btn_disount_use" android:id="@+id/btn_disount_use"
android:layout_width="73dp" android:layout_width="73dp"
android:layout_height="@dimen/size_28" android:layout_height="@dimen/size_28"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_8"
android:background="@drawable/shape_member_bg_btn_yellow" android:background="@drawable/shape_member_bg_btn_yellow"
android:gravity="center" android:gravity="center"
android:stateListAnimator="@null" android:stateListAnimator="@null"
android:text="@string/tv_use_now" android:text="@string/tv_use_now"
android:textColor="@color/white" android:textColor="#714C37"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
</LinearLayout> </LinearLayout>
...@@ -68,19 +68,18 @@ ...@@ -68,19 +68,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#333333" android:textColor="#333333"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/sp_14" />
<Button <Button
android:id="@+id/btn_freeday_use" android:id="@+id/btn_freeday_use"
android:layout_width="@dimen/size_80" android:layout_width="@dimen/size_80"
android:layout_height="@dimen/size_28" android:layout_height="@dimen/size_28"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_8"
android:background="@drawable/shape_member_bg_btn_yellow" android:background="@drawable/shape_member_bg_btn_yellow"
android:gravity="center" android:gravity="center"
android:stateListAnimator="@null" android:stateListAnimator="@null"
android:text="@string/tv_use_now" android:text="@string/tv_use_now"
android:textColor="@color/white" android:textColor="#714C37"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
</LinearLayout> </LinearLayout>
...@@ -105,19 +104,18 @@ ...@@ -105,19 +104,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/tv_outdoors_act" android:text="@string/tv_outdoors_act"
android:textColor="#333333" android:textColor="#333333"
android:textSize="@dimen/text_12" /> android:textSize="@dimen/sp_14" />
<Button <Button
android:layout_width="@dimen/size_80" android:layout_width="@dimen/size_80"
android:layout_height="@dimen/size_28" android:layout_height="@dimen/size_28"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_8"
android:background="@drawable/shape_rv_bg_member_top_grap" android:background="@drawable/shape_rv_bg_member_top_grap"
android:enabled="false" android:enabled="false"
android:gravity="center" android:gravity="center"
android:stateListAnimator="@null" android:stateListAnimator="@null"
android:text="@string/tv_please_wait" android:text="@string/tv_please_wait"
android:textColor="@color/white" android:textColor="#999999"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
</LinearLayout> </LinearLayout>
...@@ -127,15 +125,12 @@ ...@@ -127,15 +125,12 @@
<View <View
android:id="@+id/view_line" android:id="@+id/view_line"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1px" android:layout_height="15dp"
android:layout_marginLeft="@dimen/dp_10" android:background="#F5F5F5" />
android:layout_marginTop="5dp"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="#eee" />
<GridView <GridView
android:layout_marginTop="13dp"
android:id="@+id/gridview" android:id="@+id/gridview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -193,12 +188,12 @@ ...@@ -193,12 +188,12 @@
android:id="@+id/btn_buy" android:id="@+id/btn_buy"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/size_20" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/size_10" android:layout_marginTop="@dimen/size_10"
android:layout_marginRight="@dimen/size_20" android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/size_20" android:layout_marginBottom="@dimen/size_20"
android:gravity="center" android:gravity="center"
android:textColor="@color/white" android:textColor="#714C37"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
</LinearLayout> </LinearLayout>
<?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="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_member_level"
android:layout_width="0dp"
android:layout_height="@dimen/size_80"
android:layout_weight="1"
android:gravity="center"
android:textColor="#666666"
android:textSize="@dimen/text_15" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#FFC271" />
<TextView
android:id="@+id/tv_member_discount"
android:layout_width="0dp"
android:layout_height="@dimen/size_80"
android:layout_weight="1"
android:gravity="center"
android:textColor="#666666"
android:textSize="@dimen/text_15" />
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#FFC271" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="@dimen/size_80"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/tv_member_free_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:lines="2"
android:paddingTop="-20dp"
android:textColor="#666666"
android:textSize="@dimen/text_15" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<string name="tv_title_member_center">会员中心</string> <string name="tv_title_member_center">会员中心</string>
<string name="tv_outdoors_act">沙龙讲座活动</string> <string name="tv_outdoors_act">沙龙讲座活动</string>
<string name="tv_agreement">同意 《会员服务协议》 </string> <string name="tv_agreement">同意 《会员合同协议》 </string>
<string name="tv_use_now">马上使用</string> <string name="tv_use_now">马上使用</string>
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<string name="tv_title_consume_record">消费记录</string> <string name="tv_title_consume_record">消费记录</string>
<string name="tv_no_consume_data">无消费记录</string> <string name="tv_no_consume_data">无消费记录</string>
<string name="tv_member_free_day">普通会员可免费租车%d天,黄金会员%d天,钻石会员%d天(连续购买,天数可叠加)</string>
<string name="tv_member_rent_discount">普通会员%d折,黄金会员%d折,钻石会员%d折</string>
<string-array name="free_day_list"> <string-array name="free_day_list">
<item>使用明细</item> <item>使用明细</item>
<item>赠送明细</item> <item>赠送明细</item>
......
...@@ -96,7 +96,7 @@ public class PointAdapter extends RecyclerView.Adapter { ...@@ -96,7 +96,7 @@ public class PointAdapter extends RecyclerView.Adapter {
holder.btnState.setBackgroundResource(R.drawable.shape_rv_bg_dark_yellow); holder.btnState.setBackgroundResource(R.drawable.shape_rv_bg_dark_yellow);
} else { } else {
holder.btnState.setEnabled(!item.isIntegralStatus()); holder.btnState.setEnabled(!item.isIntegralStatus());
holder.btnState.setBackgroundResource(item.isIntegralStatus() ? R.drawable.shape_rv_bg_member_top_grap : R.drawable.shape_rv_bg_dark_yellow); holder.btnState.setBackgroundResource(item.isIntegralStatus() ? R.drawable.shape_rv_bg_member_top_grap1 : R.drawable.shape_rv_bg_dark_yellow);
} }
holder.btnState.setOnClickListener(new View.OnClickListener() { holder.btnState.setOnClickListener(new View.OnClickListener() {
@Override @Override
......
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