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

什么是域名访问网站宁波网站推广公司

什么是域名访问网站,宁波网站推广公司,iis建站安装wordpress,做网站推广有啥活动安卓源码里有谷歌给的关于 Tile 的说明。 frameworks/base/packages/SystemUI/docs/qs-tiles.md SystemUI QuickSettings 简称QS,指的是 下拉菜单里的区域。区域里的一个选项就是一个 Tile 。 下图是 frameworks/base/packages/SystemUI/docs/ 里的附图示例&#…

安卓源码里有谷歌给的关于 Tile 的说明。
frameworks/base/packages/SystemUI/docs/qs-tiles.md

SystemUI QuickSettings 简称QS,指的是 下拉菜单里的区域。区域里的一个选项就是一个 Tile 。

下图是 frameworks/base/packages/SystemUI/docs/ 里的附图示例,
在这里插入图片描述

SystemUI 会加载自己的Tile ,也会加载第三方应用的 Tile 。

SystemUI 里有配置,会默认加载一些Tile到QS面板 ,如 wifi 、蓝牙的Tile 。未配置的Tile不会显示的QS面板里,但备选区域里有,用户点击 编辑 按钮,可以通过拖拽的方式添加、删除Tile。

SystemUI QuickSettings 的加载流程先按住不表。

先试试作为第三方应用,如何实现添加Tile到SystemUI。

1.创建Service继承TileService

package com.test.luodemo.tileservice;import android.content.Intent;
import android.service.quicksettings.TileService;
import android.util.Log;public class ClickTileService extends TileService {public static final String TAG = ClickTileService.class.getSimpleName();public ClickTileService() {}@Overridepublic void onTileAdded() {super.onTileAdded();Log.d(TAG,"onTileAdded");}@Overridepublic void onTileRemoved() {super.onTileRemoved();Log.d(TAG,"onTileRemoved");}@Overridepublic void onStartListening() {super.onStartListening();Log.d(TAG,"onStartListening");}@Overridepublic void onStopListening() {super.onStopListening();Log.d(TAG,"onStopListening");}@Overridepublic void onClick() {super.onClick();Log.d(TAG,"onClick");}@Overridepublic void onDestroy() {super.onDestroy();Log.d(TAG,"onDestroy");}
}

示例创建了 ClickTileService ,继承 android.service.quicksettings.TileService ,重写 TileService 的方法。

  • onTileAdded: Tile 被添加到 QS 面板时的回调。
  • onTileRemoved: Tile 从 QS 面板移除时的回调。
  • onStartListening: called when QS is opened and the tile is showing. This marks the start of the window when calling getQSTile is safe and will provide the correct object.
  • onStopListening: called when QS is closed or the tile is no longer visible by the user. This marks the end of the window described in onStartListening.
  • onClick: 点击事件。

观察原生的选项,点击事件主要有两种:

  • 做切换功能,作用是打开、关闭某个功能,如打开关闭wifi。
  • 做跳转功能,如点击打开应用的某个页面。

点击做切换功能

    @Overridepublic void onClick() {super.onClick();Log.d(TAG,"onClick");Tile tile = getQsTile();int curState = tile.getState();if (curState == Tile.STATE_ACTIVE) {tile.setState(Tile.STATE_INACTIVE);tile.setStateDescription("StateDescriptionOff");tile.setSubtitle("SubtitleOff");tile.updateTile();} else if (curState == Tile.STATE_INACTIVE) {tile.setState(Tile.STATE_ACTIVE);tile.setStateDescription("StateDescriptionOn");tile.setSubtitle("SubtitleOn");tile.updateTile();}}

通过 getQsTile() 可以获取到 Tile 对象,就可以更新状态、描述。

本例 on/off 对比,
在这里插入图片描述

点击做跳转功能

    @Overridepublic void onClick() {super.onClick();Log.d(TAG,"onClick");Intent intent = new Intent(ClickTileService.this, TileActivity.class);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);//startActivity(intent);//会打开页面,下拉菜单不会收起startActivityAndCollapse(intent);//会打开页面,下拉菜单收起}

跳转功能 ,一看便知。

  • startActivity :会打开页面,但是下拉菜单不会自动收起。手动收起下拉菜单后才能看到 TileActivity 。不友好,不推荐。
  • startActivityAndCollapse :TileService 里的方法,会打开页面,下拉菜单会自动收起,然后显示 TileActivity 。操作方式友好,推荐。

2.Service注册到AndroidManifest

前面写了 Service ,四大组件之一 ,注册到 AndroidManifest ,无需解释了。

TileService 的源码注释有说明。

A TileService provides the user a tile that can be added to Quick Settings. Quick Settings is a space provided that allows the user to change settings and take quick actions without leaving the context of their current app.
The lifecycle of a TileService is different from some other services in that it may be unbound during parts of its lifecycle. Any of the following lifecycle events can happen independently in a separate binding/ creation of the service.
When a tile is added by the user its TileService will be bound to and onTileAdded() will be called.
When a tile should be up to date and listing will be indicated by onStartListening() and onStopListening().
When the user removes a tile from Quick Settings onTileRemoved() will be called.
onTileAdded() and onTileRemoved() may be called outside of the onCreate() - onDestroy() window
TileService will be detected by tiles that match the "android. service. quicksettings. action. QS_TILE" and require the permission "android. permission. BIND_QUICK_SETTINGS_TILE". The label and icon for the service will be used as the default label and icon for the tile. Here is an example TileService declaration.<serviceandroid:name=".MyQSTileService"android:label="@string/ my_default_tile_label"android:icon="@drawable/ my_default_icon_label"android:permission="android. permission. BIND_QUICK_SETTINGS_TILE"><intent-filter><action android:name="android. service. quicksettings. action. QS_TILE" /></ intent-filter></ service>

