[LG Optimus 2x] tonyp:
:)

Speaking about sharing information: I ported the extended hardware keys rebinding as well as I was hoping it would fix the search key binding (but that turned out to be another issue).

Instead of including all the Helpers of Slimbeam I rewrote the HardwareKeys.java to use the proper CM ShortcutPickHelper (instead of the ShortcutPickerHelper).

If you want you can use that as well, then you could get rid of this rather bloated and redundandent commit.

Here's the patch file:

From 13ea6ed2c6cb64ffcc76845f343a0931b8feea62 Mon Sep 17 00:00:00 2001
From: tonyp <tonyptonyp@gmail.com>
Date: Sun, 28 Apr 2013 09:51:03 +0200
Subject: [PATCH] adapt HardwareKeys.java to CMs ShortcutPicker

---
.../android/settings/cyanogenmod/HardwareKeys.java | 29 ++++++++++++----------
1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/com/android/settings/cyanogenmod/HardwareKeys.java b/src/com/android/settings/cyanogenmod/HardwareKeys.java
index d875e7f..2769570 100644
--- a/src/com/android/settings/cyanogenmod/HardwareKeys.java
+++ b/src/com/android/settings/cyanogenmod/HardwareKeys.java
@@ -18,6 +18,7 @@

import android.app.Activity;
import android.content.Intent;
+import android.content.Intent.ShortcutIconResource;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
@@ -31,11 +32,11 @@
import android.widget.Toast;

import com.android.settings.R;
-import com.android.settings.util.ShortcutPickerHelper;
+import com.android.settings.cyanogenmod.ShortcutPickHelper;
import com.android.settings.SettingsPreferenceFragment;

public class HardwareKeys extends SettingsPreferenceFragment implements
- ShortcutPickerHelper.OnPickListener, OnPreferenceChangeListener {
+ ShortcutPickHelper.OnPickListener, OnPreferenceChangeListener {

private static final String HARDWARE_KEYS_CATEGORY_BINDINGS = "hardware_keys_bindings";
private static final String HARDWARE_KEYS_ENABLE_CUSTOM = "hardware_keys_enable_custom";
@@ -90,7 +91,7 @@
private ListPreference mAppSwitchLongPressAction;
private CheckBoxPreference mShowActionOverflow;

- private ShortcutPickerHelper mPicker;
+ private ShortcutPickHelper mPicker;
private Preference mCustomAppPreference;

[MENTION=439709]override[/MENTION]
@@ -108,7 +109,7 @@ public void onCreate(Bundle savedInstanceState) {
addPreferencesFromResource(R.xml.hardware_keys);
PreferenceScreen prefSet = getPreferenceScreen();

- mPicker = new ShortcutPickerHelper(this, this);
+ mPicker = new ShortcutPickHelper(getActivity(), this);

mEnableCustomBindings = (CheckBoxPreference) prefSet.findPreference(
HARDWARE_KEYS_ENABLE_CUSTOM);
@@ -343,7 +344,13 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
int value = Integer.valueOf((String) newValue);
if (value == ACTION_CUSTOM_APP) {
mCustomAppPreference = preference;
- mPicker.pickShortcut();
+ final String label = getResources().getString(R.string.lockscreen_target_empty);
+ final ShortcutIconResource iconResource =
+ ShortcutIconResource.fromContext(getActivity(), android.R.drawable.ic_delete);
+ mPicker.pickShortcut(
+ new String[] { label },
+ new ShortcutIconResource[] { iconResource },
+ getId());
return true;
} else {
if (preference == mHomePressAction) {
@@ -443,7 +450,8 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
return false;
}

- public void shortcutPicked(String uri, String friendlyName, Bitmap bmp, boolean isApplication) {
+ [MENTION=439709]override[/MENTION]
+ public void shortcutPicked(String uri, String friendlyName, boolean isApplication) {
Preference preference = mCustomAppPreference;
if (preference == mHomePressAction) {
Settings.System.putString(getContentResolver(),
@@ -478,14 +486,9 @@ public void shortcutPicked(String uri, String friendlyName, Bitmap bmp, boolean
}
preference.setSummary(friendlyName);
}
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode == Activity.RESULT_OK) {
- if (requestCode == ShortcutPickerHelper.REQUEST_PICK_SHORTCUT
- || requestCode == ShortcutPickerHelper.REQUEST_PICK_APPLICATION
- || requestCode == ShortcutPickerHelper.REQUEST_CREATE_SHORTCUT) {
- mPicker.onActivityResult(requestCode, resultCode, data);
- }
- }
+ mPicker.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
}
--
1.8.1.6