当前位置: 首页 > news >正文

网站备案与域名备案个人如何免费建网站

网站备案与域名备案,个人如何免费建网站,wordpress网站菜单固定,上海装修公司排名l上一篇文章我们看到了车载状态栏 CarSystemBar 视图的创建流程#xff0c;这里我们继续分析将车载状态栏添加到 Windows 窗口中。 一、添加状态栏到窗口 前面我们已经分析了构建视图对象容器和构建视图对象内容#xff0c;接下来我们继续分析 attachNavBarWindows() 方法将视…        上一篇文章我们看到了车载状态栏 CarSystemBar 视图的创建流程这里我们继续分析将车载状态栏添加到 Windows 窗口中。 一、添加状态栏到窗口 前面我们已经分析了构建视图对象容器和构建视图对象内容接下来我们继续分析 attachNavBarWindows() 方法将视图对象添加到 Window 中。 1、CarSystemBar 源码位置/packages/apps/Car/SystemUI/src/com/android/systemui/car/systembar/CarSystemBar.java attachNavBarWindows private final SystemBarConfigs mSystemBarConfigs;private void attachNavBarWindows() {mSystemBarConfigs.getSystemBarSidesByZOrder().forEach(this::attachNavBarBySide); } attachNavBarWindows() 会调用 SystemBarConfigs 的 getSystemBarSidesByZOrder() 方法获取到当前存在的所有 SystemBar 所对应的 Side。 2、SystemBarConfigs 源码位置/packages/apps/Car/SystemUI/src/com/android/systemui/car/systembar/SystemBarConfigs.java private final ListSystemBarSide Integer mSystemBarSidesByZOrder new ArrayList();protected ListInteger getSystemBarSidesByZOrder() {return mSystemBarSidesByZOrder; } 可以看到这里返回一个 ListSystemBarSide Integer 类型的数组下面看一下 mSystemBarSidesByZOrder 数据的赋值。 sortSystemBarSidesByZOrder private final MapSystemBarSide Integer, SystemBarConfig mSystemBarConfigMap new ArrayMap();private void sortSystemBarSidesByZOrder() {// 获取SystemBarConfig列表ListSystemBarConfig systemBarsByZOrder new ArrayList(mSystemBarConfigMap.values());systemBarsByZOrder.sort(new ComparatorSystemBarConfig() {Overridepublic int compare(SystemBarConfig o1, SystemBarConfig o2) {// 进行大小比较return o1.getZOrder() - o2.getZOrder();}});// 存储排序后SystemBar的Side数值。systemBarsByZOrder.forEach(systemBarConfig - {mSystemBarSidesByZOrder.add(systemBarConfig.getSide());}); }这里首先对 SystemBarConfig 列表根据序号对 SystemBar 进行排序并将排序后 SystemBar 的 Side 数值保存到  mSystemBarSidesByZOrder 数组中。而该函数是在 SystemBarConfigs 构造函数中进行调用并且在调用之前还要填充 mSystemBarConfigMap 数据。 SystemBarConfigs Inject public SystemBarConfigs(Main Resources resources) {mResources resources;// 初始化数据populateMaps();// 读取SystemBar所对应的SystemBarConfig的配置信息readConfigs();……// 使用SystemBarConfig的ZOrder属性对SystemBarConfig的Size进行排序sortSystemBarSidesByZOrder(); }readConfigs private void readConfigs() {mTopNavBarEnabled mResources.getBoolean(R.bool.config_enableTopSystemBar);mBottomNavBarEnabled mResources.getBoolean(R.bool.config_enableBottomSystemBar);mLeftNavBarEnabled mResources.getBoolean(R.bool.config_enableLeftSystemBar);mRightNavBarEnabled mResources.getBoolean(R.bool.config_enableRightSystemBar);// 顶部栏可用if (mTopNavBarEnabled) {SystemBarConfig topBarConfig new SystemBarConfigBuilder().setSide(TOP)// 顶部栏高度.setGirth(mResources.getDimensionPixelSize(R.dimen.car_top_system_bar_height))// 系统栏类型.setBarType(mResources.getInteger(R.integer.config_topSystemBarType))// 系统栏Z轴序列.setZOrder(mResources.getInteger(R.integer.config_topSystemBarZOrder)).setHideForKeyboard(mResources.getBoolean(R.bool.config_hideTopSystemBarForKeyboard)).build();mSystemBarConfigMap.put(TOP, topBarConfig);}// 底部栏可用if (mBottomNavBarEnabled) {SystemBarConfig bottomBarConfig new SystemBarConfigBuilder().setSide(BOTTOM).setGirth(mResources.getDimensionPixelSize(R.dimen.car_bottom_system_bar_height)).setBarType(mResources.getInteger(R.integer.config_bottomSystemBarType)).setZOrder(mResources.getInteger(R.integer.config_bottomSystemBarZOrder)).setHideForKeyboard(mResources.getBoolean(R.bool.config_hideBottomSystemBarForKeyboard)).build();mSystemBarConfigMap.put(BOTTOM, bottomBarConfig);}// 左侧栏不可用if (mLeftNavBarEnabled) {SystemBarConfig leftBarConfig new SystemBarConfigBuilder().setSide(LEFT).setGirth(mResources.getDimensionPixelSize(R.dimen.car_left_system_bar_width)).setBarType(mResources.getInteger(R.integer.config_leftSystemBarType)).setZOrder(mResources.getInteger(R.integer.config_leftSystemBarZOrder)).setHideForKeyboard(mResources.getBoolean(R.bool.config_hideLeftSystemBarForKeyboard)).build();mSystemBarConfigMap.put(LEFT, leftBarConfig);}// 右侧栏不可用if (mRightNavBarEnabled) {SystemBarConfig rightBarConfig new SystemBarConfigBuilder().setSide(RIGHT).setGirth(mResources.getDimensionPixelSize(R.dimen.car_right_system_bar_width)).setBarType(mResources.getInteger(R.integer.config_rightSystemBarType)).setZOrder(mResources.getInteger(R.integer.config_rightSystemBarZOrder)).setHideForKeyboard(mResources.getBoolean(R.bool.config_hideRightSystemBarForKeyboard)).build();mSystemBarConfigMap.put(RIGHT, rightBarConfig);} } 这里首先获取状态了的可用状态从 config.xml 文件中获取对应数据。 !-- 配置应该显示哪些系统条 -- bool nameconfig_enableTopSystemBartrue/bool bool nameconfig_enableLeftSystemBarfalse/bool bool nameconfig_enableRightSystemBarfalse/bool bool nameconfig_enableBottomSystemBartrue/bool 可以看到这里配置了状态栏的显示状态所以修改进度条的显示位置可以通过修改该数据实现。 同样其他相关的配置信息也都可以在对应的配置文件中找到。 3、添加状态栏 我们知道 attachNavBarWindows() 方法最终会循环 mSystemBarSidesByZOrder 集合的内容用该集合的子项作为参数依次调用 attachNavBarBySide() 方法。 attachNavBarBySide private void attachNavBarBySide(int side) {switch (side) {case SystemBarConfigs.TOP:// 如果顶部栏视图容器不为空将顶部栏视图容器添加到Window中if (mTopSystemBarWindow ! null) {mWindowManager.addView(mTopSystemBarWindow,mSystemBarConfigs.getLayoutParamsBySide(SystemBarConfigs.TOP));}break;case SystemBarConfigs.BOTTOM:if (mBottomSystemBarWindow ! null !mBottomNavBarVisible) {mBottomNavBarVisible true;mWindowManager.addView(mBottomSystemBarWindow,mSystemBarConfigs.getLayoutParamsBySide(SystemBarConfigs.BOTTOM));}break;case SystemBarConfigs.LEFT:if (mLeftSystemBarWindow ! null) {mWindowManager.addView(mLeftSystemBarWindow,mSystemBarConfigs.getLayoutParamsBySide(SystemBarConfigs.LEFT));}break;case SystemBarConfigs.RIGHT:if (mRightSystemBarWindow ! null) {mWindowManager.addView(mRightSystemBarWindow,mSystemBarConfigs.getLayoutParamsBySide(SystemBarConfigs.RIGHT));}break;default:return;} } 该方法就是根据对应的 type 判断当前视图容器的具体类型到底是顶部栏、底部栏、左侧栏还是右侧栏根据类型配合类型相对应的参数将该视图容器添加到 WindowManager 中。  二、状态栏配置 状态栏配置类 SystemBarConfig 为 SystemBarConfigs 的内部类。 1、SystemBarConfig // 系统条将开始出现在HUN的顶部的z轴顺序 private static final int HUN_ZORDER 10;private static final int[] BAR_TYPE_MAP {InsetsState.ITYPE_STATUS_BAR, // 状态栏对应的系统装饰窗口类型InsetsState.ITYPE_NAVIGATION_BAR, // 导航栏对应的系统装饰窗口类型InsetsState.ITYPE_CLIMATE_BAR, // 左侧栏对应的系统装饰窗口类型InsetsState.ITYPE_EXTRA_NAVIGATION_BAR // 右侧栏对应的系统装饰窗口类型private static final class SystemBarConfig {private final int mSide;private final int mBarType;private final int mGirth;private final int mZOrder;private final boolean mHideForKeyboard;private int[] mPaddings new int[]{0, 0, 0, 0};private SystemBarConfig(SystemBarSide int side, int barType, int girth, int zOrder,boolean hideForKeyboard) {mSide side;mBarType barType;mGirth girth;mZOrder zOrder;mHideForKeyboard hideForKeyboard;}private int getSide() {return mSide;}private int getBarType() {return mBarType;}private int getGirth() {return mGirth;}private int getZOrder() {return mZOrder;}private boolean getHideForKeyboard() {return mHideForKeyboard;}private int[] getPaddings() {return mPaddings;}private WindowManager.LayoutParams getLayoutParams() {WindowManager.LayoutParams lp new WindowManager.LayoutParams(isHorizontalBar(mSide) ? ViewGroup.LayoutParams.MATCH_PARENT : mGirth,isHorizontalBar(mSide) ? mGirth : ViewGroup.LayoutParams.MATCH_PARENT,mapZOrderToBarType(mZOrder),WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,PixelFormat.TRANSLUCENT); // 设置窗口半透明全透明TRANSPARENTlp.setTitle(BAR_TITLE_MAP.get(mSide));//顶部栏为new int[]{InsetsState.ITYPE_STATUS_BAR, InsetsState.ITYPE_TOP_MANDATORY_GESTURES}//底部栏为new int[]{InsetsState.ITYPE_NAVIGATION_BAR, InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES}//providesInsetsTypes这个字段很重要只有设置对这个字段系统才会认定该窗口是对应的装饰窗口lp.providesInsetsTypes new int[]{BAR_TYPE_MAP[mBarType], BAR_GESTURE_MAP.get(mSide)};lp.setFitInsetsTypes(0);lp.windowAnimations 0;lp.gravity BAR_GRAVITY_MAP.get(mSide);return lp;}private int mapZOrderToBarType(int zOrder) {// 顶部栏窗口类型为TYPE_STATUS_BAR_ADDITIONAL底部栏TYPE_NAVIGATION_BAR_PANELreturn zOrder HUN_ZORDER ? WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL: WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;}private void setPaddingBySide(SystemBarSide int side, int padding) {mPaddings[side] padding;} } 这里主要用来配置状态栏类型及对应的视图内容其中状态栏位置和标题等信息是在上面的 populateMaps() 方法中赋值。 populateMaps public static final int TOP 0; public static final int BOTTOM 1; public static final int LEFT 2; public static final int RIGHT 3;private static void populateMaps() {// 将系统栏位置与Gravity值关联BAR_GRAVITY_MAP.put(TOP, Gravity.TOP);BAR_GRAVITY_MAP.put(BOTTOM, Gravity.BOTTOM);BAR_GRAVITY_MAP.put(LEFT, Gravity.LEFT);BAR_GRAVITY_MAP.put(RIGHT, Gravity.RIGHT);// 将系统栏位置与标题字符串关联BAR_TITLE_MAP.put(TOP, TopCarSystemBar);BAR_TITLE_MAP.put(BOTTOM, BottomCarSystemBar);BAR_TITLE_MAP.put(LEFT, LeftCarSystemBar);BAR_TITLE_MAP.put(RIGHT, RightCarSystemBar);// 将系统栏位置与手势类型关联BAR_GESTURE_MAP.put(TOP, InsetsState.ITYPE_TOP_MANDATORY_GESTURES);BAR_GESTURE_MAP.put(BOTTOM, InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES);BAR_GESTURE_MAP.put(LEFT, InsetsState.ITYPE_LEFT_MANDATORY_GESTURES);BAR_GESTURE_MAP.put(RIGHT, InsetsState.ITYPE_RIGHT_MANDATORY_GESTURES); } 2、SystemBarConfigBuilder private static final class SystemBarConfigBuilder {private int mSide;private int mBarType;private int mGirth;private int mZOrder;private boolean mHideForKeyboard;private SystemBarConfigBuilder setSide(SystemBarSide int side) {mSide side;return this;}private SystemBarConfigBuilder setBarType(int type) {mBarType type;return this;}private SystemBarConfigBuilder setGirth(int girth) {mGirth girth;return this;}private SystemBarConfigBuilder setZOrder(int zOrder) {mZOrder zOrder;return this;}private SystemBarConfigBuilder setHideForKeyboard(boolean hide) {mHideForKeyboard hide;return this;}private SystemBarConfig build() {return new SystemBarConfig(mSide, mBarType, mGirth, mZOrder, mHideForKeyboard);} }SystemBarConfigBuilder 同样是 SystemBarConfigs 的内部类它实现了构建者模式Builder Pattern用于简化 SystemBarConfig 对象的创建。
http://www.hkea.cn/news/14340533/

