PPLC
+ PPLC
+ PCLI
+ PPLC
+ MTS
+ VLC
+ PLN
+ PEN
+ ADM1
+ VLC
+ ADM1
+ VLC
+ DSRT
+ FLLS
+ FLLS
+ GLCR
+ GLCR
+ MTS
+ MTS
+ + * + */ + public String getSavedImagePath() { + return lastImagePath; + } + + /** + * Returns the String path of the last image that was saved with this + * tnydbobj + *
+ *
+ * @param String
+ * the theFolder - the folder path dir you want to save it to e.g
+ * "DropBox/WorkImages"
+ * @param String
+ * the theImageName - the name you want to assign to the image file e.g
+ * "MeAtlunch.png"
+ *
+ */
+ public String putImagePNG(String theFolder, String theImageName,
+ Bitmap theBitmap) {
+ this.DEFAULT_APP_IMAGEDATA_DIRECTORY = theFolder;
+ String mFullPath = setupFolderPath(theImageName);
+ saveBitmapPNG(mFullPath, theBitmap);
+ lastImagePath = mFullPath;
+ return mFullPath;
+ }
+
+ private String setupFolderPath(String imageName) {
+ File sdcard_path = Environment.getExternalStorageDirectory();
+ mFolder = new File(sdcard_path, DEFAULT_APP_IMAGEDATA_DIRECTORY);
+ if (!mFolder.exists()) {
+ if (!mFolder.mkdirs()) {
+// Log.e("While creatingsave path",
+// "Default Save Path Creation Error");
+// // Toast("Default Save Path Creation Error");
+ }
+ }
+ String savePath = mFolder.getPath() + '/' + imageName;
+ return savePath;
+ }
+
+ private boolean saveBitmapPNG(String strFileName, Bitmap bitmap) {
+ if (strFileName == null || bitmap == null)
+ return false;
+ boolean bSuccess1 = false;
+ boolean bSuccess2;
+ boolean bSuccess3;
+ File saveFile = new File(strFileName);
+
+ if (saveFile.exists()) {
+ if (!saveFile.delete())
+ return false;
+ }
+
+ try {
+ bSuccess1 = saveFile.createNewFile();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ OutputStream out = null;
+ try {
+ out = new FileOutputStream(saveFile);
+ bSuccess2 = bitmap.compress(CompressFormat.PNG, 100, out);
+ } catch (Exception e) {
+ e.printStackTrace();
+ bSuccess2 = false;
+ }
+ try {
+ if (out != null) {
+ out.flush();
+ out.close();
+ bSuccess3 = true;
+ } else
+ bSuccess3 = false;
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ bSuccess3 = false;
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return (bSuccess1 && bSuccess2 && bSuccess3);
+ }
+
+ public int getInt(String key) {
+ return preferences.getInt(key, 0);
+ }
+
+ public long getLong(String key) {
+ return preferences.getLong(key, 0l);
+ }
+
+ public String getString(String key) {
+ return preferences.getString(key, "");
+ }
+
+ public double getDouble(String key) {
+ String number = getString(key);
+ try {
+ double value = Double.parseDouble(number);
+ return value;
+ }
+ catch(NumberFormatException e)
+ {
+ return 0;
+ }
+ }
+
+ public void putInt(String key, int value) {
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putInt(key, value);
+ editor.apply();
+ }
+
+ public void putLong(String key, long value) {
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putLong(key, value);
+ editor.apply();
+ }
+
+ public void putDouble(String key, double value) {
+ putString(key, String.valueOf(value));
+ }
+
+ public void putString(String key, String value) {
+
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putString(key, value);
+ editor.apply();
+ }
+
+ public void putList(String key, ArrayList Also dumps all events from this request's event log; for debugging. Note that only one of getPostParams() and getPostBody() can return a non-null
+ * value. This controls both encodings:
+ * Note that you can directly override {@link #getBody()} for custom data. This controls both encodings:
+ * The default implementation just returns the passed 'networkError'. Releases waiting requests for
+ * A good candidate user for this class is something like an I/O system that uses large temporary
+ *
+ * If there is not a suitably-sized buffer in its recycling pool when a buffer is requested, this
+ * class will allocate a new buffer and return it.
+ *
+ * This class has no special ownership of buffers it creates; the caller is free to take a buffer
+ * it receives from this pool, use it permanently, and never return it to the pool; additionally,
+ * it is not harmful to return to this pool a buffer that was allocated elsewhere, provided there
+ * are no other lingering references to it.
+ *
+ * This class ensures that the total size of the buffers in its recycling pool never exceeds a
+ * certain byte limit. When a buffer is returned that would cause the pool to exceed the limit,
+ * least-recently-used buffers are disposed.
+ */
+public class ByteArrayPool {
+ /** The buffer pool, arranged both by last use and by buffer size */
+ private List
+ *
+ *
+ * @deprecated Use {@link #getParamsEncoding()} instead.
+ */
+ @Deprecated
+ protected String getPostParamsEncoding() {
+ return getParamsEncoding();
+ }
+
+ /**
+ * @deprecated Use {@link #getBodyContentType()} instead.
+ */
+ @Deprecated
+ public String getPostBodyContentType() {
+ return getBodyContentType();
+ }
+
+ /**
+ * Returns the raw POST body to be sent.
+ *
+ * @throws AuthFailureError In the event of auth failure
+ *
+ * @deprecated Use {@link #getBody()} instead.
+ */
+ @Deprecated
+ public byte[] getPostBody() throws AuthFailureError {
+ // Note: For compatibility with legacy clients of volley, this implementation must remain
+ // here instead of simply calling the getBody() function because this function must
+ // call getPostParams() and getPostParamsEncoding() since legacy clients would have
+ // overridden these two member functions for POST requests.
+ Map
+ *
+ */
+ protected String getParamsEncoding() {
+ return DEFAULT_PARAMS_ENCODING;
+ }
+
+ public String getBodyContentType() {
+ return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
+ }
+
+ /**
+ * Returns the raw POST or PUT body to be sent.
+ *
+ * @throws AuthFailureError in the event of auth failure
+ */
+ public byte[] getBody() throws AuthFailureError {
+ Mapparams into an application/x-www-form-urlencoded encoded string.
+ */
+ private byte[] encodeParameters(Map
+ *
+ */
+ private final Maprequest.getCacheKey() if
+ * request.shouldCache().errorCode != OK. */
+ public final VolleyError error;
+
+ /** True if this response was a soft-expired one and a second one MAY be coming. */
+ public boolean intermediate = false;
+
+ /**
+ * Returns whether this response is considered successful.
+ */
+ public boolean isSuccess() {
+ return error == null;
+ }
+
+
+ private Response(T result, Cache.Entry cacheEntry) {
+ this.result = result;
+ this.cacheEntry = cacheEntry;
+ this.error = null;
+ }
+
+ private Response(VolleyError error) {
+ this.result = null;
+ this.cacheEntry = null;
+ this.error = error;
+ }
+}
diff --git a/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/ResponseDelivery.java b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/ResponseDelivery.java
new file mode 100644
index 00000000..87706afc
--- /dev/null
+++ b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/ResponseDelivery.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.volley;
+
+public interface ResponseDelivery {
+ /**
+ * Parses a response from the network or cache and delivers it.
+ */
+ public void postResponse(Request> request, Response> response);
+
+ /**
+ * Parses a response from the network or cache and delivers it. The provided
+ * Runnable will be executed after delivery.
+ */
+ public void postResponse(Request> request, Response> response, Runnable runnable);
+
+ /**
+ * Posts an error for the given request.
+ */
+ public void postError(Request> request, VolleyError error);
+}
diff --git a/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/RetryPolicy.java b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/RetryPolicy.java
new file mode 100644
index 00000000..0dd198b2
--- /dev/null
+++ b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/RetryPolicy.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.volley;
+
+/**
+ * Retry policy for a request.
+ */
+public interface RetryPolicy {
+
+ /**
+ * Returns the current timeout (used for logging).
+ */
+ public int getCurrentTimeout();
+
+ /**
+ * Returns the current retry count (used for logging).
+ */
+ public int getCurrentRetryCount();
+
+ /**
+ * Prepares for the next retry by applying a backoff to the timeout.
+ * @param error The error code of the last attempt.
+ * @throws VolleyError In the event that the retry could not be performed (for example if we
+ * ran out of attempts), the passed in error is thrown.
+ */
+ public void retry(VolleyError error) throws VolleyError;
+}
diff --git a/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/ServerError.java b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/ServerError.java
new file mode 100644
index 00000000..b29a6c66
--- /dev/null
+++ b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/ServerError.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.volley;
+
+import com.android.volley.NetworkResponse;
+import com.android.volley.VolleyError;
+
+/**
+ * Indicates that the error responded with an error response.
+ */
+@SuppressWarnings("serial")
+public class ServerError extends VolleyError {
+ public ServerError(NetworkResponse networkResponse) {
+ super(networkResponse);
+ }
+
+ public ServerError() {
+ super();
+ }
+}
diff --git a/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/TimeoutError.java b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/TimeoutError.java
new file mode 100644
index 00000000..0b5d6acb
--- /dev/null
+++ b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/TimeoutError.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.volley;
+
+/**
+ * Indicates that the connection or the socket timed out.
+ */
+@SuppressWarnings("serial")
+public class TimeoutError extends VolleyError { }
diff --git a/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/VolleyError.java b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/VolleyError.java
new file mode 100644
index 00000000..4f7b883d
--- /dev/null
+++ b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/VolleyError.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.volley;
+
+/**
+ * Exception style class encapsulating Volley errors
+ */
+@SuppressWarnings("serial")
+public class VolleyError extends Exception {
+ public final NetworkResponse networkResponse;
+
+ public VolleyError() {
+ networkResponse = null;
+ }
+
+ public VolleyError(NetworkResponse response) {
+ networkResponse = response;
+ }
+
+ public VolleyError(String exceptionMessage) {
+ super(exceptionMessage);
+ networkResponse = null;
+ }
+
+ public VolleyError(String exceptionMessage, Throwable reason) {
+ super(exceptionMessage, reason);
+ networkResponse = null;
+ }
+
+ public VolleyError(Throwable cause) {
+ super(cause);
+ networkResponse = null;
+ }
+}
diff --git a/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/VolleyLog.java b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/VolleyLog.java
new file mode 100644
index 00000000..66846902
--- /dev/null
+++ b/LearnFromMap/volley_buildmlearn/src/main/java/com/android/volley/VolleyLog.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.volley;
+
+import android.os.SystemClock;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/** Logging helper class. */
+public class VolleyLog {
+ public static String TAG = "Volley";
+
+ public static boolean DEBUG = Log.isLoggable(TAG, Log.VERBOSE);
+
+ /**
+ * Customize the log tag for your application, so that other apps
+ * using Volley don't mix their logs with yours.
+ *
+ * Enable the log property for your tag before starting your app:
+ *
+ * {@code adb shell setprop log.tag.<tag>}
+ */
+ public static void setTag(String tag) {
+ d("Changing log tag to %s", tag);
+ TAG = tag;
+
+ // Reinitialize the DEBUG "constant"
+ DEBUG = Log.isLoggable(TAG, Log.VERBOSE);
+ }
+
+ public static void v(String format, Object... args) {
+ if (DEBUG) {
+ Log.v(TAG, buildMessage(format, args));
+ }
+ }
+
+ public static void d(String format, Object... args) {
+ Log.d(TAG, buildMessage(format, args));
+ }
+
+ public static void e(String format, Object... args) {
+ Log.e(TAG, buildMessage(format, args));
+ }
+
+ public static void e(Throwable tr, String format, Object... args) {
+ Log.e(TAG, buildMessage(format, args), tr);
+ }
+
+ public static void wtf(String format, Object... args) {
+ Log.wtf(TAG, buildMessage(format, args));
+ }
+
+ public static void wtf(Throwable tr, String format, Object... args) {
+ Log.wtf(TAG, buildMessage(format, args), tr);
+ }
+
+ /**
+ * Formats the caller's provided message and prepends useful info like
+ * calling thread ID and method name.
+ */
+ private static String buildMessage(String format, Object... args) {
+ String msg = (args == null) ? format : String.format(Locale.US, format, args);
+ StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();
+
+ String caller = "byte[] objects. Its purpose is to
+ * supply those buffers to consumers who need to use them for a short period of time and then
+ * dispose of them. Simply creating and disposing such buffers in the conventional manner can
+ * considerable heap churn and garbage collection delays on Android, which lacks good management of
+ * short-lived heap objects. It may be advantageous to trade off some memory in the form of a
+ * permanently allocated pool of buffers in order to gain heap performance improvements; that is
+ * what this class does.
+ * byte[] buffers to copy data around. In these use cases, often the consumer wants
+ * the buffer to be a certain minimum size to ensure good performance (e.g. when copying data chunks
+ * off of a stream), but doesn't mind if the buffer is larger than the minimum. Taking this into
+ * account and also to maximize the odds of being able to reuse a recycled buffer, this class is
+ * free to return buffers larger than the requested size. The caller needs to be able to gracefully
+ * deal with getting buffers any size over the minimum.
+ *