@ -0,0 +1,101 @@ | |||
package gq.yigit.mycity; | |||
import android.os.AsyncTask; | |||
import android.util.Log; | |||
import cz.msebera.android.httpclient.HttpResponse; | |||
import cz.msebera.android.httpclient.NameValuePair; | |||
import cz.msebera.android.httpclient.client.HttpClient; | |||
import cz.msebera.android.httpclient.client.entity.UrlEncodedFormEntity; | |||
import cz.msebera.android.httpclient.client.methods.HttpGet; | |||
import cz.msebera.android.httpclient.client.methods.HttpPost; | |||
import cz.msebera.android.httpclient.impl.client.HttpClientBuilder; | |||
import cz.msebera.android.httpclient.message.BasicNameValuePair; | |||
import java.io.BufferedReader; | |||
import java.io.InputStreamReader; | |||
import java.util.*; | |||
public class WebRequest extends AsyncTask<Void,Void,String> { | |||
private String url; | |||
private HashMap<String,String> request_content; | |||
private boolean request_type;//True = GET, False = POST | |||
private HttpClient client = HttpClientBuilder.create().build(); | |||
private HttpGet get_request; | |||
private HttpPost post_request; | |||
private HttpResponse response; | |||
private List<responseListener> listeners = new ArrayList<>(); | |||
WebRequest(String url, boolean request_type, HashMap<String,String> request_content){ | |||
this.url = url; | |||
this.request_content = request_content; | |||
this.request_type = request_type; | |||
if(request_type){ | |||
Iterator iterator = request_content.entrySet().iterator(); | |||
this.url += "?"; | |||
while(iterator.hasNext()){ | |||
Map.Entry pair = (Map.Entry)iterator.next(); | |||
this.url += pair.getKey() + "=" + pair.getValue() + "&"; | |||
iterator.remove(); | |||
} | |||
get_request = new HttpGet(this.url); | |||
}else{ | |||
post_request = new HttpPost(this.url); | |||
} | |||
} | |||
protected String doInBackground(Void... params){ | |||
if(!request_type){ | |||
try { | |||
post_request = new HttpPost(url); | |||
List<NameValuePair> pairs = new ArrayList<>(request_content.size()); | |||
Iterator iterator = request_content.entrySet().iterator(); | |||
while (iterator.hasNext()) { | |||
Map.Entry pair = (Map.Entry) iterator.next(); | |||
pairs.add(new BasicNameValuePair(pair.getKey().toString(), pair.getValue().toString())); | |||
iterator.remove(); | |||
} | |||
post_request.setEntity(new UrlEncodedFormEntity(pairs)); | |||
response = client.execute(post_request); | |||
}catch (Exception e){ | |||
Log.e("[ERROR](request:67): ", e.toString()); | |||
} | |||
}else{ | |||
try { | |||
response = client.execute(get_request); | |||
}catch (Exception e){ | |||
Log.e("[ERROR](request:74): ", e.toString()); | |||
} | |||
} | |||
try { | |||
BufferedReader rd = new BufferedReader | |||
(new InputStreamReader( | |||
response.getEntity().getContent())); | |||
String line = ""; | |||
String temp; | |||
while ((temp = rd.readLine()) != null) { | |||
line += temp; | |||
} | |||
return line; | |||
}catch(Exception e){ | |||
Log.e("[ERROR](request:87): ", e.toString()); | |||
} | |||
return "Error"; | |||
} | |||
protected void onPostExecute(String result){ | |||
for (responseListener hl : listeners) | |||
hl.receivedResponse(!result.equals("Error"),result); | |||
} | |||
public void addListener(responseListener toAdd) { | |||
listeners.add(toAdd); | |||
} | |||
} |
@ -0,0 +1,5 @@ | |||
package gq.yigit.mycity; | |||
public interface responseListener { | |||
void receivedResponse(boolean success, String response); | |||
} |
@ -0,0 +1,9 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" | |||
android:viewportWidth="45.437" | |||
android:viewportHeight="45.437" | |||
android:width="45.437dp" | |||
android:height="45.437dp"> | |||
<path | |||
android:pathData="M41.403 11.11c-0.371 -3.627 -0.962 -6.451 -1.897 -7.561c-3.855 -4.564 -30.859 -4.898 -33.925 0c-0.75 1.2 -1.276 4.014 -1.629 7.567c-1.139 0.134 -2.026 1.093 -2.026 2.267v4.443c0 0.988 0.626 1.821 1.5 2.146c-0.207 6.998 -0.039 14.299 0.271 17.93c0 2.803 1.883 2.338 1.883 2.338h1.765v3.026c0 1.2 1.237 2.171 2.761 2.171c1.526 0 2.763 -0.971 2.763 -2.171V40.24h20.534v3.026c0 1.2 1.236 2.171 2.762 2.171c1.524 0 2.761 -0.971 2.761 -2.171V40.24h0.58c0 0 2.216 0.304 2.358 -1.016c0 -3.621 0.228 -11.646 0.04 -19.221c0.929 -0.291 1.607 -1.147 1.607 -2.177v-4.443C43.512 12.181 42.582 11.206 41.403 11.11zM12.176 4.2h20.735v3.137H12.176V4.2zM12.472 36.667c-1.628 0 -2.947 -1.32 -2.947 -2.948c0 -1.627 1.319 -2.946 2.947 -2.946s2.948 1.319 2.948 2.946C15.42 35.347 14.101 36.667 12.472 36.667zM32.8 36.667c-1.627 0 -2.949 -1.32 -2.949 -2.948c0 -1.627 1.321 -2.946 2.949 -2.946s2.947 1.319 2.947 2.946C35.748 35.347 34.428 36.667 32.8 36.667zM36.547 23.767H8.54V9.077h28.007V23.767z" | |||
android:fillColor="#000000" /> | |||
</vector> |
@ -0,0 +1,9 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" | |||
android:viewportWidth="512.681" | |||
android:viewportHeight="512.681" | |||
android:width="512dp" | |||
android:height="512dp"> | |||
<path | |||
android:pathData="M210 363.465c38.506 -13.514 73.477 -37.703 94.439 -61.254L438 170.002v47.477l-63 70.237v44.161h30V299.49l63 -70.237v-101.52l-5.143 -5.025l9.874 -9.873c13.851 -13.852 16.757 -34.557 8.738 -51.296l31.211 -31.681L491.31 8.803L460.231 40.35c-16.498 -7.853 -37.15 -5.146 -51.14 8.845l-10.606 10.606l-10.729 -10.485L215.172 221.901c-20.741 20.741 -37.476 45.28 -49.402 71.977H0v210h210V363.465zM430.304 70.408c5.862 -5.862 15.35 -5.863 21.213 0c5.849 5.848 5.849 15.365 0 21.213L441.4 101.739L419.942 80.77L430.304 70.408zM387.878 91.621l43.11 43.11L283.226 280.998l-42.362 -42.362L387.878 91.621zM180 473.877H30v-150.01h124.68c-2.792 9.434 -5.01 19.054 -6.615 28.78L98.5 402.213l-31.82 -31.82l-21.213 21.213L98.5 444.639l70.778 -70.778c3.598 -0.591 7.172 -1.267 10.723 -2.015V473.877zM220.613 260.811l40.524 40.524c-23.602 18.828 -50.773 32.23 -80.005 39.487C188.428 311.733 201.971 284.299 220.613 260.811z" | |||
android:fillColor="#000000" /> | |||
</vector> |
@ -0,0 +1,18 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" | |||
android:viewportWidth="512" | |||
android:viewportHeight="512" | |||
android:width="512dp" | |||
android:height="512dp"> | |||
<group | |||
android:translateX="-1"> | |||
<path | |||
android:pathData="M308.232 256h-153.6v34.133h141.269c11.503 0 20.864 9.361 20.864 20.872v38.861h34.133v-51.2C350.899 275.14 331.759 256 308.232 256z" | |||
android:fillColor="#000000" /> | |||
<path | |||
android:pathData="M333.832 404.6l-11.034 11.034c-6.084 6.084 -6.084 15.983 0 22.067c6.084 6.084 15.983 6.084 22.067 0c6.084 -6.084 6.084 -15.983 0 -22.067L333.832 404.6z" | |||
android:fillColor="#000000" /> | |||
<path | |||
android:pathData="M489.591 188.817L293.538 14.916c-20.565 -19.806 -52.762 -19.797 -73.114 -0.171l-65.792 59.827V51.2h8.533c4.719 0 8.533 -3.823 8.533 -8.533V8.533c0 -4.71 -3.814 -8.533 -8.533 -8.533h-102.4c-4.719 0 -8.533 3.823 -8.533 8.533v34.133c0 4.71 3.814 8.533 8.533 8.533h8.533v98.5l-44.843 38.895c-5.973 5.291 -7.996 13.534 -5.163 20.992s9.813 12.279 17.792 12.279h32.213V460.8h-8.533c-4.719 0 -8.533 3.823 -8.533 8.533v34.133c0 4.71 3.814 8.533 8.533 8.533h392.465c4.71 0 8.525 -3.806 8.533 -8.516l0.068 -34.133c0.009 -2.27 -0.887 -4.446 -2.492 -6.05c-1.596 -1.604 -3.772 -2.5 -6.042 -2.5h-8.533V221.867h32.273c7.927 0 14.857 -4.787 17.681 -12.194C497.527 202.274 495.513 194.082 489.591 188.817zM356.932 449.766c-6.366 6.374 -14.737 9.557 -23.1 9.557s-16.734 -3.183 -23.1 -9.557c-12.74 -12.74 -12.74 -33.459 0 -46.199l17.067 -17.067c3.337 -3.336 8.73 -3.336 12.066 0l17.067 17.067C369.672 416.307 369.672 437.026 356.932 449.766zM367.966 358.4c0 4.71 -3.814 8.533 -8.533 8.533h-51.2c-4.719 0 -8.533 -3.823 -8.533 -8.533v-47.394c0 -2.099 -1.707 -3.806 -3.797 -3.806H146.099c-4.719 0 -8.533 -3.823 -8.533 -8.533v-51.2c0 -4.71 3.814 -8.533 8.533 -8.533h110.933V204.86l-25.591 0.043h-0.008c-4.71 0 -8.525 -3.814 -8.533 -8.525c-0.008 -4.71 3.806 -8.533 8.525 -8.542l68.267 -0.102h0.009c4.71 0 8.525 3.814 8.533 8.525c0.009 4.71 -3.806 8.533 -8.525 8.542l-25.609 0.034v34.099h34.133c32.93 0 59.733 26.795 59.733 59.733V358.4z" | |||
android:fillColor="#000000" /> | |||
</group> | |||
</vector> |
@ -0,0 +1,9 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" | |||
android:viewportWidth="60" | |||
android:viewportHeight="60" | |||
android:width="60dp" | |||
android:height="60dp"> | |||
<path | |||
android:pathData="M30 0C13.458 0 0 13.458 0 30s13.458 30 30 30s30 -13.458 30 -30S46.542 0 30 0zM45.706 14.444L28.415 49.326c-0.17 0.345 -0.521 0.556 -0.896 0.556c-0.056 0 -0.112 -0.005 -0.169 -0.015c-0.436 -0.074 -0.771 -0.427 -0.824 -0.865l-1.809 -14.95L8.885 31.398c-0.434 -0.072 -0.769 -0.419 -0.826 -0.854s0.175 -0.857 0.574 -1.041l35.761 -16.412c0.383 -0.177 0.84 -0.091 1.135 0.213S45.895 14.064 45.706 14.444z" | |||
android:fillColor="#000000" /> | |||
</vector> |
@ -1,46 +0,0 @@ | |||
<?xml version="1.0" encoding="iso-8859-1"?> | |||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | |||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | |||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"> | |||
<g> | |||
<g> | |||
<g> | |||
<path d="M452,0H60C26.916,0,0,26.916,0,60v392c0,33.084,26.916,60,60,60h392c33.084,0,60-26.916,60-60V60 | |||
C512,26.916,485.084,0,452,0z M472,452c0,11.028-8.972,20-20,20H60c-11.028,0-20-8.972-20-20V60c0-11.028,8.972-20,20-20h392 | |||
c11.028,0,20,8.972,20,20V452z"/> | |||
<path d="M286,100H146v312h40V300h100c55.14,0,100-44.86,100-100S341.14,100,286,100z M286,260H186V140h100 | |||
c33.084,0,60,26.916,60,60S319.084,260,286,260z"/> | |||
</g> | |||
</g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
<g> | |||
</g> | |||
</svg> |
@ -0,0 +1,12 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" | |||
android:viewportWidth="512" | |||
android:viewportHeight="512" | |||
android:width="512dp" | |||
android:height="512dp"> | |||
<path | |||
android:pathData="M452 0H60C26.916 0 0 26.916 0 60v392c0 33.084 26.916 60 60 60h392c33.084 0 60 -26.916 60 -60V60C512 26.916 485.084 0 452 0zM472 452c0 11.028 -8.972 20 -20 20H60c-11.028 0 -20 -8.972 -20 -20V60c0 -11.028 8.972 -20 20 -20h392c11.028 0 20 8.972 20 20V452z" | |||
android:fillColor="#000000" /> | |||
<path | |||
android:pathData="M286 100H146v312h40V300h100c55.14 0 100 -44.86 100 -100S341.14 100 286 100zM286 260H186V140h100c33.084 0 60 26.916 60 60S319.084 260 286 260z" | |||
android:fillColor="#000000" /> | |||
</vector> |
@ -0,0 +1,9 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" | |||
android:viewportWidth="487.222" | |||
android:viewportHeight="487.222" | |||
android:width="487.222dp" | |||
android:height="487.222dp"> | |||
<path | |||
android:pathData="M486.554 186.811c-1.6 -4.9 -5.8 -8.4 -10.9 -9.2l-152 -21.6l-68.4 -137.5c-2.3 -4.6 -7 -7.5 -12.1 -7.5l0 0c-5.1 0 -9.8 2.9 -12.1 7.6l-67.5 137.9l-152 22.6c-5.1 0.8 -9.3 4.3 -10.9 9.2s-0.2 10.3 3.5 13.8l110.3 106.9l-25.5 151.4c-0.9 5.1 1.2 10.2 5.4 13.2c2.3 1.7 5.1 2.6 7.9 2.6c2.2 0 4.3 -0.5 6.3 -1.6l135.7 -71.9l136.1 71.1c2 1 4.1 1.5 6.2 1.5l0 0c7.4 0 13.5 -6.1 13.5 -13.5c0 -1.1 -0.1 -2.1 -0.4 -3.1l-26.3 -150.5l109.6 -107.5C486.854 197.111 488.154 191.711 486.554 186.811zM349.554 293.911c-3.2 3.1 -4.6 7.6 -3.8 12l22.9 131.3l-118.2 -61.7c-3.9 -2.1 -8.6 -2 -12.6 0l-117.8 62.4l22.1 -131.5c0.7 -4.4 -0.7 -8.8 -3.9 -11.9l-95.6 -92.8l131.9 -19.6c4.4 -0.7 8.2 -3.4 10.1 -7.4l58.6 -119.7l59.4 119.4c2 4 5.8 6.7 10.2 7.4l132 18.8L349.554 293.911z" | |||
android:fillColor="#000000" /> | |||
</vector> |