blob: 55f100cceda44e702a696fb22212a2e5c91af78e [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) {
Joe Onorato9c1289c2009-08-17 11:03:03 -040044 d = Utilities.createIconThumbnail(resources.getDrawable(R.drawable.ic_launcher_folder),
Joe Onorato6665c0f2009-09-02 15:27:24 -070045 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
Joe Onorato00acb122009-08-04 16:04:30 -040057 public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
58 DragView dragView, Object dragInfo) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080059 return false;
60 }
61
62 @Override
Joe Onorato00acb122009-08-04 16:04:30 -040063 public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
64 DragView dragView, Object dragInfo) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080065 }
66
67 @Override
Joe Onorato00acb122009-08-04 16:04:30 -040068 public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
69 DragView dragView, Object dragInfo) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080070 }
71
72 @Override
Joe Onorato00acb122009-08-04 16:04:30 -040073 public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
74 DragView dragView, Object dragInfo) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080075 }
76
77 @Override
Joe Onorato00acb122009-08-04 16:04:30 -040078 public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
79 DragView dragView, Object dragInfo) {
The Android Open Source Project31dd5032009-03-03 19:32:27 -080080 }
81}