?????????????????? SDK ?е? HUD ??????????ù??ù???????????? HUD ?????????????????????仯??????1?????? javascript:;" onClick="javascript:tagshow(event, 'API');" target="_self">API ????? AMapNaviGuide ????????????????????????23???????
????????????23 ???????????????? assets ????а??????????????????????????
???????μ??? API ?? jar ??????
????AMap_ Navi_v1.3.0_20150828.jar
????|- assets
????|- autonavi_Resource1_1_0.png
????|- custtexture*.png (7 ??)
????|- com
????|- amap.api.navi
????|- autonavi
????|- META-INF
????????assets ???????????? 8 ???????????????? HUD ????????ī??????????????????????
?????? Android Studio ?? jar ???е? AMapHudView.class ?????? AMapHudView ???????AS 1.2 ????????????????
????...
????import com.autonavi.tbt.g;
????...
????public class AMapHudView extends FrameLayout implements OnClickListener?? OnTouchListener?? e {
????static final int[] hud_imgActions = new int[]{2130837532?? 2130837532?? 2130837532?? 2130837533?? 2130837534?? 2130837535?? 2130837536?? 2130837537?? 2130837538?? 2130837539?? 2130837522?? 2130837523?? 2130837524?? 2130837525?? 2130837526?? 2130837527?? 2130837528?? 2130837529?? 2130837530?? 2130837531};
????...
????private ImageView roadsignimg;// ??????????? View
????...
????private int resId;// ???????? id????? hud_imgActions ?? index???????μ????????????? 0-23
????...
????private void updateHudWidgetContent() {
????...
????if(this.roadsignimg != null && this.resId != 0 && this.resId != 1) {
????Drawable var1 = g.a().getDrawable(hud_imgActions[this.resId]);// g.a() ??????? Resource ????
????this.roadsignimg.setBackgroundDrawable(var1);
????...
????}
????}
????}
???????hud_imgActions??????????????????????16?????? 0x7F02 ?????0x7F ???????????? 0×02 ???? drawable ??????????updateHudWidgetContent()??????????????????resId???hud_imgActions????? drawable id????????? id ?????????? Drawable ????????????? ImageView ?С?
??????????????????? SDK ????????????????????????? Drawable??
???????????? apk ?в?????????????????????????????????? Drawable???????????????12?д???
????Drawable var1 = g.a().getDrawable(hud_imgActions[this.resId]);// g.a() ??????? Resource ????
?????????????????е?g.a()?У????com.autonavi.tbt.g#a()
????public static Resources a() {
????if (b == null) {
????b = e.getResources();
????}
????return b;
????}
???????б???e??????????? Activity????????????????????? apk ?в???????????????????????????????b????????????????
????public static boolean a(Context context) {
????...
????a = b(context.getFilesDir() + "/autonavi_Resource1_1_0.jar");
????b = a(context?? a);// ???? a ? AssetManager
????return true;
????}
????private static AssetManager b(String str) {
????try {
????Class cls = Class.forName("android.content.res.AssetManager");
????AssetManager assetManager = (AssetManager) cls.getConstructor().newInstance();
????try {
????cls.getDeclaredMethod("addAssetPath"?? String.class).invoke(assetManager?? str);
????} catch (Throwable th) {
????}
????return assetManager;
????} catch (Throwable th2) {
????return null;
????}
????}
????private static Resources a(Context context?? AssetManager assetManager) {
????DisplayMetrics displayMetrics = new DisplayMetrics();
????displayMetrics.setToDefaults();
????return new Resources(assetManager?? displayMetrics?? context.getResources().getConfiguration());
????}
???????????????? SDK ???????????????? AssetManager????????? `addAssetPath(context.getFilesDir() + “/autonavi_Resource1_1_0.jar”)??????????? Resources ??????????????????????μ? Resource ??????????????? Drawable ????
????????????? apk ????? files ???в??????? autonavi_Resource1_1_0.jar????????????????????
????private static String k = "autonavi_Resource1_1_0.png";
????...
????private static boolean b(Context var0) {
????String filePath = var0.getFilesDir().getAbsolutePath() + "/autonavi_Resource1_1_0.jar";
????...
????InputStream var1 = var0.getResources().getAssets().open(k);
????File var3 = new File(filePath);
????long var21 = var3.length();
????int var6 = var1.available();
????if(!var3.exists() || var21 != (long)var6) {
????...
????File var22 = new File(filePath);
????FileOutputStream var2 = new FileOutputStream(var22);
????byte[] var8 = new byte[1024];
????int var9;
????while((var9 = var1.read(var8)) > 0) {
????var2.write(var8?? 0?? var9);
????}
????}
????...
????}
???????? com.autonavi.tbt.g ???????????????????? jar ???? assets ???е? autonavi_Resource1_1_0.png ???????? apk ????? files ???У??????μ????????? autonavi_Resource1_1_0.jar??
??????????????????????????????? autonavi_Resource1_1_0.jar ???????????
????????????????? apk???????????????? jar????AssetManager ????? apk ??Resource ??????? AssetManager ??????????????????
????AssetManager ?????????ο???????Android??ó??????????????Asset Manager????????????????
????????????????????????? SDK ????????????????????
????????? apk ?????? jar ???? assets ???У?
?????? View ??????????????н? assets ?е???? apk ????? files ???У?
????????????? AssetManager?????? addAssetPath ???????? files ???е???? apk??
??????? AssetManager ???????????? Resouce??????? Resource ?????????apk ????????????
???????
??????????????????????????????????????????????裺
????????? AssetManager ???????????????? addAssetPath(String) ??????????? apk?????? apk ????????μ?????
????????????????? AssetManager ????? Resource ????
????????????????? Resource ????????????????
????????????????????? apk?????????????context.getFilesDir()?У?????????????addAssetPath ???? 0??????????? apk ????????????? addAssetPath ???????н??????У?顣
?????????? id
???????????У???????????????????????????????????????? id?????? apk ?? R.java ?????????? apk????????????????????
??????????????????У?
??????????????? R ????????? id??????????????????? field ?? name??????? apk ?????????field name ??????????????????????Ч?????????
????????????????? id?????????????????? apk ??????????????????????????????????????????????????????????????????У???????????
??????????? apk ?? R.java ?????? apk ?У???? R ??? id???????????????? apk ?д??????? R.java???????????????????????????????÷??????????????????????????????????????????????????
????????????????и?????????????????????y????????????
??????ó???
???????????????????????Щ??ó???????У?
?????滻????????磺QQ ???
??????С?? apk ???С??????????????????
?????????????и?? SDK ??????????? jar ?????????????????????????????????????????????????????? aar??
????????
??????????????????????????к??????????????????????漰??λ?? drawable??string ???????????з??????????????? apk ?е???????????????????_(:???∠)_???????????????ζ????????? apk ?е?????????