android第三方拨号盘,android M拨号盘开源之旅(二)--- 浅析拨号盘主界面
上一节课给大家简单介绍了下android拨号盘的工程概况,今天再向大家剖析一下主界面的布局实现
先贴上主界面布局:
xmlns:android="外链网址已屏蔽"
android:id="@+id/dialtacts_mainlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
android:clipChildren="false"
android:background="@color/background_dialer_light">
android:id="@+id/dialtacts_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/dialtacts_frame"
android:clipChildren="false" />
android:id="@+id/floating_action_button_container"
android:background="@drawable/fab_blue"
android:layout_width="@dimen/floating_action_button_width"
android:layout_height="@dimen/floating_action_button_height"
android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
android:layout_gravity="center_horizontal|bottom">
android:id="@+id/floating_action_button"
android:background="@drawable/floating_action_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/action_menu_dialpad_button"
android:src="@drawable/fab_ic_dial"/>
xml比较简单,我们看看DialtactsActivity里的实现
final ActionBar actionBar = getActionBar();
actionBar.setCustomView(R.layout.search_edittext);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setBackgroundDrawable(null);
SearchEditTextLayout searchEditTextLayout =
(SearchEditTextLayout) actionBar.getCustomView().findViewById(R.id.search_view_container);
searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener);
mActionBarController = new ActionBarController(this, searchEditTextLayout);
菜单控制器private ActionBarController mActionBarController;
用来管理SearchEditTextLayout对象(actionbar的customview)
接下来是主界面fragment(快速拨号,通话记录,联系人)
private ListsFragment mListsFragment;
放在dialtacts_frame容器里
getFragmentManager().beginTransaction().add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT).commit();
全局搜索fragment private RegularSearchFragment mRegularSearchFragment;(在actionbar的edittext里输入号码呈现结果集的fragment)
拨号搜索fragment private SmartDialSearchFragment mSmartDialSearchFragment; (在拨号盘里输入号码呈现结果集的fragment)
都放在dialtacts_frame容器里(根据是否处于搜索模式动态创建和移除)
private void enterSearchUi(boolean smartDialSearch, String query, boolean animate)
if (smartDialSearch) {
fragment = new SmartDialSearchFragment();
} else {
fragment = new RegularSearchFragment();
}
transaction.add(R.id.dialtacts_frame, fragment, tag);
private void exitSearchUi()
if (mSmartDialSearchFragment != null) {
transaction.remove(mSmartDialSearchFragment);
}
if (mRegularSearchFragment != null) {
transaction.remove(mRegularSearchFragment);
}
拨号盘fragment
protected DialpadFragment mDialpadFragment;
放在dialtacts_container容器里
if (mDialpadFragment == null) {
mDialpadFragment = new DialpadFragment();
ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
} else {
ft.show(mDialpadFragment);
}
悬浮按钮控制器,管理悬浮按钮事件
private FloatingActionButtonController mFloatingActionButtonController;
final View floatingActionButtonContainer = findViewById(R.id.floating_action_button_container);
ImageButton floatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
floatingActionButton.setOnClickListener(this);
mFloatingActionButtonController = new FloatingActionButtonController(this,floatingActionButtonContainer, floatingActionButton);
主界面容器ListsFragment mListsFragment;
自定义的TAB分页控件ViewPagerTabs extends HorizontalScrollView
嵌套三个子fragment:快速拨号,通话记录,联系人
private SpeedDialFragment mSpeedDialFragment;
private CallLogFragment mRecentsFragment;
private AllContactsFragment mAllContactsFragment;
主界面的框架大致如此,各个fragment切换逻辑以及动效细节大家跟踪代码实现细看就明白了
时间不走啊了,今天的课程到此为止
github下载链接:外链网址已屏蔽
欲知后事如何,且听蓝老师下回分解
more brilliant,Please pay attention to my cnblog -->外链网址已屏蔽
android第三方拨号盘,android M拨号盘开源之旅(二)--- 浅析拨号盘主界面相关推荐
- android微信第三方登陆混淆,Android 第三方应用接入微信平台研究情况分享(二)
微信平台开放后倒是挺火的,许多第三方应用都想试下,毕竟可以利用微信建立起来的关系链来拓展自己的应用还是挺不错的,可以节约很多在社交方面的开销,我最近由于实习需要也在研究这个东西,不过发现网上的相关资料 ...
- android 第三方 im,Android基于环信SDK开发IM即时聊天
目前市面上我了解的做第三方即时聊天SDK的有两家:环信.融云,这里我使用环信SDK来完成即时聊天的初步开发工作. 下面先奉上1张效果图: 1.开发准备 首先要到环信官网注册开发者账号,目前只有企业账号 ...
- android第三方手势,Android手势识别02——旋转、移动等使用第三方库
Android手势识别02--旋转.移动等使用第三方库 一.简要说明 通过前面一篇文章(Android手势识别01--基本手势的处理)的学习,我们知道了基本手势的使用方法.但是我们发现这里基本上手势的 ...
- android 第三方裁剪,Android裁剪意向不适用于系统图库应用程序,但适用于第三方应用程序...
我尝试从sdcard中选择一个图像,然后进行裁剪. ACTION_PICK没问题,但是当我调用ACTION_CROP时,我的系统图库应用程序(我称为A)无法执行操作,而另一个应用程序(B)可以执行该操 ...
- android第三方手势,Android手势---GestureDetector
GestureDetector 可以使用 MotionEvents 检测各种手势和事件. 这个类只能用于检测触摸事件的 MotionEvent GestureDetector有三个内部接口,两个内部类 ...
- android第三方应用,Android 第三方应用接入微信平台研究情况分享(一)
微信平台开放后倒是挺火的,许多第三方应用都想试下接入微信这个平台,毕竟可以利用微信建立起来的关系链来拓展自己的应用还是挺不错的,可以节约很多在社交方面的开销,我最近由于实习需要也在研究这个东西,不过发 ...
- Facebook android 第三方登录
Facebook android 第三方登录 android平台使用Facebook账号登录自己的app - 前期准备 - 注册Facebook开发者账号,添加自己的应用,按照官方文档的指引完成需要的 ...
- Unity3D应用--打造Android车载3D车模桌面(车载主界面开发)
前言 Android中应用加载Unity3D来显示3D效果参考上一篇博文:Unity3D导出Android工程(Android中应用Unity3D) 透明背景实现参考另一篇博文: 在Android中U ...
- Android项目:手机安全卫士(3)—— 主界面布局
Android项目:手机安全卫士(3)-- 主界面布局 1 总纲 前面实现了"手机安全卫士"的闪屏界面与版本检测升级问题,接下来的任务就是实现主界面了,这个相对简单,因为没有涉及到 ...
- android studio finish,Android Studio finish()方法的使用与解决app点击“返回”(直接退出)...
在这里,我们将用到finish(),简单介绍一下它的使用: finish()官方解析:Call this when your activity is done and should be closed ...
最新文章
- 图深度学习(GraphDL),下一个人工智能算法热点
- Python基础入门:使用openpyxl读写Excel文件
- 猫咪藏在哪个房间python作业_python练习题之 猫2
- 爬虫(十二):scrapy中spiders的用法
- Spring事务管理的demo
- Day4:html和css
- php memcache 扩展 libmemcached 安装
- 介绍一个基于SpringBoot2的脚手架项目
- Linux下PS命令详解 (转)
- mysql用户订阅数据表设计_小程序商城-用户表 - 数据库设计 - 数据库表结构 - 果创云...
- Elastic ik插件配置热更新功能
- mysql拼接字符串的方式_mysql 字符串拼接,你知道几种方式?
- Reeder Web版
- 32位微型计算机中的32级的4,2013年计算机等级考试一级微机知识预测题(4)
- Github Markdown 指定图片在光亮或暗黑模式展示
- [技术分享 – FCS 篇] 驭龙五式5之神龙摆尾:如果没有 WSUS…
- js正则验证人名,包含· | 手机号正则验证(199)
- word中插入图片,转pdf后,打印的图片出现阴影模糊的问题及处理办法
- [RK3568 Android11] 开发之开发者选项中添加USB OTG模式切换(一)
- 手把手教你编写最简单的性能脚本