[2110] 任务列表

This commit is contained in:
yangyakun
2022-09-16 20:17:12 +08:00
parent be56b6a073
commit e94f0e941f
25 changed files with 1139 additions and 179 deletions

View File

@@ -51,6 +51,7 @@ dependencies {
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
compileOnly rootProject.ext.dependencies.recyclerviewadapterhelper
implementation project(":OCH:mogo-och-common-module")

View File

@@ -13,7 +13,7 @@
<activity android:name=".ui.BusSwitchLineActivity"
android:theme="@style/SwitchLineDialogStyle"
android:launchMode="singleTask"
android:screenOrientation="landscape" />/>
android:screenOrientation="landscape" />
</application>
</manifest>

View File

@@ -19,5 +19,9 @@ public class BusQueryLinesResponse extends BaseData {
public String startSiteName;//始发站名称
public String endSiteName;//终点名称
public boolean open;
public boolean haveTask;
public List<Result> taskList;
}
}

View File

@@ -9,4 +9,5 @@ import com.mogo.och.bus.bean.BusQueryLinesResponse;
public interface IBusLinesCallback {
void onBusLinesChange(BusQueryLinesResponse lines);
void onChangeLineIdSuccess();
void onBusLineTasks(BusQueryLinesResponse o, int position);
}

View File

@@ -63,6 +63,36 @@ public class BusLineModel {
});
}
/**
* 通过线路id 查询线路排班表
* @param lineId
* @param position 位置
*/
public void queryBusLineTasksById(int lineId, int position){
BusServiceManager.getInstance().queryBusLines(mContext, new IBusServiceCallback<BusQueryLinesResponse>() {
@Override
public void onSuccess(BusQueryLinesResponse data) {
if (null == data && mBusLinesCallback != null) {
mBusLinesCallback.onBusLineTasks(null,position);
return;
}
if (mBusLinesCallback != null){
mBusLinesCallback.onBusLineTasks(data,position);
}
}
@Override
public void onFail(String failMsg) {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort("网络异常,请稍后重试");
}else {
ToastUtils.showShort("查询所有绑定路线失败:"+failMsg);
}
}
});
}
public void commitSwitchLineId(int lineId){
BusServiceManager.getInstance().switchLine(mContext,lineId, new IBusServiceCallback<BusRoutesResponse>() {
@Override

View File

@@ -61,6 +61,10 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
BusLineModel.getInstance().queryBusLines();
}
public void queryBusLineTasks(int lineId, int position){
BusLineModel.getInstance().queryBusLineTasksById(lineId,position);
}
public void commitSwitchLineId(int lineId){
BusLineModel.getInstance().commitSwitchLineId(lineId);
}
@@ -77,4 +81,10 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
public void onDestroy(@NonNull LifecycleOwner owner) {
super.onDestroy(owner);
}
@Override
public void onBusLineTasks(BusQueryLinesResponse o, int position) {
mView.onBusLineTasks(o,position);
}
}

View File

@@ -3,9 +3,7 @@ package com.mogo.och.bus.ui;
import android.content.Context;
import android.graphics.Point;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -21,12 +19,19 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.module.common.view.SpacesItemDecoration;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.presenter.BusLinePresenter;
import com.mogo.och.bus.ui.adapter.OpenItemAnimator;
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
/**
* @author: wangmingjun
@@ -43,6 +48,8 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
private List<BusQueryLinesResponse.Result> mData = new ArrayList<>();
private int mSelectLineId = -1;
private Disposable subscribe;
@Override
protected int getLayoutId() {
return R.layout.activity_bus_switch_line;
@@ -79,19 +86,19 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
mLinesListView = findViewById(R.id.switch_line_rv);
mLinesListView.setLayoutManager(new LinearLayoutManager(this));
mLinesListView.setItemAnimator(new OpenItemAnimator());
mAdapter = new SwitchLineAdapter(getApplicationContext(),mData);
mLinesListView.addItemDecoration(new SpacesItemDecoration(4));
mLinesListView.setAdapter(mAdapter);
//设置item 点击事件
mAdapter.setOnLineItemClickListener(new LineItemClickListener() {
@Override
public void onItemClick(int position) {
if (mData.size() > position && !TextUtils.isEmpty(mData.get(position).startSiteName )
&& !TextUtils.isEmpty(mData.get(position).endSiteName)){
mSelectLineId = mData.get(position).lineId;
}else {
mSelectLineId = -1;
}
mAdapter.setOnLineItemClickListener((position) -> {
mPresenter.queryBusLineTasks(mData.get(position).lineId,position);
if(subscribe!=null&&!subscribe.isDisposed()){
subscribe.dispose();
}
subscribe = Observable.timer(3, TimeUnit.MINUTES).subscribe(aLong -> {
mPresenter.queryBusLineTasks(mData.get(position).lineId,position);
});
});
}
@@ -165,6 +172,24 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
finish();
}
@Override
public void onBusLineTasks(BusQueryLinesResponse o, int position) {
BusQueryLinesResponse.Result result = mData.get(position);
if(result.taskList ==null){
result.taskList = new ArrayList<>();
}
if(o.data.size()!=result.taskList.size()) {// 不相等有变动 重新赋值
result.taskList.clear();
if (position % 3 != 0) {
result.taskList.addAll(o.data);
result.haveTask = false;
} else {
result.haveTask = true;
}
}
mAdapter.notifyItemChanged(position);
}
/**
* 有无数据UI显示
* @param b
@@ -195,105 +220,14 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
}else {
finish();
}
return;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
}
/**
* 路线列表adapter
*/
static class SwitchLineAdapter extends RecyclerView.Adapter<SwitchLineViewHolder>{
private Context mContext;
private List<BusQueryLinesResponse.Result> mData;
// RecyclerView设置点击事件
private LineItemClickListener mItemClickListener ;
private int clickPos = -1;
public SwitchLineAdapter(Context context, List<BusQueryLinesResponse.Result> data){
mContext = context;
mData = data;
if(subscribe!=null&&!subscribe.isDisposed()){
subscribe.dispose();
}
@NonNull
@Override
public SwitchLineViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.bus_switch_line_list_item
,parent,false);
SwitchLineViewHolder viewHolder = new SwitchLineViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull SwitchLineViewHolder holder, int position) {
BusQueryLinesResponse.Result line = mData.get(position);
holder.lineName.setText(mContext.getString(R.string.bus_switch_line_name)+" "+line.name);
holder.lineStartName.setText(mContext.getString(R.string.bus_line_start)+" "+line.startSiteName);
holder.lineEndName.setText(mContext.getString(R.string.bus_line_end)+" "+line.endSiteName);
//设置item点击事件
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mItemClickListener != null){
mItemClickListener.onItemClick(position);
clickPos = position;
notifyDataSetChanged();
}
}
});
//选中绑定
if (clickPos > -1){
if (clickPos == position){
holder.selectIv.setImageResource(R.drawable.bus_selected_btn);
}else {
holder.selectIv.setImageResource(R.drawable.bus_unselect_btn);
}
}else {
if (line.choose == 1){//1:绑定 2:未绑定 默认绑定
if (mItemClickListener != null) {
mItemClickListener.onItemClick(position);
}
holder.selectIv.setImageResource(R.drawable.bus_selected_btn);
}else {
holder.selectIv.setImageResource(R.drawable.bus_unselect_btn);
}
}
}
@Override
public int getItemCount() {
return mData.size();
}
public void setOnLineItemClickListener(LineItemClickListener itemClickListener){
this.mItemClickListener = itemClickListener ;
}
}
static class SwitchLineViewHolder extends RecyclerView.ViewHolder{
private ImageView selectIv;
private TextView lineName; //线路名称
private TextView lineStartName; //起点
private TextView lineEndName; //终点
public SwitchLineViewHolder(@NonNull View itemView) {
super(itemView);
selectIv = itemView.findViewById(R.id.switch_line_item_select_iv);
lineName = itemView.findViewById(R.id.switch_line_name);
lineStartName = itemView.findViewById(R.id.switch_line_start_station);
lineEndName = itemView.findViewById(R.id.switch_line_end_station);
}
}
public interface LineItemClickListener {
void onItemClick(int position) ;
}
}

