Exemplo n.º 1
0
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		switch (keyCode) {
		case KeyEvent.KEYCODE_MENU:
			if (com.coco.theme.themebox.util.FunctionConfig.isLockVisible()
					&& com.coco.lock2.lockbox.StaticClass
							.isLockBoxInstalled(this)) {
				// 在lock界面按设置才有用
				int tabIndex = tabHost.getCurrentTab();
				if (tabIndex == 1) {
					Intent intentSetting = new Intent();
					intentSetting.setClassName(
							StaticClass.LOCKBOX_PACKAGE_NAME,
							StaticClass.LOCKBOX_SETTING_ACTIVITY);
					startActivity(intentSetting);
				}
			}
			break;
		}
		return super.onKeyDown(keyCode, event);
	}
Exemplo n.º 2
0
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		ActivityManager.pushActivity(this);
		super.onCreate(savedInstanceState);
		mContext = this;

		// added by zhenNan.ye begin
		String sdpath = getSDPath();
		if (sdpath != null) {
			PATH_ENABLE_LOG = sdpath + File.separator + "enablelog.log";
			File dir = new File(PATH_ENABLE_LOG);
			if (dir.exists()) {
				Log.setEnableLog(true);
			}
		}
		// added by zhenNan.ye end

	

		if (!com.coco.theme.themebox.StaticClass.isAllowDownload(mContext)
				&& com.coco.theme.themebox.util.FunctionConfig
						.isDownToInternal()) {
			com.coco.theme.themebox.StaticClass.canDownToInternal = true;
		}
		PathTool.makeDirApp();
		// teapotXu_20130304: add start
		// set a flag that indicates whether the ThemeSelectIcon launched the
		// ThemeBox or Launcher app.
		String pkgNameFromThemeBox = getIntent().getStringExtra("FROM_PACKAGE");

		if (pkgNameFromThemeBox != null
				&& pkgNameFromThemeBox.length() > 16
				&& pkgNameFromThemeBox.substring(0, 16).equals(
						"com.coco.themes.")) {
			b_theme_icon_start_launcher = true;
			return;
		}

		// teapotXu_20130304: add end
		downModule = new DownModule(this);
		themedownModule = new ThemeDownModule(this);
		if (!com.coco.theme.themebox.util.FunctionConfig.isLockVisible()
				&& !com.coco.lock2.lockbox.StaticClass.isLockBoxInstalled(this)) {
			setContentView(R.layout.man_tab_nolock);
		} else {
			setContentView(R.layout.main_tab_lock);
		}
		tabHost = (TabHost) findViewById(R.id.tabhost);
		tabHost.setup();
		// 添加主题页面

		tabTheme = new TabThemeFactory(MainActivity.this, themedownModule);
		final View indicatorTheme = View.inflate(MainActivity.this,
				R.layout.indicator_theme, null);
		tabHost.addTab(tabHost.newTabSpec(TAG_THEME)
				.setIndicator(indicatorTheme).setContent(tabTheme));

		if (com.coco.theme.themebox.util.FunctionConfig.isLockVisible()
				|| com.coco.lock2.lockbox.StaticClass.isLockBoxInstalled(this)) {
			int Screen_W = getWindowManager().getDefaultDisplay().getWidth();
			int Screen_H = getWindowManager().getDefaultDisplay().getHeight();
			// 添加锁屏页面
			tabLock = new TabLockFactory(MainActivity.this, downModule,
					Screen_W, Screen_H);
			View indicatorLock = View.inflate(MainActivity.this,
					R.layout.indicator_lock, null);
			tabHost.addTab(tabHost.newTabSpec(TAG_LOCK)
					.setIndicator(indicatorLock).setContent(tabLock));

			int tabIndex = getIntent().getIntExtra(
					StaticClass.EXTRA_MAIN_TAB_INDEX, 0);
			switch (tabIndex) {
			default:
			case 0:
				tabHost.setCurrentTabByTag(TAG_THEME);
				break;
			case 1:
				tabHost.setCurrentTabByTag(TAG_LOCK);
				break;
			}
		}

		// 友盟 进入主题盒子统计
		MobclickAgent.onEvent(mContext, "StartBox");
		// 友盟 新用户统计
		NewUser(mContext);
		// 友盟 活跃用户统计
		ActiveUser(mContext);
	}