博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
gdx 源码分析摘录
阅读量:4222 次
发布时间:2019-05-26

本文共 1662 字,大约阅读时间需要 5 分钟。

一, HandlerCaller的使用

        封装handler;

        1,实现类

              HandlerCaller   mCaller = new HandlerCaller(context, context.getMainLooper(), this, true);

        2,实现回调;

               class XX implements HandlerCaller.Callback

               public void executeMessage(Message message) { }

        3,创建发送message

           Message msg = mCaller.obtainMessageI(MSG_VISIBILITY_CHANGED,

                    visible ? 1 : 0);
            mCaller.sendMessage(msg);

二, Engine

        The actual implementation of a wallpaper. You must implement {@link WallpaperService#onCreateEngine()}

         to return your concrete Engine implementation.

              1,监听屏幕

             

final BroadcastReceiver mReceiver = new BroadcastReceiver() {            @Override            public void onReceive(Context context, Intent intent) {                if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) {                    mScreenOn = true;                    reportVisibility();                } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {                    mScreenOn = false;                    reportVisibility();                }            }        };
    

三, class WallpaperService extends Service

         实现了IWallpaperService

四,IWallpaperService.stub

       attach(); 在attach中创建engine

五,IWallpaperEngine

oneway interface IWallpaperEngine {    void setDesiredSize(int width, int height);    void setVisibility(boolean visible);    void dispatchPointer(in MotionEvent event);    void dispatchWallpaperCommand(String action, int x, int y,            int z, in Bundle extras);        void destroy();}控制wallpaper的生命周期,ibinder对象

六: 创建AndroidWallpaperEngine(libgdx封装)

         public class AndroidWallpaperEngine extends Engine

七:  Application

       It sets up a window and rendering surface and manages the * different aspects of your application

转载地址:http://poomi.baihongyu.com/

你可能感兴趣的文章
git reset --hard命令挽救方法
查看>>
蚁群算法求解有时间窗约束的车辆路径问题matlab程序
查看>>
批处理经典入门教程!(从不懂到高手)
查看>>
jQuery.delay()方法简介
查看>>
EasyUI——常见用法总结
查看>>
火狐下easyui1.3.*弹出window框定位不到中间解决把办法
查看>>
Hadoop启动报错NoClassDefFoundError: javax/activation/DataSource解决方案
查看>>
Python爬虫来啦,抓取数据导出到excel,简单明了,强大,直接贴代码
查看>>
Docker拉取镜像失败报错Error response from daemon: Get https://registry-1.docker.io解决办法
查看>>
Hibernate JPA 中配置Ehcache二级缓存
查看>>
IO操作的工具类总结
查看>>
对指定文件或目录进行压缩和解压缩的工具类总结
查看>>
Java中如何遍历Map对象的4种方法
查看>>
Map加锁操作小例子
查看>>
简单了解mysql表分区
查看>>
深入解析MySQL分区(Partition)功能
查看>>
mysql定时任务简单例子
查看>>
JDK8绿色安装详细步骤
查看>>
MySql最简单的触发器例子
查看>>
全选反选按钮简单例子
查看>>