Michael Jurka | 9c6fbed | 2011-03-02 17:41:34 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.launcher2; |
| 18 | |
| 19 | import com.android.launcher.R; |
| 20 | |
| 21 | import android.content.Context; |
| 22 | import android.graphics.Canvas; |
| 23 | import android.graphics.drawable.Drawable; |
| 24 | import android.util.AttributeSet; |
| 25 | import 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 | */ |
| 31 | public 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 | } |