blob: 73901d338ff7a28599f5ac64414764dea2c3e795 [file] [log] [blame]
The Android Open Source Project31dd5032009-03-03 19:32:27 -08001/*
2 * Copyright (C) 2008 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
Joe Onoratoa5902522009-07-30 13:37:37 -070017package com.android.launcher2;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080018
19import android.content.Context;
20import android.graphics.Bitmap;
21import android.graphics.Canvas;
22import android.graphics.Matrix;
23import android.graphics.Rect;
24import android.graphics.RectF;
25import android.graphics.Paint;
26import android.graphics.PorterDuffColorFilter;
27import android.graphics.PorterDuff;
28import android.os.Vibrator;
29import android.os.SystemClock;
30import android.util.AttributeSet;
Joe Onorato59791172009-07-31 16:21:40 -070031import android.util.Log;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080032import android.view.MotionEvent;
33import android.view.View;
34import android.view.ViewGroup;
35import android.view.KeyEvent;
36import android.view.inputmethod.InputMethodManager;
37import android.widget.FrameLayout;
38
39/**
40 * A ViewGroup that coordinated dragging across its dscendants
41 */
Joe Onorato00acb122009-08-04 16:04:30 -040042public class DragLayer extends FrameLayout {
Joe Onorato85a02a82009-09-08 12:34:22 -070043 private static final String TAG = "Launcher.DragLayer";
44
Joe Onorato00acb122009-08-04 16:04:30 -040045 DragController mDragController;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080046
47 /**
48 * Used to create a new DragLayer from XML.
49 *
50 * @param context The application's context.
51 * @param attrs The attribtues set containing the Workspace's customization values.
52 */
53 public DragLayer(Context context, AttributeSet attrs) {
54 super(context, attrs);
The Android Open Source Project31dd5032009-03-03 19:32:27 -080055 }
56
Joe Onorato00acb122009-08-04 16:04:30 -040057 public void setDragController(DragController controller) {
58 mDragController = controller;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080059 }
Joe Onorato00acb122009-08-04 16:04:30 -040060
The Android Open Source Project31dd5032009-03-03 19:32:27 -080061 @Override
62 public boolean dispatchKeyEvent(KeyEvent event) {
Joe Onorato00acb122009-08-04 16:04:30 -040063 return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
The Android Open Source Project31dd5032009-03-03 19:32:27 -080064 }
65
66 @Override
67 public boolean onInterceptTouchEvent(MotionEvent ev) {
Joe Onorato4db52312009-10-06 11:17:43 -070068 return mDragController.onInterceptTouchEvent(ev);
The Android Open Source Project31dd5032009-03-03 19:32:27 -080069 }
70
71 @Override
72 public boolean onTouchEvent(MotionEvent ev) {
Joe Onorato4db52312009-10-06 11:17:43 -070073 return mDragController.onTouchEvent(ev);
Romain Guy91a9c962009-06-12 13:52:17 -070074 }
The Android Open Source Project31dd5032009-03-03 19:32:27 -080075}