package com.invest.jthap.activity;
import android.app.AlertDialog;
import android.app.TabActivity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.hardware.PowerSet;
import android.os.Bundle;
import android.os.PowerManager;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
import android.widget.TextView;
import android.widget.Toast;
import com.invest.jthap.R;
import com.invest.jthap.application.MyApplication;
import com.invest.jthap.common.CommonData;
import com.invest.jthap.modelnew.EnumEquipMonitorState;
import com.invest.jthap.service.AutoSubmitHoleDataService;
import com.invest.jthap.service.LockPatternService;
import com.invest.jthap.service.SerialComService;
import com.invest.jthap.util.SPreferences;
import com.invest.jthap.util.UtilString;
/**
* @author dongxie
*/
@SuppressWarnings("deprecation")
public class GroupActivity extends TabActivity {
public static final String TAG = GroupActivity.class.getSimpleName();
private static final String HOME = "主页";
private static final String TASKHISTORY = "历史任务";
private static final String MORE = "系统设置";
private long mExitTime = 0;
private static TabHost mTabHost;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_group);// 设置TabHost使用的布局文件
mTabHost = this.getTabHost();
mTabHost.setFocusable(true);
setupIntent();
mTabHost.getTabWidget().getChildTabViewAt(2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//判断逻辑
//打开页面
mTabHost.setCurrentTab(2);
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
}
public static void changeTab(int id) {
mTabHost.setCurrentTab(id);
}
//mTabHost基于顺序存储
private void setupIntent() {
mTabHost.addTab(buildTabSpec(HOME, R.drawable.homepg_home_selector, new Intent(this, TaskListActivity.class)));
mTabHost.addTab(buildTabSpec(TASKHISTORY, R.drawable.homepg_taskhistory_selector, new Intent(this, TaskListHistoryActivity.class)));
mTabHost.addTab(buildTabSpec(MORE, R.drawable.homepg_more_selector, new Intent(this, HelpActivity.class)));
}
private TabSpec buildTabSpec(String tag, int icon, Intent intent) {
View view = View.inflate(this, R.layout.item_tab, null);
((ImageView) view.findViewById(R.id.iv_tab_icon)).setImageResource(icon);
((TextView) view.findViewById(R.id.tv_tab_text)).setText(tag);
return mTabHost.newTabSpec(tag).setIndicator(view).setContent(intent);
}
}