blob: 4e1904102bd3ed4b3d7788d2f4491177c65b9ac7 [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.content.res.Resources;
21import android.util.AttributeSet;
22import android.view.ViewGroup;
23import android.view.LayoutInflater;
24import android.graphics.drawable.Drawable;
25
26public class LiveFolderIcon extends FolderIcon {
27 public LiveFolderIcon(Context context, AttributeSet attrs) {
28 super(context, attrs);
29 }
30
31 public LiveFolderIcon(Context context) {
32 super(context);
33 }
34
35 static LiveFolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
36 LiveFolderInfo folderInfo) {
37
38 LiveFolderIcon icon = (LiveFolderIcon)
39 LayoutInflater.from(launcher).inflate(resId, group, false);
40
41 final Resources resources = launcher.getResources();
42 Drawable d = folderInfo.icon;
43 if (d == null) {
Mitsuru Oshima583ed3b2009-05-12 19:19:10 -070044 d = Utilities.createIconThumbnail(
45 resources.getDrawable(R.drawable.ic_launcher_folder), launcher);
The Android Open Source Project31dd5032009-03-03 19:32:27 -080046 folderInfo.filtered = true;
47 }
48 icon.setCompoundDrawablesWithIntrinsicBounds(null, d, null, null);
49 icon.setText(folderInfo.title);
50 icon.setTag(folderInfo);
51 icon.setOnClickListener(launcher);
52
53 return icon;
54 }
55
56 @Override
57 public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
58 return false;
59 }
60
61 @Override
62 public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
63 }
64
65 @Override
66 public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
67 }
68
69 @Override
70 public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
71 }
72
73 @Override
74 public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo) {
75 }
76}