當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultRetryPolicy.DEFAULT_BACKOFF_MULT屬性代碼示例

本文整理匯總了Java中com.android.volley.DefaultRetryPolicy.DEFAULT_BACKOFF_MULT屬性的典型用法代碼示例。如果您正苦於以下問題:Java DefaultRetryPolicy.DEFAULT_BACKOFF_MULT屬性的具體用法?Java DefaultRetryPolicy.DEFAULT_BACKOFF_MULT怎麽用?Java DefaultRetryPolicy.DEFAULT_BACKOFF_MULT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.android.volley.DefaultRetryPolicy的用法示例。


在下文中一共展示了DefaultRetryPolicy.DEFAULT_BACKOFF_MULT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getInterpolation

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);
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:19,代碼來源:ElasticOutInterpolator.java

示例2: getInterpolation

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))));
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:20,代碼來源:ElasticInInterpolator.java

示例3: runPullShadeAnimation

AnimationSequence runPullShadeAnimation(final View view) {
    view.setVisibility(View.VISIBLE);
    view.setAlpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    view.setTranslationY(0.0f);
    AnimationSequence sequence = new AnimationSequence();
    sequence.setView(view);
    sequence.setRepeat(true);
    AlphaAnimation fadeIn = new AlphaAnimation(0.0f, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    fadeIn.setDuration(300);
    sequence.addAnimation(fadeIn);
    TranslateAnimation swipe = new TranslateAnimation(0.0f, 0.0f, 0.0f, 100.0f);
    swipe.setDuration(500);
    sequence.addAnimation(swipe);
    Animation fadeOut = new AlphaAnimation(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT, 0.0f);
    fadeOut.setDuration(300);
    sequence.addAnimation(new Runnable() {
        public void run() {
            view.setTranslationY(100.0f);
        }
    }, fadeOut);
    Animation pause = new AlphaAnimation(0.0f, 0.0f);
    pause.setDuration(4000);
    sequence.addAnimation(pause, new Runnable() {
        public void run() {
            view.setTranslationY(0.0f);
        }
    });
    sequence.start();
    return sequence;
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:30,代碼來源:OOBTutorialActivity.java

示例4: findIntersection

static PointF findIntersection(PointF p1, PointF p2, PointF p3, PointF p4) {
    float xD1 = p2.x - p1.x;
    float xD2 = p4.x - p3.x;
    float yD1 = p2.y - p1.y;
    float yD2 = p4.y - p3.y;
    float xD3 = p1.x - p3.x;
    float yD3 = p1.y - p3.y;
    float len1 = (float) Math.sqrt((double) ((xD1 * xD1) + (yD1 * yD1)));
    float len2 = (float) Math.sqrt((double) ((xD2 * xD2) + (yD2 * yD2)));
    if (Math.abs(((xD1 * xD2) + (yD1 * yD2)) / (len1 * len2)) == DefaultRetryPolicy.DEFAULT_BACKOFF_MULT) {
        return null;
    }
    PointF pt = new PointF(0.0f, 0.0f);
    float div = (yD2 * xD1) - (xD2 * yD1);
    float ua = ((xD2 * yD3) - (yD2 * xD3)) / div;
    float ub = ((xD1 * yD3) - (yD1 * xD3)) / div;
    pt.x = p1.x + (ua * xD1);
    pt.y = p1.y + (ua * yD1);
    xD1 = pt.x - p1.x;
    xD2 = pt.x - p2.x;
    yD1 = pt.y - p1.y;
    yD2 = pt.y - p2.y;
    float segmentLen1 = (float) (Math.sqrt((double) ((xD1 * xD1) + (yD1 * yD1))) + Math.sqrt((double) ((xD2 * xD2) + (yD2 * yD2))));
    xD1 = pt.x - p3.x;
    xD2 = pt.x - p4.x;
    yD1 = pt.y - p3.y;
    yD2 = pt.y - p4.y;
    float segmentLen2 = (float) (Math.sqrt((double) ((xD1 * xD1) + (yD1 * yD1))) + Math.sqrt((double) ((xD2 * xD2) + (yD2 * yD2))));
    if (((double) Math.abs(len1 - segmentLen1)) > 0.01d || ((double) Math.abs(len2 - segmentLen2)) > 0.01d) {
        return null;
    }
    return pt;
}
 
開發者ID:bunnyblue,項目名稱:NoticeDog,代碼行數:33,代碼來源:GeometryUtils.java

示例5: setRequestTimeout

private void setRequestTimeout(int ms) {
    int timeout = (ms == 0) ? DefaultRetryPolicy.DEFAULT_TIMEOUT_MS : ms;

    mRetryPolicy = new DefaultRetryPolicy(timeout,
            DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
}
 
開發者ID:socoolby,項目名稱:CoolClock,代碼行數:7,代碼來源:NetworkService.java

示例6: IrailApi

public IrailApi(Context context, IrailParser parser, IrailStationProvider stationProvider) {
    this.context = context;
    this.parser = parser;
    this.stationProvider = stationProvider;
    this.requestQueue = Volley.newRequestQueue(context);
    this.requestPolicy = new DefaultRetryPolicy(10000,
            3,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:9,代碼來源:IrailApi.java

示例7: generateRetryPolicy

/**
 * Generate a default retry policy (30 seconds for the timeout, 1 retry maximum, 1 backoff multiplier)
 * @return a default retry policy, not null
 */
@NonNull
private static RetryPolicy generateRetryPolicy() {
    return new DefaultRetryPolicy(requestTimeout,
            DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
}
 
開發者ID:neopixl,項目名稱:Spitfire,代碼行數:10,代碼來源:SpitfireManager.java

示例8: makeRequest

/**
 * 如果傳入的tag有效,則可以通過該tag取消請求的發送
 *
 * @param request    req
 * @param requestTag tag
 */
private void makeRequest(VolleyRequest request, String requestTag) {
    if (!TextUtils.isEmpty(requestTag)) {
        request.setTag(requestTag);
    }
    // step4:放入請求隊列
    RequestQueue requestQueue = VolleyManager.getInstance(mContext).getRequestQueue();
    int socketTimeout = 5000;//30 seconds - change to what you want
    RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    request.setRetryPolicy(policy);
    requestQueue.add(request);
}
 
開發者ID:jessie345,項目名稱:RealArchitecture,代碼行數:17,代碼來源:VolleyClient.java

示例9: callAPI

public void callAPI(View view) {
    Log.d("Action Log", "button clicked");

    RequestQueue queue = Volley.newRequestQueue(this);
    String baseURL = "http://azureml-recommend-sample-android.azurewebsites.net";//ご自身の展開した Azure Web Apps のURL を記入してください。
    String url = baseURL +  "/api/values/11";//Web application 側の API を呼び出します。この例では ID 11 の人を呼び出すことになります。


    //https://developer.android.com/intl/ja/training/volley/simple.html を參考に実裝
    StringRequest apiRequest = new StringRequest(Request.Method.GET, url,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    //成功時の出力
                    Log.d("response", response);
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    //失敗時のエラー出力。
                    Log.d("response", error.toString());
                }
            });

    int custome_timeout_ms = 60000;//timeoutを60000sec(1min)に設定する為の変數
    DefaultRetryPolicy policy = new DefaultRetryPolicy(custome_timeout_ms,DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    apiRequest.setRetryPolicy(policy);//リトライのポリシーを設定。ここで、タイムアウトの時間を変更。

    //API 呼び出し
    queue.add(apiRequest);
}
 
開發者ID:NT-D,項目名稱:AzureML_Recommend_Android,代碼行數:32,代碼來源:MainActivity.java

示例10: onCreate

@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    this.mContext = this;
    this.mApplicationContext = getApplicationContext();
    this.mActivity = this;

    this.volleyQueue = Volley.newRequestQueue(mContext);

    this.policy = new DefaultRetryPolicy(Constant.TimeInApplication.NET_TIMEOUT, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);

    ActivityManager.addActivity(this);
}
 
開發者ID:ChinaSunHZ,項目名稱:ProjectUtils,代碼行數:14,代碼來源:BaseActivity.java

示例11: onAttach

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    mContext = activity.getBaseContext();
    mApplicationContext = mContext.getApplicationContext();
    mActivity = activity;

    this.volleyQueue = Volley.newRequestQueue(mContext);
    this.policy = new DefaultRetryPolicy(Constant.TimeInApplication.NET_TIMEOUT, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
}
 
開發者ID:ChinaSunHZ,項目名稱:ProjectUtils,代碼行數:11,代碼來源:BaseFragment.java

示例12: ResetCameraAndGetImageReq

public ResetCameraAndGetImageReq(RequestQueue queue, OnGetImgListener listener)
{
    RetryPolicy retryPolicy = new DefaultRetryPolicy(
            15000,
            1,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    mImageReq = new GetImage(queue, this, UrlRequestType.RESET_AND_GET_IMAGE, retryPolicy);
    mListener = listener;
}
 
開發者ID:ludwigandersson,項目名稱:thermospy,代碼行數:9,代碼來源:ResetCameraAndGetImageReq.java

示例13: SetImgBoundsReq

public SetImgBoundsReq(RequestQueue queue, OnSetImgBoundsListener listener, Boundary bounds)
{
    mBounds = bounds;
    mListener = listener;
    mGetJsonObjectReq = new PutJsonObject(queue, this, UrlRequestType.IMG_BOUNDS, getJsonObject(), new DefaultRetryPolicy(10000, 1, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

}
 
開發者ID:ludwigandersson,項目名稱:thermospy,代碼行數:7,代碼來源:SetImgBoundsReq.java

示例14: CameraControlReq

public CameraControlReq(RequestQueue queue, OnCameraControlListener listener, Action cameraControlAction)
{
    mCameraControlAction = cameraControlAction;
    RetryPolicy retryPolicy = new DefaultRetryPolicy(
            15000,
            DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    mGetJsonObjectReq = new PutJsonObject(queue, this, UrlRequestType.CAMERA_CONTROL, getJsonObject(), retryPolicy);
    mListener = listener;
}
 
開發者ID:ludwigandersson,項目名稱:thermospy,代碼行數:10,代碼來源:CameraControlReq.java

示例15: init

protected void init() {
		initErrorListener();
		if(method==Method.POST&&params!=null&&params.size()>0&&isJsonPost){
			initListener2();
			initJson();
			return;
		}
		initListener();
		Logger.info("Request", url);
		jsonObjectRequest = new com.android.volley.toolbox.StringRequest(method, url, listener,errorListener
		){
			@Override
			protected Map<String, String> getParams() throws AuthFailureError {
				if(params!=null&&params.entrySet().size()>0){
					Logger.info("params", params.toString());
					return validFormat(params);
				}
				return super.getParams();
			}
			@Override
			public Map<String, String> getHeaders() throws AuthFailureError {
				Map<String, String> rt = NetConfig.getHeaders(isNormalPost);
				addCustomHeader(rt);
				Logger.info("headers", rt.toString());
				return rt;
			}
//			@Override
			public RetryPolicy getRetryPolicy() {
				RetryPolicy retryPolicy = new DefaultRetryPolicy(NetConfig.getConnectionTimeout(), 0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
				return retryPolicy;
			}
		};
	}
 
開發者ID:simplelifetian,項目名稱:GomeOnline,代碼行數:33,代碼來源:JsonRequest.java


注:本文中的com.android.volley.DefaultRetryPolicy.DEFAULT_BACKOFF_MULT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。