View File

@@ -11,5 +11,7 @@ public interface BusSwitchLineView extends IView {
void onBusLinesChange(BusQueryLinesResponse data);
void onChangeLineIdSuccess();
void onBusLineTasks(BusQueryLinesResponse o, int position);
}

View File

@@ -0,0 +1,655 @@
package com.mogo.och.bus.ui.adapter;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.ViewPropertyAnimator;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import java.util.ArrayList;
import java.util.List;
/**
* This implementation of {@link RecyclerView.ItemAnimator} provides basic
* animations on remove, add, and move events that happen to the items in
* a RecyclerView. RecyclerView uses a DefaultItemAnimator by default.
*
* @see RecyclerView#setItemAnimator(RecyclerView.ItemAnimator)
*/
public class OpenItemAnimator extends DefaultItemAnimator {
private static final boolean DEBUG = false;
private static TimeInterpolator sDefaultInterpolator;
private ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
private ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
private static class MoveInfo {
public RecyclerView.ViewHolder holder;
public int fromX, fromY, toX, toY;
MoveInfo(RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
this.holder = holder;
this.fromX = fromX;
this.fromY = fromY;
this.toX = toX;
this.toY = toY;
}
}
private static class ChangeInfo {
public RecyclerView.ViewHolder oldHolder, newHolder;
public int fromX, fromY, toX, toY;
private ChangeInfo(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder) {
this.oldHolder = oldHolder;
this.newHolder = newHolder;
}
ChangeInfo(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
int fromX, int fromY, int toX, int toY) {
this(oldHolder, newHolder);
this.fromX = fromX;
this.fromY = fromY;
this.toX = toX;
this.toY = toY;
}
@Override
public String toString() {
return "ChangeInfo{"
+ "oldHolder=" + oldHolder
+ ", newHolder=" + newHolder
+ ", fromX=" + fromX
+ ", fromY=" + fromY
+ ", toX=" + toX
+ ", toY=" + toY
+ '}';
}
}
@Override
public void runPendingAnimations() {
boolean removalsPending = !mPendingRemovals.isEmpty();
boolean movesPending = !mPendingMoves.isEmpty();
boolean changesPending = !mPendingChanges.isEmpty();
boolean additionsPending = !mPendingAdditions.isEmpty();
if (!removalsPending && !movesPending && !additionsPending && !changesPending) {
// nothing to animate
return;
}
// First, remove stuff
for (RecyclerView.ViewHolder holder : mPendingRemovals) {
animateRemoveImpl(holder);
}
mPendingRemovals.clear();
// Next, move stuff
if (movesPending) {
final ArrayList<MoveInfo> moves = new ArrayList<>();
moves.addAll(mPendingMoves);
mMovesList.add(moves);
mPendingMoves.clear();
Runnable mover = new Runnable() {
@Override
public void run() {
for (MoveInfo moveInfo : moves) {
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
moveInfo.toX, moveInfo.toY);
}
moves.clear();
mMovesList.remove(moves);
}
};
if (removalsPending) {
View view = moves.get(0).holder.itemView;
ViewCompat.postOnAnimationDelayed(view, mover, getRemoveDuration());
} else {
mover.run();
}
}
// Next, change stuff, to run in parallel with move animations
if (changesPending) {
final ArrayList<ChangeInfo> changes = new ArrayList<>();
changes.addAll(mPendingChanges);
mChangesList.add(changes);
mPendingChanges.clear();
Runnable changer = new Runnable() {
@Override
public void run() {
for (ChangeInfo change : changes) {
animateChangeImpl(change);
}
changes.clear();
mChangesList.remove(changes);
}
};
if (removalsPending) {
RecyclerView.ViewHolder holder = changes.get(0).oldHolder;
ViewCompat.postOnAnimationDelayed(holder.itemView, changer, getRemoveDuration());
} else {
changer.run();
}
}
// Next, add stuff
if (additionsPending) {
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
additions.addAll(mPendingAdditions);
mAdditionsList.add(additions);
mPendingAdditions.clear();
Runnable adder = new Runnable() {
@Override
public void run() {
for (RecyclerView.ViewHolder holder : additions) {
animateAddImpl(holder);
}
additions.clear();
mAdditionsList.remove(additions);
}
};
if (removalsPending || movesPending || changesPending) {
long removeDuration = removalsPending ? getRemoveDuration() : 0;
long moveDuration = movesPending ? getMoveDuration() : 0;
long changeDuration = changesPending ? getChangeDuration() : 0;
long totalDelay = removeDuration + Math.max(moveDuration, changeDuration);
View view = additions.get(0).itemView;
ViewCompat.postOnAnimationDelayed(view, adder, totalDelay);
} else {
adder.run();
}
}
}
@Override
public boolean animateRemove(final RecyclerView.ViewHolder holder) {
resetAnimation(holder);
mPendingRemovals.add(holder);
return true;
}
private void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
final View view = holder.itemView;
final ViewPropertyAnimator animation = view.animate();
mRemoveAnimations.add(holder);
animation.setDuration(getRemoveDuration()).alpha(0).setListener(
new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchRemoveStarting(holder);
}
@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
view.setAlpha(1);
dispatchRemoveFinished(holder);
mRemoveAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).start();
}
@Override
public boolean animateAdd(final RecyclerView.ViewHolder holder) {
resetAnimation(holder);
holder.itemView.setAlpha(0);
mPendingAdditions.add(holder);
return true;
}
void animateAddImpl(final RecyclerView.ViewHolder holder) {
final View view = holder.itemView;
final ViewPropertyAnimator animation = view.animate();
mAddAnimations.add(holder);
animation.alpha(1).setDuration(getAddDuration())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchAddStarting(holder);
}
@Override
public void onAnimationCancel(Animator animator) {
view.setAlpha(1);
}
@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
dispatchAddFinished(holder);
mAddAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).start();
}
@Override
public boolean animateMove(final RecyclerView.ViewHolder holder, int fromX, int fromY,
int toX, int toY) {
final View view = holder.itemView;
fromX += (int) holder.itemView.getTranslationX();
fromY += (int) holder.itemView.getTranslationY();
resetAnimation(holder);
int deltaX = toX - fromX;
int deltaY = toY - fromY;
if (deltaX == 0 && deltaY == 0) {
dispatchMoveFinished(holder);
return false;
}
if (deltaX != 0) {
view.setTranslationX(-deltaX);
}
if (deltaY != 0) {
view.setTranslationY(-deltaY);
}
mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
return true;
}
void animateMoveImpl(final RecyclerView.ViewHolder holder, int fromX, int fromY, int toX, int toY) {
final View view = holder.itemView;
final int deltaX = toX - fromX;
final int deltaY = toY - fromY;
if (deltaX != 0) {
view.animate().translationX(0);
}
if (deltaY != 0) {
view.animate().translationY(0);
}
// TODO: make EndActions end listeners instead, since end actions aren't called when
// vpas are canceled (and can't end them. why?)
// need listener functionality in VPACompat for this. Ick.
final ViewPropertyAnimator animation = view.animate();
mMoveAnimations.add(holder);
animation.setDuration(getMoveDuration()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchMoveStarting(holder);
}
@Override
public void onAnimationCancel(Animator animator) {
if (deltaX != 0) {
view.setTranslationX(0);
}
if (deltaY != 0) {
view.setTranslationY(0);
}
}
@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
dispatchMoveFinished(holder);
mMoveAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).start();
}
@Override
public boolean animateChange(RecyclerView.ViewHolder oldHolder, RecyclerView.ViewHolder newHolder,
int fromX, int fromY, int toX, int toY) {
if (oldHolder == newHolder) {
// Don't know how to run change animations when the same view holder is re-used.
// run a move animation to handle position changes.
return animateMove(oldHolder, fromX, fromY, toX, toY);
}
final float prevTranslationX = oldHolder.itemView.getTranslationX();
final float prevTranslationY = oldHolder.itemView.getTranslationY();
final float prevAlpha = oldHolder.itemView.getAlpha();
resetAnimation(oldHolder);
int deltaX = (int) (toX - fromX - prevTranslationX);
int deltaY = (int) (toY - fromY - prevTranslationY);
// recover prev translation state after ending animation
oldHolder.itemView.setTranslationX(prevTranslationX);
oldHolder.itemView.setTranslationY(prevTranslationY);
oldHolder.itemView.setAlpha(prevAlpha);
if (newHolder != null) {
// carry over translation values
resetAnimation(newHolder);
newHolder.itemView.setTranslationX(-deltaX);
newHolder.itemView.setTranslationY(-deltaY);
newHolder.itemView.setAlpha(0);
}
mPendingChanges.add(new ChangeInfo(oldHolder, newHolder, fromX, fromY, toX, toY));
return true;
}
void animateChangeImpl(final ChangeInfo changeInfo) {
final RecyclerView.ViewHolder holder = changeInfo.oldHolder;
final View view = holder == null ? null : holder.itemView;
final RecyclerView.ViewHolder newHolder = changeInfo.newHolder;
final View newView = newHolder != null ? newHolder.itemView : null;
if (view != null) {
final ViewPropertyAnimator oldViewAnim = view.animate().setDuration(
getChangeDuration());
mChangeAnimations.add(changeInfo.oldHolder);
oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX);
oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY);
oldViewAnim.alpha(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchChangeStarting(changeInfo.oldHolder, true);
}
@Override
public void onAnimationEnd(Animator animator) {
oldViewAnim.setListener(null);
view.setAlpha(1);
view.setTranslationX(0);
view.setTranslationY(0);
dispatchChangeFinished(changeInfo.oldHolder, true);
mChangeAnimations.remove(changeInfo.oldHolder);
dispatchFinishedWhenDone();
}
}).start();
}
if (newView != null) {
final ViewPropertyAnimator newViewAnimation = newView.animate();
mChangeAnimations.add(changeInfo.newHolder);
newViewAnimation.translationX(0).translationY(0).setDuration(getChangeDuration())
.alpha(1).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchChangeStarting(changeInfo.newHolder, false);
}
@Override
public void onAnimationEnd(Animator animator) {
newViewAnimation.setListener(null);
newView.setAlpha(1);
newView.setTranslationX(0);
newView.setTranslationY(0);
dispatchChangeFinished(changeInfo.newHolder, false);
mChangeAnimations.remove(changeInfo.newHolder);
dispatchFinishedWhenDone();
}
}).start();
}
}
private void endChangeAnimation(List<ChangeInfo> infoList, RecyclerView.ViewHolder item) {
for (int i = infoList.size() - 1; i >= 0; i--) {
ChangeInfo changeInfo = infoList.get(i);
if (endChangeAnimationIfNecessary(changeInfo, item)) {
if (changeInfo.oldHolder == null && changeInfo.newHolder == null) {
infoList.remove(changeInfo);
}
}
}
}
private void endChangeAnimationIfNecessary(ChangeInfo changeInfo) {
if (changeInfo.oldHolder != null) {
endChangeAnimationIfNecessary(changeInfo, changeInfo.oldHolder);
}
if (changeInfo.newHolder != null) {
endChangeAnimationIfNecessary(changeInfo, changeInfo.newHolder);
}
}
private boolean endChangeAnimationIfNecessary(ChangeInfo changeInfo, RecyclerView.ViewHolder item) {
boolean oldItem = false;
if (changeInfo.newHolder == item) {
changeInfo.newHolder = null;
} else if (changeInfo.oldHolder == item) {
changeInfo.oldHolder = null;
oldItem = true;
} else {
return false;
}
item.itemView.setAlpha(1);
item.itemView.setTranslationX(0);
item.itemView.setTranslationY(0);
dispatchChangeFinished(item, oldItem);
return true;
}
@Override
public void endAnimation(RecyclerView.ViewHolder item) {
final View view = item.itemView;
// this will trigger end callback which should set properties to their target values.
view.animate().cancel();
// TODO if some other animations are chained to end, how do we cancel them as well?
for (int i = mPendingMoves.size() - 1; i >= 0; i--) {
MoveInfo moveInfo = mPendingMoves.get(i);
if (moveInfo.holder == item) {
view.setTranslationY(0);
view.setTranslationX(0);
dispatchMoveFinished(item);
mPendingMoves.remove(i);
}
}
endChangeAnimation(mPendingChanges, item);
if (mPendingRemovals.remove(item)) {
view.setAlpha(1);
dispatchRemoveFinished(item);
}
if (mPendingAdditions.remove(item)) {
view.setAlpha(1);
dispatchAddFinished(item);
}
for (int i = mChangesList.size() - 1; i >= 0; i--) {
ArrayList<ChangeInfo> changes = mChangesList.get(i);
endChangeAnimation(changes, item);
if (changes.isEmpty()) {
mChangesList.remove(i);
}
}
for (int i = mMovesList.size() - 1; i >= 0; i--) {
ArrayList<MoveInfo> moves = mMovesList.get(i);
for (int j = moves.size() - 1; j >= 0; j--) {
MoveInfo moveInfo = moves.get(j);
if (moveInfo.holder == item) {
view.setTranslationY(0);
view.setTranslationX(0);
dispatchMoveFinished(item);
moves.remove(j);
if (moves.isEmpty()) {
mMovesList.remove(i);
}
break;
}
}
}
for (int i = mAdditionsList.size() - 1; i >= 0; i--) {
ArrayList<RecyclerView.ViewHolder> additions = mAdditionsList.get(i);
if (additions.remove(item)) {
view.setAlpha(1);
dispatchAddFinished(item);
if (additions.isEmpty()) {
mAdditionsList.remove(i);
}
}
}
// animations should be ended by the cancel above.
//noinspection PointlessBooleanExpression,ConstantConditions
if (mRemoveAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mRemoveAnimations list");
}
//noinspection PointlessBooleanExpression,ConstantConditions
if (mAddAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mAddAnimations list");
}
//noinspection PointlessBooleanExpression,ConstantConditions
if (mChangeAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mChangeAnimations list");
}
//noinspection PointlessBooleanExpression,ConstantConditions
if (mMoveAnimations.remove(item) && DEBUG) {
throw new IllegalStateException("after animation is cancelled, item should not be in "
+ "mMoveAnimations list");
}
dispatchFinishedWhenDone();
}
private void resetAnimation(RecyclerView.ViewHolder holder) {
if (sDefaultInterpolator == null) {
sDefaultInterpolator = new ValueAnimator().getInterpolator();
}
holder.itemView.animate().setInterpolator(sDefaultInterpolator);
endAnimation(holder);
}
@Override
public boolean isRunning() {
return (!mPendingAdditions.isEmpty()
|| !mPendingChanges.isEmpty()
|| !mPendingMoves.isEmpty()
|| !mPendingRemovals.isEmpty()
|| !mMoveAnimations.isEmpty()
|| !mRemoveAnimations.isEmpty()
|| !mAddAnimations.isEmpty()
|| !mChangeAnimations.isEmpty()
|| !mMovesList.isEmpty()
|| !mAdditionsList.isEmpty()
|| !mChangesList.isEmpty());
}
/**
* Check the state of currently pending and running animations. If there are none
* pending/running, call {@link #dispatchAnimationsFinished()} to notify any
* listeners.
*/
void dispatchFinishedWhenDone() {
if (!isRunning()) {
dispatchAnimationsFinished();
}
}
@Override
public void endAnimations() {
int count = mPendingMoves.size();
for (int i = count - 1; i >= 0; i--) {
MoveInfo item = mPendingMoves.get(i);
View view = item.holder.itemView;
view.setTranslationY(0);
view.setTranslationX(0);
dispatchMoveFinished(item.holder);
mPendingMoves.remove(i);
}
count = mPendingRemovals.size();
for (int i = count - 1; i >= 0; i--) {
RecyclerView.ViewHolder item = mPendingRemovals.get(i);
dispatchRemoveFinished(item);
mPendingRemovals.remove(i);
}
count = mPendingAdditions.size();
for (int i = count - 1; i >= 0; i--) {
RecyclerView.ViewHolder item = mPendingAdditions.get(i);
item.itemView.setAlpha(1);
dispatchAddFinished(item);
mPendingAdditions.remove(i);
}
count = mPendingChanges.size();
for (int i = count - 1; i >= 0; i--) {
endChangeAnimationIfNecessary(mPendingChanges.get(i));
}
mPendingChanges.clear();
if (!isRunning()) {
return;
}
int listCount = mMovesList.size();
for (int i = listCount - 1; i >= 0; i--) {
ArrayList<MoveInfo> moves = mMovesList.get(i);
count = moves.size();
for (int j = count - 1; j >= 0; j--) {
MoveInfo moveInfo = moves.get(j);
RecyclerView.ViewHolder item = moveInfo.holder;
View view = item.itemView;
view.setTranslationY(0);
view.setTranslationX(0);
dispatchMoveFinished(moveInfo.holder);
moves.remove(j);
if (moves.isEmpty()) {
mMovesList.remove(moves);
}
}
}
listCount = mAdditionsList.size();
for (int i = listCount - 1; i >= 0; i--) {
ArrayList<RecyclerView.ViewHolder> additions = mAdditionsList.get(i);
count = additions.size();
for (int j = count - 1; j >= 0; j--) {
RecyclerView.ViewHolder item = additions.get(j);
View view = item.itemView;
view.setAlpha(1);
dispatchAddFinished(item);
additions.remove(j);
if (additions.isEmpty()) {
mAdditionsList.remove(additions);
}
}
}
listCount = mChangesList.size();
for (int i = listCount - 1; i >= 0; i--) {
ArrayList<ChangeInfo> changes = mChangesList.get(i);
count = changes.size();
for (int j = count - 1; j >= 0; j--) {
endChangeAnimationIfNecessary(changes.get(j));
if (changes.isEmpty()) {
mChangesList.remove(changes);
}
}
}
cancelAll(mRemoveAnimations);
cancelAll(mMoveAnimations);
cancelAll(mAddAnimations);
cancelAll(mChangeAnimations);
dispatchAnimationsFinished();
}
void cancelAll(List<RecyclerView.ViewHolder> viewHolders) {
for (int i = viewHolders.size() - 1; i >= 0; i--) {
viewHolders.get(i).itemView.animate().cancel();
}
}
/**
* {@inheritDoc}
* <p>
* If the payload list is not empty, DefaultItemAnimator returns <code>true</code>.
* When this is the case:
* <ul>
* <li>If you override {@link #animateChange(RecyclerView.ViewHolder, RecyclerView.ViewHolder, int, int, int, int)}, both
* ViewHolder arguments will be the same instance.
* </li>
* <li>
* If you are not overriding {@link #animateChange(RecyclerView.ViewHolder, RecyclerView.ViewHolder, int, int, int, int)},
* then DefaultItemAnimator will call {@link #animateMove(RecyclerView.ViewHolder, int, int, int, int)} and
* run a move animation instead.
* </li>
* </ul>
*/
@Override
public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder,
@NonNull List<Object> payloads) {
return !payloads.isEmpty() || super.canReuseUpdatedViewHolder(viewHolder, payloads);
}
}

