Beispiel #1
0
 private boolean ErrTimeTransfinite(TYPE type) {
   if (errtime.equals(DEFAULT_ERRTIME)) {
     if (enable_Statistics_LOG)
       Log.v(
           "UICenter - StatisticsNew", LOG_TAG + "\n=ErrTimeTransfinite" + "\n--DEFAULT_ERRTIME ");
     return false;
   } else {
     int errtime1 = Integer.parseInt(errtime.substring(4, 12));
     int curtime = Integer.parseInt(getCurTime().substring(4, 12));
     if (enable_Statistics_LOG)
       Log.v(
           "UICenter - StatisticsNew",
           LOG_TAG
               + "\n=ErrTimeTransfinite"
               + "\n--errtime1:"
               + errtime1
               + "\n--curtime :"
               + curtime);
     if (type == TYPE.RETRYINTERVAL) {
       if (curtime - errtime1 > 1 || curtime - errtime1 < 0) {
         return true;
       }
     } else if (type == TYPE.ONEDAYINTERVAL) {
       if (curtime - errtime1 > 10000 || curtime - errtime1 < 0) {
         return true;
       }
     }
     return false;
   }
 }
Beispiel #2
0
 /** 获取<=50条日志信息并拼接 */
 private String getLogInformation() {
   String text = "";
   if (mContext == null) {
     return null;
   }
   LogDB logDB = new LogDB(mContext);
   logDB.open();
   Cursor cursor = logDB.getAllLogText();
   boolean isSingleLog = false;
   String log0017 = null;
   String log0017List = null;
   for (int i = 0; i < LOGTEXT_NUM && cursor.moveToNext(); i++) {
     String id = cursor.getString(cursor.getColumnIndexOrThrow("_id"));
     String logtext = cursor.getString(cursor.getColumnIndexOrThrow("logtext"));
     String[] itemsTemp = logtext.split("#");
     if (itemsTemp[0].equals(ACTION_USE_LOG)) {
       isUseLog = true;
     }
     idSet.add(Integer.valueOf(id));
     if (enable_Statistics_LOG)
       Log.v(
           "UICenter - StatisticsNew",
           LOG_TAG
               + "\n=getLogInformation"
               + "\n--id = "
               + Integer.valueOf(id)
               + "  logText = "
               + logtext);
     if (cursor.getCount() == 1) {
       text = getParams(logtext, true);
       isSingleLog = true;
       break;
     } else {
       if (log0017 == null) {
         log0017 = getParams0017NoMd5();
       }
       text = getParams(logtext, false);
       log0017List = getParams0017List(log0017List, text);
     }
   }
   cursor.close();
   logDB.close();
   if (!isSingleLog) {
     if ((log0017 != null) && (log0017List != null)) {
       text = getParams0017WithMd5(log0017, log0017List);
     } else {
       text = null;
     }
   }
   if (enable_Statistics_LOG)
     Log.v(
         "UICenter - StatisticsNew",
         LOG_TAG
             + "\n=getLogInformation"
             + "\n--informationsize = "
             + idSet.size()
             + "\n--text = "
             + text);
   return text;
 }
Beispiel #3
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   cancelUpdate = true;
   manager.cancel(id);
   Log.v("updateservice", "service ondestroy");
 }
	private void loadThemeInformation(
			boolean reloadGallery )
	{
		ThemeService service = new ThemeService( this );
		themeInformation = service.queryTheme( packageName , destClassName );
		if( themeInformation.isInstalled() )
		{
			Context dstContext = null;
			try
			{
				dstContext = createPackageContext( packageName , Context.CONTEXT_IGNORE_SECURITY );
			}
			catch( NameNotFoundException e )
			{
				e.printStackTrace();
				return;
			}
			Log.v( LOG_TAG , "2222222222222222destClassName = " + destClassName );
			ContentConfig destContent = new ContentConfig();
			destContent.loadConfig( dstContext , destClassName );
			themeInformation.loadInstallDetail( dstContext , destContent );
			if( reloadGallery )
			{
				themeLocalAdapter = new ThemePreviewLocalAdapter( this , destContent , dstContext , false );
				galleryPreview.setAdapter( themeLocalAdapter );
			}
			return;
		}
		if( reloadGallery )
		{
			galleryPreview.setAdapter( new ThemePreviewHotAdapter( this , packageName , downModule , false ) );
		}
	}
