Revert "[2/2] Settings: Add lockscreen shortcuts settings"

Need to redo that in framework

This reverts commit 724c786e1a7a80cfe4b09fad337f139fd543f105.

Conflicts:
	res/values/custom_arrays.xml
	res/values/custom_strings.xml

Change-Id: Ice0f747d7891c3ddddac060f1853b022f4132986
diff --git a/res/drawable-hdpi/ic_empty.png b/res/drawable-hdpi/ic_empty.png
deleted file mode 100644
index a45c6cf..0000000
--- a/res/drawable-hdpi/ic_empty.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_save.png b/res/drawable-hdpi/ic_menu_save.png
deleted file mode 100644
index 2b29557..0000000
--- a/res/drawable-hdpi/ic_menu_save.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_empty.png b/res/drawable-mdpi/ic_empty.png
deleted file mode 100644
index ede2c83..0000000
--- a/res/drawable-mdpi/ic_empty.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_save.png b/res/drawable-mdpi/ic_menu_save.png
deleted file mode 100644
index 283be30..0000000
--- a/res/drawable-mdpi/ic_menu_save.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_empty.png b/res/drawable-xhdpi/ic_empty.png
deleted file mode 100644
index 5742d13..0000000
--- a/res/drawable-xhdpi/ic_empty.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_menu_save.png b/res/drawable-xhdpi/ic_menu_save.png
deleted file mode 100644
index c403206..0000000
--- a/res/drawable-xhdpi/ic_menu_save.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/activities_icon.png b/res/drawable/activities_icon.png
deleted file mode 100644
index abd62e2..0000000
--- a/res/drawable/activities_icon.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/lockscreen_shortcut_dialog.xml b/res/layout/lockscreen_shortcut_dialog.xml
deleted file mode 100644
index 72a5392..0000000
--- a/res/layout/lockscreen_shortcut_dialog.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:padding="8dp"
-    android:orientation="vertical">
-
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        style="?android:attr/textAppearanceSmall"
-        android:text="@string/lockscreen_target_edit_msg" />
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:minHeight="?android:attr/listPreferredItemHeight"
-        android:gravity="center_vertical"
-        android:orientation="horizontal">
-
-        <ImageButton
-            android:padding="5dp"
-            android:layout_width="@android:dimen/app_icon_size"
-            style="?android:attr/borderlessButtonStyle"
-            android:id="@+id/icon"
-            android:layout_height="@android:dimen/app_icon_size" />
-
-        <View
-            android:layout_width="2dp"
-            android:layout_height="match_parent"
-            android:layout_marginTop="5dp"
-            android:layout_marginBottom="5dp"
-            android:layout_marginEnd="5dp"
-            android:layout_marginStart="5dp"
-            android:background="@android:drawable/divider_horizontal_dark" />
-
-        <Button
-            android:layout_width="match_parent"
-            style="?android:attr/borderlessButtonStyle"
-            android:gravity="start|center_vertical"
-            android:paddingStart="5dp"
-            android:layout_height="wrap_content"
-            android:id="@+id/label" />
-
-    </LinearLayout>
-
-</LinearLayout>
diff --git a/res/layout/lockscreen_targets.xml b/res/layout/lockscreen_targets.xml
deleted file mode 100644
index 357ed20..0000000
--- a/res/layout/lockscreen_targets.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:background="@android:color/holo_blue_light"
-        android:layout_margin="8dip"
-        android:padding="4dip"
-        android:gravity="center_horizontal"
-        android:textColor="#FFFFFF"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:text="@string/lockscreen_target_info" />
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="0.4" />
-
-    <com.android.internal.widget.multiwaveview.GlowPadView
-        android:id="@+id/lock_target"
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="0.6"
-        android:orientation="horizontal"
-        android:gravity="top"
-        android:contentDescription="@*android:string/keyguard_accessibility_slide_area"
-        prvandroid:targetDrawables="@*android:array/lockscreen_targets_unlock_only"
-        prvandroid:targetDescriptions="@*android:array/lockscreen_target_descriptions_unlock_only"
-        prvandroid:directionDescriptions="@*android:array/lockscreen_direction_descriptions"
-        prvandroid:handleDrawable="@*android:drawable/ic_lockscreen_handle"
-        prvandroid:outerRingDrawable="@*android:drawable/ic_lockscreen_outerring"
-        prvandroid:outerRadius="@*android:dimen/glowpadview_target_placement_radius"
-        prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
-        prvandroid:snapMargin="@*android:dimen/glowpadview_snap_margin"
-        prvandroid:firstItemOffset="@*android:integer/kg_glowpad_rotation_offset"
-        prvandroid:magneticTargets="false"
-        prvandroid:feedbackCount="1"
-        prvandroid:vibrationDuration="20"
-        prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
-        prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
-        prvandroid:allowScaling="true" />
-
-</LinearLayout>
diff --git a/res/values/custom_arrays.xml b/res/values/custom_arrays.xml
index 5e28804..cb8a4d0 100644
--- a/res/values/custom_arrays.xml
+++ b/res/values/custom_arrays.xml
@@ -34,58 +34,6 @@
         <item>4</item>
     </string-array>
 
