本文整理汇总了Java中com.android.volley.DefaultRetryPolicy类的典型用法代码示例。如果您正苦于以下问题:Java DefaultRetryPolicy类的具体用法?Java DefaultRetryPolicy怎么用?Java DefaultRetryPolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultRetryPolicy类属于com.android.volley包,在下文中一共展示了DefaultRetryPolicy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInterpolation
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public float getInterpolation(float t) {
if (t == 0.0f) {
return 0.0f;
}
if (t >= DefaultRetryPolicy.DEFAULT_BACKOFF_MULT) {
return DefaultRetryPolicy.DEFAULT_BACKOFF_MULT;
}
float s;
if (this._period == 0.0f) {
this._period = 0.3f;
}
if (this._amplitude == 0.0f || this._amplitude < DefaultRetryPolicy.DEFAULT_BACKOFF_MULT) {
this._amplitude = DefaultRetryPolicy.DEFAULT_BACKOFF_MULT;
s = this._period / 4.0f;
} else {
s = (float) (Math.asin((double) (DefaultRetryPolicy.DEFAULT_BACKOFF_MULT / this._amplitude)) * (((double) this._period) / 6.283185307179586d));
}
return (float) (((((double) this._amplitude) * Math.pow(2.0d, (double) (-10.0f * t))) * Math.sin((((double) (t - s)) * 6.283185307179586d) / ((double) this._period))) + 1.0d);
}
示例2: check
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void check(final Callback callback) {
mCallback = callback;
StringRequest request = new StringRequest(Request.Method.GET, UPDATE_URL, this, this);
request.setRetryPolicy(new DefaultRetryPolicy(mTimeOut, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
request.setTag("update-check");
request.setShouldCache(false);
mRequestQueue.add(request);
}
示例3: load
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void load(String url, final OnStringListener listener) {
StringRequest request = new StringRequest(url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
listener.onSuccess(s);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
listener.onError(volleyError);
}
});
request.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
VolleySingleton.getVolleySingleton(context).addToRequestQueue(request);
}
示例4: loadSearchSuggestions
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
private void loadSearchSuggestions(final String query) {
String showName = query.replaceAll("\\s", "+");
RequestQueue requestQueue = VolleySingleton.getInstance().getRequestQueue();
JsonArrayRequest req = new JsonArrayRequest(
API.TV_MAZE_SEARCH + showName,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
List<SearchSuggestions> searchSuggestions = new ArrayList<>();
JSONObject object;
try {
for (int j = 0; j < response.length() && searchSuggestions.size() < 5; j++) {
object = response.getJSONObject(j).getJSONObject("show");
SearchSuggestions suggestion = new SearchSuggestions(object.getString("name"));
if (!searchSuggestions.contains(suggestion)) {
searchSuggestions.add(suggestion);
}
}
} catch (JSONException e) {
//Log.e("JSON exception", e.getMessage());
}
if (searchView.isSearchBarFocused()) {
searchView.swapSuggestions(searchSuggestions);
}
searchView.hideProgress();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
searchView.hideProgress();
}
});
req.setRetryPolicy(new DefaultRetryPolicy(
5000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(req);
}
示例5: postRequest
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void postRequest(Request<?> request){
request.setRetryPolicy(new DefaultRetryPolicy(10000,
DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
mQueue.add(request);
}
示例6: startTutorialShadeNotificationTest
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
void startTutorialShadeNotificationTest() {
this.phone.animate().alpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setDuration(500).setStartDelay(0).withEndAction(new Runnable() {
public void run() {
OOBTutorialActivity.this.shadeHeight = OOBTutorialActivity.this.shade.getHeight();
OOBTutorialActivity.this.shade.setVisibility(View.GONE);
OOBTutorialActivity.this.explanation.animate().alpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setDuration(500).setStartDelay(0).withEndAction(new Runnable() {
public void run() {
OOBTutorialActivity.this.updateText(OOBTutorialActivity.this.explanation, R.string.oob_popout_tab_explanation_shade_notification_test, OOBTutorialActivity.READ_DELAY, new Runnable() {
public void run() {
OOBTutorialActivity.this.updateText(OOBTutorialActivity.this.explanation, R.string.oob_pullout_shade_explanation, OOBTutorialActivity.READ_DELAY, new Runnable() {
public void run() {
OOBTutorialActivity.this.enableShadePullHandler();
}
});
}
});
}
});
}
});
}
示例7: setUnreadCount
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void setUnreadCount(int unreadCount, final AnimationPNGSequence.IAnimationListener listener) {
final TextView badgeCountText = (TextView) findViewById(R.id.text_badge_count);
badgeCountText.setAlpha(0.0f);
if (unreadCount == 0) {
badgeCountText.setText("0");
getHeadAnimation().playAnimation("IDLE");
return;
}
String nextText = String.format("%d", new Object[]{Integer.valueOf(unreadCount)});
getHeadAnimation().playAnimation("IDLE_BACK");
badgeCountText.setText(nextText);
badgeCountText.setAlpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
badgeCountText.setScaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
badgeCountText.setScaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
badgeCountText.animate().scaleY(1.3f).scaleX(1.3f).setDuration(200).withEndAction(new Runnable() {
public void run() {
badgeCountText.animate().scaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).scaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setDuration(200).withEndAction(new Runnable() {
public void run() {
if (listener != null) {
listener.onAnimationFinished();
}
}
});
}
});
}
示例8: animateIn
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void animateIn(int duration) {
int increment;
int start = 0;
int end = 0;
if (this.exitOnRight) {
start = this.buttons.size() - 1;
increment = -1;
} else {
end = this.buttons.size() - 1;
increment = 1;
}
int index = start;
while (true) {
((ImageButton) this.buttons.get(index)).animate().scaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).scaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setInterpolator(new ElasticOutInterpolator(1.2f, 2.0f)).setDuration((long) duration).start();
if (index == end) {
this.closeLeft.animate().scaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).scaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setInterpolator(new ElasticOutInterpolator(1.2f, 2.0f)).setDuration((long) duration).start();
this.closeRight.animate().scaleX(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).scaleY(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setInterpolator(new ElasticOutInterpolator(1.2f, 2.0f)).setDuration((long) duration).start();
return;
}
index += increment;
}
}
示例9: getInterpolation
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public float getInterpolation(float t) {
if (t == 0.0f) {
return 0.0f;
}
if (t >= DefaultRetryPolicy.DEFAULT_BACKOFF_MULT) {
return DefaultRetryPolicy.DEFAULT_BACKOFF_MULT;
}
float s;
if (this._period == 0.0f) {
this._period = 0.3f;
}
if (this._amplitude == 0.0f || this._amplitude < DefaultRetryPolicy.DEFAULT_BACKOFF_MULT) {
this._amplitude = DefaultRetryPolicy.DEFAULT_BACKOFF_MULT;
s = this._period / 4.0f;
} else {
s = (float) ((((double) this._period) / 6.283185307179586d) * Math.asin((double) (DefaultRetryPolicy.DEFAULT_BACKOFF_MULT / this._amplitude)));
}
t -= DefaultRetryPolicy.DEFAULT_BACKOFF_MULT;
return (float) (-((Math.pow(2.0d, (double) (10.0f * t)) * ((double) this._amplitude)) * Math.sin((((double) (t - s)) * 6.283185307179586d) / ((double) this._period))));
}
示例10: setExpandedHeightInternal
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void setExpandedHeightInternal(float h) {
float f = 0.0f;
if (Float.isNaN(h)) {
Log.v(TAG, "setExpandedHeightInternal: warning: h=NaN, using 0 instead", new Throwable());
h = 0.0f;
}
float fh = getFullHeight();
if (fh == 0.0f) {
}
if (h < 0.0f) {
h = 0.0f;
}
if (!(this.mRubberbandingEnabled && (this.mTracking || this.mRubberbanding)) && h > fh) {
h = fh;
}
this.mExpandedHeight = h;
((PanelHolder) getParent()).setExpandedHeight((float) getTargetExpandedHeight());
requestLayout();
if (fh != 0.0f) {
f = h / fh;
}
this.mExpandedFraction = Math.min(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT, f);
}
示例11: run
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public final void run() {
d dVar = this.b;
a aVar = this.a;
if (aVar != null && "toast".equals(aVar.k)) {
JSONObject jSONObject = aVar.m;
CharSequence optString = jSONObject.optString(Utils.RESPONSE_CONTENT);
int optInt = jSONObject.optInt(SportRecordDao.DURATION);
int i = 1;
if (optInt < DefaultRetryPolicy.DEFAULT_TIMEOUT_MS) {
i = 0;
}
Toast.makeText(dVar.b, optString, i).show();
new Timer().schedule(new f(dVar, aVar), (long) i);
}
a aVar2 = a.NONE_ERROR;
if (aVar2 != a.NONE_ERROR) {
try {
this.b.a(this.a.i, aVar2);
} catch (JSONException e) {
}
}
}
示例12: execute
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void execute() {
final String url = URL + "/remind";
StringRequest req = new StringRequest(Request.Method.POST, url, this, this) {
@Override
public HashMap<String, String> getHeaders() {
return getDefaultHeaders();
}
@Override
public byte[] getBody() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("fromUsername", mUsername);
params.put("toUsername", mToUsername);
params.put("guid", mGuid);
params.put("isRemindingRef", isRemindingRef ? "1" : "0");
return new JSONObject(params).toString().getBytes();
}
};
req.setRetryPolicy(new DefaultRetryPolicy(
ASYNC_CONNECTION_NORMAL_TIMEOUT,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
0));
VolleyRequestQueue.getInstance().addToRequestQueue(req);
}
示例13: execute
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void execute() {
String url;
try {
url = URL + "/getuserinfo?username=" + URLEncoder.encode(mUsername, "utf-8");
} catch (UnsupportedEncodingException e) {
url = URL + "/getuserinfo?username=" + mUsername;
}
StringRequest req = new StringRequest(Request.Method.GET, url, this, this) {
@Override
public HashMap<String, String> getHeaders() {
return getDefaultHeaders();
}
};
req.setRetryPolicy(new DefaultRetryPolicy(
ASYNC_CONNECTION_NORMAL_TIMEOUT,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
0));
VolleyRequestQueue.getInstance().addToRequestQueue(req);
}
示例14: execute
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void execute() {
final String url = URL + "/register";
isRegistering = true;
StringRequest req = new StringRequest(Request.Method.POST, url, this, this) {
@Override
public Map<String, String> getHeaders() {
return getDefaultHeaders();
}
@Override
public byte[] getBody() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("username", mUsername);
params.put("device", "android");
params.put("pushID", mPushID);
return new JSONObject(params).toString().getBytes();
}
};
req.setRetryPolicy(new DefaultRetryPolicy(
ASYNC_CONNECTION_EXTENDED_TIMEOUT,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
0));
VolleyRequestQueue.getInstance().addToRequestQueue(req);
}
示例15: execute
import com.android.volley.DefaultRetryPolicy; //导入依赖的package包/类
public void execute() {
final String url = URL + "/updategoal";
StringRequest req = new StringRequest(Request.Method.POST, url, this, this) {
@Override
public HashMap<String, String> getHeaders() {
return getDefaultHeaders();
}
@Override
public byte[] getBody() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("username", mUsername);
params.put("guid", mGuid);
params.put("goalCompleteResult", String.valueOf(mGoalCompleteResult.ordinal()));
return new JSONObject(params).toString().getBytes();
}
};
req.setRetryPolicy(new DefaultRetryPolicy(
ASYNC_CONNECTION_EXTENDED_TIMEOUT,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
0));
VolleyRequestQueue.getInstance().addToRequestQueue(req);
}