1/*
2 * Copyright (C) 2007 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.example.android.apis.app;
18
19// Need the following import to get access to the app resources, since this
20// class is in a sub-package.
21import com.example.android.apis.R;
22
23import android.app.Activity;
24import android.os.Bundle;
25import android.view.WindowManager;
26
27
28/**
29 * <h3>Fancy Blur Activity</h3>
30 *
31 * <p>This demonstrates the how to write an activity that is translucent,
32 * allowing windows underneath to show through, with a fancy blur
33 * compositing effect.</p>
34 */
35public class TranslucentBlurActivity extends Activity {
36    /**
37     * Initialization of the Activity after it is first created.  Must at least
38     * call {@link android.app.Activity#setContentView setContentView()} to
39     * describe what is to be displayed in the screen.
40     */
41    @Override
42    protected void onCreate(Bundle icicle) {
43        // Be sure to call the super class.
44        super.onCreate(icicle);
45
46        // Have the system blur any windows behind this one.
47        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
48                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
49
50        // See assets/res/any/layout/translucent_background.xml for this
51        // view layout definition, which is being set here as
52        // the content of our screen.
53        setContentView(R.layout.translucent_background);
54    }
55}
56