Loading res/drawable/drop_badge_states.xml +13 −7 Original line number Diff line number Diff line Loading @@ -16,15 +16,21 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <!-- state when we can't drop --> <item app:state_droppable="true" app:state_drop_hovered="true" android:drawable="@drawable/ic_drop_ok_badge" /> app:state_reject_drop="true" android:drawable="@drawable/ic_reject_drop_badge"/> <!-- state when we can drop, and it will be a copy --> <item app:state_droppable="false" app:state_drop_hovered="true" android:drawable="@drawable/ic_drop_not_ok_badge" /> app:state_reject_drop="false" app:state_copy="true" android:drawable="@drawable/ic_drop_copy_badge"/> <!-- default state. Also used to show state when we can drop, and it will be a move --> <item app:state_drop_hovered="false" app:state_reject_drop="false" app:state_copy="false" android:drawable="@android:color/transparent" /> </selector> No newline at end of file res/drawable/ic_drop_ok_badge.xml→res/drawable/ic_drop_copy_badge.xml +0 −0 File moved. View file res/drawable/ic_drop_not_ok_badge.xml→res/drawable/ic_reject_drop_badge.xml +0 −0 File moved. View file res/values/attrs.xml +3 −3 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ <declare-styleable name="HighlightedItemView"> <attr name="state_highlighted" format="boolean"/> </declare-styleable> <declare-styleable name="DroppableItemView"> <attr name="state_droppable" format="boolean"/> <attr name="state_drop_hovered" format="boolean"/> <declare-styleable name="DropBadgeView"> <attr name="state_reject_drop" format="boolean"/> <attr name="state_copy" format="boolean"/> </declare-styleable> </resources> src/com/android/documentsui/AbstractDragHost.java 0 → 100644 +46 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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. */ package com.android.documentsui; import android.annotation.CallSuper; import android.view.View; import com.android.documentsui.services.FileOperationService; /** * Provides common functionality for a {@link ItemDragListener.DragHost}. */ public abstract class AbstractDragHost implements ItemDragListener.DragHost { protected DragAndDropManager mDragAndDropManager; public AbstractDragHost(DragAndDropManager dragAndDropManager) { mDragAndDropManager = dragAndDropManager; } @CallSuper @Override public void onDragExited(View v) { mDragAndDropManager.resetState(v); } @CallSuper @Override public void onDragEnded() { mDragAndDropManager.dragEnded(); } } Loading
res/drawable/drop_badge_states.xml +13 −7 Original line number Diff line number Diff line Loading @@ -16,15 +16,21 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <!-- state when we can't drop --> <item app:state_droppable="true" app:state_drop_hovered="true" android:drawable="@drawable/ic_drop_ok_badge" /> app:state_reject_drop="true" android:drawable="@drawable/ic_reject_drop_badge"/> <!-- state when we can drop, and it will be a copy --> <item app:state_droppable="false" app:state_drop_hovered="true" android:drawable="@drawable/ic_drop_not_ok_badge" /> app:state_reject_drop="false" app:state_copy="true" android:drawable="@drawable/ic_drop_copy_badge"/> <!-- default state. Also used to show state when we can drop, and it will be a move --> <item app:state_drop_hovered="false" app:state_reject_drop="false" app:state_copy="false" android:drawable="@android:color/transparent" /> </selector> No newline at end of file
res/drawable/ic_drop_not_ok_badge.xml→res/drawable/ic_reject_drop_badge.xml +0 −0 File moved. View file
res/values/attrs.xml +3 −3 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ <declare-styleable name="HighlightedItemView"> <attr name="state_highlighted" format="boolean"/> </declare-styleable> <declare-styleable name="DroppableItemView"> <attr name="state_droppable" format="boolean"/> <attr name="state_drop_hovered" format="boolean"/> <declare-styleable name="DropBadgeView"> <attr name="state_reject_drop" format="boolean"/> <attr name="state_copy" format="boolean"/> </declare-styleable> </resources>
src/com/android/documentsui/AbstractDragHost.java 0 → 100644 +46 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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. */ package com.android.documentsui; import android.annotation.CallSuper; import android.view.View; import com.android.documentsui.services.FileOperationService; /** * Provides common functionality for a {@link ItemDragListener.DragHost}. */ public abstract class AbstractDragHost implements ItemDragListener.DragHost { protected DragAndDropManager mDragAndDropManager; public AbstractDragHost(DragAndDropManager dragAndDropManager) { mDragAndDropManager = dragAndDropManager; } @CallSuper @Override public void onDragExited(View v) { mDragAndDropManager.resetState(v); } @CallSuper @Override public void onDragEnded() { mDragAndDropManager.dragEnded(); } }