Beispiel #5
0
 private void checkThread() {
   synchronized (threadSync) {
     if (handlerThread == null) {
       handlerThread = new HandlerThread("handlerThread");
       handlerThread.start();
       mHandler = new Handler(handlerThread.getLooper());
       if (enable_Statistics_LOG) Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=checkThread");
     }
   }
 }
Beispiel #6
0
 private void exitThread() {
   synchronized (threadSync) {
     if (handlerThread != null) {
       if (enable_Statistics_LOG) Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=exitThread");
       handlerThread.quit();
       handlerThread = null;
       mHandler = null;
     }
   }
 }
Beispiel #7
0
 private void downloadTabFinish() {
   Log.v(LOG_TAG, "downloadListFinish:" + ACTION_TAB_CHANGED);
   ConfigurationTabService sv = new ConfigurationTabService(mContext);
   sv.clearTable();
   sv.batchInsert(tabInfo);
   saveTabTime();
   Intent intent = new Intent();
   intent.setAction(ACTION_TAB_CHANGED);
   mContext.sendBroadcast(intent);
 }
Beispiel #8
0
 private int getErrTimes() {
   if (mContext == null) {
     return 0;
   }
   ConfigDB config = new ConfigDB(mContext);
   config.open();
   int count = Integer.parseInt(config.getRecord(ERRCOUNT));
   if (enable_Statistics_LOG)
     Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=getErrTimes" + "\n--geterrtimes:" + count);
   config.close();
   return count;
 }
Beispiel #9
0
 @Override
 public void run() {
   String url = SERVER_URL_TEST;
   String params = getParams(ACTION_TAB, true);
   boolean isSucceed = false;
   if (params != null) {
     CustomerHttpClient client = new CustomerHttpClient(mContext);
     String[] res = client.post(url, params);
     if (isExit) {
       synchronized (syncTabObject) {
         downTabThread = null;
         return;
       }
     }
     if (res != null) {
       String content = res[0];
       Log.v("downloadtab", "content = " + content);
       JSONObject json = null;
       try {
         json = new JSONObject(content);
         int retCode = json.getInt("retcode");
         if (retCode == 0) {
           String configUrl = json.getString("tablist");
           json = new JSONObject(configUrl);
           tabInfo.clear();
           for (Iterator iter = json.keys(); iter.hasNext(); ) {
             String key = (String) iter.next();
             JSONObject tmJson = (JSONObject) json.get(key);
             Map<String, String> map = new HashMap<String, String>();
             map.put("tabid", tmJson.getString("tabid"));
             map.put("enname", tmJson.getString("enname"));
             map.put("cnname", tmJson.getString("cnname"));
             map.put("twname", tmJson.getString("twname"));
             map.put("id", key);
             tabInfo.add(map);
           }
           Collections.sort(tabInfo, new ByStringValue());
           isSucceed = true;
         }
       } catch (JSONException e) {
         e.printStackTrace();
       }
     }
   }
   if (isSucceed) {
     downloadTabFinish();
   }
   synchronized (syncTabObject) {
     downTabThread = null;
     return;
   }
 }
Beispiel #10
0
 private void downloadListFinish() {
   Log.v(LOG_TAG, "downloadListFinish:" + ACTION_HOTLIST_CHANGED);
   ThemeXmlParser parserXml = new ThemeXmlParser(mContext);
   HotService sv = new HotService(mContext);
   Intent intent = new Intent();
   sv.clearTable();
   for (String item : types) {
     if (parserXml.parseList(DownloadList.getInstance(mContext).getListInfo(), item, mContext)) {
       sv.batchInsert(parserXml.getThemeList());
     }
   }
   saveListTime();
   intent.setAction(ACTION_HOTLIST_CHANGED);
   mContext.sendBroadcast(intent);
 }
		@Override
		public void onReceive(
				Context context ,
				Intent intent )
		{
			String actionName = intent.getAction();
			Log.d( LOG_TAG , "action=" + actionName );
			if( actionName.equals( StaticClass.ACTION_PREVIEW_CHANGED ) )
			{
				SpinnerAdapter apt = galleryPreview.getAdapter();
				if( apt != null && apt instanceof ThemePreviewHotAdapter )
				{
					( (ThemePreviewHotAdapter)apt ).reload();
					//					pageControl.setCurrentPage(galleryPreview
					//							.getSelectedItemPosition());
				}
			}
		}
