public void clickGetAcc() { RequestParams params = new RequestParams(); params.put("j_username", firstparameter.trim()); params.put("j_password", secondparameter.trim()); System.out.println(params.toString()); httpClient.post( METRO_STEP2, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { System.out.println("metrobank5 response " + response); // myProgressDialog.dismiss(); clickJavier(); } public void onFailure(Throwable error, String content) { System.out.println("metrobank2 e1rror " + content); myProgressDialog.dismiss(); } }); }
public void getDBSize() { AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put(Settings.DB_HOST, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_HOST)); params.put(Settings.DB_NAME, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_NAME)); params.put(Settings.DB_USER, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_USERNAME)); params.put(Settings.DB_PASSWORD, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_PASSWORD)); System.out.println("params: " + params.toString()); String url = sharedPrefs.getValueStr(SharedPrefs.KEY_DOMAIN_NAME) + "/php/checkDBSize.php"; Log.i("getDBSize", "URL: " + url); client.post( url, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { System.out.println("sucess sa dbcheck"); try { JSONObject json_data = new JSONObject(response); double size = (json_data.getDouble("size")); dataHandler.setDbSize(size); Log.i("checkDBSize", "DB Size: " + dataHandler.getDbSize()); dialog.dismiss(); updateDialog.dismiss(); Intent intent = new Intent(getApplicationContext(), UpdateManager.class); startActivity(intent); } catch (Exception e) { updateDialog.dismiss(); Log.e("Fail 3", e.toString()); } } @Override public void onFailure(int statusCode, Throwable error, String content) { dialog.dismiss(); System.out.println("failed sa dbcheck"); if (statusCode == 404) { Log.e("getDBSize", "ERROR 404"); } else if (statusCode == 500) { Log.e("getDBSize", "ERROR 500"); } else { Log.e( "getDBSize", "ERROR OCCURED! content: " + content + "\nstatus: " + statusCode + "\nerror: " + error.toString()); } } }); }
public void postNewTweet(String status, AsyncHttpResponseHandler handler) { String apiUrl = getApiUrl("statuses/update.json"); RequestParams params = new RequestParams(); params.put("status", status); Log.d("client", "POST: " + apiUrl); Log.d("client", "Params: " + params.toString()); getClient().post(apiUrl, params, handler); }
public void clickSetParams(View v) { RequestParams params = new RequestParams(); params.put("Password", "Dmdhsmdx4"); params.put("Character2", editText3.getText().toString().trim()); params.put("Character0", editText1.getText().toString().trim()); params.put("Character1", editText2.getText().toString().trim()); System.out.println(params.toString()); httpClient.post( METRO_STEP1, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { System.out.println("metrobank2 response " + response); // myProgressDialog.dismiss(); String[] temp; /* delimiter */ String delimiter = "\""; /* * given string will be split by the argument delimiter * provided. */ temp = response.split(delimiter); /* print substrings */ for (int i = 0; i < temp.length; i++) System.out.println(temp[i]); firstparameter = temp[1]; secondparameter = temp[3]; System.out.println(firstparameter); System.out.println(secondparameter); clickGetAcc(); } public void onFailure(Throwable error, String content) { System.out.println("metrobank2 e1r11ror " + content); } }); }
public void checkNeedUpdate() { final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date datelocal = new Date(sharedPrefs.getValueLong(SharedPrefs.KEY_DATE_MODIFIED)); Log.i("checkNeedUpdate", sdf.format(datelocal)); final Date dateModifiedLocal = datelocal; AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put(Settings.DB_HOST, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_HOST)); params.put(Settings.DB_NAME, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_NAME)); params.put(Settings.DB_USER, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_USERNAME)); params.put(Settings.DB_PASSWORD, sharedPrefs.getValueStr(SharedPrefs.KEY_DB_PASSWORD)); System.out.println("need Update params: " + params.toString()); String url = sharedPrefs.getValueStr(SharedPrefs.KEY_DOMAIN_NAME) + "/php/getDateModified.php"; Log.i("getDBSize", "URL: " + url); client.post( url, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { System.out.println("success sa dbcheck"); try { JSONObject json_data = new JSONObject(response); long date_modified = (json_data.getLong("date_modified")); date_modified = date_modified * 1000; Date dateremote = new Date(date_modified); Log.i("needUpdate", "date_modified (long)(remote): " + date_modified); Log.i( "needUpdate", "date_modified (long)(local): " + sharedPrefs.getValueLong(SharedPrefs.KEY_DATE_MODIFIED)); Log.i("needUpdate", "date_modified (remote): " + sdf.format(dateremote)); Log.i("needUpdate", "date_modified (local): " + sdf.format(dateModifiedLocal)); if (dateremote.after(dateModifiedLocal)) { Log.i("needUpdate", "WEE NEED BLOODY UPDATES"); getDBSize(); } else { Log.i("needUpdate", "WEE DONT NEED BLOODY UPDATES"); updateDialog.dismiss(); Intent intent = new Intent(getBaseContext(), SearchActivity.class); startActivity(intent); } } catch (Exception e) { updateDialog.dismiss(); Log.e("Fail 3", e.toString()); } } @Override public void onFailure(int statusCode, Throwable error, String content) { System.out.println("failed sa dbcheck"); if (statusCode == 404) { Log.e("getDBSize", "ERROR 404"); } else if (statusCode == 500) { Log.e("getDBSize", "ERROR 500"); } else { Log.e( "getDBSize", "ERROR OCCURED! content: " + content + "\nstatus: " + statusCode + "\nerror: " + error.toString()); } } }); }
private void getTimelineEntries(RequestParams params, AsyncHttpResponseHandler handler) { String apiUrl = getApiUrl("statuses/home_timeline.json"); Log.d("client", "GET: " + apiUrl); Log.d("client", "Params: " + params.toString()); getClient().get(apiUrl, params, handler); }
private void getListData() { RequestParams params = RequestParam.getRequestParams(getActivity()); String workId = ""; String lastId = ""; String lastData = ""; if (mList.size() != 0 && tempEntry != null) { workId = tempEntry.getData().getLastRank(); lastId = tempEntry.getData().getLastWorkId(); lastData = tempEntry.getData().getLastDate(); } else { if (mList.size() != 0 && homeData != null) { workId = homeData.getData().getWorks().getLastRank(); lastId = homeData.getData().getWorks().getLastWorkId(); lastData = homeData.getData().getWorks().getLastDate(); } } Log.e("work", workId); Queue queue = new Queue(); queue.setWorksId(""); queue.setLastRank(workId); queue.setLastWorkId(lastId); queue.setLastDate(lastData); queue.setText(""); queue.setUserId(""); queue.setUserId("-1"); queue.setTemplateId(""); queue.setTemplateTag(""); queue.setHotPoint(-1); queue.setHotTagId(LID); queue.setDateNow(""); queue.setTemplateFlag(-1); queue.setStatus(""); String query = gson.toJson(queue); params.put("query", query); params.put("pageCount", 10); Log.e("param", params.toString()); client.post( url, params, new AsyncHttpResponseCallBack(getActivity()) { @Override public void onSuccess(int i, Header[] headers, byte[] bytes) { super.onSuccess(i, headers, bytes); Log.e("json", new String(bytes)); Type type = new TypeToken<TempEntry>() {}.getType(); tempEntry = new TempEntry(); try { tempEntry = gson.fromJson(new String(bytes), type); mList.addAll(tempEntry.getData().getWorks()); // adapter.setmList(mList); if (mList.size() > tempEntry.getData().getWorks().size()) { adapter.notifyItemRangeInserted( mList.size() - tempEntry.getData().getWorks().size() + 1, tempEntry.getData().getWorks().size()); } else { adapter.notifyDataSetChanged(); } // } catch (Exception ex) { } if (circleBar.isShowing()) { circleBar.dismiss(); } refreshLayout.setRefreshing(false); progressBar_bottom.setVisibility(View.GONE); } @Override public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { if (circleBar.isShowing()) { circleBar.dismiss(); } refreshLayout.setRefreshing(false); progressBar_bottom.setVisibility(View.GONE); } }); }