コード例 #1
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 /** 获取<=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;
 }
コード例 #2
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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;
   }
 }
コード例 #3
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   cancelUpdate = true;
   manager.cancel(id);
   Log.v("updateservice", "service ondestroy");
 }
コード例 #4
0
	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 ) );
		}
	}
コード例 #5
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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;
     }
   }
 }
コード例 #6
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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");
     }
   }
 }
コード例 #7
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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);
 }
コード例 #8
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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;
 }
コード例 #9
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 @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;
   }
 }
コード例 #10
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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);
 }
コード例 #11
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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;
 }
コード例 #12
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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;
 }
コード例 #13
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 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-------------------- ");
     }
   }
 }
コード例 #14
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 @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();
   }
 }
コード例 #15
0
ファイル: DownloadList.java プロジェクト: norain2050/daima111
 @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;
   }
 }
コード例 #16
0
ファイル: Assets.java プロジェクト: norain2050/daima111
 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) {
   }
 }