Beispiel #12
0
 private boolean SuccessTimeTransfinite() {
   if (mContext == null) {
     return false;
   }
   ConfigDB config = new ConfigDB(mContext);
   config.open();
   String successtime = config.getRecord(SUCCESSTIME);
   config.close();
   if (successtime.equals(DEFAULT_ERRTIME)) {
     return true;
   } else {
     try {
       SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
       Calendar calendar = Calendar.getInstance();
       calendar.setTime(df.parse(successtime));
       Calendar calendar1 = Calendar.getInstance();
       calendar1.setTime(df.parse(getCurTime()));
       if (enable_Statistics_LOG)
         Log.v(
             "UICenter - StatisticsNew",
             LOG_TAG
                 + "\n=SuccessTimeTransfinite"
                 + "\n--successtime1:"
                 + successtime
                 + "\n--curtime     :"
                 + getCurTime());
       long delta = calendar1.getTimeInMillis() - calendar.getTimeInMillis();
       if (delta > 1440 * 60 * 1000 || delta < 0) {
         return true;
       }
     } catch (ParseException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   return false;
 }
Beispiel #13
0
 private String getParams(String logText, boolean isAddMd5) {
   String action = null;
   String resid = null;
   String packageName = null;
   String[] itemsTemp = logText.split("#");
   int len = itemsTemp.length;
   if (len > 0) {
     action = itemsTemp[0];
     if (len > 1) resid = itemsTemp[1];
     if (len > 2) packageName = itemsTemp[2];
   }
   String appid = null;
   String sn = null;
   PackageManager pm;
   JSONObject res;
   int networktype = -1;
   int networksubtype = -1;
   ConnectivityManager connMgr =
       (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
   NetworkInfo netInfo = connMgr.getActiveNetworkInfo();
   if (netInfo != null) {
     networktype = netInfo.getType();
     networksubtype = netInfo.getSubtype();
   }
   appid = Assets.getAppId(mContext);
   String channelString = AnalyticsConfig.getChannel(mContext);
   if (MainActivity.sbGoogleVersion == true && channelString.equals("amazon")) {
     if (appid.equals("f2986")) {
       appid = "f566";
     }
   }
   sn = Assets.getSerialNo(mContext);
   Log.v("downloadlist", "sn = " + sn);
   if (appid == null || sn == null) return null;
   pm = mContext.getPackageManager();
   res = new JSONObject();
   try {
     res.put("Action", action);
     if (isAddMd5) {
       res.put("packname", mContext.getPackageName());
       res.put("versioncode", pm.getPackageInfo(mContext.getPackageName(), 0).versionCode);
       res.put("versionname", pm.getPackageInfo(mContext.getPackageName(), 0).versionName);
       res.put("sn", sn);
       res.put("appid", appid);
       res.put("shellid", getShellID());
       res.put("timestamp", 0);
       res.put("uuid", Installation.id(mContext));
       TelephonyManager mTelephonyMgr =
           (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
       res.put(
           "imsi", mTelephonyMgr.getSubscriberId() == null ? "" : mTelephonyMgr.getSubscriberId());
       res.put(
           "iccid",
           mTelephonyMgr.getSimSerialNumber() == null ? "" : mTelephonyMgr.getSimSerialNumber());
       res.put("imei", mTelephonyMgr.getDeviceId() == null ? "" : mTelephonyMgr.getDeviceId());
       res.put(
           "phone", mTelephonyMgr.getLine1Number() == null ? "" : mTelephonyMgr.getLine1Number());
       java.text.DateFormat format = new java.text.SimpleDateFormat("yyyyMMddhhmmss");
       res.put("localtime", format.format(new Date()));
       res.put("model", Build.MODEL);
       res.put("display", Build.DISPLAY);
       res.put("product", Build.PRODUCT);
       res.put("device", Build.DEVICE);
       res.put("board", Build.BOARD);
       res.put("manufacturer", Build.MANUFACTURER);
       res.put("brand", Build.BRAND);
       res.put("hardware", Build.HARDWARE);
       res.put("buildversion", Build.VERSION.RELEASE);
       res.put("sdkint", Build.VERSION.SDK_INT);
       res.put(
           "androidid",
           android.provider.Settings.Secure.getString(
               mContext.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID));
       res.put("buildtime", Build.TIME);
       res.put("heightpixels", mContext.getResources().getDisplayMetrics().heightPixels);
       res.put("widthpixels", mContext.getResources().getDisplayMetrics().widthPixels);
       res.put("networktype", networktype);
       res.put("networksubtype", networksubtype);
       res.put("producttype", 4);
       res.put("productname", "uipersonalcenter");
       res.put("count", 0);
       res.put("opversion", getVersion());
       Log.v("downloadlist", logText + "下载线程启动");
     }
     if (action.equals(ACTION_USE_LOG)) {
       res.put("param1", "");
       res.put("param2", "");
       res.put("count", getUseCount());
     } else if (action.equals(ACTION_UNINSTALL_LOG)) {
       res.put("param1", resid);
       res.put("param2", packageName);
       res.put("count", 0);
     } else if (action.equals(ACTION_DOWNLOAD_LOG) || action.equals(ACTION_INSTALL_LOG)) {
       res.put("param1", resid);
       res.put("param2", packageName);
       res.put("count", 0);
     }
     String content = res.toString();
     String params = content;
     if (isAddMd5) {
       String md5_res = getMD5EncruptKey(content + DEFAULT_KEY);
       // res.put("md5", md5_res);
       String newContent = content.substring(0, content.lastIndexOf('}'));
       params = newContent + ",\"md5\":\"" + md5_res + "\"}";
     }
     return params;
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return null;
 }
Beispiel #14
0
 private static void initAssets(Context context) {
   mContext = context;
   String serialno = "";
   String domain = "";
   String app_id = "";
   String template_id = "";
   String channel_id = "";
   ContentResolver resolver = context.getContentResolver();
   Uri uri;
   if (com.coco.theme.themebox.util.FunctionConfig.isNetVersion())
     uri = Uri.parse("content://" + TURBO_LAUNCHER_PROVIDER_AUTHOR + "/" + "config");
   else uri = Uri.parse("content://" + "com.iLoong.launcher.pub.provider" + "/" + "config");
   String[] projection = null;
   String selection = null;
   String[] selectionArgs = null;
   String sortOrder = null;
   config = new JSONObject();
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_DOMAIN};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         domain = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       domain = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_DOMAIN, domain);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_SERIALNO};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         serialno = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       serialno = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_SERIALNO, serialno);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_APPID};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         app_id = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       app_id = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_APPID, app_id);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_TEMPLATEID};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         template_id = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       template_id = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_TEMPLATEID, template_id);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_CHANNELID};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         channel_id = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       channel_id = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_CHANNELID, channel_id);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_DOMAIN
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_DOMAIN));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_SERIALNO
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_SERIALNO));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_APPID
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_APPID));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_TEMPLATEID
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_TEMPLATEID));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_CHANNELID
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_CHANNELID));
   } catch (Exception ex) {
   }
 }
