整理资源

This commit is contained in:
董宏宇
2021-08-09 17:01:19 +08:00
parent 9cc8d3aa6e
commit d0055d6eed
27 changed files with 0 additions and 69 deletions

View File

@@ -1,69 +0,0 @@
package com.mogo.module.common.drawer.marker;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.CarModelType;
import com.mogo.module.common.constants.SafeType;
import com.mogo.module.common.constants.VisionMode;
import com.mogo.utils.logger.Logger;
public
/**
* @author congtaowang
* @since 2020/10/29
* <p>
* 描述 按照命名规则用字符串拼接成资源名称的方式拿到图片的id避免枚举
*/
class MarkerResourceManager {
private static final String TAG = "MarkerResourceManager";
/**
* @param mode
* @param adasRecognizedType
* @param type
* @return
*/
public static int getMarkerDrawableResId( VisionMode mode,
AdasRecognizedType adasRecognizedType,
CarModelType type,
SafeType safeType ) {
if ( mode == null ) {
mode = VisionMode.User;
}
if ( adasRecognizedType == null ) {
adasRecognizedType = AdasRecognizedType.classIdCar;
}
if ( type == null ) {
type = CarModelType.Other;
}
if ( safeType == null ) {
safeType = SafeType.Normal;
}
StringBuilder builder = new StringBuilder();
builder.append( "module_commons" )
.append( "_" ).append( mode.getRes() )
.append( "_" ).append( adasRecognizedType.getRes() )
.append( "_" ).append( type.getRes() )
.append( "_" ).append( safeType.getRes() );
Logger.d( TAG, "res name = %s", builder.toString() );
int id = AbsMogoApplication.getApp().getResources().getIdentifier(
builder.toString(),
"drawable",
AbsMogoApplication.getApp().getPackageName() );
if ( id == 0 ) {
if ( mode == VisionMode.User ) {
return R.drawable.module_commons_user_car_other_normal;
} else {
return R.drawable.module_commons_machine_car_other_normal;
}
}
return id;
}
}