一、启动页面 AppStart

 1 /**
 2  * 应用程序启动类:显示欢迎界面并跳转到主界面
 3  * @author liux (http://my.oschina.net/liux)
 4  * @version 1.0
 5  * @created 2012-3-21
 6  */
 7 public class AppStart extends Activity {
 8     
 9     @Override
10     public void onCreate(Bundle savedInstanceState) {
11         super.onCreate(savedInstanceState);
12         final View view = View.inflate(this, R.layout.start, null);
13         setContentView(view);
14         
15         //渐变展示启动屏     -------------------------------------------------------  分析 1
16         AlphaAnimation aa = new AlphaAnimation(0.3f,1.0f);
17         aa.setDuration(2000);
18         view.startAnimation(aa);
19         aa.setAnimationListener(new AnimationListener()
20         {
21             @Override
22             public void onAnimationEnd(Animation arg0) {
23                 redirectTo();
24             }
25             @Override
26             public void onAnimationRepeat(Animation animation) {}
27             @Override
28             public void onAnimationStart(Animation animation) {}
29             
30         });
31         
32         //兼容低版本cookie(1.5版本以下,包括1.5.0,1.5.1)
33         AppContext appContext = (AppContext)getApplication();
34         String cookie = appContext.getProperty("cookie");     //-----------------------------------------------分析 2
35         if(StringUtils.isEmpty(cookie)) {
36             String cookie_name = appContext.getProperty("cookie_name");
37             String cookie_value = appContext.getProperty("cookie_value");
38             if(!StringUtils.isEmpty(cookie_name) && !StringUtils.isEmpty(cookie_value)) {
39                 cookie = cookie_name + "=" + cookie_value;
40                 appContext.setProperty("cookie", cookie);
41                 appContext.removeProperty("cookie_domain","cookie_name","cookie_value","cookie_version","cookie_path");
42             }
43         }
44     }
45     
46     /**
47      * 跳转到...
48      */
49     private void redirectTo(){        
50         Intent intent = new Intent(this, Main.class);
51         startActivity(intent);
52         finish();
53     }
54 }

 

1、动画渐变显示启动界面 

2、获取cookie  

appContext.getProperty("cookie")  调用流程:

  动画结束后跳转到  Main

 

posted @ 2013-06-27 11:19  wenlude  阅读(273)  评论(0编辑  收藏  举报