Home | History | Annotate | Download | only in app
      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 
     17 package android.app;
     18 
     19 import com.android.frameworks.coretests.R;
     20 
     21 import android.app.Activity;
     22 import android.os.Bundle;
     23 import android.view.WindowManager;
     24 
     25 
     26 /**
     27  * <h3>Fancy Translucent Activity</h3>
     28  *
     29  * <p>This demonstrates the how to write an activity that is translucent,
     30  * allowing windows underneath to show through, with a fancy
     31  * compositing effect.</p>
     32  *
     33  * <h4>Demo</h4>
     34  * App/Activity/Translucent Fancy
     35  *
     36  * <h4>Source files</h4>
     37  * <table class="LinkTable">
     38  *         <tr>
     39  *             <td >src/com/android/samples/app/TranslucentFancyActivity.java</td>
     40  *             <td >The Translucent Fancy Screen implementation</td>
     41  *         </tr>
     42  *         <tr>
     43  *             <td >/res/any/layout/translucent_background.xml</td>
     44  *             <td >Defines contents of the screen</td>
     45  *         </tr>
     46  * </table>
     47  */
     48 public class TranslucentFancyActivity extends Activity
     49 {
     50     /**
     51      * Initialization of the Activity after it is first created.  Must at least
     52      * call {@link android.app.Activity#setContentView setContentView()} to
     53      * describe what is to be displayed in the screen.
     54      */
     55     @Override
     56     protected void onCreate(Bundle icicle)
     57     {
     58         // Be sure to call the super class.
     59         super.onCreate(icicle);
     60 
     61         // Have the system blur any windows behind this one.
     62         getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
     63                 WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
     64 
     65         // See assets/res/any/layout/translucent_background.xml for this
     66         // view layout definition, which is being set here as
     67         // the content of our screen.
     68         setContentView(R.layout.translucent_background);
     69     }
     70 }
     71