View File

@@ -0,0 +1,142 @@
package com.mogo.och.bus.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.BusQueryLinesResponse
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter.SwitchLineViewHolder
/**
* 路线列表adapter
*/
class SwitchLineAdapter(
private val mContext: Context,
private val mData: List<BusQueryLinesResponse.Result>
) : RecyclerView.Adapter<SwitchLineViewHolder>() {
companion object{
const val TAG = "SwitchLineAdapter"
}
// RecyclerView设置点击事件
private var mItemClickListener: LineItemClickListener? = null
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): SwitchLineViewHolder {
val view = LayoutInflater.from(mContext).inflate(
R.layout.bus_switch_line_list_item, parent, false
)
return SwitchLineViewHolder(view)
}
override fun onBindViewHolder(holder: SwitchLineViewHolder, position: Int) {
val currentPosition = holder.bindingAdapterPosition
val line = mData[currentPosition]
holder.lineName.text = line.name
holder.lineEndName.text = mContext.getString(R.string.bus_line_goto_end, line.endSiteName)
holder.rvLineTask.layoutManager = GridLayoutManager(mContext, 3)
val switchLineTaskAdapter =
SwitchLineTaskAdapter(
mContext,
line.taskList
)
holder.rvLineTask.adapter = switchLineTaskAdapter
holder.rvLineTask.isFocusableInTouchMode = false
holder.actvShowMore.visibility = View.VISIBLE
if(line.open){
if(line.taskList==null||line.taskList.isEmpty()){
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_no_task)
holder.vLineTask.visibility = View.GONE
holder.rvLineTask.visibility = View.GONE
holder.selectIv.visibility = View.INVISIBLE
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
}else {
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_select_task)
holder.vLineTask.visibility = View.VISIBLE
holder.rvLineTask.visibility = View.VISIBLE
holder.selectIv.visibility = View.VISIBLE
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_selected)
holder.selectIv.apply {
pivotX = 9.5f
pivotY = 17f
rotation = 90f
}
}
}else{
if(line.haveTask){
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_no_task)
holder.vLineTask.visibility = View.GONE
holder.rvLineTask.visibility = View.GONE
holder.selectIv.visibility = View.INVISIBLE
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
}else {
holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_select_task)
holder.vLineTask.visibility = View.GONE
holder.rvLineTask.visibility = View.GONE
holder.selectIv.visibility = View.VISIBLE
holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal)
holder.selectIv.apply {
pivotX = 9.5f
pivotY = 17f
rotation = 0f
}
}
}
//设置item点击事件
holder.itemView.setOnClickListener {
if(holder.actvShowMore.text==mContext.getString(R.string.bus_switch_line_no_task)){
return@setOnClickListener
}
closeOther()
mItemClickListener?.onItemClick(currentPosition)
line.open = holder.rvLineTask.visibility == View.GONE
}
}
private fun closeOther() {
mData.forEachIndexed { index, result ->
if(result.open){
result.open = false;
notifyItemChanged(index)
}
}
}
override fun getItemCount(): Int {
return mData.size
}
fun setOnLineItemClickListener(itemClickListener: LineItemClickListener?) {
mItemClickListener = itemClickListener
}
class SwitchLineViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val selectIv: ImageView
val lineName: AppCompatTextView//线路名称
val lineEndName: AppCompatTextView //终点
val actvShowMore: AppCompatTextView //选择时间
val rvLineTask: RecyclerView// 排班时间
val vLineTask: View// 白色分割线
init {
selectIv = itemView.findViewById(R.id.switch_line_item_select_iv)
lineName = itemView.findViewById(R.id.switch_line_name)
lineEndName = itemView.findViewById(R.id.switch_line_end_station)
rvLineTask = itemView.findViewById(R.id.rv_line_task_list)
vLineTask = itemView.findViewById(R.id.v_line_task)
actvShowMore = itemView.findViewById(R.id.actv_show_more)
}
}
interface LineItemClickListener {
fun onItemClick(position: Int)
}
}