照葫芦画瓢,

  • icon :自定义图标。
  • label :描述。可以通过 tile.setLabel() 修改。
  • android:permission=“android.permission.BIND_QUICK_SETTINGS_TILE” :固定写法。
  • < action android:name=“android.service.quicksettings.action.QS_TILE” /> :固定写法。

两个固定写法,frameworks/base/packages/SystemUI/docs/qs-tiles.md 里也有说明。

This is an abstract Service that needs to be implemented by the developer. The Service manifest must have the permission android.permission.BIND_QUICK_SETTINGS_TILE and must respond to the action android.service.quicksettings.action.QS_TILE. This will allow SystemUI to find the available tiles and display them to the user.

示例代码,

	<serviceandroid:name=".tileservice.SwitchTileService"android:enabled="true"android:exported="true"android:icon="@drawable/icon_info"android:label="MySwitchLabel"android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"><intent-filter><action android:name="android.service.quicksettings.action.QS_TILE" /></intent-filter></service><serviceandroid:name=".tileservice.ClickTileService"android:enabled="true"android:exported="true"android:icon="@drawable/icon_vector_red_star"android:label="MyClickLabel"android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"><intent-filter><action android:name="android.service.quicksettings.action.QS_TILE" /></intent-filter></service>

run ,添加到 QS ,两个 Tile 的效果,
在这里插入图片描述


文章转载自:

http://7wZCzxeC.dsxgc.cn
http://mkRezFyL.dsxgc.cn
http://wfeuH4rU.dsxgc.cn
http://qgjOeva1.dsxgc.cn
http://9OMnLdEs.dsxgc.cn
http://TMDUDOXB.dsxgc.cn
http://awZBU1VM.dsxgc.cn
http://SLr1r1hu.dsxgc.cn
http://qmw5B30c.dsxgc.cn
http://cOlX8ZWj.dsxgc.cn
http://rH1cbPhY.dsxgc.cn
http://PpGcjvOQ.dsxgc.cn
http://Ukfu8cbN.dsxgc.cn
http://wI3opCs5.dsxgc.cn
http://G4fYyHCw.dsxgc.cn
http://mvkkyeZS.dsxgc.cn
http://hZnf9LFp.dsxgc.cn
http://ublykEzl.dsxgc.cn
http://POzS1Vvb.dsxgc.cn
http://Xenylz6c.dsxgc.cn
http://kYfBg3fZ.dsxgc.cn
http://MA1vBraa.dsxgc.cn
http://fEGpH99d.dsxgc.cn
http://dHjnAoZ2.dsxgc.cn
http://WVJfA1uM.dsxgc.cn
http://fOWOZKx0.dsxgc.cn
http://LbFVIWcm.dsxgc.cn
http://Wtn6SyRL.dsxgc.cn
http://EemH2X1I.dsxgc.cn
http://5rpgMVAW.dsxgc.cn
http://www.dtcms.com/wzjs/764969.html

相关文章:

  • 云南网站建设招商做英文网站怎么赚钱
  • app推广平台网站始兴县建设局网站
  • 太原做网站联系方式scratch少儿编程网站
  • 入门做网站wordpress foot增加js
  • 杭州网站建设页面share poine 户做网站
  • 郑州做网站公司 汉狮网络做视频网站 视频放在哪里
  • 黄岩区信誉好高端网站设计个人网站备案名和运营
  • 网站开发员的工作内容商务网站建设的步骤
  • 肥城网站建设公司什么网站可以做宝宝相册
  • 企业自建站环保业网站建设的策划
  • 广西网站建设的公司临沂 网站推广
  • 如何开一个自己的网站微信公众号登录入口怎么找
  • 建筑工程网图清远市seo网站设计联系方式
  • 免费的微网站哪个好正规的培训行业网站开发
  • 网站优化三要素申请企业邮箱步骤是什么?
  • 优秀的展厅设计网站wordpress阿里云图片不显示不出来
  • 武威建设厅网站有哪些做的好的自学网站
  • 阿里网站域名要购卖吗建设和交通局网站
  • 河北怀来县建设局网站网站备案需要提供网站建设方案书
  • 网站的功能需求聊城建设学校毕业证
  • 做竞拍网站合法吗深圳网站建设哪家
  • 怀柔石家庄网站建设自己如何做企业网站
  • 网站涉及敏感视频等该怎么做logo和网站主色调
  • 米东区成业建设集团公司网站网站开发外文翻译
  • 永年做网站多少钱dz论坛做视频网站教程
  • 网站建设框架构建个人微信公众平台怎么用
  • seo网站运营网站做标题有用吗
  • 门户网站建设工作方案免费建手机个人网站
  • 帮一个企业做网站流程网络营销的成功案例
  • 作品集模板网站久久营销网站