• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.replica.replicaisland;
18 
19 import java.lang.reflect.InvocationTargetException;
20 
21 import android.app.Activity;
22 import android.content.Intent;
23 import android.graphics.drawable.AnimationDrawable;
24 import android.os.Bundle;
25 import android.view.View;
26 import android.view.View.OnClickListener;
27 import android.view.animation.AnimationUtils;
28 import android.widget.ImageView;
29 import android.widget.TextView;
30 import android.widget.Toast;
31 
32 public class DiaryActivity extends Activity {
33 
34 	private OnClickListener mKillDiaryListener = new OnClickListener() {
35 		public void onClick(View arg0) {
36 			finish();
37 			if (UIConstants.mOverridePendingTransition != null) {
38  		       try {
39  		    	  UIConstants.mOverridePendingTransition.invoke(DiaryActivity.this, R.anim.activity_fade_in, R.anim.activity_fade_out);
40  		       } catch (InvocationTargetException ite) {
41  		           DebugLog.d("Activity Transition", "Invocation Target Exception");
42  		       } catch (IllegalAccessException ie) {
43  		    	   DebugLog.d("Activity Transition", "Illegal Access Exception");
44  		       }
45 			}
46 		}
47     };
48 
49     @Override
onCreate(Bundle savedInstanceState)50     public void onCreate(Bundle savedInstanceState) {
51         super.onCreate(savedInstanceState);
52         setContentView(R.layout.diary);
53 
54         TextView text = (TextView)findViewById(R.id.diarytext);
55 
56         ImageView image = (ImageView)findViewById(R.id.diarybackground);
57         image.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fade));
58         final Intent callingIntent = getIntent();
59         final int textResource = callingIntent.getIntExtra("text", -1);
60 
61         if (textResource != -1) {
62             text.setText(textResource);
63         }
64 
65         ImageView okArrow = (ImageView)findViewById(R.id.ok);
66         okArrow.setOnClickListener(mKillDiaryListener);
67         okArrow.setBackgroundResource(R.anim.ui_button);
68         AnimationDrawable anim = (AnimationDrawable) okArrow.getBackground();
69         anim.start();
70 
71         BaseObject.sSystemRegistry.customToastSystem.toast(getString(R.string.diary_found), Toast.LENGTH_SHORT);
72 
73     }
74 
75 
76 
77 
78 }
79