相关文章:

  • 全国做网站最好的公司有哪些官方设计方案
  • wordpress申请adsense盐城优化办
  • 网站开发年薪建设优质网站需要什么
  • 个体户可以做网站建设软件开发模型的对比
  • 凡科做网站多少钱办公室装修实景拍摄图
  • 平安建设 十户长网站地址永久免费云服务器申请
  • 自己做网站代码保定市工程造价信息网
  • wordpress网址打不开从seo角度谈网站建设
  • 木材模板.网站宁夏网站建设价格
  • 爱站网络科技有限公司浦江网站建设微信开发
  • 智慧城市网站建设微网站预约网站开发
  • 空白网站怎么做360免费建站官网入口
  • 网站进度条做多大网站是否必须做认证
  • 网站seo在哪里设置微信公众号和网站建设的意义
  • 昆明网站seo优化整站优化加盟
  • 做骗子网站惠州关键词排名推广
  • 学设计网站佛山网站建设哪儿有
  • 网站一般用什么免费字体wordpress 增加字段
  • 网站数字化建设深圳市住房和建设局官网网址
  • 网站背景居中怎么做重庆建筑信息网查询
  • 商业网站模板微商代理网
  • 免费申请企业网站大鹏手机网站建设
  • 网站到期可以续费免费做苗木网站
  • 淘宝上做网站行吗传奇霸主网页版
  • 广州商城型网站优惠卷网站怎么做推广
  • 成立网站开发公司珠海医疗网站建设公司
  • 做旅游网站毕设任务书企业网站设计开发服务
  • 凡客诚品网站建设策划书上海公司注册查名官网
  • 临沂网站建设联系方式网站被黑咋样的
  • 河津网站建设网站建设如何使图片翻转