-    <string-array name="lockscreen_icon_picker_labels" translatable="false">
-        <item>@string/icon_picker_alarm</item>
-        <item>@string/icon_picker_browser</item>
-        <item>@string/icon_picker_calendar</item>
-        <item>@string/icon_picker_camera</item>
-        <item>@string/icon_picker_chrome</item>
-        <item>@string/icon_picker_contacts</item>
-        <item>@string/icon_picker_email</item>
-        <item>@string/icon_picker_email2</item>
-        <item>@string/icon_picker_facebook</item>
-        <item>@string/icon_picker_gallery</item>
-        <item>@string/icon_picker_google_small</item>
-        <item>@string/icon_picker_googleplus</item>
-        <item>@string/icon_picker_googletalk</item>
-        <item>@string/icon_picker_maps</item>
-        <item>@string/icon_picker_sms</item>
-        <item>@string/icon_picker_movie</item>
-        <item>@string/icon_picker_music</item>
-        <item>@string/icon_picker_nav_normal</item>
-        <item>@string/icon_picker_phone</item>
-        <item>@string/icon_picker_podcast</item>
-        <item>@string/icon_picker_rss</item>
-        <item>@string/icon_picker_search</item>
-        <item>@string/icon_picker_twitter</item>
-    </string-array>
-
-    <string-array name="lockscreen_icon_picker_icons" translatable="false">
-        <item>@*android:drawable/ic_lockscreen_alarm_normal</item>
-        <item>@*android:drawable/ic_lockscreen_browser_normal</item>
-        <item>@*android:drawable/ic_lockscreen_calendar_normal</item>
-        <item>@*android:drawable/ic_lockscreen_camera_normal</item>
-        <item>@*android:drawable/ic_lockscreen_chrome_normal</item>
-        <item>@*android:drawable/ic_lockscreen_contacts_normal</item>
-        <item>@*android:drawable/ic_lockscreen_email_normal</item>
-        <item>@*android:drawable/ic_lockscreen_email2_normal</item>
-        <item>@*android:drawable/ic_lockscreen_facebook_normal</item>
-        <item>@*android:drawable/ic_lockscreen_gallery_normal</item>
-        <item>@*android:drawable/ic_lockscreen_google_small_normal</item>
-        <item>@*android:drawable/ic_lockscreen_gplus_normal</item>
-        <item>@*android:drawable/ic_lockscreen_gtalk_normal</item>
-        <item>@*android:drawable/ic_lockscreen_maps_normal</item>
-        <item>@*android:drawable/ic_lockscreen_sms_normal</item>
-        <item>@*android:drawable/ic_lockscreen_movie_normal</item>
-        <item>@*android:drawable/ic_lockscreen_music_normal</item>
-        <item>@*android:drawable/ic_lockscreen_nav_normal</item>
-        <item>@*android:drawable/ic_lockscreen_phone_normal</item>
-        <item>@*android:drawable/ic_lockscreen_podcast_normal</item>
-        <item>@*android:drawable/ic_lockscreen_rss_normal</item>
-        <item>@*android:drawable/ic_lockscreen_google_normal</item>
-        <item>@*android:drawable/ic_lockscreen_twitter_normal</item>
-    </string-array>
-
     <!-- Values for the notification light pulse spinners -->
     <string-array name="notification_pulse_length_entries" translatable="false">
         <item>@string/pulse_length_always_on</item>
diff --git a/res/values/custom_dimens.xml b/res/values/custom_dimens.xml
deleted file mode 100644
index 2ee2d77..0000000
--- a/res/values/custom_dimens.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--  Copyright (C) 2013 The OmniROM Project
-
-  Parts Copyright (C) 2012-2013 The CyanogenMod Project
-
-  This program is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- -->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <dimen name="shortcut_picker_left_padding">70dip</dimen>
-</resources>
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index 952b00a..28f169a 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -18,9 +18,6 @@
  -->
 
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="ok">OK</string>
-    <string name="reset">Reset</string>
-
     <string name="bars_and_menus_settings">Bars and menus</string>
     <string name="bars_and_menus_category_status_bar_title">Status bar</string>
     <string name="status_bar_battery_title">Battery style</string>
@@ -40,49 +37,6 @@
     <string name="status_bar_transparent_on_keyguard_title">Translucent lockscreen status bar</string>
     <string name="status_bar_transparent_on_keyguard_summary">Makes the status bar translucent on the lockscreen</string>
 
-    <!-- Lock Screen Shortcuts -->
-    <string name="lockscreen_shortcuts_settings">Lockscreen shortcuts</string>
-
-    <string name="lockscreen_target_info">Drag the slider to targets to assign shortcuts</string>
-    <string name="lockscreen_target_title">Slider shortcuts</string>
-    <string name="lockscreen_target_summary">View or change custom lock screen shortcuts</string>
-    <string name="lockscreen_target_reset">Lock screen shortcuts reset to default</string>
-    <string name="lockscreen_target_save">Lock screen shortcuts saved</string>
-    <string name="lockscreen_target_reset_title">Reset</string>
-    <string name="lockscreen_target_reset_message">Delete all user created lock screen shortcuts and restore to default?</string>
-    <string name="lockscreen_target_empty">Empty</string>
-    <string name="lockscreen_target_edit_title">Edit shortcut and icon</string>
-    <string name="lockscreen_target_edit_msg">Select or change the desired application or activity and the associated icon</string>
-
-    <!-- Lock screen shortcuts -->
-    <string name="picker_activities">Activities</string>
-    <string name="select_custom_app_title">Select custom app</string>
-    <string name="select_custom_activity_title">Select custom activity</string>
-    <string name="icon_picker_choose_icon_title">Choose icon</string>
-    <string name="icon_picker_alarm">Alarm</string>
-    <string name="icon_picker_browser">Browser</string>
-    <string name="icon_picker_calendar">Calendar</string>
-    <string name="icon_picker_camera">Camera</string>
-    <string name="icon_picker_chrome">Chrome</string>
-    <string name="icon_picker_contacts">Contacts</string>
-    <string name="icon_picker_email">Email</string>
-    <string name="icon_picker_email2">Email Holo</string>
-    <string name="icon_picker_facebook">Facebook</string>
-    <string name="icon_picker_gallery">Gallery</string>
-    <string name="icon_picker_google_small">Google (small)</string>
-    <string name="icon_picker_googleplus">Google Plus</string>
-    <string name="icon_picker_googletalk">Hangouts</string>
-    <string name="icon_picker_maps">Maps</string>
-    <string name="icon_picker_movie">Movie</string>
-    <string name="icon_picker_music">Music</string>
-    <string name="icon_picker_nav_normal">Navigation</string>
-    <string name="icon_picker_phone">Phone</string>
-    <string name="icon_picker_podcast">Podcast</string>
-    <string name="icon_picker_rss">Rss</string>
-    <string name="icon_picker_search">Search</string>
-    <string name="icon_picker_sms">Messaging</string>
-    <string name="icon_picker_twitter">Twitter</string>
-
     <!-- String for IconPicker -->
     <string name="icon_picker_title">Choose icon source</string>
     <string name="icon_picker_system_icons_title">System icons</string>
