• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.launcher3.dragndrop;
18 
19 import android.content.Context;
20 import android.view.View;
21 
22 import com.android.launcher3.DragSource;
23 import com.android.launcher3.DropTarget.DragObject;
24 import com.android.launcher3.ItemInfo;
25 import com.android.launcher3.Launcher;
26 import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
27 
28 /**
29  * DragSource used when the drag started at another window.
30  */
31 public class AnotherWindowDragSource implements DragSource {
32 
33     private final Context mContext;
34 
AnotherWindowDragSource(Context context)35     AnotherWindowDragSource(Context context) {
36         mContext = context;
37     }
38 
39     @Override
supportsFlingToDelete()40     public boolean supportsFlingToDelete() {
41         return false;
42     }
43 
44     @Override
supportsAppInfoDropTarget()45     public boolean supportsAppInfoDropTarget() {
46         return false;
47     }
48 
49     @Override
supportsDeleteDropTarget()50     public boolean supportsDeleteDropTarget() {
51         return false;
52     }
53 
54     @Override
getIntrinsicIconScaleFactor()55     public float getIntrinsicIconScaleFactor() {
56         return 1;
57     }
58 
59     @Override
onFlingToDeleteCompleted()60     public void onFlingToDeleteCompleted() {
61     }
62 
63     @Override
onDropCompleted(View target, DragObject d, boolean isFlingToDelete, boolean success)64     public void onDropCompleted(View target, DragObject d,
65             boolean isFlingToDelete, boolean success) {
66         if (!success) {
67             Launcher.getLauncher(mContext).exitSpringLoadedDragModeDelayed(false, 0, null);
68         }
69 
70     }
71 
72     @Override
fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent)73     public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
74         // TODO: Probably log something
75     }
76 }
77