Beispiel #15
0
 public void startUICenterLog(String action, String resid, String packageName) {
   String logText = action + "#" + resid + "#" + packageName;
   boolean isFind = false;
   if (mContext == null) {
     if (enable_Statistics_LOG)
       Log.v(
           "UICenter - StatisticsNew",
           LOG_TAG
               + "\n=packageOnEvent"
               + "\n--[(mContext == null)] --------------------- return");
     return;
   }
   if (enable_Statistics_LOG)
     Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=packageOnEvent" + "\n--order:" + logText);
   LogDB logDB = new LogDB(mContext);
   logDB.open();
   Cursor cursor = logDB.getAllLogText();
   while (cursor.moveToNext()) {
     String text = cursor.getString(cursor.getColumnIndexOrThrow("logtext"));
     if (text.equals(logText)) {
       isFind = true;
       break;
     }
   }
   cursor.close();
   if (!isFind) {
     logDB.insertRecord(logText);
   }
   logDB.close();
   if (mHandler != null) {
     if (enable_Statistics_LOG)
       Log.v(
           "UICenter - StatisticsNew",
           LOG_TAG + "\n=packageOnEvent" + "\n--存在上传线程 ---------------------return");
     return;
   }
   checkThread();
   if (!exitErrTime()) {
     if (enable_Statistics_LOG)
       Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=packageOnEvent" + "\n--不存在错误时间");
     if (SuccessTimeTransfinite()) {
       if (enable_Statistics_LOG)
         Log.v(
             "UICenter - StatisticsNew",
             LOG_TAG + "\n=packageOnEvent" + "\n--成功时间超过时间间隔 ==========================");
       // 上传数据
       mHandler.post(UploadRun);
     } else {
       exitThread();
       if (enable_Statistics_LOG)
         Log.v(
             "UICenter - StatisticsNew",
             LOG_TAG
                 + "\n=packageOnEvent"
                 + "\n--exitThread成功时间没有超过时间间隔 ---------------------exitThread--------------------");
     }
   } else {
     if (enable_Statistics_LOG)
       Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=packageOnEvent" + "\n--存在错误时间");
     if (getErrTimes() > 3 && ErrTimeTransfinite(TYPE.ONEDAYINTERVAL)) {
       if (enable_Statistics_LOG)
         Log.v(
             "UICenter - StatisticsNew",
             LOG_TAG + "\n=packageOnEvent" + "\n--错误时间超过一小时 ==========================");
       // 更新失败次数&失败时间
       recordErrCount(1);
       recordErrTime();
       // 上传数据
       mHandler.post(UploadRun);
     } else if (getErrTimes() <= 3 && ErrTimeTransfinite(TYPE.RETRYINTERVAL)) {
       if (enable_Statistics_LOG)
         Log.v(
             "UICenter - StatisticsNew",
             LOG_TAG + "\n=packageOnEvent" + "\n--错误时间间隔超过1分钟 ========================== ");
       // 上传数据
       mHandler.post(UploadRun);
     } else {
       exitThread();
       if (enable_Statistics_LOG)
         Log.v(
             "UICenter - StatisticsNew",
             LOG_TAG
                 + "\n=packageOnEvent"
                 + "\n--exitThread错误时间没有超过时间间隔 ---------------------exitThread-------------------- ");
     }
   }
 }
