@Override
	protected void onDestroy()
	{
		ActivityManager.popupActivity( this );
		unregisterReceiver( previewReceiver );
		downModule.dispose();
		super.onDestroy();
	}
Beispiel #2
0
	@Override
	protected void onDestroy() {
		ActivityManager.popupActivity(this);
		// teapotXu_20130304: add start
		// set a flag that indicates whether the ThemeSelectIcon launched the
		// ThemeBox or Launcher app.
		if (b_theme_icon_start_launcher == false) {
			if (tabLock != null)
				tabLock.onDestroy();
			tabTheme.onDestroy();
			downModule.dispose();
			themedownModule.dispose();
		}
		// teapotXu_20130304: add end
		super.onDestroy();
	}
Beispiel #3
0
	// teapotXu_20130304: add start
	// set a flag that indicates whether the ThemeSelectIcon launched the
	// ThemeBox or Launcher app.
	@Override
	protected void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
		if (b_theme_icon_start_launcher == true) {
			String theme_icon_pkgName = getIntent().getStringExtra(
					"FROM_PACKAGE");


			// start the launcher directly
			ThemeService sv = new ThemeService(this);

			sv.applyTheme(sv.queryComponent(theme_icon_pkgName));
			sendBroadcast(new Intent(StaticClass.ACTION_DEFAULT_THEME_CHANGED));
			ActivityManager.KillActivity();
		}
	}
Beispiel #4
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);
	}
	@Override
	protected void onCreate(
			Bundle savedInstanceState )
	{
		super.onCreate( savedInstanceState );
		this.requestWindowFeature( Window.FEATURE_NO_TITLE );
		ActivityManager.pushActivity( this );
		mContext = this;
		setContentView( R.layout.preview_hot_picture );
		DisplayMetrics dm = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics( dm );
		Bitmap bitmap1 = BitmapFactory.decodeResource( getResources() , R.drawable.comet_indicator );
		int width = bitmap1.getWidth();
		int height = bitmap1.getHeight();
		float scaleWidth = ( (float)dm.widthPixels / 3 ) / width;
		Matrix matrix = new Matrix();
		matrix.postScale( scaleWidth , 1 );
		Bitmap resizedBitmap = Bitmap.createBitmap( bitmap1 , 0 , 0 , width , height , matrix , true );
		bitmap1 = null;
		pageControl = (ImageView)findViewById( R.id.page_control );
		pageControl.setImageBitmap( resizedBitmap );
		resizedBitmap = null;
		//		pageControl = (PageControl) findViewById(R.id.page_control);
		//		pageControl.setPageCount(3,dm.widthPixels);
		//		pageControl.setCurrentPage(0);
		galleryPreview = (PreViewGallery)findViewById( R.id.galleryPreview );
		galleryPreview.setFullScreen( true );
		downModule = new ThemeDownModule( this );
		Intent intent = this.getIntent();
		packageName = intent.getStringExtra( StaticClass.EXTRA_PACKAGE_NAME );
		destClassName = intent.getStringExtra( StaticClass.EXTRA_CLASS_NAME );
		curPackageName = intent.getStringExtra( "current_theme_packagename" );
		curClassName = intent.getStringExtra( "current_theme_classname" );
		if( destClassName == null || destClassName.equals( "" ) )
		{
			destClassName = "";
		}
		loadThemeInformation( true );
		updateShowInfo();
		//		galleryPreview.setOnItemSelectedListener(new OnItemSelectedListener() {
		//
		//			@Override
		//			public void onItemSelected(AdapterView<?> parent, View view,
		//					int position, long id) {
		//				Log.d(LOG_TAG, "galleryPreview,position=" + position);
		//
		//				pageControl.setCurrentPage(position);
		//			}
		//
		//			@Override
		//			public void onNothingSelected(AdapterView<?> parent) {
		//				Log.d(LOG_TAG, "galleryPreview,onNothingSelected");
		//				pageControl.setCurrentPage(0);
		//			}
		//
		//		});
		galleryPreview.setOnItemClickListener( new OnItemClickListener() {
			
			@Override
			public void onItemClick(
					AdapterView<?> parent ,
					View view ,
					int position ,
					long id )
			{
				ThemeService service = new ThemeService( mContext );
				themeInformation = service.queryTheme( packageName , destClassName );
				boolean local = themeInformation.isInstalled();
				Intent i = new Intent();
				i.putExtra( "position" , position );
				i.putExtra( "local" , local );
				i.putExtra( "packname" , packageName );
				i.putExtra( "classname" , destClassName );
				i.setClass( mContext , ThemePreviewFullActivity.class );
				startActivity( i );
				overridePendingTransition( R.anim.enter_anim , 0 );
				//				if (fullScreen) {
				//					
				//				}else {
				//					setContentView(R.layout.preview_fullscreen);
				//					themeLocalAdapter.updatePreviewImage(true);
				////					galleryPreview.startAnimation(AnimationUtils.loadAnimation(mContext,
				////							R.anim.enter_anim));
				//					pageControl.setVisibility(View.INVISIBLE);
				//					((TextView) findViewById(R.id.textAppName)).setVisibility(View.INVISIBLE);
				//					((ImageButton)findViewById(R.id.buttonApply)).setVisibility(View.INVISIBLE);
				//					((ImageButton)findViewById(R.id.buttonUsed)).setVisibility(View.INVISIBLE);
				//					((ImageView)findViewById(R.id.watingView1)).setVisibility(View.INVISIBLE);
				//					((ImageView)findViewById(R.id.watingView2)).setVisibility(View.INVISIBLE);
				//				}
			}
		} );
		IntentFilter screenFilter = new IntentFilter();
		screenFilter.addAction( StaticClass.ACTION_PREVIEW_CHANGED );
		screenFilter.addAction( StaticClass.ACTION_DOWNLOAD_SIZE_CHANGED );
		screenFilter.addAction( StaticClass.ACTION_DOWNLOAD_STATUS_CHANGED );
		registerReceiver( previewReceiver , screenFilter );
		// 注册删除事件
		IntentFilter pkgFilter = new IntentFilter();
		pkgFilter.addAction( Intent.ACTION_PACKAGE_REMOVED );
		pkgFilter.addAction( Intent.ACTION_PACKAGE_ADDED );
		pkgFilter.addDataScheme( "package" );
		registerReceiver( previewReceiver , pkgFilter );
		// 应用按钮
		ImageButton btnApply = (ImageButton)findViewById( R.id.buttonApply );
		btnApply.setOnClickListener( new View.OnClickListener() {
			
			@Override
			public void onClick(
					View v )
			{
				//友盟  应用统计
				MobclickAgent.onEvent( mContext , "Apply" , packageName + "-" + destClassName );
				ThemeService sv = new ThemeService( ThemePreviewHotActivity.this );
				sv.applyTheme( new ComponentName( packageName , destClassName ) );
				Toast.makeText( ThemePreviewHotActivity.this , getString( R.string.toastPreviewApply ) , Toast.LENGTH_SHORT ).show();
				sendBroadcast( new Intent( StaticClass.ACTION_DEFAULT_THEME_CHANGED ) );
				ActivityManager.KillActivity();
			}
		} );
	}