diff --git a/src/org/omnirom/omnigears/IconPicker.java b/src/org/omnirom/omnigears/IconPicker.java
deleted file mode 100644
index 730cc1e..0000000
--- a/src/org/omnirom/omnigears/IconPicker.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.omnirom.omnigears;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.Fragment;
-import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.provider.MediaStore;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.android.settings.R;
-
-import java.io.File;
-
-public class IconPicker {
-    private static final String ICON_ACTION = "org.omnirom.omnigears.ACTION_PICK_ICON";
-    public static final String RESOURCE_NAME = "resource_name";
-    public static final String PACKAGE_NAME = "package_name";
-
-    public static final int REQUEST_PICK_SYSTEM = 0;
-    public static final int REQUEST_PICK_GALLERY = 1;
-    public static final int REQUEST_PICK_ICON_PACK = 2;
-
-    private Activity mParent;
-    private Resources mResources;
-    private OnIconPickListener mIconListener;
-
-    public interface OnIconPickListener {
-        void iconPicked(int requestCode, int resultCode, Intent in);
-    }
-
-    public IconPicker(Activity parent, OnIconPickListener listener) {
-        mParent = parent;
-        mResources = parent.getResources();
-        mIconListener = listener;
-    }
-
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        mIconListener.iconPicked(requestCode, resultCode, data);
-    }
-
-    public void pickIcon(final int fragmentId, final File image) {
-        Intent iconPackIntent = new Intent(ICON_ACTION);
-        ComponentName component = iconPackIntent.resolveActivity(mParent.getPackageManager());
-
-        String[] items = new String[component != null ? 3 : 2];
-        items[0] = mResources.getString(R.string.icon_picker_system_icons_title);
-        items[1] = mResources.getString(R.string.icon_picker_gallery_title);
-        if (component != null) {
-            items[2] = mResources.getString(R.string.icon_picker_pack_title);
-        }
-
-        new AlertDialog.Builder(mParent)
-                .setTitle(R.string.icon_picker_title)
-                .setItems(items, new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int item) {
-                        showChosen(item, image, fragmentId);
-                    }
-                })
-                .show();
-    }
-
-    private void startFragmentOrActivityForResult(Intent pickIntent,
-            int requestCode, int fragmentId) {
-        if (fragmentId == 0) {
-            mParent.startActivityForResult(pickIntent, requestCode);
-        } else {
-            Fragment fragment = mParent.getFragmentManager().findFragmentById(fragmentId);
-            if (fragment != null) {
-                mParent.startActivityFromFragment(fragment, pickIntent, requestCode);
-            }
-        }
-    }
-
-    private void showChosen(final int type, File image, int fragmentId) {
-        if (type == REQUEST_PICK_SYSTEM) {
-            ListView list = new ListView(mParent);
-            final IconAdapter adapter = new IconAdapter();
-
-            final Dialog dialog = new Dialog(mParent);
-            dialog.setTitle(R.string.icon_picker_choose_icon_title);
-            dialog.setContentView(list);
-
-            list.setAdapter(adapter);
-            list.setOnItemClickListener(new OnItemClickListener(){
-                @Override
-                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                    Intent intent = new Intent();
-                    intent.putExtra(RESOURCE_NAME, adapter.getItemReference(position));
-                    mIconListener.iconPicked(type, Activity.RESULT_OK, intent);
-                    dialog.dismiss();
-                }
-            });
-            dialog.show();
-        } else if (type == REQUEST_PICK_GALLERY) {
-            Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
-            intent.setType("image/*");
-            intent.putExtra("crop", "true");
-            intent.putExtra("scale", true);
-            intent.putExtra("scaleUpIfNeeded", false);
-            intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
-            intent.putExtra("aspectX", 1);
-            intent.putExtra("aspectY", 1);
-            intent.putExtra("outputX", 162);
-            intent.putExtra("outputY", 162);
-            try {
-                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image));
-                intent.putExtra("return-data", false);
-                startFragmentOrActivityForResult(intent, type, fragmentId);
-            } catch (ActivityNotFoundException e) {
-                e.printStackTrace();
-            }
-        } else if (type == REQUEST_PICK_ICON_PACK) {
-            Intent iconPackIntent = new Intent(ICON_ACTION);
-            startFragmentOrActivityForResult(iconPackIntent, type, fragmentId);
-        }
-    }
-
-    class IconAdapter extends BaseAdapter {
-        String[] labels;
-        TypedArray icons;
-
-        public IconAdapter() {
-            labels = mResources.getStringArray(R.array.lockscreen_icon_picker_labels);
-            icons = mResources.obtainTypedArray(R.array.lockscreen_icon_picker_icons);
-        }
-
-        @Override
-        public int getCount() {
-            return labels.length;
-        }
-
-        @Override
-        public Object getItem(int position) {
-            return icons.getDrawable(position);
-        }
-
-        public String getItemReference(int position) {
-            String name = icons.getString(position);
-            int separatorIndex = name.lastIndexOf(File.separator);
-            int periodIndex = name.lastIndexOf('.');
-            return name.substring(separatorIndex + 1, periodIndex);
-        }
-
-        @Override
-        public long getItemId(int position) {
-            return 0;
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-            View view = convertView;
-            if (convertView == null) {
-                view = View.inflate(mParent, android.R.layout.simple_list_item_1, null);
-            }
-
-            TextView label = (TextView) view.findViewById(android.R.id.text1);
-            label.setText(labels[position]);
-
-            Drawable icon = ((Drawable) getItem(position)).mutate();
-            int bound = mParent.getResources().getDimensionPixelSize(
-                    R.dimen.shortcut_picker_left_padding);
-
-            icon.setBounds(0,  0, bound, bound);
-            label.setCompoundDrawables(icon, null, null, null);
-
-            return view;
-        }
-    }
-}
diff --git a/src/org/omnirom/omnigears/LockscreenTargets.java b/src/org/omnirom/omnigears/LockscreenTargets.java
deleted file mode 100644
index ef10a89..0000000
--- a/src/org/omnirom/omnigears/LockscreenTargets.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- * Copyright (C) 2012 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.omnirom.omnigears;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Fragment;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.InsetDrawable;
-import android.graphics.drawable.LayerDrawable;
-import android.graphics.drawable.StateListDrawable;
-import android.os.Bundle;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.ImageButton;
-import android.widget.Toast;
-
-import com.android.internal.util.custom.LockscreenTargetUtils;
-import com.android.internal.widget.multiwaveview.GlowPadView;
-import com.android.internal.widget.multiwaveview.TargetDrawable;
-import com.android.settings.R;
-import org.omnirom.omnigears.IconPicker.OnIconPickListener;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-
-public class LockscreenTargets extends Fragment implements
-        ShortcutPickHelper.OnPickListener, GlowPadView.OnTriggerListener, OnIconPickListener {
-    private static final String TAG = "LockscreenTargets";
-
-    private Activity mActivity;
-    private Resources mResources;
-    private ShortcutPickHelper mPicker;
-    private IconPicker mIconPicker;
-
-    private GlowPadView mWaveView;
-    private ViewGroup mContainer;
-
-    private ImageButton mDialogIcon;
-    private Button mDialogLabel;
-
-    private ArrayList<TargetInfo> mTargetStore = new ArrayList<TargetInfo>();
-    private int mTargetOffset;
-    private int mMaxTargets;
-
-    private File mTemporaryImage;
-    private int mTargetIndex = 0;
-    private static String mEmptyLabel;
-
-    private static final int MENU_RESET = Menu.FIRST;
-    private static final int MENU_SAVE = Menu.FIRST + 1;
-
-    class TargetInfo {
-        String uri;
-        String packageName;
-        StateListDrawable icon;
-        Drawable defaultIcon;
-        String iconType;
-        String iconSource;
-
-        TargetInfo(StateListDrawable target) {
-            icon = target;
-        }
-
-        TargetInfo(String uri, StateListDrawable target, String type, String source, Drawable defaultIcon) {
-            this.uri = uri;
-            this.icon = target;
-            this.defaultIcon = defaultIcon;
-            this.iconType = type;
-            this.iconSource = source;
-        }
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        mContainer = container;
-
-        setHasOptionsMenu(true);
-
-        mActivity = getActivity();
-        mResources = getResources();
-
-        mTargetOffset = LockscreenTargetUtils.getTargetOffset(mActivity);
-        mMaxTargets = LockscreenTargetUtils.getMaxTargets(mActivity);
-
-        mIconPicker = new IconPicker(mActivity, this);
-        mPicker = new ShortcutPickHelper(mActivity, this);
-
-        mTemporaryImage = new File(mActivity.getCacheDir() + "/target.tmp");
-        mEmptyLabel = mResources.getString(R.string.lockscreen_target_empty);
-
-        return inflater.inflate(R.layout.lockscreen_targets, container, false);
-    }
-
-    @Override
-    public void onActivityCreated(Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
-
-        mWaveView = (GlowPadView) mActivity.findViewById(R.id.lock_target);
-        mWaveView.setOnTriggerListener(this);
-
-        initializeView(Settings.System.getString(mActivity.getContentResolver(),
-                Settings.System.LOCKSCREEN_TARGETS));
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        // If running on a phone, remove padding around container
-        if (!LockscreenTargetUtils.isScreenLarge(mActivity)) {
-            mContainer.setPadding(0, 0, 0, 0);
-        }
-    }
-
-    @Override
-    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        menu.add(0, MENU_RESET, 0, R.string.reset)
-            .setIcon(R.drawable.ic_settings_backup) // use the backup icon
-            .setAlphabeticShortcut('r')
-            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
-                MenuItem.SHOW_AS_ACTION_WITH_TEXT);
-        menu.add(0, MENU_SAVE, 0, R.string.wifi_save)
-            .setIcon(R.drawable.ic_menu_save)
-            .setAlphabeticShortcut('s')
-            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
-                MenuItem.SHOW_AS_ACTION_WITH_TEXT);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case MENU_RESET:
-                resetAll();
-                return true;
-            case MENU_SAVE:
-                saveAll();
-                Toast.makeText(mActivity,
-                        R.string.lockscreen_target_save, Toast.LENGTH_LONG).show();
-                return true;
-            default:
-                return false;
-        }
-    }
-
-    private void initializeView(String input) {
-        if (input == null) {
-            input = GlowPadView.EMPTY_TARGET;
-        }
-
-        mTargetStore.clear();
-
-        final Drawable activeBack = mResources.getDrawable(
-                com.android.internal.R.drawable.ic_lockscreen_target_activated);
-        final String[] targetStore = input.split("\\|");
-
-        for (int i = 0; i < mTargetOffset; i++) {
-            mTargetStore.add(new TargetInfo(null));
-        }
-
-        //Add the unlock icon
-        Drawable unlockFront = mResources.getDrawable(
-                com.android.internal.R.drawable.ic_lockscreen_unlock_normal);
-        Drawable unlockBack = mResources.getDrawable(
-                com.android.internal.R.drawable.ic_lockscreen_unlock_activated);
-        mTargetStore.add(new TargetInfo(LockscreenTargetUtils.getLayeredDrawable(
-                mActivity, unlockBack, unlockFront, 0, true)));
-
-        for (int i = 0; i < 8 - mTargetOffset - 1; i++) {
-            if (i >= mMaxTargets) {
-                mTargetStore.add(new TargetInfo(null));
-                continue;
-            }
-
-            String uri = i < targetStore.length ? targetStore[i] : GlowPadView.EMPTY_TARGET;
-            Drawable front = null;
-            Drawable back = activeBack;
-            boolean frontBlank = false;
-            String iconType = null;
-            String iconSource = null;
-
-            if (!uri.equals(GlowPadView.EMPTY_TARGET)) {
-                try {
-                    Intent intent = Intent.parseUri(uri, 0);
-                    if (intent.hasExtra(GlowPadView.ICON_FILE)) {
-                        iconType = GlowPadView.ICON_FILE;
-                        front = LockscreenTargetUtils.getDrawableFromFile(mActivity,
-                                intent.getStringExtra(GlowPadView.ICON_FILE));
-                    } else if (intent.hasExtra(GlowPadView.ICON_RESOURCE)) {
-                        String source = intent.getStringExtra(GlowPadView.ICON_RESOURCE);
-                        String packageName = intent.getStringExtra(GlowPadView.ICON_PACKAGE);
-
-                        if (source != null) {
-                            front = LockscreenTargetUtils.getDrawableFromResources(mActivity,
-                                    packageName, source, false);
-                            back = LockscreenTargetUtils.getDrawableFromResources(mActivity,
-                                    packageName, source, true);
-                            iconType = GlowPadView.ICON_RESOURCE;
-                            frontBlank = true;
-                        }
-                    }
-                    if (front == null) {
-                        front = LockscreenTargetUtils.getDrawableFromIntent(mActivity, intent);
-                    }
-                } catch (URISyntaxException e) {
-                    Log.w(TAG, "Invalid lockscreen target " + uri);
-                }
-            }
-
-            if (back == null || front == null) {
-                front = mResources.getDrawable(R.drawable.ic_empty);
-            }
-
-            int inset = LockscreenTargetUtils.getInsetForIconType(mActivity, iconType);
-            StateListDrawable drawable = LockscreenTargetUtils.getLayeredDrawable(
-                    mActivity, back, front, inset, frontBlank);
-            mTargetStore.add(new TargetInfo(uri, drawable, iconType, iconSource, front));
-        }
-
-        ArrayList<TargetDrawable> targetDrawables = new ArrayList<TargetDrawable>();
-        for (TargetInfo i : mTargetStore) {
-            targetDrawables.add(new TargetDrawable(mResources, i != null ? i.icon : null));
-        }
-        mWaveView.setTargetResources(targetDrawables);
-    }
-
-    /**
-     * Resets the target layout to stock
-     */
-    private void resetAll() {
-        new AlertDialog.Builder(mActivity)
-                .setTitle(R.string.lockscreen_target_reset_title)
-                .setIconAttribute(android.R.attr.alertDialogIcon)
-                .setMessage(R.string.lockscreen_target_reset_message)
-                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int id) {
-                        initializeView(null);
-                        Settings.System.putString(mActivity.getContentResolver(),
-                                Settings.System.LOCKSCREEN_TARGETS, null);
-                        Toast.makeText(mActivity, R.string.lockscreen_target_reset,
-                                Toast.LENGTH_LONG).show();
-                    }
-                })
-                .setNegativeButton(R.string.cancel, null)
-                .show();
-    }
-
-    /**
-     * Save targets to settings provider
-     */
-    private void saveAll() {
-        StringBuilder targetLayout = new StringBuilder();
-        ArrayList<String> existingImages = new ArrayList<String>();
-        boolean hasValidTargets = false;
-
-        for (int i = mTargetOffset + 1; i <= mTargetOffset + mMaxTargets; i++) {
-            TargetInfo info = mTargetStore.get(i);
-            String uri = info.uri;
-
-            if (info.iconSource != null) {
-                existingImages.add(info.iconSource);
-            }
-
-            if (!TextUtils.equals(uri, GlowPadView.EMPTY_TARGET)) {
-                try {
-                    Intent intent = Intent.parseUri(info.uri, 0);
-                    // make sure to remove any outdated icon references
-                    intent.removeExtra(GlowPadView.ICON_RESOURCE);
-                    intent.removeExtra(GlowPadView.ICON_FILE);
-                    if (info.iconType != null) {
-                        intent.putExtra(info.iconType, info.iconSource);
-                    }
-                    if (info.packageName != null) {
-                        intent.putExtra(GlowPadView.ICON_PACKAGE, info.packageName);
-                    } else {
-                        intent.removeExtra(GlowPadView.ICON_PACKAGE);
-                    }
-
-                    uri = intent.toUri(0);
-                    hasValidTargets = true;
-                } catch (URISyntaxException e) {
-                    Log.w(TAG, "Invalid uri " + info.uri + " on save, ignoring");
-                    uri = GlowPadView.EMPTY_TARGET;
-                }
-            }
-
-            if (targetLayout.length() > 0) {
-                targetLayout.append("|");
-            }
-            targetLayout.append(uri);
-        }
-
-        final String targets = hasValidTargets ? targetLayout.toString() : null;
-        Settings.System.putString(mActivity.getContentResolver(),
-                Settings.System.LOCKSCREEN_TARGETS, targets);
-
-        for (File image : mActivity.getFilesDir().listFiles()) {
-            if (image.getName().startsWith("lockscreen_")
-                    && !existingImages.contains(image.getAbsolutePath())) {
-                image.delete();
-            }
-        }
-    }
-
-    /**
-     * Updates a target in the GlowPadView
-     */
-    private void setTarget(int position, String uri, Drawable drawable,
-            String iconType, String iconSource, String packageName) {
-        TargetInfo item = mTargetStore.get(position);
-        StateListDrawable state = (StateListDrawable) item.icon;
-        LayerDrawable inactiveLayer = (LayerDrawable) state.getStateDrawable(0);
-        LayerDrawable activeLayer = (LayerDrawable) state.getStateDrawable(1);
-        boolean hasBackground = false;
-
-        inactiveLayer.setDrawableByLayerId(1, drawable);
-
-        if (GlowPadView.ICON_RESOURCE.equals(iconType) && iconSource != null) {
-            InsetDrawable empty = new InsetDrawable(
-                    mResources.getDrawable(android.R.color.transparent), 0, 0, 0, 0);
-            activeLayer.setDrawableByLayerId(1, empty);
-            Drawable back = LockscreenTargetUtils.getDrawableFromResources(mActivity,
-                    null, iconSource, true);
-            if (back != null) {
-                activeLayer.setDrawableByLayerId(0, back);
-                hasBackground = true;
-            }
-        } else {
-            activeLayer.setDrawableByLayerId(1, drawable);
-        }
-
-        if (!hasBackground) {
-            final Drawable activeBack = mResources.getDrawable(
-                    com.android.internal.R.drawable.ic_lockscreen_target_activated);
-            activeLayer.setDrawableByLayerId(0, new InsetDrawable(activeBack, 0, 0, 0, 0));
-        }
-
-        item.defaultIcon = getPickedIconFromDialog();
-        item.uri = uri;
-        item.iconType = iconType;
-        item.iconSource = iconSource;
-        item.packageName = packageName;
-    }
-
-    private Drawable getPickedIconFromDialog() {
-        return mDialogIcon.getDrawable().mutate();
-    }
-
-    private void setIconForDialog(Drawable icon) {
-        // need to mutate the drawable here to not share drawable state with GlowPadView
-        mDialogIcon.setImageDrawable(icon.getConstantState().newDrawable().mutate());
-    }
-
-    @Override
-    public void shortcutPicked(String uri, String friendlyName, boolean isApplication) {
-        if (uri == null) {
-            return;
-        }
-
-        try {
-            Intent intent = Intent.parseUri(uri, 0);
-            Drawable icon = LockscreenTargetUtils.getDrawableFromIntent(mActivity, intent);
-
-            mDialogLabel.setText(friendlyName);
-            mDialogLabel.setTag(uri);
-            // this is a fresh drawable, so we can assign it directly
-            mDialogIcon.setImageDrawable(icon);
-            mDialogIcon.setTag(null);
-        } catch (URISyntaxException e) {
-            Log.wtf(TAG, "Invalid uri " + uri + " on pick");
-        }
-    }
-
-    @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        String shortcutName = null;
-        if (data != null) {
-            shortcutName = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
-        }
-
-        if (TextUtils.equals(shortcutName, mEmptyLabel)) {
-            mDialogLabel.setText(mEmptyLabel);
-            mDialogLabel.setTag(GlowPadView.EMPTY_TARGET);
-            mDialogIcon.setImageResource(R.drawable.ic_empty);
-            mDialogIcon.setTag(null);
-        } else if (requestCode == IconPicker.REQUEST_PICK_SYSTEM
-                || requestCode == IconPicker.REQUEST_PICK_GALLERY
-                || requestCode == IconPicker.REQUEST_PICK_ICON_PACK) {
-            mIconPicker.onActivityResult(requestCode, resultCode, data);
-        } else if (requestCode != Activity.RESULT_CANCELED
-                && resultCode != Activity.RESULT_CANCELED) {
-            mPicker.onActivityResult(requestCode, resultCode, data);
-        }
-    }
-
-    @Override
-    public void onGrabbed(View v, int handle) {
-    }
-
-    @Override
-    public void onReleased(View v, int handle) {
-    }
-
-    @Override
-    public void onTrigger(View v, final int target) {
-        mTargetIndex = target;
-
-        if (target == mTargetOffset) {
-            return;
-        }
-
-        new AlertDialog.Builder(mActivity)
-                .setTitle(R.string.lockscreen_target_edit_title)
-                .setView(createShortcutDialogView(target))
-                .setPositiveButton(R.string.ok,  new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        TargetInfo info = (TargetInfo) mDialogIcon.getTag();
-                        String type = info != null ? info.iconType : null;
-                        String source = info != null ? info.iconSource : null;
-                        String packageName = info != null ? info.packageName : null;
-                        int inset = LockscreenTargetUtils.getInsetForIconType(mActivity, type);
-
-                        InsetDrawable drawable = new InsetDrawable(getPickedIconFromDialog(),
-                                inset, inset, inset, inset);
-                        setTarget(mTargetIndex, mDialogLabel.getTag().toString(),
-                                drawable, type, source, packageName);
-                    }
-                })
-                .setNegativeButton(R.string.cancel, null)
-                .setCancelable(false)
-                .show();
-    }
-
-    private View createShortcutDialogView(int target) {
-        View view = View.inflate(mActivity, R.layout.lockscreen_shortcut_dialog, null);
-        view.findViewById(R.id.icon).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                if (!mDialogLabel.getText().equals(mEmptyLabel)) {
-                    try {
-                        mTemporaryImage.createNewFile();
-                        mTemporaryImage.setWritable(true, false);
-                        mIconPicker.pickIcon(getId(), mTemporaryImage);
-                    } catch (IOException e) {
-                        Log.d(TAG, "Could not create temporary icon", e);
-                    }
-                }
-            }
-        });
-        view.findViewById(R.id.label).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                String[] names = new String[] { mEmptyLabel };
-                ShortcutIconResource[] icons = new ShortcutIconResource[] {
-                    ShortcutIconResource.fromContext(mActivity, android.R.drawable.ic_delete)
-                };
-                mPicker.pickShortcut(names, icons, getId());
-            }
-        });
-
-        mDialogIcon = (ImageButton) view.findViewById(R.id.icon);
-        mDialogLabel = (Button) view.findViewById(R.id.label);
-
-        TargetInfo item = mTargetStore.get(target);
-        setIconForDialog(item.defaultIcon);
-
-        TargetInfo icon = new TargetInfo(null);
-        icon.iconType = item.iconType;
-        icon.iconSource = item.iconSource;
-        icon.packageName = item.packageName;
-        mDialogIcon.setTag(icon);
-
-        if (TextUtils.equals(item.uri, GlowPadView.EMPTY_TARGET)) {
-            mDialogLabel.setText(mEmptyLabel);
-        } else {
-            mDialogLabel.setText(mPicker.getFriendlyNameForUri(item.uri));
-        }
-        mDialogLabel.setTag(item.uri);
-
-        return view;
-    }
-
-    @Override
-    public void onGrabbedStateChange(View v, int handle) {
-    }
-
-    @Override
-    public void iconPicked(int requestCode, int resultCode, Intent intent) {
-        TargetInfo icon = new TargetInfo(null);
-        Drawable iconDrawable = null;
-
-        if (requestCode == IconPicker.REQUEST_PICK_GALLERY) {
-            if (resultCode == Activity.RESULT_OK) {
-                File imageFile = new File(mActivity.getFilesDir(),
-                        "/lockscreen_" + System.currentTimeMillis() + ".png");
-                if (mTemporaryImage.exists()) {
-                    mTemporaryImage.renameTo(imageFile);
-                }
-                imageFile.setReadOnly();
-
-                icon.iconType = GlowPadView.ICON_FILE;
-                icon.iconSource = imageFile.getAbsolutePath();
-                iconDrawable = LockscreenTargetUtils.getDrawableFromFile(
-                        mActivity, icon.iconSource);
-            } else {
-                if (mTemporaryImage.exists()) {
-                    mTemporaryImage.delete();
-                }
-                return;
-            }
-        } else if (requestCode == IconPicker.REQUEST_PICK_SYSTEM) {
-            icon.iconType = GlowPadView.ICON_RESOURCE;
-            icon.iconSource = intent.getStringExtra(IconPicker.RESOURCE_NAME);
-            iconDrawable = LockscreenTargetUtils.getDrawableFromResources(mActivity,
-                    null, icon.iconSource, false);
-        } else if (requestCode == IconPicker.REQUEST_PICK_ICON_PACK
-                && resultCode == Activity.RESULT_OK) {
-            icon.packageName = intent.getStringExtra(IconPicker.PACKAGE_NAME);
-            icon.iconType = GlowPadView.ICON_RESOURCE;
-            icon.iconSource = intent.getStringExtra(IconPicker.RESOURCE_NAME);
-            iconDrawable = LockscreenTargetUtils.getDrawableFromResources(mActivity,
-                    icon.packageName, icon.iconSource, false);
-        } else {
-            return;
-        }
-
-        if (iconDrawable != null) {
-            mDialogIcon.setTag(icon);
-            setIconForDialog(iconDrawable);
-        } else {
-            Log.w(TAG, "Could not fetch icon, keeping old one (type=" + icon.iconType
-                    + ", source=" + icon.iconSource + ", package= " + icon.packageName + ")");
-        }
-    }
-
-    @Override
-    public void onFinishFinalAnimation() {
-    }
-}
diff --git a/src/org/omnirom/omnigears/ShortcutPickHelper.java b/src/org/omnirom/omnigears/ShortcutPickHelper.java
deleted file mode 100644
index 5f3b82b..0000000
--- a/src/org/omnirom/omnigears/ShortcutPickHelper.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (C) 2011 The CyanogenMod Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.omnirom.omnigears;
-
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.app.Fragment;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
-import android.content.pm.ActivityInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseExpandableListAdapter;
-import android.widget.ExpandableListView;
-import android.widget.TextView;
-
-import com.android.settings.R;
-import org.omnirom.omnigears.ShortcutPickHelper.AppExpandableAdapter.GroupInfo;
-
-public class ShortcutPickHelper {
-
-    private Activity mParent;
-    private AlertDialog mAlertDialog;
-    private OnPickListener mListener;
-    private PackageManager mPackageManager;
-    private static final int REQUEST_PICK_SHORTCUT = 100;
-    private static final int REQUEST_PICK_APPLICATION = 101;
-    private static final int REQUEST_CREATE_SHORTCUT = 102;
-    private int lastFragmentId;
-
-    public interface OnPickListener {
-        void shortcutPicked(String uri, String friendlyName, boolean isApplication);
-    }
-
-    public ShortcutPickHelper(Activity parent, OnPickListener listener) {
-        mParent = parent;
-        mPackageManager = mParent.getPackageManager();
-        mListener = listener;
-    }
-
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if (resultCode == Activity.RESULT_OK) {
-            switch (requestCode) {
-            case REQUEST_PICK_APPLICATION:
-                completeSetCustomApp(data);
-                break;
-            case REQUEST_CREATE_SHORTCUT:
-                completeSetCustomShortcut(data);
-                break;
-            case REQUEST_PICK_SHORTCUT:
-                processShortcut(data, REQUEST_PICK_APPLICATION, REQUEST_CREATE_SHORTCUT);
-                break;
-            }
-        }
-    }
-
-    public void pickShortcut(String[] names, ShortcutIconResource[] icons, int fragmentId) {
-        Bundle bundle = new Bundle();
-
-        ArrayList<String> shortcutNames = new ArrayList<String>();
-        if (names != null) {
-            for (String s : names) {
-                shortcutNames.add(s);
-            }
-        }
-        shortcutNames.add(mParent.getString(R.string.profile_applist_title));
-        shortcutNames.add(mParent.getString(R.string.picker_activities));
-        bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames);
-
-        ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
-        if (icons != null) {
-            for (ShortcutIconResource s : icons) {
-                shortcutIcons.add(s);
-            }
-        }
-        shortcutIcons.add(ShortcutIconResource.fromContext(mParent, android.R.drawable.sym_def_app_icon));
-        shortcutIcons.add(ShortcutIconResource.fromContext(mParent, R.drawable.activities_icon));
-        bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);
-
-        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
-        pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT));
-        pickIntent.putExtra(Intent.EXTRA_TITLE, mParent.getText(R.string.select_custom_app_title));
-        pickIntent.putExtras(bundle);
-        lastFragmentId = fragmentId;
-        startFragmentOrActivity(pickIntent, REQUEST_PICK_SHORTCUT);
-    }
-
-    private void startFragmentOrActivity(Intent pickIntent, int requestCode) {
-        if (lastFragmentId == 0) {
-            mParent.startActivityForResult(pickIntent, requestCode);
-        } else {
-            Fragment cFrag = mParent.getFragmentManager().findFragmentById(lastFragmentId);
-            if (cFrag != null) {
-                mParent.startActivityFromFragment(cFrag, pickIntent, requestCode);
-            }
-        }
-    }
-
-    private void processShortcut(final Intent intent, int requestCodeApplication, int requestCodeShortcut) {
-        // Handle case where user selected "Applications"
-        String applicationName = mParent.getString(R.string.profile_applist_title);
-        String application2name = mParent.getString(R.string.picker_activities);
-        String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
-        if (applicationName != null && applicationName.equals(shortcutName)) {
-            Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
-            mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
-
-            Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
-            pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
-            startFragmentOrActivity(pickIntent, requestCodeApplication);
-        } else if (application2name != null && application2name.equals(shortcutName)){
-            final List<PackageInfo> pInfos = mPackageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES);
-            ExpandableListView appListView = new ExpandableListView(mParent);
-            AppExpandableAdapter appAdapter = new AppExpandableAdapter(pInfos, mParent);
-            appListView.setAdapter(appAdapter);
-            appListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
-                @Override
-                public boolean onChildClick(ExpandableListView parent, View v,
-                        int groupPosition, int childPosition, long id) {
-                    Intent shortIntent = new Intent(Intent.ACTION_MAIN);
-                    String pkgName = ((GroupInfo)parent.getExpandableListAdapter().getGroup(groupPosition))
-                            .info.packageName;
-                    String actName = ((GroupInfo)parent.getExpandableListAdapter().getGroup(groupPosition))
-                            .info.activities[childPosition].name;
-                    shortIntent.setClassName(pkgName, actName);
-                    completeSetCustomApp(shortIntent);
-                    mAlertDialog.dismiss();
-                    return true;
-                }
-            });
-            Builder builder = new Builder(mParent);
-            builder.setView(appListView);
-            mAlertDialog = builder.create();
-            mAlertDialog.setTitle(mParent.getString(R.string.select_custom_activity_title));
-            mAlertDialog.show();
-            mAlertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
-                @Override
-                public void onCancel(DialogInterface dialog) {
-                    mListener.shortcutPicked(null, null, false);
-                }
-            });
-        } else {
-            startFragmentOrActivity(intent, requestCodeShortcut);
-        }
-    }
-
-    public class AppExpandableAdapter extends BaseExpandableListAdapter {
-
-        ArrayList<GroupInfo> allList = new ArrayList<GroupInfo>();
-        final int groupPadding;
-
-        public class LabelCompare implements Comparator<GroupInfo>{
-            @Override
-            public int compare(GroupInfo item1, GroupInfo item2) {
-                String rank1 = item1.label.toLowerCase();
-                String rank2 = item2.label.toLowerCase();
-                int result = rank1.compareTo(rank2);
-                if(result == 0) {
-                    return 0;
-                } else if(result < 0) {
-                    return -1;
-                } else {
-                    return +1;
-                }
-            }
-        }
-
-        class GroupInfo {
-            String label;
-            PackageInfo info;
-            GroupInfo (String l, PackageInfo p) {
-                label = l;
-                info = p;
-            }
-        }
-
-        public AppExpandableAdapter(List<PackageInfo> pInfos, Context context) {
-            for (PackageInfo i : pInfos) {
-                allList.add(new GroupInfo(i.applicationInfo.loadLabel(mPackageManager).toString(), i));
-            }
-            Collections.sort(allList, new LabelCompare());
-            groupPadding = context.getResources().getDimensionPixelSize(R.dimen.shortcut_picker_left_padding);
-        }
-
-        public String getChild(int groupPosition, int childPosition) {
-            return allList.get(groupPosition).info.activities[childPosition].name;
-        }
-
-        public long getChildId(int groupPosition, int childPosition) {
-            return childPosition;
-        }
-
-        public int getChildrenCount(int groupPosition) {
-            if (allList.get(groupPosition).info.activities != null) {
-                return allList.get(groupPosition).info.activities.length;
-            } else {
-                return 0;
-            }
-        }
-
-
-        public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
-                View convertView, ViewGroup parent) {
-            if (convertView == null) {
-                convertView = View.inflate(mParent, android.R.layout.simple_list_item_1, null);
-                convertView.setPadding(groupPadding, 0, 0, 0);
-
-            }
-            TextView textView = (TextView)convertView.findViewById(android.R.id.text1);
-            textView.setText(getChild(groupPosition, childPosition).replaceFirst(allList.get(groupPosition).info.packageName + ".", ""));
-            return convertView;
-        }
-
-        public GroupInfo getGroup(int groupPosition) {
-            return allList.get(groupPosition);
-        }
-
-        public int getGroupCount() {
-            return allList.size();
-        }
-
-        public long getGroupId(int groupPosition) {
-            return groupPosition;
-        }
-
-        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
-                ViewGroup parent) {
-            if (convertView == null) {
-                convertView = View.inflate(mParent, android.R.layout.simple_list_item_1, null);
-                convertView.setPadding(70, 0, 0, 0);
-            }
-            TextView textView = (TextView)convertView.findViewById(android.R.id.text1);
-            textView.setText(getGroup(groupPosition).label.toString());
-            return convertView;
-        }
-
-        public boolean isChildSelectable(int groupPosition, int childPosition) {
-            return true;
-        }
-
-        public boolean hasStableIds() {
-            return true;
-        }
-
-    }
-
-    private void completeSetCustomApp(Intent data) {
-        mListener.shortcutPicked(data.toUri(0), getFriendlyActivityName(data, false), true);
-    }
-
-    private void completeSetCustomShortcut(Intent data) {
-        Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
-        /* preserve shortcut name, we want to restore it later */
-        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
-        String appUri = intent.toUri(0);
-        appUri = appUri.replaceAll("com.android.contacts.action.QUICK_CONTACT", "android.intent.action.VIEW");
-        mListener.shortcutPicked(appUri, getFriendlyShortcutName(intent), false);
-    }
-
-    private String getFriendlyActivityName(Intent intent, boolean labelOnly) {
-        ActivityInfo ai = intent.resolveActivityInfo(mPackageManager, PackageManager.GET_ACTIVITIES);
-        String friendlyName = null;
-        if (ai != null) {
-            friendlyName = ai.loadLabel(mPackageManager).toString();
-            if (friendlyName == null && !labelOnly) {
-                friendlyName = ai.name;
-            }
-        }
-        return friendlyName != null || labelOnly ? friendlyName : intent.toUri(0);
-    }
-
-    private String getFriendlyShortcutName(Intent intent) {
-        String activityName = getFriendlyActivityName(intent, true);
-        String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
-
-        if (activityName != null && name != null) {
-            return activityName + ": " + name;
-        }
-        return name != null ? name : intent.toUri(0);
-    }
-
-    public String getFriendlyNameForUri(String uri) {
-        if (uri == null) {
-            return null;
-        }
-
-        try {
-            Intent intent = Intent.parseUri(uri, 0);
-            if (Intent.ACTION_MAIN.equals(intent.getAction())) {
-                return getFriendlyActivityName(intent, false);
-            }
-            return getFriendlyShortcutName(intent);
-        } catch (URISyntaxException e) {
-        }
-
-        return uri;
-    }
-}