コード例 #1
0
ファイル: Cache.java プロジェクト: Zhangangle/NewJiaoYou
 /**
  * 读取 String数据
  *
  * @param key
  * @return String 数据
  */
 public String getAsString(String key) {
   File file = mCache.get(key);
   if (!file.exists()) return null;
   boolean removeFile = false;
   BufferedReader in = null;
   try {
     in = new BufferedReader(new FileReader(file));
     String readString = "";
     String currentLine;
     while ((currentLine = in.readLine()) != null) {
       readString += currentLine;
     }
     LogUtils.e("boolean" + cacheUtils.isExpire(readString));
     if (!cacheUtils.isExpire(readString)) {
       return cacheUtils.clearDateInfo(readString);
     } else {
       removeFile = true;
       return null;
     }
   } catch (IOException e) {
     e.printStackTrace();
     LogUtils.e("文件错误" + e.toString());
     return null;
   } finally {
     if (in != null) {
       try {
         in.close();
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
     if (removeFile) remove(key);
   }
 }
コード例 #2
0
 public void addItem(List<MessageBean> list) {
   LogUtils.e("list.size = " + list.size());
   if (this.list == null) {
     return;
   }
   this.list.addAll(list);
   LogUtils.e("list.size = " + this.list.size());
   notifyDataSetChanged();
 }
コード例 #3
0
 @Override
 public void onStopTrackingTouch(SeekBar seekBar) {
   if (methods.length < 3 || methods[2] == null) {
     LogUtils.w("onStopTrackingTouch not implement");
     return;
   }
   try {
     methods[2].invoke(handler, seekBar);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #4
0
 @Override
 public void onNothingSelected(AdapterView<?> parent) {
   if (methods.length < 2 || methods[1] == null) {
     LogUtils.w("onNothingSelected not implement");
     return;
   }
   try {
     methods[1].invoke(handler, parent);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #5
0
 @Override
 public void onScroll(AbsListView absListView, int i, int i2, int i3) {
   if (methods.length < 2 || methods[1] == null) {
     LogUtils.w("onScroll not implement");
     return;
   }
   try {
     methods[1].invoke(handler, absListView, i, i2, i3);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #6
0
ファイル: SortPattern.java プロジェクト: blueberryCoder/bus
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    float y = event.getY();
    clickIndex = (int) ((y - paddingTop) / itemHeight);
    switch (event.getAction()) {
      case MotionEvent.ACTION_UP:
        is_select = false;
        break;
      case MotionEvent.ACTION_DOWN:
        is_select = true;
        break;
      case MotionEvent.ACTION_SCROLL:
        is_select = true;
        break;
    }
    invalidate();
    if (null != listener && clickIndex > -1) {
      try {

        listener.onDataChange(indexStr[clickIndex], is_select);
      } catch (ArrayIndexOutOfBoundsException e) {
        LogUtils.e(" array index out of bound error  clickIndex =" + clickIndex);
      }
    }
    return true;
  }
コード例 #7
0
  /** Returns an HttpEntity containing all request parameters */
  public HttpEntity getEntity() {

    if (bodyEntity != null) {
      return bodyEntity;
    }

    HttpEntity result = null;

    if (fileParams != null && !fileParams.isEmpty()) {

      MultipartEntity multipartEntity =
          new MultipartEntity(HttpMultipartMode.STRICT, boundary, Charset.forName(charset));

      if (bodyParams != null && !bodyParams.isEmpty()) {
        for (NameValuePair param : bodyParams) {
          try {
            multipartEntity.addPart(param.getName(), new StringBody(param.getValue()));
          } catch (UnsupportedEncodingException e) {
            LogUtils.e(e.getMessage(), e);
          }
        }
      }

      for (ConcurrentHashMap.Entry<String, ContentBody> entry : fileParams.entrySet()) {
        multipartEntity.addPart(entry.getKey(), entry.getValue());
      }

      result = multipartEntity;
    } else if (bodyParams != null && !bodyParams.isEmpty()) {
      result = new BodyParamsEntity(bodyParams, charset);
    }

    return result;
  }
コード例 #8
0
 @Override
 public boolean onLongClick(View v) {
   LogUtils.e("position = " + position);
   commonDialog.show(AnimType.centerScale);
   SingleChatAdapter.this.position = position;
   return true;
 }
コード例 #9
0
ファイル: BianMinPage.java プロジェクト: chsmy/shenghuobao
        @Override
        public void succeed(String name) {
          String city = name;
          LogUtils.i(city);
          String url = SHApi.WEATHER_URL + city;
          loadData(
              HttpMethod.GET,
              url,
              null,
              new RequestCallBack<String>() {

                @Override
                public void onSuccess(ResponseInfo<String> info) {
                  LogUtils.i(info.result);
                  WeatherInfo weatherInfo = WeatherParser.parser(info.result, WeatherInfo.class);
                  ((MainActivity) ct).getMenuFragment().initWeatherInfo(weatherInfo);
                  dialog.dismiss();
                }

                @Override
                public void onFailure(HttpException arg0, String arg1) {
                  showToast(ct.getResources().getString(R.string.networkno));
                  dialog.dismiss();
                }
              });
        }
コード例 #10
0
 @Override
 public void onPlayer(MediaStatus mediaStatus, int code, String message) {
   LogUtils.e("mediaStatus = " + mediaStatus + " code = " + code + " message = " + message);
   if ((MediaStatus.playComplete == mediaStatus) && (playerAnim != null)) {
     playerAnim.stop();
   }
 }
コード例 #11
0
ファイル: DbUtils.java プロジェクト: miagosen/market
  private static synchronized DbUtils getInstance(DaoConfig daoConfig) {
    DbUtils dao = daoMap.get(daoConfig.getDbName());
    if (dao == null) {
      dao = new DbUtils(daoConfig);
      daoMap.put(daoConfig.getDbName(), dao);
    } else {
      dao.daoConfig = daoConfig;
    }

    // update the database if needed
    SQLiteDatabase database = dao.database;
    int oldVersion = database.getVersion();
    int newVersion = daoConfig.getDbVersion();
    if (oldVersion != newVersion) {
      if (oldVersion != 0) {
        DbUpgradeListener upgradeListener = daoConfig.getDbUpgradeListener();
        if (upgradeListener != null) {
          upgradeListener.onUpgrade(dao, oldVersion, newVersion);
        } else {
          try {
            dao.dropDb();
          } catch (DbException e) {
            LogUtils.e(e.getMessage(), e);
          }
        }
      }
      database.setVersion(newVersion);
    }

    return dao;
  }
コード例 #12
0
ファイル: LocationService.java プロジェクト: uwitec/hckpApp
        public void handleMessage(Message msg) {

          if (msg.what == 1) {
            LogUtils.i("go thread...");
          }
          super.handleMessage(msg);
        }
コード例 #13
0
ファイル: BasePage.java プロジェクト: csj664103736/ActualNew
 protected void loadData(
     HttpRequest.HttpMethod method,
     String url,
     RequestParams params,
     RequestCallBack<String> callback) {
   HttpUtils http = new HttpUtils();
   http.configCurrentHttpCacheExpiry(1000 * 1);
   LogUtils.allowD = true;
   if (params != null) {
     if (params.getQueryStringParams() != null)
       LogUtils.d(url + params.getQueryStringParams().toString());
   } else {
     params = new RequestParams();
   }
   // 设备ID
   //		params.addHeader("x-deviceid", app.deviceId);
   // 渠道,统计用
   //		params.addHeader("x-channel", app.channel);
   if (0 == CommonUtil.isNetworkAvailable(ct)) {
     showToast("无网络,请检查网络连接!");
     http.send(method, url, params, callback);
   } else {
     http.send(method, url, params, callback);
   }
 }
コード例 #14
0
 @Override
 public void onFocusChange(View view, boolean b) {
   try {
     methods[0].invoke(handler, view, b);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #15
0
 @Override
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   try {
     methods[0].invoke(handler, buttonView, isChecked);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #16
0
 @Override
 public void onStopTrackingTouch(SeekBar seekBar) {
   try {
     methods[2].invoke(handler, seekBar);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #17
0
 // #region SeekBar.OnSeekBarChangeListener
 @Override
 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
   try {
     methods[0].invoke(handler, seekBar, progress, fromUser);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #18
0
 @Override
 public void onNothingSelected(AdapterView<?> parent) {
   try {
     methods[1].invoke(handler, parent);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #19
0
 @Override
 public void onScroll(AbsListView absListView, int i, int i2, int i3) {
   try {
     methods[1].invoke(handler, absListView, i, i2, i3);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #20
0
 // #region AbsListView.OnScrollListener
 @Override
 public void onScrollStateChanged(AbsListView absListView, int i) {
   try {
     methods[0].invoke(handler, absListView, i);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #21
0
 @Override
 public void onScrollChanged() {
   try {
     methods[0].invoke(handler);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #22
0
 @Override
 public void onTabChanged(String tabId) {
   try {
     methods[0].invoke(handler, tabId);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #23
0
 @Override
 public void onGroupExpand(int i) {
   try {
     methods[0].invoke(handler, i);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #24
0
 @Override
 public void onClick(View v) {
   try {
     methods[0].invoke(handler, v);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #25
0
 // #region OnItemSelectedListener
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
   try {
     methods[0].invoke(handler, parent, view, position, id);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #26
0
 @Override
 public void onCheckedChanged(RadioGroup group, int checkedId) {
   try {
     methods[0].invoke(handler, group, checkedId);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
 }
コード例 #27
0
 @Override
 public boolean onPreferenceChange(Preference preference, Object newValue) {
   try {
     return (Boolean) methods[0].invoke(handler, preference, newValue);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
   return false;
 }
コード例 #28
0
 @Override
 public boolean onKey(View view, int i, KeyEvent keyEvent) {
   try {
     return (Boolean) methods[0].invoke(handler, view, i, keyEvent);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
   return false;
 }
コード例 #29
0
 @Override
 public boolean onLongClick(View v) {
   try {
     return (Boolean) methods[0].invoke(handler, v);
   } catch (Throwable e) {
     LogUtils.e(e.getMessage(), e);
   }
   return false;
 }
コード例 #30
0
ファイル: TestActivity.java プロジェクト: treejames/NightFair
 protected void onPostExecute(JSONObject result) {
   LogUtils.e("--------onPostExecute---------" + result.toString());
   String buses = result.optString("buses");
   Gson gson = new Gson();
   Buses bus = gson.fromJson(buses, new TypeToken<Buses>() {}.getType());
   mListView.setAdapter(mAdapter);
   mList.addAll(bus.getBus());
   mAdapter.notifyDataSetChanged();
 }