package com.ttj.activity;
import lib.view.ViewUtils;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.ttj.MyApplication;
import com.ttj.R;
import com.ttj.utils.SPUtils;
import com.ttj.utils.TextUtils;
import com.umeng.update.UmengUpdateAgent;
/**
*
* @Title: Main_WelcomeAty.java
*
* @Description: 启动界面
*
* @author linshao
*
* @date 2015年5月27日 上午10:12:32
*
* @version V1.0
*/
public class Main_WelcomeAty extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyApplication.getInstance().addActivity(this);
UmengUpdateAgent.forceUpdate(this);
setContentView(R.layout.p1_main_welcome_layout);
ViewUtils.inject(this);
if(TextUtils.isBlank(SPUtils.getUid(this))){
showNotify();
}
UmengUpdateAgent.forceUpdate(this);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (SPUtils.getIsLogin(Main_WelcomeAty.this)) {
Intent intent = new Intent(Main_WelcomeAty.this,
Main_HomeAty.class);
startActivity(intent);
// }
finish();
} else {
SPUtils.saveIsLogin(Main_WelcomeAty.this, true);
Intent intent = new Intent(Main_WelcomeAty.this,
BootPage_Aty.class);
startActivity(intent);
// }
finish();
}
}
}, 1200);
}
private void showNotify() {
NotificationManager manager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification();
notification.icon = R.drawable.notify_icon;
notification.tickerText = "天天价会员特权";
notification.defaults = Notification.DEFAULT_SOUND;
notification.audioStreamType = android.media.AudioManager.ADJUST_LOWER;
notification.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(this, Member_Aty.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
intent, PendingIntent.FLAG_ONE_SHOT);
notification.setLatestEventInfo(this, "天天价会员特权", "点击查看详情",
pendingIntent);
manager.notify(10, notification);
}
}