Android 删除/定制桌面电量控制插件
2012-02-20 21:38
309 查看
这个插件是属于设置的一部分,可以在
这个文件夹里面查看,呵呵,有没有看到上面目录的斜杠方向,懂吧。
这里找到一个文件名为:“ic_appwidget_settings_mobile_off” 的PNG文件。
而相关的文件是:
1. 是否显示这个部件
3. 重新载入图片
4. 还有这个,全注释掉吧。
packages\apps\Settings\res\drawable-hdpi
这个文件夹里面查看,呵呵,有没有看到上面目录的斜杠方向,懂吧。
这里找到一个文件名为:“ic_appwidget_settings_mobile_off” 的PNG文件。
而相关的文件是:
vim packages/apps/Settings/src/com/android/settings/widget/SettingsAppWidgetProvider.java代码要修改有几个部分,可以搜索“BUTTON_MOBILE”,进行修改。
1. 是否显示这个部件
/** * Provides control of power-related settings from a widget. */ public class SettingsAppWidgetProvider extends AppWidgetProvider { static final String TAG = "SettingsAppWidgetProvider"; static final ComponentName THIS_APPWIDGET = new ComponentName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); private static LocalBluetoothManager sLocalBluetoothManager = null; private static TelephonyManager mTelephonyManager = null; private static final int BUTTON_WIFI = 0; private static final int BUTTON_BRIGHTNESS = 1; private static final int BUTTON_SYNC = 2; private static final int BUTTON_GPS = 3; private static final int BUTTON_BLUETOOTH = 4; // private static final int BUTTON_MOBILE = 5; /* 该产品没有通话功能。 */2. 点击之后的事件处理
/** * Receives and processes a button pressed intent or state change. * * @param context * @param intent Indicates the pressed button. */ @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(intent.getAction())) { sWifiState.onActualStateChange(context, intent); } else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(intent.getAction())) { sBluetoothState.onActualStateChange(context, intent); } else if (intent.hasCategory(Intent.CATEGORY_ALTERNATIVE)) { Uri data = intent.getData(); int buttonId = Integer.parseInt(data.getSchemeSpecificPart()); if (buttonId == BUTTON_WIFI) { sWifiState.toggleState(context); } else if (buttonId == BUTTON_BRIGHTNESS) { toggleBrightness(context); } else if (buttonId == BUTTON_SYNC) { toggleSync(context); } else if (buttonId == BUTTON_GPS) { toggleGps(context); } else if (buttonId == BUTTON_BLUETOOTH) { sBluetoothState.toggleState(context); } /* 删去相应的事件处理代码。 else if (buttonId == BUTTON_MOBILE) { toggleMobile(context); }*/ } else if (TelephonyIntents.ACTION_MODEM_POWER_STATE_CHANGED.equals(intent.getAction())) { } else { // Don't fall-through to updating the widget. The Intent // was something unrelated or that our super class took // care of. return; }
3. 重新载入图片
/** * Load image for given widget and build {@link RemoteViews} for it. */ static RemoteViews buildUpdate(Context context, int appWidgetId) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); views.setOnClickPendingIntent(R.id.btn_wifi, getLaunchPendingIntent(context, appWidgetId, BUTTON_WIFI)); views.setOnClickPendingIntent(R.id.btn_brightness, getLaunchPendingIntent(context, appWidgetId, BUTTON_BRIGHTNESS)); views.setOnClickPendingIntent(R.id.btn_sync, getLaunchPendingIntent(context, appWidgetId, BUTTON_SYNC)); views.setOnClickPendingIntent(R.id.btn_bluetooth, getLaunchPendingIntent(context, appWidgetId, BUTTON_BLUETOOTH)); /* views.setOnClickPendingIntent(R.id.btn_mobile, getLaunchPendingIntent(context, appWidgetId, BUTTON_MOBILE)); */ updateButtons(views, context); return views; }
4. 还有这个,全注释掉吧。
switch (getMobileState(context)) { case STATE_DISABLED: views.setImageViewResource(R.id.img_mobile, R.drawable.ic_appwidget_settings_mobile_off); views.setImageViewResource(R.id.ind_mobile, R.drawable.appwidget_settings_ind_off_c); break; case STATE_ENABLED: views.setImageViewResource(R.id.img_mobile, R.drawable.ic_appwidget_settings_mobile_on); views.setImageViewResource(R.id.ind_mobile, R.drawable.appwidget_settings_ind_on_c); break; case STATE_INTERMEDIATE: views.setImageViewResource(R.id.img_mobile, R.drawable.ic_appwidget_settings_mobile_off); views.setImageViewResource(R.id.ind_mobile, R.drawable.appwidget_settings_ind_mid_c); break; }
相关文章推荐
- android手机添加删除桌面图标和插件,设置壁纸
- PX2分享Android预设桌面定制与电量图标修改以及版本更改
- android桌面悬浮窗显示录屏时间控制效果
- 终于找到一个类似wince 远程桌面控制android设备的软件——Androidscreencast
- android 如何添加 桌面图标 和 卸载程序后如何删除图标
- 【Android开发总结(1)】桌面快捷方式创建、删除、查询等方式
- android程序卸载后无法删除桌面快捷方式的解决办法
- android桌面快捷方式添加 删除 更新 自动运行
- 手把手教你定制android桌面
- Android桌面插件App Widget用法分析
- Android创建和删除桌面快捷方式
- Android应用添加(创建)和删除及判断是否存在桌面快捷方式
- 定制android桌面系统
- android程序卸载后无法删除桌面快捷方式的解决办法
- Android Magnet:桌面删除APP自动弹出垃圾桶接受图标删除动作
- 定制你自己的android手机桌面Launcher===一个完成Launcher开发的介绍-第二篇
- Android的桌面(Launcher)的定制
- Android桌面快捷方式图标生成与删除,使用Intent与launcher交互
- Android源码中加入定制桌面
- android如何添加桌面图标和卸载程序后自动删除图标