桌面快捷键和桌面livefolder
// to create live folder on "home" screen
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equalsIgnoreCase(getIntent().getAction())) {
- tent().getAction() can be null
- Intent intent = new Intent();
- Uri LIVE_FOLDER_URI = Uri.parse("content://contacts/live_folders/people");
- intent.setData(LIVE_FOLDER_URI);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT, new Intent(
- Intent.ACTION_VIEW, Contacts.People.CONTENT_URI));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, "allnamefolder");
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON, Intent.ShortcutIconResource
- .fromContext(this, R.drawable.krec));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE,
- LiveFolders.DISPLAY_MODE_GRID);
- this.setResult(RESULT_OK, intent);
- } else {
- this.setResult(Activity.RESULT_CANCELED);
- }
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equalsIgnoreCase(getIntent().getAction())) {
- tent().getAction() can be null
- Intent intent = new Intent();
- Uri LIVE_FOLDER_URI = Uri.parse("content://contacts/live_folders/people");
- intent.setData(LIVE_FOLDER_URI);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT, new Intent(
- Intent.ACTION_VIEW, Contacts.People.CONTENT_URI));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, "allnamefolder");
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON, Intent.ShortcutIconResource
- .fromContext(this, R.drawable.krec));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE,
- LiveFolders.DISPLAY_MODE_GRID);
- this.setResult(RESULT_OK, intent);
- } else {
- this.setResult(Activity.RESULT_CANCELED);
- }
// to create shortcut on "home" screen
// toPrint is a very simple apk.
- Intent toPrint = new Intent(this, anSimplePrint.class);
- Intent addShortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
- addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "SP");
- addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, toPrint);
- addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource
- .fromContext(this, R.drawable.ksig));
- Intent toPrint = new Intent(this, anSimplePrint.class);
- Intent addShortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
- addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "SP");
- addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, toPrint);
- addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource
- .fromContext(this, R.drawable.ksig));
//remember to fix manifest file
// add .
- <intent-filter>
- <action android:name="android.intent.action.CREATE_SHORTCUT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"></uses-permission>
- <intent-filter>
- <action android:name="android.intent.action.CREATE_SHORTCUT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"></uses-permission>
///
// 系统的contacts 在桌面livefolder添加快捷方式的代码如下。想要在livefolder中添加// 其他app的快捷方式,也可以依法炮制
- public class ContactsLiveFolders {
- public static class StarredContacts extends Activity {
- public static final Uri CONTENT_URI =
- Uri.parse("content://contacts/live_folders/favorites");
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final Intent intent = getIntent();
- final String action = intent.getAction();
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
- setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
- getString(R.string.liveFolder_favorites_label),
- R.drawable.ic_launcher_folder_live_contacts_starred));
- } else {
- setResult(RESULT_CANCELED);
- }
- finish();
- }
- }
- public static class PhoneContacts extends Activity {
- public static final Uri CONTENT_URI =
- Uri.parse("content://contacts/live_folders/people_with_phones");
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final Intent intent = getIntent();
- final String action = intent.getAction();
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
- setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
- getString(R.string.liveFolder_phones_label),
- R.drawable.ic_launcher_folder_live_contacts_phone));
- } else {
- setResult(RESULT_CANCELED);
- }
- finish();
- }
- }
- public static class AllContacts extends Activity {
- public static final Uri CONTENT_URI =
- Uri.parse("content://contacts/live_folders/people");
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final Intent intent = getIntent();
- final String action = intent.getAction();
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
- setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
- getString(R.string.liveFolder_all_label),
- R.drawable.ic_launcher_folder_live_contacts));
- } else {
- setResult(RESULT_CANCELED);
- }
- finish();
- }
- }
- private static Intent createLiveFolder(Context context, Uri uri, String name,
- int icon) {
- final Intent intent = new Intent();
- intent.setData(uri);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
- new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,
- Intent.ShortcutIconResource.fromContext(context, icon));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);
- return intent;
- }
- }
- public class ContactsLiveFolders {
- public static class StarredContacts extends Activity {
- public static final Uri CONTENT_URI =
- Uri.parse("content://contacts/live_folders/favorites");
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final Intent intent = getIntent();
- final String action = intent.getAction();
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
- setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
- getString(R.string.liveFolder_favorites_label),
- R.drawable.ic_launcher_folder_live_contacts_starred));
- } else {
- setResult(RESULT_CANCELED);
- }
- finish();
- }
- }
- public static class PhoneContacts extends Activity {
- public static final Uri CONTENT_URI =
- Uri.parse("content://contacts/live_folders/people_with_phones");
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final Intent intent = getIntent();
- final String action = intent.getAction();
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
- setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
- getString(R.string.liveFolder_phones_label),
- R.drawable.ic_launcher_folder_live_contacts_phone));
- } else {
- setResult(RESULT_CANCELED);
- }
- finish();
- }
- }
- public static class AllContacts extends Activity {
- public static final Uri CONTENT_URI =
- Uri.parse("content://contacts/live_folders/people");
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final Intent intent = getIntent();
- final String action = intent.getAction();
- if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
- setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
- getString(R.string.liveFolder_all_label),
- R.drawable.ic_launcher_folder_live_contacts));
- } else {
- setResult(RESULT_CANCELED);
- }
- finish();
- }
- }
- private static Intent createLiveFolder(Context context, Uri uri, String name,
- int icon) {
- final Intent intent = new Intent();
- intent.setData(uri);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
- new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,
- Intent.ShortcutIconResource.fromContext(context, icon));
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);
- return intent;
- }
- }
//
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
- new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
- 这个在用的时候。 如果你用的uri读出来没有一个叫name的表项,
- 那这个ACTION_VIEW会失败,所以需要有个叫name的,作为livefolder显示出来的东西。
- 比如系统的contactsprovider 里面 大概3790行
- case LIVE_FOLDERS_CONTACTS_GROUP_NAME:
- qb.setTables(mDbHelper.getContactView());
- qb.setProjectionMap(sLiveFoldersProjectionMap);
- qb.appendWhere(CONTACTS_IN_GROUP_SELECT);
- selectionArgs = insertSelectionArg(selectionArgs, uri.getLastPathSegment());
- break;
- 这里qb.setProjectionMap(sLiveFoldersProjectionMap); 就是把有一个项作为name显示
- //contactsProvider2.java line 854
- sLiveFoldersProjectionMap = new HashMap<String, String>();
- sLiveFoldersProjectionMap.put(LiveFolders._ID,
- Contacts._ID + " AS " + LiveFolders._ID);
- sLiveFoldersProjectionMap.put(LiveFolders.NAME,
- Contacts.DISPLAY_NAME + " AS " + LiveFolders.NAME);
- intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
- new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
- 这个在用的时候。 如果你用的uri读出来没有一个叫name的表项,
- 那这个ACTION_VIEW会失败,所以需要有个叫name的,作为livefolder显示出来的东西。
- 比如系统的contactsprovider 里面 大概3790行
- case LIVE_FOLDERS_CONTACTS_GROUP_NAME:
- qb.setTables(mDbHelper.getContactView());
- qb.setProjectionMap(sLiveFoldersProjectionMap);
- qb.appendWhere(CONTACTS_IN_GROUP_SELECT);
- selectionArgs = insertSelectionArg(selectionArgs, uri.getLastPathSegment());
- break;
- 这里qb.setProjectionMap(sLiveFoldersProjectionMap); 就是把有一个项作为name显示
- //contactsProvider2.java line 854
- sLiveFoldersProjectionMap = new HashMap<String, String>();
- sLiveFoldersProjectionMap.put(LiveFolders._ID,
- Contacts._ID + " AS " + LiveFolders._ID);
- sLiveFoldersProjectionMap.put(LiveFolders.NAME,
- Contacts.DISPLAY_NAME + " AS " + LiveFolders.NAME);
自己实现一contentprovider来做这个事情的时候也需要实现一个 name作为显示,
即在cursor query的时候加入比如select xxx as name, 在projection里加。
说不清了。。。
//一般还是不要自己造contentprovider了。。 系统的差不多够用
//问题是怎么在系统里找到所有的uri? 嘿嘿。我不会- -
这里转个大大的博克
http://kuikui.iteye.com/blog/318627
刚起步的时候经常困扰我们的是一些本来容易解决的问题,往往我们会花掉很大的力气去找解决的办法,最后才知道原来这么简单,这就是英文世界造成的。
Intent在 Android应用开发中,占有很大的分量,关于Intent在Android中的作用在网络上已经有很多资料了,这里不再累赘,本人喜欢直来直去。在网上看到很多关于Intent的资料,说那么多,你也许还是一头雾水,到底如何使用Intent呢?这里总结一些重用的Intent使用,仅供参考。
下面直接给我学习的实例片段。
1,掉web浏览器
Uri myBlogUri = Uri.parse("http://kuikui.iteye.com");
returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
2,地图
Uri mapUri = Uri.parse("geo:38.899533,-77.036476");
returnIt = new Intent(Intent.ACTION_VIEW, mapUri);
3,调拨打电话界面
Uri telUri = Uri.parse("tel:100861");
returnIt = new Intent(Intent.ACTION_DIAL, telUri);
4,直接拨打电话
Uri callUri = Uri.parse("tel:100861");
returnIt = new Intent(Intent.ACTION_CALL, callUri);
5,卸载
Uri uninstallUri = Uri.fromParts("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
6,安装
Uri installUri = Uri.fromParts("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
7,播放
Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
returnIt = new Intent(Intent.ACTION_VIEW, playUri);
8,掉用发邮件
Uri emailUri = Uri.parse("mailto:shenrenkui@gmail.com");
returnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
9,发邮件
returnIt = new Intent(Intent.ACTION_SEND);
String[] tos = { "shenrenkui@gmail.com" };
String[] ccs = { "shenrenkui@gmail.com" };
returnIt.putExtra(Intent.EXTRA_EMAIL, tos);
returnIt.putExtra(Intent.EXTRA_CC, ccs);
returnIt.putExtra(Intent.EXTRA_TEXT, "body");
returnIt.putExtra(Intent.EXTRA_SUBJECT, "subject");
returnIt.setType("message/rfc882");
Intent.createChooser(returnIt, "Choose Email Client");
10,发短信
Uri smsUri = Uri.parse("tel:100861");
returnIt = new Intent(Intent.ACTION_VIEW, smsUri);
returnIt.putExtra("sms_body", "shenrenkui");
returnIt.setType("vnd.android-dir/mms-sms");
11,直接发邮件
Uri smsToUri = Uri.parse("smsto://100861");
returnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);
returnIt.putExtra("sms_body", "shenrenkui");
12,发彩信
Uri mmsUri = Uri.parse("content://media/external/images/media/23");
returnIt = new Intent(Intent.ACTION_SEND);
returnIt.putExtra("sms_body", "shenrenkui");
returnIt.putExtra(Intent.EXTRA_STREAM, mmsUri);
returnIt.setType("image/png");
用获取到的Intent直接调用startActivity(returnIt)就ok了
转载于:https://www.cnblogs.com/greywolf/archive/2012/12/24/2831344.html
桌面快捷键和桌面livefolder相关推荐
- cenos回到linux桌面快捷键,Centos桌面 快捷键
最近常常使用Centos桌面,下面介绍一些常用的快捷键 * 打开主菜单 = Alt + F1 * 运行 = Alt + F2 * 显示桌面 = Ctrl + Alt + d * 最小化当前窗口 = A ...
- win7计算机桌面快捷键显示桌面,【显示桌面快捷键 win7】显示桌面的快捷键是_win7返回桌面快捷键-系统城...
2018-01-19 13:49:19 浏览量:4649 在使用windowsxp系统过程中,一位用户发现电脑桌面左下角的显示桌面图标消失不见了,感觉非常烦恼.那么,我们要如何恢复它呢?若是不恢复又有 ...
- Mac快速显示桌面快捷键
Mac快速显示桌面快捷键 在Mac系统中,有时候打开的程序多了,想退回桌面,要一个一个的将窗口小化 今天无意中发现了一个快捷键,可以直接显示到桌面: 普通键盘按 F11 Mac笔记本键盘按 fn(左 ...
- [Fedora 20] 设置Terminal快捷键 + 设置桌面快捷方式 + Terminal透明解决方案
[Fedora 20] 设置Terminal快捷键 + 设置桌面快捷方式 + Terminal透明解决方案 参考文章: (1)[Fedora 20] 设置Terminal快捷键 + 设置桌面快捷方式 ...
- win11怎么快速返回桌面 windows11快捷键返回桌面的设置方法
有时候我们在win11系统上全屏玩游戏时要怎么快速回到桌面呢?可能很多小伙伴都不知道如何操作,那么下面小编就来跟大家说说win11快捷键返回桌面是哪个的介绍,还有不懂的可以来看看这篇教程,更多wind ...
- linux切换桌面的快捷键,SUSE Linux Gnome桌面快捷键整理
整理了一些常用的SUSE Linux Gnome桌面快捷键,希望对大家有用! 快捷键 ctrl+shift+f (窗口全屏) ctrl+shift+n (新建konsole窗口) ctrl+shift ...
- 计算机快捷键如何移动到桌面,如何设置显示桌面快捷键 设置显示桌面快捷键方法【图文】...
显示桌面图标快捷方式是Windows系统中一个非常实用的功能,当我们使用的电脑时间比较长之后就会有很多软件程序窗口开着,占满了电脑的整个屏幕,您只要点击一下电脑左下角的显示桌面图标就能回到桌面.但是有 ...
- 计算机快捷键里面不显示桌面,桌面显示,显示桌面快捷键不见了
我们通常在使用电脑的时候,都不会只打开一个窗口,我们会使用很多功能同时运行,比如我们可以边聊QQ,边看电影;也可以边听歌儿变上网购物. 所以这时候,就要用到最小化来显示出桌面. 但是如果对这些程序一一 ...
- 计算机怎么一键到桌面快捷键,关于添加一键返回桌面快捷键在win10电脑中的技巧...
我们在win10系统的操作中,对于电脑中需要操作到多个窗口和页面的情况是很多的,那有小伙伴在网络上提问不知道是不是可以添加一个返回桌面快捷键的情况,我们在win10电脑中打开的程序很多的话切换窗口也就 ...
最新文章
- JAVA面试题(2)
- css 在线生成器,CSS Sprites在线生成器
- wsl for pycharm vscode
- 关于开源软件的书籍一定要尽量提供搭配好的软件版本
- 转:认识cpu、核与线程
- java8 日期api_我们多么想要新的Java日期/时间API?
- python漏洞检测脚本_URL重定向漏洞,python打造URL重定向漏洞检测脚本
- 关于iOS7里的JavaScriptCore framework
- 高效测试必学 | 用pytest生成测试报告
- 73.fseek与宽字符读取文件
- 深度学习pytorch基础入门教程(1小时)-张量、操作、转换
- 360linux如何卸载,卸载360安全卫士方法
- Linux下用ffmpeg轉PSP影片 (MP4/AVC格式)
- UART串口协议时序图
- 全球及中国布鲁顿酪氨酸蛋白激酶抑制剂行业研究及十四五规划分析报告
- 给你一个二维整数数组 matrix,返回 matrix 的 转置矩阵
- java模拟微信抢红包金额算法规则二倍均值法模拟(满满的注释)
- 掘金mysql_我的 mysql 半年小得 | 掘金征文
- easyui复杂表单_jQuery EasyUI 表单 – 创建树形下拉框(ComboTree) | 菜鸟教程
- 为泰泽铺路, Intel宣布32nm Atom正式出货 规格详解
热门文章
- VTK:图片之ImageMagnify
- OpenCV iOS-视频处理
- C++ Opengl 绘制纹理字符源码
- C++STL的 list容器
- c++访问者模式visitor
- 经典C语言程序100例之九五
- C++变量、函数在内存中的情况
- snmp linux arm,Net-SNMP的交叉编译 for ARM64
- 「ProtocolBuffers2」ProtocolBuffers2 Python简易入门
- 远程拷贝、查看端口、vim常见快捷键、查找替换命令、grep命令、查看存储空间的命令、chkconfig命令、系统自动启动级别、主机名配置、IP地址配置、域名映射、防火墙设置