View File

@@ -0,0 +1,73 @@
package com.mogo.och.bus.ui.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import java.util.List;
/**
* 路线列表adapter
*/
public class SwitchLineTaskAdapter extends RecyclerView.Adapter<SwitchLineTaskAdapter.SwitchLineTaskViewHolder> {
private Context mContext;
private List<BusQueryLinesResponse.Result> mData;
public SwitchLineTaskAdapter(Context context, List<BusQueryLinesResponse.Result> data) {
mContext = context;
mData = data;
}
@NonNull
@Override
public SwitchLineTaskViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.bus_switch_line_list_task_item
, parent, false);
return new SwitchLineTaskViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull SwitchLineTaskViewHolder holder, int position) {
int currentPosition = holder.getBindingAdapterPosition();
BusQueryLinesResponse.Result line = mData.get(currentPosition);
holder.lineTask.setText(line.name);
holder.lineTask.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
@Override
public int getItemCount() {
return mData==null?0:mData.size();
}
static class SwitchLineTaskViewHolder extends RecyclerView.ViewHolder {
private TextView lineTask; // 时间
public SwitchLineTaskViewHolder(@NonNull View itemView) {
super(itemView);
lineTask = itemView.findViewById(R.id.actv_line_task);
}
}
public interface LineItemClickListener {
void onItemClick(int position) ;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#660043FF"
android:startColor="#0028345E" />
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#CC0043FF"
android:startColor="#0028345E" />
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:color="#A7B6F0" android:width="@dimen/dp_4"/>
<solid android:color="#1AA7B6F0" />
<corners android:radius="@dimen/dp_13"/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#029DFF" android:endColor="#F00056FF"/>
<corners android:radius="@dimen/dp_13"/>
</shape>

View File

@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/bus_switch_line_bg">
<View
@@ -44,11 +45,7 @@
app:layout_constraintLeft_toLeftOf="@+id/switch_line_1"
app:layout_constraintTop_toBottomOf="@+id/switch_line_1"
app:layout_constraintBottom_toTopOf="@+id/switch_line_btn_commit"
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="40dp"
android:layout_marginTop="@dimen/dp_50"
android:layout_marginLeft="@dimen/dp_80"
android:layout_marginRight="@dimen/dp_80"
android:layout_marginBottom="@dimen/dp_30"/>
<TextView

View File

@@ -1,89 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_80">
android:background="@drawable/bus_shape_select_line_item_bg_normal">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_show_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_13"
android:text="选择时间"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_40"
app:layout_constraintTop_toTopOf="@+id/switch_line_item_select_iv"
app:layout_constraintBottom_toBottomOf="@+id/switch_line_item_select_iv"
app:layout_constraintEnd_toStartOf="@+id/switch_line_item_select_iv" />
<ImageView
android:id="@+id/switch_line_item_select_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bus_checkbox_selector"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
android:layout_marginEnd="@dimen/dp_80"
android:background="@drawable/bus_line_task_arrow"
app:layout_constraintBottom_toTopOf="@+id/v_line_task"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/switch_line_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@+id/switch_line_item_select_iv"
android:layout_marginLeft="@dimen/dp_33"
android:maxLines="2"
android:layout_marginStart="@dimen/dp_80"
android:layout_marginTop="@dimen/dp_34"
android:ellipsize="end"
android:textStyle="bold"
android:maxLines="2"
android:textColor="@android:color/white"
android:text="@string/bus_switch_line_name"
android:textSize="@dimen/dp_42" />
android:textSize="@dimen/dp_46"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/bus_switch_line_name" />
<TextView
android:id="@+id/switch_line_start_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_17"
android:layout_marginTop="@dimen/dp_30"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/bus_switch_line_start"
android:textColor="#B9C3E9"
android:textSize="@dimen/dp_36"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switch_line_name"
app:layout_constraintLeft_toRightOf="@+id/switch_line_start_greenDot"/>
<ImageView
android:id="@+id/switch_line_start_greenDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bus_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@+id/switch_line_start_station"
app:layout_constraintLeft_toLeftOf="@+id/switch_line_name"
app:layout_constraintTop_toTopOf="@+id/switch_line_start_station" />
<ImageView
android:id="@+id/switch_line_end_dotLine"
android:layout_width="wrap_content"
android:layout_height="0px"
android:scaleType="fitXY"
android:src="@drawable/bus_och_dot_line"
app:layout_constraintBottom_toTopOf="@+id/switch_line_end_blueDot"
app:layout_constraintLeft_toLeftOf="@+id/switch_line_start_greenDot"
app:layout_constraintRight_toRightOf="@+id/switch_line_start_greenDot"
app:layout_constraintTop_toBottomOf="@+id/switch_line_start_greenDot" />
<ImageView
android:id="@+id/switch_line_end_blueDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bus_icon_arriving_station"
app:layout_constraintBottom_toBottomOf="@+id/switch_line_end_station"
app:layout_constraintLeft_toLeftOf="@+id/switch_line_name"
app:layout_constraintTop_toTopOf="@+id/switch_line_end_station" />
<TextView
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/switch_line_end_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_17"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_35"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/bus_switch_line_end"
android:textColor="#B9C3E9"
android:textColor="@color/bus_color_b9c3e9"
android:textSize="@dimen/dp_36"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@+id/switch_line_end_blueDot"
app:layout_constraintTop_toBottomOf="@+id/switch_line_start_station"/>
app:layout_constraintBottom_toTopOf="@+id/v_line_task"
app:layout_constraintStart_toStartOf="@+id/switch_line_name"
app:layout_constraintTop_toBottomOf="@+id/switch_line_name"
tools:text="@string/bus_switch_line_end" />
<View
android:id="@+id/v_line_task"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="@dimen/dp_80"
android:layout_marginEnd="@dimen/dp_80"
android:background="@android:color/white"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/rv_line_task_list"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switch_line_end_station" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_line_task_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_50"
android:layout_marginBottom="@dimen/dp_20"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v_line_task" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/actv_line_task"
android:gravity="center"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_30"
android:background="@drawable/bus_shape_select_line_item_time_bg"
android:layout_width="match_parent"
android:textSize="@dimen/dp_40"
android:textColor="@android:color/white"
android:layout_height="@dimen/dp_102">
</androidx.appcompat.widget.AppCompatTextView>

View File

@@ -45,4 +45,6 @@
<color name="bus_traffic_light_yellow_color_up">#FFFFE198</color>
<color name="bus_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="bus_arrived_btn_un_clickable_color">#59FFFFFF</color>
<color name="bus_color_b9c3e9">#B9C3E9 </color>
</resources>

View File

@@ -5,7 +5,9 @@
<string name="bus_loading_autopilot_success_tv">启动成功</string>
<string name="bus_loading_autopilot_failure_tv">启动失败</string>
<string name="bus_loading_autopilot_runnig_tv">自动驾驶</string>
<string name="bus_switch_line_title">路线列表</string>
<string name="bus_switch_line_title">任务列表</string>
<string name="bus_switch_line_no_task">暂无任务</string>
<string name="bus_switch_line_select_task">选择时间</string>
<string name="bus_switch_line_name">路线: </string>
<string name="bus_switch_line_start">起点: </string>
<string name="bus_switch_line_end">终点:</string>
@@ -17,6 +19,7 @@
<string name="bus_no_line_tip">当前车辆无路线\n请联系运营人员绑定</string>
<string name="bus_line_start">起点: </string>
<string name="bus_line_end">终点: </string>
<string name="bus_line_goto_end">往%1$s方向</string>
<string name="bus_change_line_commit_tip_s">更换路线成功</string>
<string name="bus_change_line_commit_tip_f">更换路线失败</string>
<!-- <string name="bus_arrive_to_end_title">去往下车地点</string>-->

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:motionInterpolator="easeInOut"
motion:duration="300">
<KeyFrameSet>
</KeyFrameSet>
<OnClick motion:targetId="@+id/switch_line_item_select_iv" motion:clickAction="toggle" />
</Transition>
<ConstraintSet android:id="@+id/start">
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/switch_line_end_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
motion:layout_constraintBottom_toTopOf="@id/v_line_task"
android:layout_marginBottom="@dimen/dp_40"
motion:layout_constraintTop_toBottomOf="@+id/switch_line_name"
motion:layout_constraintStart_toStartOf="@+id/switch_line_name"
android:layout_marginTop="@dimen/dp_20" />
<Constraint
android:id="@+id/v_line_task"
android:visibility="visible"
android:background="@android:color/white"
android:layout_marginStart="@dimen/dp_80"
android:layout_marginEnd="@dimen/dp_80"
android:layout_marginTop="@dimen/dp_40"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toBottomOf="@+id/switch_line_end_station"
android:layout_width="match_parent"
android:layout_height="1px"/>
<Constraint
android:id="@+id/rv_line_task_list"
android:visibility="visible"
android:layout_marginStart="@dimen/dp_80"
android:layout_marginEnd="@dimen/dp_80"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toBottomOf="@+id/v_line_task"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ConstraintSet>
</MotionScene>

View File

@@ -1,8 +1,8 @@
package com.mogo.och.common.module
import org.junit.Test
import com.zhidao.thirdlogin.utils.Aes
import org.junit.Assert.*
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
@@ -13,5 +13,11 @@ class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
val json = "{\"device\":\"03cdfec225781de0\",\"time\":" + System.currentTimeMillis() + "}"
val IVS = "tqXMOa6g2w3S4sso+DqCfKAHRNA5jg3Mzp45e33zHFA="
val KEY = "y5VajBH+sTHonJP2a5Uh6uDZcK0fxNB5ORHmbg9B3V0="
val encrypt: String = Aes.encrypt(json, KEY, IVS, "UTF-8")
println(encrypt)
}
}

View File

@@ -54,7 +54,7 @@ public class TaxiPassengerServiceManager {
* @return
*/
private String getDriverAppSn(){
return CallerTelematicManager.INSTANCE.getServerToken();
return "X20202206092431156";
}
/**

View File

@@ -248,7 +248,10 @@ ext {
//========================= Koom ======================
koomnative : "com.kuaishou.koom:koom-native-leak-static:2.2.0",
koomxhook : "com.kuaishou.koom:xhook-static:2.2.0"
koomxhook : "com.kuaishou.koom:xhook-static:2.2.0",
//========================= Koom ======================
recyclerviewadapterhelper : "io.github.cymchad:BaseRecyclerViewAdapterHelper:3.0.4"
]
}