下拉菜单增加一个自定义磁贴
1、新建Tile.java。
在\frameworks\base\packages\SystemUI\src\com\android\systemui\qs\tile路径下创建一个类DesignNewTile.java
![image.png](https://img-blog.csdnimg.cn/img_convert/d52c42b17e22f19219dcc7fb89c69d0e.png#averageHue=#2d2c2b&clientId=u0ea6c1e7-69fb-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=756&id=uedfdfd84&margin=[object Object]&name=image.png&originHeight=756&originWidth=1059&originalType=binary&ratio=1&rotation=0&showTitle=true&size=113814&status=done&style=none&taskId=uea070926-44af-45e7-a50f-a3ff05249a7&title=新建DesignNewTile&width=1059 “新建DesignNewTile”)
2、添加操作类-controller类。
这边以我复刻的便捷式热点为例,定义了带有QSHost和磁贴的操作类(具体需要的操作看客户需求,自己可以先实现简单的操作,例如长按和单击之后的操作),接口和接口的实现,然后我们的Tile类中即可使用
private final HotspotController mHotspotController;//检索热点和相关信息
private final DataSaverController mDataSaverController;//数据控制
![image.png](https://img-blog.csdnimg.cn/img_convert/27420a01d68591389c71154517a6910d.png#averageHue=#2e2d2c&clientId=u0ea6c1e7-69fb-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=532&id=bTw0Y&margin=[object Object]&name=image.png&originHeight=532&originWidth=785&originalType=binary&ratio=1&rotation=0&showTitle=false&size=74234&status=done&style=none&taskId=u7f8ef339-e7a5-41d0-997c-1d635454e50&title=&width=785)
HotspotController——HotspotControllerImpl
![image.png](https://img-blog.csdnimg.cn/img_convert/40497fac5dfa98f5e01d13e6a21d2fbb.png#averageHue=#2f2d2b&clientId=u0ea6c1e7-69fb-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=379&id=ubd540870&margin=[object Object]&name=image.png&originHeight=379&originWidth=815&originalType=binary&ratio=1&rotation=0&showTitle=false&size=44124&status=done&style=none&taskId=u254ada6d-9ded-428b-badf-1fa5cc795ef&title=&width=815)
![image.png](https://img-blog.csdnimg.cn/img_convert/6f395f776c1c7e0b2a2bb7ed4c7efd9c.png#averageHue=#2e2c2b&clientId=u0ea6c1e7-69fb-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=691&id=l6JWM&margin=[object Object]&name=image.png&originHeight=691&originWidth=858&originalType=binary&ratio=1&rotation=0&showTitle=false&size=106831&status=done&style=none&taskId=u32639000-ea76-402e-a602-dcf412669b7&title=&width=858)
DataSaverController——DataSaverControllerImpl
![image.png](https://img-blog.csdnimg.cn/img_convert/6a8eaff7b07c56b6dc99837599c81c3e.png#averageHue=#2e2c2b&clientId=u0ea6c1e7-69fb-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=811&id=u3b1c52a7&margin=[object Object]&name=image.png&originHeight=811&originWidth=848&originalType=binary&ratio=1&rotation=0&showTitle=false&size=108920&sta