diff options
author | Mindy Pereira <mindyp@google.com> | 2012-02-14 18:13:13 -0800 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2012-02-15 09:47:28 -0800 |
commit | f645288ddaf5d24af952dd4ebf6d461eebddcfcf (patch) | |
tree | 94476a6cce30a6dd79f6d98eba888e9768d47d05 | |
parent | ead74e4a3efab75cb6321e68828f96dfca081d6f (diff) | |
download | android_packages_apps_UnifiedEmail-f645288ddaf5d24af952dd4ebf6d461eebddcfcf.tar.gz android_packages_apps_UnifiedEmail-f645288ddaf5d24af952dd4ebf6d461eebddcfcf.tar.bz2 android_packages_apps_UnifiedEmail-f645288ddaf5d24af952dd4ebf6d461eebddcfcf.zip |
Show all folders for an account.
This is just the start. Needs a lot more passes, and will
want to make this a fragment instead of an activity.
Change-Id: I107390ee6c2e3af044c977c160b8d9a52477d569
21 files changed, 496 insertions, 6 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index cd78cc20d..450a3079b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -44,6 +44,7 @@ <activity android:name=".compose.ComposeActivity" /> <activity android:name=".browse.ConversationListActivity" /> <activity android:name=".browse.ConversationViewActivity" /> + <activity android:name=".browse.FoldersListActivity" /> <activity android:name=".browse.FolderItem" /> <activity android:name=".ui.ActionbarActivity" diff --git a/res/color/text_color_unread_invertible.xml b/res/color/text_color_unread_invertible.xml new file mode 100644 index 000000000..6043e910e --- /dev/null +++ b/res/color/text_color_unread_invertible.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 Google Inc. + Licensed to The Android Open Source 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. +--> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_enabled="false" + android:color="#ff999999"/> + <item android:state_activated="true" + android:color="@android:color/white" /> + <item + android:color="#bcbcbc" /> +</selector>
\ No newline at end of file diff --git a/res/drawable/folder_drag_target.xml b/res/drawable/folder_drag_target.xml new file mode 100644 index 000000000..c1fea431d --- /dev/null +++ b/res/drawable/folder_drag_target.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2011 Google Inc. + Licensed to The Android Open Source 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- If this selector has more than one state, LabelItemView will need to be changed + to change the reference there to not be static --> + <item android:drawable="@drawable/list_pressed_holo" /> +</selector> diff --git a/res/drawable/folder_item.xml b/res/drawable/folder_item.xml new file mode 100644 index 000000000..cc362eda0 --- /dev/null +++ b/res/drawable/folder_item.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2011 Google Inc. + Licensed to The Android Open Source 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/list_selected_holo" /> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/res/drawable/folder_no_hover.xml b/res/drawable/folder_no_hover.xml new file mode 100644 index 000000000..99c85349d --- /dev/null +++ b/res/drawable/folder_no_hover.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2011 Google Inc. + Licensed to The Android Open Source 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- If this selector has more than one state, LabelItemView will need to be changed + to change the reference there to not be static --> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/res/layout/folder_item.xml b/res/layout/folder_item.xml new file mode 100644 index 000000000..9be38fa12 --- /dev/null +++ b/res/layout/folder_item.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 Google Inc. + Licensed to The Android Open Source 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. +--> + +<com.android.mail.ui.FolderItemView + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:minHeight="@dimen/folder_list_minimum_height" + android:background="@drawable/folder_item"> + + <ImageView + android:id="@+id/label_box" + style="@style/FolderItemIcon" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" /> + + <TextView + android:id="@+id/unread" + style="@style/UnreadCount" + android:layout_marginRight="@dimen/folder_list_item_right_margin" + android:layout_alignParentRight="true" + android:textColor="@color/text_color_unread_invertible" /> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_toLeftOf="@id/unread" + android:layout_marginLeft="@dimen/folder_list_item_left_margin" + android:layout_marginTop="@dimen/folder_swatch_height" + android:layout_marginBottom="@dimen/folder_swatch_height"> + + <TextView + android:id="@+id/name" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:maxLines="2" + android:ellipsize="end" + android:textColor="@color/text_color_primary_invertible" + android:textAppearance="?android:attr/textAppearanceMedium" /> + + <TextView + android:id="@+id/description" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_below="@id/name" + android:textColor="@color/text_color_primary_invertible" + android:textAppearance="?android:attr/textAppearanceSmall" + android:visibility="gone" /> + + </RelativeLayout> + +</com.android.mail.ui.FolderItemView>
\ No newline at end of file diff --git a/res/layout/folders_activity.xml b/res/layout/folders_activity.xml new file mode 100644 index 000000000..82875fd89 --- /dev/null +++ b/res/layout/folders_activity.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 Google Inc. + Licensed to The Android Open Source 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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + + <ListView + android:id="@+id/folders_list" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:cacheColorHint="@android:color/transparent" + android:drawSelectorOnTop="false" + android:fadingEdge="none" /> + + <TextView android:id="@+id/empty_view" + android:visibility="gone" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/folders_activity_instructions"/> + +</LinearLayout> diff --git a/res/menu/conversation_list_menu.xml b/res/menu/conversation_list_menu.xml index ce6dda08d..44221ab98 100644 --- a/res/menu/conversation_list_menu.xml +++ b/res/menu/conversation_list_menu.xml @@ -30,8 +30,8 @@ android:icon="@drawable/ic_menu_search_holo_light" android:actionLayout="@layout/mail_actionbar_searchview" /> - <item android:id="@+id/show_all_labels" - android:title="@string/show_all_labels" + <item android:id="@+id/show_all_folders" + android:title="@string/show_all_folders" android:showAsAction="ifRoom" android:icon="@drawable/ic_menu_labels_holo_light" /> diff --git a/res/menu/conversation_list_search_results_actions.xml b/res/menu/conversation_list_search_results_actions.xml index c358204cd..7edfa7622 100644 --- a/res/menu/conversation_list_search_results_actions.xml +++ b/res/menu/conversation_list_search_results_actions.xml @@ -30,8 +30,8 @@ android:icon="@drawable/ic_menu_search_holo_light" android:actionLayout="@layout/mail_actionbar_searchview" /> - <item android:id="@+id/show_all_labels" - android:title="@string/show_all_labels" + <item android:id="@+id/show_all_folders" + android:title="@string/show_all_folders" android:showAsAction="ifRoom" android:icon="@drawable/ic_menu_labels_holo_light" /> diff --git a/res/mipmap-hdpi/ic_launcher_mail.png b/res/mipmap-hdpi/ic_launcher_mail.png Binary files differnew file mode 100644 index 000000000..4620e7101 --- /dev/null +++ b/res/mipmap-hdpi/ic_launcher_mail.png diff --git a/res/mipmap-hdpi/ic_launcher_shortcut_folder.png b/res/mipmap-hdpi/ic_launcher_shortcut_folder.png Binary files differnew file mode 100644 index 000000000..96eddb33a --- /dev/null +++ b/res/mipmap-hdpi/ic_launcher_shortcut_folder.png diff --git a/res/mipmap-mdpi/ic_launcher_mail.png b/res/mipmap-mdpi/ic_launcher_mail.png Binary files differnew file mode 100644 index 000000000..2c43d0d83 --- /dev/null +++ b/res/mipmap-mdpi/ic_launcher_mail.png diff --git a/res/mipmap-mdpi/ic_launcher_shortcut_folder.png b/res/mipmap-mdpi/ic_launcher_shortcut_folder.png Binary files differnew file mode 100644 index 000000000..eb8653d5d --- /dev/null +++ b/res/mipmap-mdpi/ic_launcher_shortcut_folder.png diff --git a/res/mipmap-xhdpi/ic_launcher_shortcut_folder.png b/res/mipmap-xhdpi/ic_launcher_shortcut_folder.png Binary files differnew file mode 100644 index 000000000..00ed48d39 --- /dev/null +++ b/res/mipmap-xhdpi/ic_launcher_shortcut_folder.png diff --git a/res/values/colors.xml b/res/values/colors.xml index 6e53af243..3be280cd9 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -45,4 +45,7 @@ <!-- Conversation message header colors --> <color name="conv_subject_border">#c0c0c0</color> <color name="conv_header_text_light">#777777</color> + + <!-- Folder colors --> + <color name="folder_disabled_drop_target_text_color">#999999</color> </resources> diff --git a/res/values/dimen.xml b/res/values/dimen.xml index bc6c4970d..9f350a3c8 100644 --- a/res/values/dimen.xml +++ b/res/values/dimen.xml @@ -60,4 +60,11 @@ <dimen name="message_header_inner_side_padding">8dip</dimen> <dimen name="attachment_toast_yoffset">-100dip</dimen> <dimen name="spinner_frame_width">168dip</dimen> + <dimen name="folder_list_heading_padding_side">8dp</dimen> + <dimen name="folder_list_item_left_margin">24dp</dimen> + <dimen name="folder_list_item_right_margin">16dp</dimen> + <dimen name="folder_swatch_height">8dip</dimen> + <dimen name="folder_list_popup_width">200dip</dimen> + <dimen name="folder_list_folder_color_width">36dip</dimen> + <dimen name="folder_list_minimum_height">48dip</dimen> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 9ae89ead9..eeb776f9e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -263,8 +263,8 @@ <!-- Strings used to show myself in a To/Cc list. [CHAR LIMIT=15] --> <string name="me">me</string> <string name="labels">Labels</string> - <!-- List item to open label view in account dropdown [CHAR LIMIT=50] --> - <string name="show_all_labels">Show all labels</string> + <!-- List item to open fodlers view in account dropdown [CHAR LIMIT=50] --> + <string name="show_all_folders">Show all folders</string> <!-- Undo bar strings --> <!-- Displayed in the middle of the screen when the inbox is empty [CHAR LIMIT 100]--> @@ -469,4 +469,8 @@ <string name="done">Done</string> <string name="cancel">Cancel</string> <string name="close">Close</string> + + <!-- Folders --> + <!-- Displayed in the middle of the Folders screen when no folders have been defined --> + <string name="folders_activity_instructions">No folders have been set for this account.</string> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 8e8c200a9..290dbb7ad 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -307,4 +307,10 @@ <item name="android:contentDescription">@string/collapse_recipient_details</item> </style> <!-- End conversation view message header styles --> + + <!-- Folder styles --> + <style name="FolderItemIcon"> + <item name="android:layout_height">@dimen/folder_swatch_height</item> + <item name="android:layout_width">@dimen/folder_list_folder_color_width</item> + </style> </resources> diff --git a/src/com/android/mail/browse/ConversationListActivity.java b/src/com/android/mail/browse/ConversationListActivity.java index 72ce5b628..fee0a105b 100644 --- a/src/com/android/mail/browse/ConversationListActivity.java +++ b/src/com/android/mail/browse/ConversationListActivity.java @@ -117,6 +117,9 @@ public class ConversationListActivity extends Activity implements OnItemSelected case R.id.compose: ComposeActivity.compose(this, mSelectedAccount); break; + case R.id.show_all_folders: + showAllFolders(); + break; default: handled = false; break; @@ -124,6 +127,10 @@ public class ConversationListActivity extends Activity implements OnItemSelected return handled; } + private void showAllFolders() { + FoldersListActivity.launch(this, mSelectedAccount); + } + @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // Currently this activity only creates a single loader (Account List) diff --git a/src/com/android/mail/browse/FoldersListActivity.java b/src/com/android/mail/browse/FoldersListActivity.java new file mode 100644 index 000000000..33909ff8d --- /dev/null +++ b/src/com/android/mail/browse/FoldersListActivity.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2012, Google Inc. + * + * 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 com.android.mail.browse; + +import com.android.mail.R; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ListView; +import android.widget.SimpleCursorAdapter; + +import com.android.mail.providers.Account; +import com.android.mail.providers.Folder; +import com.android.mail.providers.Message; +import com.android.mail.providers.UIProvider; +import com.android.mail.ui.FolderItemView; +import com.android.mail.ui.FolderItemView.DropHandler; +import com.android.mail.utils.Utils; + +public class FoldersListActivity extends Activity { + private ListView mListView; + private Account mAccount; + private Cursor mFoldersCursor; + + public static void launch(Context launcher, Account account) { + Intent intent = new Intent(launcher, FoldersListActivity.class); + intent.putExtra(Utils.EXTRA_ACCOUNT, account); + launcher.startActivity(intent); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.folders_activity); + mListView = (ListView) findViewById(R.id.folders_list); + mAccount = (Account) getIntent().getParcelableExtra(Utils.EXTRA_ACCOUNT); + mFoldersCursor = getContentResolver().query(Uri.parse(mAccount.folderListUri), + UIProvider.FOLDERS_PROJECTION, null, null, null); + mListView.setAdapter(new FolderListAdapter(this, R.layout.folder_item, mFoldersCursor, + null, null)); + } + + private class FolderListAdapter extends SimpleCursorAdapter { + + public FolderListAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { + super(context, layout, c, new String[0], new int[0], 0); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + FolderItemView folderItemView; + if (convertView != null) { + folderItemView = (FolderItemView) convertView; + } else { + folderItemView = (FolderItemView) LayoutInflater.from(FoldersListActivity.this) + .inflate(R.layout.folder_item, null); + } + mFoldersCursor.moveToPosition(position); + folderItemView.bind(new Folder(mFoldersCursor), null); + return folderItemView; + } + } +} diff --git a/src/com/android/mail/ui/FolderItemView.java b/src/com/android/mail/ui/FolderItemView.java new file mode 100644 index 000000000..d24f5da7e --- /dev/null +++ b/src/com/android/mail/ui/FolderItemView.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) 2012, Google Inc. + * + * 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 com.android.mail.ui; + +import com.android.mail.R; + +import android.widget.TextView; + +import com.android.mail.providers.Folder; +import android.content.Context; +import android.content.res.ColorStateList; +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.DragEvent; +import android.widget.RelativeLayout; + +/** + * The view for each label in the label list. + */ +public class FolderItemView extends RelativeLayout { + // Static colors + private static int NON_DROPPABLE_TARGET_TEXT_COLOR; + + // Static bitmap + private static Bitmap SHORTCUT_ICON; + + // These are fine to be static, as these Drawables only have one state + private static Drawable DROPPABLE_HOVER_BACKGROUND; + private static Drawable DRAG_STEADY_STATE_BACKGROUND; + + private Drawable mBackground; + private ColorStateList mInitialLabelTextColor; + private ColorStateList mInitialUnreadCountTextColor; + + private Folder mFolder; + private TextView mFolderTextView; + private TextView mUnreadCountTextView; + private DropHandler mDropHandler; + + + /** + * A delegate for a handler to handle a drop of an item. + */ + public interface DropHandler { + /** + * Return whether or not the drag event is supported by the drop handler. The + * {@code FolderItemView} will present appropriate visual affordances if the drag is + * supported. + */ + boolean supportsDrag(DragEvent event, Folder folder); + + /** + * Handles a drop event, applying the appropriate logic. + */ + void handleDrop(DragEvent event, Folder folder); + } + + public FolderItemView(Context context) { + super(context); + } + + public FolderItemView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public FolderItemView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + if (SHORTCUT_ICON == null) { + final Resources res = getResources(); + SHORTCUT_ICON = BitmapFactory.decodeResource( + res, R.mipmap.ic_launcher_shortcut_folder); + DROPPABLE_HOVER_BACKGROUND = + res.getDrawable(R.drawable.folder_drag_target); + DRAG_STEADY_STATE_BACKGROUND = + res.getDrawable(R.drawable.folder_no_hover); + NON_DROPPABLE_TARGET_TEXT_COLOR = + res.getColor(R.color.folder_disabled_drop_target_text_color); + } + mFolderTextView = (TextView)findViewById(R.id.name); + mUnreadCountTextView = (TextView)findViewById(R.id.unread); + mBackground = getBackground(); + mInitialLabelTextColor = mFolderTextView.getTextColors(); + mInitialUnreadCountTextColor = mUnreadCountTextView.getTextColors(); + } + + public void bind(Folder folder, DropHandler dropHandler) { + mFolder = folder; + mDropHandler = dropHandler; + mFolderTextView.setText(folder.name); + } + + private boolean isDroppableTarget(DragEvent event) { + return (mDropHandler != null && mDropHandler.supportsDrag(event, mFolder)); + } + + /** + * Handles the drag event. + * + * @param event the drag event to be handled + */ + @Override + public boolean onDragEvent(DragEvent event) { + switch (event.getAction()) { + case DragEvent.ACTION_DRAG_STARTED: + // If this label is not a drop target, dim the text. + if (!isDroppableTarget(event)) { + // Make sure we update this at the time we drop on the target. + mInitialLabelTextColor = mFolderTextView.getTextColors(); + mInitialUnreadCountTextColor = mUnreadCountTextView.getTextColors(); + mFolderTextView.setTextColor(NON_DROPPABLE_TARGET_TEXT_COLOR); + mUnreadCountTextView.setTextColor(NON_DROPPABLE_TARGET_TEXT_COLOR); + } + // Set the background to a steady state background. + setBackgroundDrawable(DRAG_STEADY_STATE_BACKGROUND); + return true; + + case DragEvent.ACTION_DRAG_ENTERED: + // Change background color to indicate this label is the drop target. + if (isDroppableTarget(event)) { + setBackgroundDrawable(DROPPABLE_HOVER_BACKGROUND); + return true; + } + break; + + case DragEvent.ACTION_DRAG_EXITED: + // If this is a droppable target, make sure that it is set back to steady state, + // when the drag leaves the view. + if (isDroppableTarget(event)) { + setBackgroundDrawable(DRAG_STEADY_STATE_BACKGROUND); + return true; + } + break; + + case DragEvent.ACTION_DRAG_ENDED: + // Reset the text of the non draggable views back to the color it had been.. + if (!isDroppableTarget(event)) { + mFolderTextView.setTextColor(mInitialLabelTextColor); + mUnreadCountTextView.setTextColor(mInitialUnreadCountTextColor); + } + // Restore the background of the view. + setBackgroundDrawable(mBackground); + return true; + + case DragEvent.ACTION_DRAG_LOCATION: + return true; + + case DragEvent.ACTION_DROP: + if (mDropHandler == null) { + return false; + } + + mDropHandler.handleDrop(event, mFolder); + return true; + } + return false; + } +} |