blob: 5292d0ad3b289eb48f5ee5faab57f01f29c2a6ce [file] [log] [blame]
Michael Jurka9c6fbed2011-03-02 17:41:34 -08001/*
2 * Copyright (C) 2010 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
17package com.android.launcher2;
18
19import com.android.launcher.R;
20
21import android.content.Context;
22import android.graphics.Canvas;
23import android.graphics.drawable.Drawable;
24import android.util.AttributeSet;
25import android.view.View;
26
27/**
28 * An implementation of PagedView that populates the pages of the workspace
29 * with all of the user's applications.
30 */
31public class AllAppsBackground extends View {
32 private Drawable mBackground;
33
34 public AllAppsBackground(Context context) {
35 this(context, null);
36 }
37
38 public AllAppsBackground(Context context, AttributeSet attrs) {
39 this(context, attrs, 0);
40 }
41
42 public AllAppsBackground(Context context, AttributeSet attrs, int defStyle) {
43 super(context, attrs, defStyle);
44 mBackground = getResources().getDrawable(R.drawable.all_apps_bg_gradient);
45 }
46
47 @Override
48 public void onDraw(Canvas canvas) {
49 mBackground.setBounds(mScrollX, 0, mScrollX + getMeasuredWidth(),
50 getMeasuredHeight());
51 mBackground.draw(canvas);
52 }
53}