Beispiel #16
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);
	}
Beispiel #17
0
 @Override
 public void run() {
   // TODO Auto-generated method stub
   mHandler.removeCallbacks(UploadRun);
   if (enable_Statistics_LOG) {
     Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=UploadRun" + "\n--上传线程");
   }
   // 判断是否联网
   if (!IsHaveInternet(mContext)) {
     if (enable_Statistics_LOG)
       Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=UploadRun" + "\n--没有线程");
     exitThread();
     if (enable_Statistics_LOG)
       Log.v(
           "UICenter - StatisticsNew",
           LOG_TAG
               + "\n=UploadRun"
               + "\n--没有网退出线程"
               + "---------------------exitThread--------------------");
     return;
   } else {
     String params = getLogInformation();
     if (params != null) {
       CustomerHttpClient client = new CustomerHttpClient(mContext);
       String[] res = client.post(LOG_URL_TEST, params);
       if (res != null) {
         String content = res[0];
         JSONObject json = null;
         try {
           json = new JSONObject(content);
           int retCode = json.getInt("retcode");
           if (retCode == 0) {
             delAllData();
             clearErrTimeAndCount();
             recordSuccessTime();
             if (enable_Statistics_LOG)
               Log.v(
                   "UICenter - StatisticsNew",
                   LOG_TAG
                       + "\n=UploadRun"
                       + "\n--上传成功 =============ok===================="
                       + "\n--params    = "
                       + params);
           } else {
             isUseLog = false;
             int errcount = getErrTimes();
             recordErrCount(++errcount);
             recordErrTime();
             if (enable_Statistics_LOG)
               Log.v(
                   "UICenter - StatisticsNew",
                   LOG_TAG
                       + "\n=UploadRun"
                       + "\n--上传失败=============not ok===================="
                       + "\n--params    = "
                       + params
                       + "\n--retCode    ="
                       + retCode);
           }
         } catch (JSONException e) {
           isUseLog = false;
           int errcount = getErrTimes();
           recordErrCount(++errcount);
           recordErrTime();
           if (enable_Statistics_LOG)
             Log.v(
                 "UICenter - StatisticsNew",
                 LOG_TAG
                     + "\n=UploadRun"
                     + "\n--上传失败=============not ok===================="
                     + "\n--params    = "
                     + params);
           e.printStackTrace();
         }
       } else {
         isUseLog = false;
         int errcount = getErrTimes();
         recordErrCount(++errcount);
         recordErrTime();
         if (enable_Statistics_LOG)
           Log.v(
               "UICenter - StatisticsNew",
               LOG_TAG
                   + "\n=UploadRun"
                   + "\n--上传失败=============not ok===================="
                   + "\n--params    = "
                   + params
                   + "\n--res      ="
                   + res);
       }
     }
     if (enable_Statistics_LOG)
       Log.v("UICenter - StatisticsNew", LOG_TAG + "\n=UploadRun" + "\n--关闭上传线程");
     exitThread();
   }
 }
