[6.4.0]
[getActivity 改为UiThread]
This commit is contained in:
@@ -322,10 +322,13 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
public void showSlidePanel(String text) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
setArrivedClickable(false);
|
||||
}
|
||||
|
||||
@@ -335,23 +338,29 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
* @param isClickable
|
||||
*/
|
||||
public void setArrivedClickable(boolean isClickable) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
tvArrived.setEnabled(isClickable);
|
||||
if (isClickable) {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_white));
|
||||
} else {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_arrived_btn_un_clickable_color));
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tvArrived.setEnabled(isClickable);
|
||||
if (isClickable) {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_white));
|
||||
} else {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_arrived_btn_un_clickable_color));
|
||||
}
|
||||
}
|
||||
});
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏滑动按钮
|
||||
*/
|
||||
public void hideSlidePanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void playDI() {
|
||||
@@ -364,9 +373,12 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(int autopilotStatus) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void setAutopilotBtnStatus(int autopilotStatus) {
|
||||
@@ -443,19 +455,12 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
public void hideAutopilotBiz() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setVisibility(View.GONE);
|
||||
// slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示【自动驾驶】按钮
|
||||
*/
|
||||
public void showAutopilotBiz() {
|
||||
// getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setVisibility(View.VISIBLE);
|
||||
// });
|
||||
}
|
||||
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
import com.mogo.map.overlay.core.Level;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
@@ -191,20 +192,23 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
return;
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
|
||||
showStationsPanel();
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
mLineName.setText(lineName);
|
||||
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}
|
||||
|
||||
showStationsPanel();
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
mLineName.setText(lineName);
|
||||
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
});
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
private void updateBusStationStatus(List<BusStationBean> stationList,
|
||||
|
||||
@@ -427,12 +427,15 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
|
||||
public void onAutopilotStatusChanged(int status) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// 3. 其他过程直接更新
|
||||
if (mPrevAPStatus != status){
|
||||
AutopilotStatusChanged(status);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 3. 其他过程直接更新
|
||||
if (mPrevAPStatus != status){
|
||||
AutopilotStatusChanged(status);
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -324,10 +324,13 @@ public abstract class BaseShuttleTabFragment<V extends IView, P extends Presente
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
public void showSlidePanel(String text) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
setArrivedClikable(false);
|
||||
}
|
||||
|
||||
@@ -337,23 +340,29 @@ public abstract class BaseShuttleTabFragment<V extends IView, P extends Presente
|
||||
* @param isClickable
|
||||
*/
|
||||
public void setArrivedClikable(boolean isClickable) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
tvArrived.setEnabled(isClickable);
|
||||
if (isClickable) {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_white));
|
||||
} else {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_arrived_btn_un_clickable_color));
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tvArrived.setEnabled(isClickable);
|
||||
if (isClickable) {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_white));
|
||||
} else {
|
||||
tvArrived.setTextColor(getResources().getColor(R.color.bus_arrived_btn_un_clickable_color));
|
||||
}
|
||||
}
|
||||
});
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏滑动按钮
|
||||
*/
|
||||
public void hideSlidePanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void playDI() {
|
||||
@@ -366,9 +375,12 @@ public abstract class BaseShuttleTabFragment<V extends IView, P extends Presente
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(int autopilotStatus) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning);
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void setAutopilotBtnStatus(int autopilotStatus) {
|
||||
@@ -450,19 +462,12 @@ public abstract class BaseShuttleTabFragment<V extends IView, P extends Presente
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
public void hideAutopilotBiz() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setVisibility(View.GONE);
|
||||
// slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示【自动驾驶】按钮
|
||||
*/
|
||||
public void showAutopilotBiz() {
|
||||
// getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setVisibility(View.VISIBLE);
|
||||
// });
|
||||
}
|
||||
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
import com.mogo.map.overlay.core.Level;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
@@ -198,20 +199,23 @@ public class ShuttleFragment extends BaseShuttleTabFragment<ShuttleFragment, Bus
|
||||
return;
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
|
||||
showStationsPanel();
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
mLineName.setText(lineName);
|
||||
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}
|
||||
|
||||
showStationsPanel();
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
mLineName.setText(lineName);
|
||||
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
});
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
private void updateBusStationStatus(List<BusStationBean> stationList,
|
||||
|
||||
@@ -339,12 +339,15 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
|
||||
public void onAutopilotStatusChanged(int status) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// 3. 其他过程直接更新
|
||||
if (mPrevAPStatus != status){
|
||||
AutopilotStatusChanged(status);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 3. 其他过程直接更新
|
||||
if (mPrevAPStatus != status){
|
||||
AutopilotStatusChanged(status);
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -362,20 +362,23 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
}
|
||||
|
||||
public void onAutopilotStatusChanged(int status) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) {
|
||||
// 1. 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return;
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) {
|
||||
// 1. 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return;
|
||||
}
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
// 2. 主动开启自动驾驶中,为2则停止loading,并isStarting = false
|
||||
startAutopilotDone(true);
|
||||
return;
|
||||
}
|
||||
// 3. 其他过程直接更新
|
||||
startOrStopLoadingAnim(false);
|
||||
autopilotStatusAnimchanged(status);
|
||||
}
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
// 2. 主动开启自动驾驶中,为2则停止loading,并isStarting = false
|
||||
startAutopilotDone(true);
|
||||
return;
|
||||
}
|
||||
// 3. 其他过程直接更新
|
||||
startOrStopLoadingAnim(false);
|
||||
autopilotStatusAnimchanged(status);
|
||||
});
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void stopAnimAndUpdateBtnStatus() {
|
||||
@@ -523,15 +526,20 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
}
|
||||
|
||||
public void hidPanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flStationPanelContainer.setVisibility(View.GONE);
|
||||
});
|
||||
}},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void showPanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
flStationPanelContainer.setVisibility(View.VISIBLE);
|
||||
});
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flStationPanelContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public View getPanelView() {
|
||||
@@ -552,12 +560,15 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
|
||||
|
||||
public void changeOperationViewVisible(int visible) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (tvOperationStatus == null) {
|
||||
return;
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (tvOperationStatus == null) {
|
||||
return;
|
||||
}
|
||||
tvOperationStatus.setVisibility(visible);
|
||||
}
|
||||
tvOperationStatus.setVisibility(visible);
|
||||
});
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
protected void showAmapNaviToStationFragment(boolean isShow) {
|
||||
|
||||
Reference in New Issue
Block a user