本文整理汇总了Java中com.androidquery.callback.AjaxStatus.getCode方法的典型用法代码示例。如果您正苦于以下问题:Java AjaxStatus.getCode方法的具体用法?Java AjaxStatus.getCode怎么用?Java AjaxStatus.getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.androidquery.callback.AjaxStatus
的用法示例。
在下文中一共展示了AjaxStatus.getCode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expired
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
@Override
public boolean expired(AbstractAjaxCallback<?, ?> cb, AjaxStatus status)
{
int code = status.getCode();
if (code == 200)
return false;
String error = status.getError();
if (error != null && error.contains("OAuthException"))
{
AQUtility.debug("fb token expired");
return true;
}
String url = cb.getUrl();
if (code == 400 && (url.endsWith("/likes") || url.endsWith("/comments") || url.endsWith("/checkins")))
{
return false;
}
if (code == 403 && (url.endsWith("/feed") || url.contains("method=delete")))
{
return false;
}
return code == 400 || code == 401 || code == 403;
}
示例2: initYingpingServiceData
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void initYingpingServiceData(String url, JSONObject json,
AjaxStatus status) {
// TODO Auto-generated method stub
if (status.getCode() == AjaxStatus.NETWORK_ERROR) {
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if (json == null || json.equals(""))
return;
String str = json.toString();
if(str.contains("review_id")) {
isYingPing = true;
}
Log.i(TAG, "isYingPing--->" + isYingPing + " --->" + str);
if(!isYingPing) {
yingpingBt.setEnabled(false);
yingpingBt.setBackgroundResource(R.drawable.yingping_button_unuse_selector);
yingpingBt.setTextColor(getResources().getColor(R.color.unuse_color));
// yingpingBt.setFocusable(false);
}
getGroupSeries(URLUtils.getGroupSeries(prod_id));
}
示例3: initIsShoucangData
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void initIsShoucangData(String url, JSONObject json, AjaxStatus status){
xiaiBt.setEnabled(true);
if (status.getCode() == AjaxStatus.NETWORK_ERROR||json == null) {
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if(json == null || json.equals(""))
return;
Log.d(TAG, "data = " + json.toString());
String flag = json.toString();
if(!flag.equals("")) {
if(flag.contains("true")) {
isXiai = true;
ItemStateUtils.shoucangButtonToFocusState(xiaiBt, getApplicationContext());
} else {
isXiai = false;
ItemStateUtils.shoucangButtonToNormalState(xiaiBt, getApplicationContext());
}
} else {
isXiai = true;
ItemStateUtils.shoucangButtonToFocusState(xiaiBt, getApplicationContext());
}
}
示例4: deleteResult
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void deleteResult(String url, JSONObject json, AjaxStatus status){
if (status.getCode() == AjaxStatus.NETWORK_ERROR) {
// aq.id(R.id.ProgressText).invisible();
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if(json == null || json.equals(""))
return;
Log.d(TAG, json.toString());
}
示例5: initYingpingServiceData
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void initYingpingServiceData(String url, JSONObject json,
AjaxStatus status) {
// TODO Auto-generated method stub
if (status.getCode() == AjaxStatus.NETWORK_ERROR) {
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if (json == null || json.equals(""))
return;
String str = json.toString();
if(str.contains("review_id")) {
isYingPing = true;
}
Log.i(TAG, "isYingPing--->" + yingpingBt);
if(!isYingPing) {
yingpingBt.setEnabled(false);
yingpingBt.setBackgroundResource(R.drawable.yingping_button_unuse_selector);
yingpingBt.setTextColor(getResources().getColor(R.color.unuse_color));
// yingpingBt.setFocusable(false);
}
}
示例6: deleteResult
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void deleteResult(String url, JSONObject json, AjaxStatus status){
if (status.getCode() == AjaxStatus.NETWORK_ERROR) {
// aq.id(R.id.ProgressText).invisible();
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if(json == null || json.equals(""))
return;
Log.d(TAG, json.toString());
}
示例7: initIsShoucangData
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void initIsShoucangData(String url, JSONObject json,
AjaxStatus status) {
xiaiBt.setEnabled(true);
if (status.getCode() == AjaxStatus.NETWORK_ERROR || json == null) {
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if (json == null || json.equals(""))
return;
Log.d(TAG, "data = " + json.toString());
String flag = json.toString();
if (!flag.equals("")) {
if (flag.contains("true")) {
isXiai = true;
ItemStateUtils.shoucangButtonToFocusState(xiaiBt,
getApplicationContext());
} else {
isXiai = false;
ItemStateUtils.shoucangButtonToNormalState(xiaiBt,
getApplicationContext());
}
} else {
isXiai = true;
ItemStateUtils.shoucangButtonToFocusState(xiaiBt,
getApplicationContext());
}
}
示例8: initYingpingServiceData
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void initYingpingServiceData(String url, JSONObject json,
AjaxStatus status) {
// TODO Auto-generated method stub
if (status.getCode() == AjaxStatus.NETWORK_ERROR) {
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if (json == null || json.equals(""))
return;
String str = json.toString();
if (str.contains("review_id")) {
isYingPing = true;
}
Log.i(TAG, "isYingPing--->" + isYingPing + " --->" + str);
if (!isYingPing) {
yingpingBt.setEnabled(false);
yingpingBt
.setBackgroundResource(R.drawable.yingping_button_unuse_selector);
yingpingBt.setTextColor(getResources()
.getColor(R.color.unuse_color));
// yingpingBt.setFocusable(false);
}
}
示例9: initIsShoucangData
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void initIsShoucangData(String url, JSONObject json,
AjaxStatus status) {
if (status.getCode() == AjaxStatus.NETWORK_ERROR || json == null) {
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
return;
}
if (json == null || json.equals(""))
return;
Log.d(TAG, "data = " + json.toString());
String flag = json.toString();
if (!flag.equals("")) {
if (flag.contains("true")) {
isShoucang = true;
} else {
isShoucang = false;
}
} else {
isShoucang = true;
}
}
示例10: favorityResult
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void favorityResult(String url, JSONObject json,
AjaxStatus status) {
if (json != null) {
try {
// woof is "00000",now "20024",by yyc
if (json.getString("res_code").trim().equalsIgnoreCase("00000")) {
app.MyToast(this, "收藏成功!");
isShoucang = true;
mBottomButton.setBackgroundResource(R.drawable.player_btn_unfav);
} else {
isShoucang = true;
mBottomButton.setBackgroundResource(R.drawable.player_btn_unfav);
app.MyToast(this, "已收藏!");
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
// ajax error, show error code
if (status.getCode() == AjaxStatus.NETWORK_ERROR)
app.MyToast(aq.getContext(),
getResources().getString(R.string.networknotwork));
}
}
示例11: unfavorityResult
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void unfavorityResult(String url, JSONObject json, AjaxStatus status) {
if (json != null) {
try {
if (json.getString("res_code").trim().equalsIgnoreCase("00000")) {
app.MyToast(this, "取消收藏成功!");
mBottomButton
.setBackgroundResource(R.drawable.player_btn_fav);
isShoucang = false;
// setResult(JieMianConstant.SHOUCANG_CANCEL);
} else {
app.MyToast(this, "取消收藏失败!");
isShoucang = true;
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
// ajax error, show error code
if (status.getCode() == AjaxStatus.NETWORK_ERROR)
app.MyToast(this,
getResources().getString(R.string.networknotwork));
}
}
示例12: getArtwork
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
public void getArtwork(Track track) {
final String currentArtist = "" + track.getArtist();
if (currentArtist.equals(""))
return;
if (MediaUtils.getArtworkQuick(context, track, 300, 300) != null)
return;
if (activeTasks.size() > 2)
return;
if (activeTasks.containsKey(currentArtist))
return;
activeTasks.put(currentArtist, this);
AQuery aq = new AQuery(context);
String url = String.format("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key=683548928700d0cdc664691b862a8d21&artist=%s&format=json", Uri.encode(currentArtist));
AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>();
cb.url(url).type(JSONObject.class).fileCache(true).expire(3600 * 60 * 1000);
aq.sync(cb);
JSONObject result = cb.getResult();
if (result != null) {
JSONObject jsonObject = null;
String albumArtImageLink = null;
try {
if (!result.has("artist"))
return;
jsonObject = result.getJSONObject("artist");
JSONArray image = jsonObject.getJSONArray("image");
for (int i=0;i<image.length();i++) {
jsonObject = image.getJSONObject(i);
if (jsonObject.getString("size").equals("extralarge")) {
albumArtImageLink = Uri.decode(jsonObject.getString("#text"));
}
}
if (!(albumArtImageLink != null && albumArtImageLink.equals(""))) {
String path = MediaUtils.getArtistPath(track);
if (path != null) {
File file = new File(path);
AjaxCallback<File> cbFile = new AjaxCallback<File>();
cbFile.url(albumArtImageLink).type(File.class).targetFile(file);
aq.sync(cbFile);
AjaxStatus status = cbFile.getStatus();
if (status.getCode() == 200) {
if (listener != null)
listener.onNewArtwork();
} else {
file.delete();
}
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
activeTasks.remove(currentArtist);
}
示例13: expired
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
@Override
public boolean expired(AbstractAjaxCallback<?, ?> cb, AjaxStatus status)
{
int code = status.getCode();
return code == 401 || code == 403;
}
示例14: expired
import com.androidquery.callback.AjaxStatus; //导入方法依赖的package包/类
@Override
public boolean expired(AbstractAjaxCallback<?, ?> cb, AjaxStatus status) {
int code = status.getCode();
return code == 401 || code == 403;
}