Beispiel #18
0
 @Override
 public void run() {
   String url = SERVER_URL_TEST;
   String params = getParams(ACTION_LIST, true);
   boolean isSucceed = false;
   if (params != null) {
     CustomerHttpClient client = new CustomerHttpClient(mContext);
     String[] res = client.post(url, params);
     if (isExit) {
       synchronized (syncObject) {
         downListThread = null;
         return;
       }
     }
     if (res != null) {
       String content = res[0];
       Log.v("downloadlist", "content = " + content);
       //					Tools.writelogTosd( content );
       JSONObject json = null;
       try {
         json = new JSONObject(content);
         int retCode = json.getInt("retcode");
         if (retCode == 0) {
           String configUrl = json.getString("reslist");
           json = new JSONObject(configUrl);
           for (Iterator iter = json.keys(); iter.hasNext(); ) {
             String key = (String) iter.next();
             JSONObject tmJson = (JSONObject) json.get(key);
             ListInfo listInfo = new ListInfo();
             for (Iterator mIterator = tmJson.keys(); mIterator.hasNext(); ) {
               String mKey = (String) mIterator.next();
               if (mKey.equals("tabid")) {
                 listInfo.setTabid(tmJson.get(mKey).toString());
               } else if (mKey.equals("enname")) {
                 listInfo.setEnname(tmJson.get(mKey).toString());
               } else if (mKey.equals("cnname")) {
                 listInfo.setCnname(tmJson.get(mKey).toString());
               } else if (mKey.equals("twname")) {
                 listInfo.setTwname(tmJson.get(mKey).toString());
               } else if (mKey.equals("typeid")) {
                 listInfo.setTypeid(tmJson.get(mKey).toString());
               } else {
                 JSONObject jsObj = (JSONObject) tmJson.get(mKey);
                 ItemInfo itemInfo = new ItemInfo();
                 itemInfo.setIndex(mKey);
                 System.out.println(
                     "mKey = " + mKey + " jsObj.getString() = " + jsObj.getString("cnname"));
                 itemInfo.setResid(jsObj.getString("resid"));
                 itemInfo.setEnname(jsObj.getString("enname"));
                 itemInfo.setCnname(jsObj.getString("cnname"));
                 // itemInfo.setTwname(jsObj.getString("twname"));
                 itemInfo.setResurl(jsObj.getString("resurl"));
                 itemInfo.setPackname(jsObj.getString("packname"));
                 itemInfo.setSize(jsObj.getString("size"));
                 itemInfo.setAuthor(jsObj.getString("author"));
                 itemInfo.setAboutchinese(jsObj.getString("aboutchinese"));
                 itemInfo.setVersion(jsObj.getString("version"));
                 itemInfo.setVersionname(jsObj.getString("versionname"));
                 itemInfo.setAboutenglish(jsObj.getString("aboutenglish"));
                 itemInfo.setPrice(jsObj.getString("price"));
                 itemInfo.setPricedetail(jsObj.getString("pricedetail"));
                 itemInfo.setPricePoint(jsObj.getString("pricepoint"));
                 itemInfo.setIcon(jsObj.getString("icon"));
                 itemInfo.setThumbimg(jsObj.getString("thumbimg"));
                 try {
                   itemInfo.setEnginepackname(jsObj.getString("enginepackname"));
                   itemInfo.setEngineurl(jsObj.getString("engineurl"));
                   itemInfo.setEnginesize(jsObj.getString("enginesize"));
                 } catch (JSONException e) {
                   itemInfo.setEnginepackname(null);
                   itemInfo.setEngineurl(null);
                   itemInfo.setEnginesize(null);
                 }
                 try {
                   itemInfo.setEnginedesc(jsObj.getString("enginedesc"));
                 } catch (JSONException e) {
                   itemInfo.setEnginedesc(null);
                 }
                 try {
                   itemInfo.setThirdparty(jsObj.getString("thirdparty"));
                 } catch (JSONException e) {
                   itemInfo.setThirdparty(null);
                 }
                 try {
                   JSONArray preview = jsObj.getJSONArray("previewlist");
                   String[] pre = new String[preview.length()];
                   for (int k = 0; k < preview.length(); k++) {
                     pre[k] = preview.getString(k);
                   }
                   itemInfo.setPreviewlist(pre);
                 } catch (JSONException e) {
                   itemInfo.setPreviewlist(new String[] {itemInfo.getThumbimg()});
                 }
                 listInfo.getItemList().add(itemInfo);
               }
             }
             info.add(listInfo);
           }
           isSucceed = true;
         }
       } catch (JSONException e) {
         e.printStackTrace();
       }
     }
   }
   if (isSucceed) {
     downloadListFinish();
   }
   synchronized (syncObject) {
     downListThread = null;
     return;
   }
 }