[fea]
获取资源统一修改为ResourcesUtils
This commit is contained in:
yakunyang
2024-06-14 10:52:43 +08:00
parent dd0926c171
commit 6b6970e373
4 changed files with 60 additions and 42 deletions

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
import com.mogo.och.common.module.utils.ResourcesUtils
import java.util.ArrayList
/**
@@ -139,7 +140,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
}
override fun onChangeLineIdSuccess() {
ToastUtils.showLong(resources.getString(R.string.bus_change_line_commit_tip_s))
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_change_line_commit_tip_s))
mPresenter?.queryBusRoutes()
mAdapter.setOnLineItemClickListener(null)
mPresenter?.removeListener()

View File

@@ -15,6 +15,7 @@ import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.passenger.presenter.PM2DrivingPresenter
import com.mogo.och.common.module.utils.DateTimeUtil.*
import com.mogo.och.common.module.utils.NumberFormatUtil
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.data.bean.BusStationBean
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.auto_tv
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.clg_distance_left_time
@@ -66,12 +67,12 @@ class PM2DrivingInfoFragment :
true
}
line_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_line_name_tv_color))
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_line_name_tv_color))
line_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_line_name_tv_color))
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_line_name_tv_color))
speed_tv.setVertrial(true)
val intArrayOf = intArrayOf(
requireContext().resources.getColor(R.color.bus_p_m2_color_43cefe),
requireContext().resources.getColor(R.color.bus_p_m2_color_1466fb)
ResourcesUtils.getColor(R.color.bus_p_m2_color_43cefe),
ResourcesUtils.getColor(R.color.bus_p_m2_color_1466fb)
)
speed_tv.setmColorList(intArrayOf)
@@ -152,7 +153,7 @@ class PM2DrivingInfoFragment :
}
fun showNoTaskView(){
line_name_tv.text = resources.getString(R.string.bus_p_m2_not_select_line_content)
line_name_tv.text = ResourcesUtils.getString(R.string.bus_p_m2_not_select_line_content)
updateNoStationView()
overMapView?.let {
it.clearSiteMarkers()
@@ -166,10 +167,10 @@ class PM2DrivingInfoFragment :
}
}
private fun updateNoStationView(){
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_next_tv_color))
station_name_tv.text = resources.getString(R.string.bus_p_m2_empty_tv)
tv_distance.text = resources.getString(R.string.bus_p_m2_empty_remain_km)
tv_left_time.text = resources.getString(R.string.bus_p_m2_empty_remain_minute)
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_next_tv_color))
station_name_tv.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_tv)
tv_distance.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_km)
tv_left_time.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_minute)
noLineShow()
}
@@ -214,19 +215,19 @@ class PM2DrivingInfoFragment :
fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean){
if (stations.size == 0) return
if (0<= currentStationIndex && currentStationIndex<stations.size){
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_next_tv_color))
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_next_tv_color))
station_name_tv.text = stations[currentStationIndex].name
}
if (currentStationIndex == 0 && isArrived){
clearCustomPolyline()
}
if (isArrived){//到站
tv_distance.text = resources.getString(R.string.bus_p_m2_empty_remain_km)
tv_left_time.text = resources.getString(R.string.bus_p_m2_empty_remain_minute)
tv_next_station_title.text = resources.getString(R.string.bus_p_m2_station_title_arrived_tv)
tv_distance.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_km)
tv_left_time.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_minute)
tv_next_station_title.text = ResourcesUtils.getString(R.string.bus_p_m2_station_title_arrived_tv)
haveLineAndArrivedStation()
}else{ //前往目的地中
tv_next_station_title.text = resources.getString(R.string.bus_p_m2_next_station_title)
tv_next_station_title.text = ResourcesUtils.getString(R.string.bus_p_m2_next_station_title)
haveLineAndArriveingStation()
}
}

View File

@@ -24,6 +24,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
import com.mogo.eagle.core.function.smp.view.SmallMapView
import com.mogo.eagle.core.function.view.MapBizView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.utils.SoundPoolHelper
import kotlinx.android.synthetic.main.charter_base_fragment.module_mogo_och_arrived_tv
import org.greenrobot.eventbus.EventBus
@@ -69,7 +70,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container)
slidePanelView = findViewById(R.id.charter_slide_panel)
slidePanelView?.setText(resources.getString(R.string.charter_back_car))
slidePanelView?.setText(ResourcesUtils.getString(R.string.charter_back_car))
slidePanelView?.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
@@ -191,9 +192,9 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
requireActivity().runOnUiThread {
module_mogo_och_arrived_tv.isEnabled = isClickable
if (isClickable) {
module_mogo_och_arrived_tv.setTextColor(resources.getColor(android.R.color.white))
module_mogo_och_arrived_tv.setTextColor(ResourcesUtils.getColor(android.R.color.white))
} else {
module_mogo_och_arrived_tv.setTextColor(resources.getColor(R.color.charter_arrived_btn_un_clickable_color))
module_mogo_och_arrived_tv.setTextColor(ResourcesUtils.getColor(R.color.charter_arrived_btn_un_clickable_color))
}
}
}

View File

@@ -233,20 +233,23 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}
public void onAutopilotStatusChanged(int status,boolean canStart) {
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,canStart);
}
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
// 2. 主动开启自动驾驶中为2则停止loading并isStarting = false
startAutopilotDone(true);
return;
}
// 3. 其他过程直接更新
startOrStopLoadingAnim(false);
autopilotStatusAnimchanged(status,canStart);
});
},UiThreadHandler.MODE.QUEUE);
}
public void stopAnimAndUpdateBtnStatus() {
@@ -302,6 +305,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}
private void startAutopilotDone(boolean success) {
if(mAutopilotImage==null){
return;
}
if (autopilotLoadingAnimator != null) {
autopilotLoadingAnimator.end();
mAutopilotImage.clearAnimation();
@@ -375,15 +381,21 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}
public void hidPanel() {
getActivity().runOnUiThread(() -> {
flStationPanelContainer.setVisibility(View.GONE);
});
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);
}
/**
@@ -400,12 +412,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) {