欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android不显示开机向导和开机气泡问题

程序员文章站 2023-12-01 21:13:40
修改好的代码下载地址: https://github.com/vico-h/launcher •不显示开机向导 ---------------------...

修改好的代码下载地址:

https://github.com/vico-h/launcher

•不显示开机向导

--------------------------------------------------------------------------------
修改launcher2.java的代码

(文件位置: /alps/packages/apps/launcher2/src/com/android/launcher2/launcher.java)

网站查看源码:

https://www.androidos.net.cn/android/6.0.1_r16/xref/packages/apps/launcher2/src/com/android/launcher2/launcher.java

launcher2.java部分源码如下:

······
public void showfirstrunworkspacecling() {
  // enable the clings only if they have not been dismissed before
  if (isclingsenabled() &&
    !msharedprefs.getboolean(cling.workspace_cling_dismissed_key, false) &&//此处false改为true
    !skipcustomclingifnoaccounts() ) {
   // if we're not using the default workspace layout, replace workspace cling
   // with a custom workspace cling (usually specified in an overlay)
   // for now, only do this on tablets
   if (msharedprefs.getint(launcherprovider.default_workspace_resource_id, 0) != 0 &&
     getresources().getboolean(r.bool.config_usecustomclings)) {
    // use a custom cling
    view cling = findviewbyid(r.id.workspace_cling);
    viewgroup clingparent = (viewgroup) cling.getparent();
    int clingindex = clingparent.indexofchild(cling);
    clingparent.removeviewat(clingindex);
    view customcling = minflater.inflate(r.layout.custom_workspace_cling, clingparent, false);
    clingparent.addview(customcling, clingindex);
    customcling.setid(r.id.workspace_cling);
   }
   initcling(r.id.workspace_cling, null, false, 0);
  } else {
   removecling(r.id.workspace_cling);
  }
 }
 public void showfirstrunallappscling(int[] position) {
  // enable the clings only if they have not been dismissed before
  if (isclingsenabled() &&
    !msharedprefs.getboolean(cling.allapps_cling_dismissed_key, false)) {//此处false改为true
   initcling(r.id.all_apps_cling, position, true, 0);
  } else {
   removecling(r.id.all_apps_cling);
  }
 }
 public cling showfirstrunfolderscling() {
  // enable the clings only if they have not been dismissed before
  if (isclingsenabled() &&
    !msharedprefs.getboolean(cling.folder_cling_dismissed_key, false)) {//此处false改为true
   return initcling(r.id.folder_cling, null, true, 0);
  } else {
   removecling(r.id.folder_cling);
   return null;
  }
 }
······

修改如下:

- !msharedprefs.getboolean(cling.workspace_cling_dismissed_key, false) &&
+ !msharedprefs.getboolean(cling.workspace_cling_dismissed_key, true) &&
- !msharedprefs.getboolean(cling.allapps_cling_dismissed_key, false)) 
+ !msharedprefs.getboolean(cling.allapps_cling_dismissed_key, true)) 
- !msharedprefs.getboolean(cling.folder_cling_dismissed_key, false)) 
+ !msharedprefs.getboolean(cling.folder_cling_dismissed_key, true)) 

•不显示开机气泡

--------------------------------------------------------------------------------
有个需求是开机不要下面这个图片所示的气泡

Android不显示开机向导和开机气泡问题

修改launcher3.java的代码

(文件位置: /alps/packages/apps/launcher3/src/com/android/launcher3/launcher.java)

网站查看源码:

https://www.androidos.net.cn/android/6.0.1_r16/xref/packages/apps/launcher3/src/com/android/launcher3/launcher.java

launcher3.java部分源码如下:

······
protected void oncreate(bundle savedinstancestate) {
  ······
  if (shouldshowintroscreen()) {
     showintroscreen();
    } else {
     showfirstrunactivity();
     showfirstrunclings();//注释此行即可
    }
}
······

将下面的直接的这行注释掉就不会有开机气泡了

- showfirstrunclings();
+ //showfirstrunclings();

总结

以上所述是小编给大家介绍的android不显示开机向导和开机气泡问题,希望对大家有所帮助,如果大家有任何欢迎给我留言,小编会及时回复大家的!