android 预约挂号
package com.wiz.ui.activity;
import com.wiz.ui.adapter.AdImageAdapter;
import com.wiz.ui.adapter.R;
import com.wiz.ui.view.PageControlView;
import android.content.Intent;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.Gallery;
import android.widget.LinearLayout;
import android.widget.TextView;
public class IndexActivity extends ParentActivity implements
View.OnClickListener {
private String[] adString;
private Gallery ad_image;
private TextView ad_text;
private LinearLayout bottom_left;
private LinearLayout bottom_right;
private LinearLayout center_layout;
Handler galleryHandler = new Handler() {
public void handleMessage(Message paramMessage) {
int i = 1 ((Integer) paramMessage.obj).intValue();
if (i < 4) {
IndexActivity.this.ad_image.setSelection(i);
} else {
IndexActivity.this.ad_image.setSelection(0);
}
}
};
private boolean isFirstCreate = false;
private Button login_btn;
AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> paramAdapterView,
View paramView, int paramInt, long paramLong) {
IndexActivity.this.page_control.generatePageControl(paramInt);
IndexActivity.this.ad_text
.setText(IndexActivity.this.adString[paramInt]);
IndexActivity.this.galleryHandler.removeMessages(0);
IndexActivity.this.galleryHandler.sendMessageDelayed(
IndexActivity.this.galleryHandler.obtainMessage(0,
Integer.valueOf(paramInt)), 2000L);
}
public void onNothingSelected(AdapterView<?> paramAdapterView) {
}
};
View.OnLongClickListener onLongClickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View paramView) {
int i = paramView.getId();
int j = 0;
Intent localIntent = null;
IndexActivity.this.startAnimal(i);
switch (i) {
case R.id.register:
j = 0;
break;
case R.id.hospital:
j = 1;
break;
case R.id.more:
j = 2;
break;
case R.id.myservice:
j = 3;
break;
}
localIntent = new Intent(IndexActivity.this, MainActivity.class);
localIntent.putExtra("intent_to_main_id", j);
IndexActivity.this.begin(localIntent);
return false;
}
};
private PageControlView page_control;
private LinearLayout top_left;
private LinearLayout top_right;
private void begin(Intent paramIntent) {
new AsyncTask<String, Void, String>() {
@Override
protected String doInBackground(String... params) {
try {
Thread.sleep(500L);
return null;
} catch (InterruptedException localInterruptedException) {
localInterruptedException.printStackTrace();
}
return null;
}
};
IndexActivity.this.startActivity(paramIntent);
}
public void onClick(View paramView) {
int i = paramView.getId();
int j = 0;
Intent localIntent = null;
IndexActivity.this.startAnimal(i);
switch (i) {
case R.id.register:
j = 0;
break;
case R.id.hospital:
j = 1;
break;
case R.id.more:
j = 2;
break;
case R.id.myservice:
j = 3;
break;
}
localIntent = new Intent(IndexActivity.this, MainActivity.class);
localIntent.putExtra("intent_to_main_id", j);
IndexActivity.this.begin(localIntent);
}
public void onCreate(Bundle paramBundle) {
super.onCreate(paramBundle);
this.isFirstCreate = true;
init(R.layout.p_index);
}
public boolean onKeyDown(int keyCode, KeyEvent paramKeyEvent) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
showConfirmDialog(R.string.logout_info);
break;
}
return false;
}
protected void onResume() {
super.onResume();
if (!this.isFirstCreate)
resumStartAnimal();
this.isFirstCreate = false;
}
public void resumStartAnimal() {
this.top_left.startAnimation(AnimationUtils.loadAnimation(this.context,
R.anim.anim_left_resume));
this.top_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_top_resume));
this.center_layout.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center_resume));
this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_bottom_resume));
this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_right_resume));
this.top_left.setEnabled(true);
this.top_right.setEnabled(true);
this.center_layout.setEnabled(true);
this.bottom_left.setEnabled(true);
this.bottom_right.setEnabled(true);
}
protected void setupData() {
this.adString = getResources().getStringArray(R.array.ad_title);
}
protected void setupView() {
this.ad_image = (Gallery) findViewById(R.id.ad_image);
this.ad_text = (TextView) findViewById(R.id.ad_text);
this.page_control = (PageControlView) findViewById(R.id.pageControlView);
this.login_btn = (Button) findViewById(R.id.login_btn);
this.top_left = (LinearLayout) findViewById(R.id.top_left);
this.top_right = (LinearLayout) findViewById(R.id.top_right);
this.center_layout = (LinearLayout) findViewById(R.id.center);
this.bottom_left = (LinearLayout) findViewById(R.id.bottom_left);
this.bottom_right = (LinearLayout) findViewById(R.id.bottom_right);
this.top_left.setOnClickListener(this);
this.top_right.setOnClickListener(this);
this.center_layout.setOnClickListener(this);
this.bottom_left.setOnClickListener(this);
this.bottom_right.setOnClickListener(this);
this.top_left.setOnLongClickListener(this.onLongClickListener);
this.top_right.setOnLongClickListener(this.onLongClickListener);
this.center_layout.setOnLongClickListener(this.onLongClickListener);
this.bottom_left.setOnLongClickListener(this.onLongClickListener);
this.bottom_right.setOnLongClickListener(this.onLongClickListener);
AdImageAdapter localAdImageAdapter = new AdImageAdapter(this.context);
this.ad_image.setAdapter(localAdImageAdapter);
this.ad_image.setOnItemSelectedListener(this.onItemSelectedListener);
this.page_control.count = 4;
this.ad_image.setSelection(0);
this.login_btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View paramView) {
// Intent localIntent = new Intent(IndexActivity.this,
// UserLoginActivity.class);
// localIntent.addFlags(67108864);
// IndexActivity.this.startActivity(localIntent);
}
});
}
public void startAnimal(int paramInt) {
this.top_left.setEnabled(false);
this.top_right.setEnabled(false);
this.center_layout.setEnabled(false);
this.bottom_left.setEnabled(false);
this.bottom_right.setEnabled(false);
switch (paramInt) {
case R.id.register:
this.top_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.top_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_top));
this.center_layout.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_bottom));
this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_right));
break;
case R.id.hospital:
this.top_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_left));
this.top_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.center_layout.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_bottom));
this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_right));
break;
case R.id.more:
this.top_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_left));
this.top_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_top));
this.center_layout.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_bottom));
this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_right));
break;
case R.id.myservice:
this.top_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_left));
this.top_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_top));
this.center_layout.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_right));
break;
default:
this.top_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_left));
this.top_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_top));
this.center_layout.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_bottom));
this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
this.context, R.anim.anim_center));
}
// switch (paramInt) {
// case 2131361895:
// case 2131361897:
// case 2131361899:
// case 2131361901:
// default:
// case 2131361894:
// case 2131361896:
// case 2131361898:
// case 2131361900:
// case 2131361902:
// }
// while (true) {
// return;
// continue;
// continue;
// continue;
// this.top_left.startAnimation(AnimationUtils.loadAnimation(
// this.context, 2130968580));
// this.top_right.startAnimation(AnimationUtils.loadAnimation(
// this.context, 2130968584));
// this.center_layout.startAnimation(AnimationUtils.loadAnimation(
// this.context, 2130968578));
// this.bottom_left.startAnimation(AnimationUtils.loadAnimation(
// this.context, 2130968576));
// this.bottom_right.startAnimation(AnimationUtils.loadAnimation(
// this.context, 2130968578));
// }
}
}


评论