From bc1ac556db3b921eb434b5543dbd0c3aad599374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20=C3=87olako=C4=9Flu?= Date: Wed, 17 Apr 2019 20:52:49 +0300 Subject: [PATCH] public Transport added --- MyCity/app/build.gradle | 2 + .../gq/yigit/mycity/DenunciationFragment.java | 6 +- .../java/gq/yigit/mycity/MainActivity.java | 18 +- .../java/gq/yigit/mycity/RateFragment.java | 8 +- .../mycity/navigation/TransitFragment.java | 306 + .../gq/yigit/mycity/tools/WebRequest.java | 9 +- .../mycity/utility/UtilityElectricity.java | 4 +- .../gq/yigit/mycity/utility/UtilityMain.java | 2 +- .../mycity/votesFragment/VoteFragment.java | 6 +- .../mycity/votesFragment/VotesFragment.java | 4 +- .../src/main/res/drawable-v24/magnifier.xml | 2 +- .../src/main/res/drawable/circle_shape.xml | 12 + .../app/src/main/res/drawable/line_shape.xml | 11 + .../src/main/res/drawable/search_shape.xml | 10 + .../app/src/main/res/layout/fragment_main.xml | 1 - .../src/main/res/layout/fragment_transit.xml | 37 + .../src/main/res/layout/fragment_utility.xml | 2 +- .../main/res/layout/popup_confirmation.xml | 28 +- .../app/src/main/res/layout/transit_item.xml | 72 + MyCity/app/src/main/res/values/dimens.xml | 1 + .../__pycache__/denunciation.cpython-37.pyc | Bin 1016 -> 2350 bytes .../__pycache__/navigation.cpython-37.pyc | Bin 1288 -> 9867 bytes server_side/api/modules/databases/bus.json | 50694 ++++++++++++++-- server_side/api/modules/navigation.py | 269 +- 24 files changed, 44722 insertions(+), 6782 deletions(-) create mode 100644 MyCity/app/src/main/java/gq/yigit/mycity/navigation/TransitFragment.java create mode 100644 MyCity/app/src/main/res/drawable/circle_shape.xml create mode 100644 MyCity/app/src/main/res/drawable/line_shape.xml create mode 100644 MyCity/app/src/main/res/drawable/search_shape.xml create mode 100644 MyCity/app/src/main/res/layout/fragment_transit.xml create mode 100644 MyCity/app/src/main/res/layout/transit_item.xml diff --git a/MyCity/app/build.gradle b/MyCity/app/build.gradle index 1df261f..37951b6 100644 --- a/MyCity/app/build.gradle +++ b/MyCity/app/build.gradle @@ -32,4 +32,6 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + implementation 'com.google.android.libraries.places:places:1.1.0' + } diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/DenunciationFragment.java b/MyCity/app/src/main/java/gq/yigit/mycity/DenunciationFragment.java index 5895562..6044b01 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/DenunciationFragment.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/DenunciationFragment.java @@ -112,7 +112,7 @@ public class DenunciationFragment extends Fragment implements WebRequest.respons args.put("photo", "null"); } - WebRequest request = new WebRequest(url+"/denunciation",false,args); + WebRequest request = new WebRequest(url+"/denunciation",false,args,0); request.addListener(activity); request.execute(); } @@ -177,7 +177,7 @@ public class DenunciationFragment extends Fragment implements WebRequest.respons void onFragmentInteraction(Uri uri); } - public void receivedResponse(boolean success, String response) { + public void receivedResponse(boolean success, String response,int id) { try { JSONObject received = new JSONObject(response); if (reps % 2 == 0) { @@ -213,7 +213,7 @@ public class DenunciationFragment extends Fragment implements WebRequest.respons } args.put("accepted","true"); - WebRequest requestConfirm = new WebRequest(url+"/denunciation",false,args); + WebRequest requestConfirm = new WebRequest(url+"/denunciation",false,args,0); requestConfirm.addListener(activity); requestConfirm.execute(); } diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/MainActivity.java b/MyCity/app/src/main/java/gq/yigit/mycity/MainActivity.java index 085af48..7a47f81 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/MainActivity.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/MainActivity.java @@ -1,14 +1,18 @@ package gq.yigit.mycity; +import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; +import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener; +import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; +import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.*; @@ -23,6 +27,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import gq.yigit.mycity.navigation.MapsFragment; +import gq.yigit.mycity.navigation.TransitFragment; import gq.yigit.mycity.tools.*; import gq.yigit.mycity.tools.WebRequest.responseListener; import gq.yigit.mycity.utility.UtilityMain; @@ -46,6 +51,7 @@ public class MainActivity extends AppCompatActivity RateFragment.OnFragmentInteractionListener, MapsFragment.OnFragmentInteractionListener, UtilityMain.OnFragmentInteractionListener, + TransitFragment.OnFragmentInteractionListener, OnFragmentInteractionListener, responseListener, imageListener { @@ -57,10 +63,13 @@ public class MainActivity extends AppCompatActivity private ImageView avatarView; private TextView userName; public static Activity mainActivity; + public static String apikey = "AIzaSyBuOC03IHPA_6TPnfk18b0SAgD1uge4-dk"; + @Override protected void onCreate(Bundle savedInstanceState) { Log.d("[BOOKMARK]","Started creating activity"); super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); @@ -77,7 +86,7 @@ public class MainActivity extends AppCompatActivity HashMap request = new HashMap<>(); request.put("username","efe"); request.put("password","12345"); - WebRequest login_manager = new WebRequest(url + "/login/",false,request); + WebRequest login_manager = new WebRequest(url + "/login/",false,request,0); login_manager.addListener(this); Log.d("[BOOKMARK]","Before executing login"); login_manager.execute(); @@ -163,7 +172,10 @@ public class MainActivity extends AppCompatActivity } else if (id == R.id.parking) { } else if (id == R.id.transit) { - + TransitFragment fragment = new TransitFragment(); + fragmentTransaction.replace(R.id.app_bar_main, fragment); + fragmentTransaction.commit(); + fragmentTransaction.addToBackStack(null); } else if (id == R.id.navigation) { MapsFragment fragment = new MapsFragment(); fragmentTransaction.replace(R.id.app_bar_main, fragment); @@ -205,7 +217,7 @@ public class MainActivity extends AppCompatActivity } - public void receivedResponse(boolean success,String response){ + public void receivedResponse(boolean success,String response,int reqid){ if(success) { try { JSONArray receivedData = new JSONArray(response); diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/RateFragment.java b/MyCity/app/src/main/java/gq/yigit/mycity/RateFragment.java index a9da9bc..6af38eb 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/RateFragment.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/RateFragment.java @@ -115,7 +115,7 @@ public class RateFragment extends Fragment implements WebRequest.responseListene Log.e("[ERROR]","An error occured with json!"); } request.put("note",comment); - WebRequest rate_sender = new WebRequest(url + "/rate", false, request); + WebRequest rate_sender = new WebRequest(url + "/rate", false, request,0); rate_sender.execute(); } } @@ -139,7 +139,7 @@ public class RateFragment extends Fragment implements WebRequest.responseListene HashMap request = new HashMap<>(); request.put("longitude",longitude); request.put("latitude",latitude); - WebRequest web_manager = new WebRequest(url + "/ratings",false,request); + WebRequest web_manager = new WebRequest(url + "/ratings",false,request,0); web_manager.addListener(this); web_manager.execute(); return rootView; @@ -175,7 +175,7 @@ public class RateFragment extends Fragment implements WebRequest.responseListene @Override - public void receivedResponse(boolean success, String response) { + public void receivedResponse(boolean success, String response,int id) { if(success){ try { ratings = new JSONArray(response); @@ -223,7 +223,7 @@ public class RateFragment extends Fragment implements WebRequest.responseListene private void downloadImg(int i) throws JSONException { ImageDownload downloader = new ImageDownload(); downloader.addListener(this); - downloader.execute(url + ((JSONObject) ratings.get(i)).get("img")); + downloader.execute(url + ((JSONObject) ratings.get(i)).get("type")); } diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/navigation/TransitFragment.java b/MyCity/app/src/main/java/gq/yigit/mycity/navigation/TransitFragment.java new file mode 100644 index 0000000..73acad3 --- /dev/null +++ b/MyCity/app/src/main/java/gq/yigit/mycity/navigation/TransitFragment.java @@ -0,0 +1,306 @@ +package gq.yigit.mycity.navigation; + +import android.content.Context; +import android.content.Intent; +import android.location.Location; +import android.location.LocationManager; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import com.google.android.gms.common.api.Status; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.libraries.places.api.Places; +import com.google.android.libraries.places.api.model.Place; +import com.google.android.libraries.places.api.model.RectangularBounds; +import com.google.android.libraries.places.api.net.PlacesClient; +import com.google.android.libraries.places.widget.Autocomplete; +import com.google.android.libraries.places.widget.AutocompleteActivity; +import com.google.android.libraries.places.widget.model.AutocompleteActivityMode; +import gq.yigit.mycity.R; +import gq.yigit.mycity.tools.FileActions; +import gq.yigit.mycity.tools.WebRequest; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.*; + +import static android.app.Activity.RESULT_CANCELED; +import static android.app.Activity.RESULT_OK; +import static gq.yigit.mycity.MainActivity.apikey; +import static gq.yigit.mycity.MainActivity.cntxt; + + +public class TransitFragment extends Fragment implements WebRequest.responseListener { + + + + + private OnFragmentInteractionListener mListener; + private OnRecyclerViewInteractionListener recyclerViewInteractionListener; + private TextView place_name; + private String[] place_data = {"","","",""}; + private PlacesClient placesClient; + private String url; + private String longitude; + private String latitude; + private RecyclerView recyclerView; + + public TransitFragment() { + // Required empty public constructor + } + + + public static TransitFragment newInstance(String param1, String param2) { + TransitFragment fragment = new TransitFragment(); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + View rootView = inflater.inflate(R.layout.fragment_transit, container, false); + + LinearLayout search_button = rootView.findViewById(R.id.search_layout); + search_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Places.initialize(getContext(), apikey); + + placesClient = Places.createClient(getContext()); + + int AUTOCOMPLETE_REQUEST_CODE = 1; + + List fields = Arrays.asList(Place.Field.ID, Place.Field.NAME,Place.Field.LAT_LNG); + + Intent intent = new Autocomplete.IntentBuilder( + AutocompleteActivityMode.FULLSCREEN, fields). + setLocationRestriction(RectangularBounds.newInstance(new LatLng(39.7281252,32.4848006),new LatLng(40.061707,32.9889204))) + .build(getContext()); + startActivityForResult(intent, AUTOCOMPLETE_REQUEST_CODE); + } + }); + place_name = rootView.findViewById(R.id.place_name); + recyclerView = rootView.findViewById(R.id.route_view); + try { + LocationManager locationManager = (LocationManager) + getContext().getSystemService(cntxt.LOCATION_SERVICE); + Location loc = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); + longitude = String.valueOf((double)loc.getLongitude()); + latitude = String.valueOf(loc.getLatitude()); + }catch (SecurityException e){ + Log.e("[ERROR]","An error occured with location permissions"); + } + return rootView; + } + + public void onButtonPressed(Uri uri) { + if (mListener != null) { + mListener.onFragmentInteraction(uri); + } + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (context instanceof OnFragmentInteractionListener) { + mListener = (OnFragmentInteractionListener) context; + } else { + throw new RuntimeException(context.toString() + + " must implement OnFragmentInteractionListener"); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mListener = null; + } + + public interface OnFragmentInteractionListener { + // TODO: Update argument type and name + void onFragmentInteraction(Uri uri); + } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == 1) { + if (resultCode == RESULT_OK) { + Place place = Autocomplete.getPlaceFromIntent(data); + place_data[0] = place.getName(); + place_data[1] = place.getId(); + Log.i("[INFO]", "Place: " + place.getName() + ", " + place.getId()); + place_name.setText(place_data[0]); + + place_data[2] = String.valueOf(place.getLatLng().latitude); + place_data[3] = String.valueOf(place.getLatLng().longitude); + + FileActions file_manager = new FileActions(); + url = file_manager.readFromFile(cntxt,"server.config").trim(); + + HashMap args = new HashMap<>(); + args.put("lat_usr",latitude); + args.put("lng_usr",longitude); + args.put("lat_dest",place_data[2]); + args.put("lng_dest",place_data[3]); + + WebRequest request = new WebRequest(url + "/transit",false, args,0); + request.addListener(this); + request.execute(); + + } else if (resultCode == AutocompleteActivity.RESULT_ERROR) { + Status status = Autocomplete.getStatusFromIntent(data); + Log.i("[INFO]", status.getStatusMessage()); + } else if (resultCode == RESULT_CANCELED) { + } + } + } + @Override + public void receivedResponse(boolean success,String response, int reqid){ + Log.i("[INFO]",response); + try{ + JSONObject travel = new JSONObject(response); + JSONArray routes = new JSONArray(travel.getString("routes")); + for(int i = 0; i< routes.length();i++){ + JSONObject route = new JSONObject(routes.getString(i)); + TransitContent.addItem(new TransitContent.TransitItem( + route.getString("name"), + (new JSONArray(route.getString("stops")).getString(0)), + (new JSONArray(route.getString("stops")).getString(1)), + (new JSONArray(route.getString("time")).getString(0)), + (new JSONArray(route.getString("time")).getString(1)), + "bus" + )); + } + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + recyclerView.setAdapter(new TransitAdapter(TransitContent.ITEMS, recyclerViewInteractionListener)); + }catch (JSONException e){ + Log.e("[ERROR]", "Received invalid response from public transport service!"); + } + } + + public interface OnRecyclerViewInteractionListener { + void OnRecyclerViewInteractionListener(TransitContent.TransitItem item); + } +} + +class TransitContent { + public static final List ITEMS = new ArrayList(); + + + public static final Map ITEM_MAP = new HashMap(); + public static void addItem(TransitItem item) { + ITEMS.add(item); + ITEM_MAP.put(item.endTime, item); + } + + + public static class TransitItem { + public final String lineNo; + public final String startName; + public final String endName; + public final String startTime; + public final String endTime; + public final String type; + + public TransitItem(String lineNo, String startName, String endName, String startTime, String endTime, String type) { + this.lineNo = lineNo; + this.startName = startName; + this.endName = endName; + this.startTime = startTime; + this.endTime = endTime; + this.type = type; + } + + } +} + +class TransitAdapter extends RecyclerView.Adapter{ + + private final List mValues; + private final TransitFragment.OnRecyclerViewInteractionListener mListener; + + public TransitAdapter(List items, TransitFragment.OnRecyclerViewInteractionListener listener) { + mValues = items; + mListener = listener; + } + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.transit_item, parent, false); + return new ViewHolder(view); + } + + @Override + public void onBindViewHolder(final ViewHolder holder, int position) { + + holder.mItem = mValues.get(position); + holder.stop1.setText(mValues.get(position).startName); + holder.stop2.setText(mValues.get(position).endName); + holder.time1.setText(mValues.get(position).startTime); + holder.time2.setText(mValues.get(position).endTime); + holder.line.setText(mValues.get(position).lineNo); + String type = mValues.get(position).type; + + if(type.equals("bus")){ + + }else if(type.equals("subway") || type.equals("ankaray")){ + + }else if(type.equals("walk")){} + + holder.mView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (null != mListener) { + mListener.OnRecyclerViewInteractionListener(holder.mItem); + } + } + }); + } + + @Override + public int getItemCount() { + return mValues.size(); + } + + public class ViewHolder extends RecyclerView.ViewHolder { + private final View mView; + private final TextView stop1; + private final TextView stop2; + private final ImageView type; + private final TextView line; + private final TextView time1; + private final TextView time2; + + private TransitContent.TransitItem mItem; + + private ViewHolder(View view) { + super(view); + mView = view; + stop1 = view.findViewById(R.id.stop1_addr); + stop2 = view.findViewById(R.id.stop2_addr); + time1 = view.findViewById(R.id.stop1_time); + time2 = view.findViewById(R.id.stop2_time); + line = view.findViewById(R.id.line_no); + type = view.findViewById(R.id.type_img); + } + + } +} diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/tools/WebRequest.java b/MyCity/app/src/main/java/gq/yigit/mycity/tools/WebRequest.java index 9c366f0..0c96385 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/tools/WebRequest.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/tools/WebRequest.java @@ -37,9 +37,9 @@ public class WebRequest extends AsyncTask { private HttpPost post_request; private HttpResponse response; private List listeners = new ArrayList<>(); + private int reqid = 0; - - public WebRequest(String url, boolean request_type, HashMap request_content){ + public WebRequest(String url, boolean request_type, HashMap request_content,int reqid){ client = AcceptAllSSLSocketFactory.getNewHttpClient(); @@ -61,6 +61,7 @@ public class WebRequest extends AsyncTask { }else{ post_request = new HttpPost(this.url); } + this.reqid = reqid; } protected String doInBackground(Void... params){ @@ -109,14 +110,14 @@ public class WebRequest extends AsyncTask { } protected void onPostExecute(String result){ for (responseListener hl : listeners) - hl.receivedResponse(!result.equals("Error"),result); + hl.receivedResponse(!result.equals("Error"),result,reqid); } public void addListener(responseListener toAdd) { listeners.add(toAdd); } public interface responseListener { - void receivedResponse(boolean success, String response); + void receivedResponse(boolean success, String response,int id); } } diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityElectricity.java b/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityElectricity.java index c3f0e17..32f7ca9 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityElectricity.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityElectricity.java @@ -69,7 +69,7 @@ public class UtilityElectricity extends Fragment implements WebRequest.responseL Log.e("[ERROR]","User data not correct"); } request.put("type","electricity"); - WebRequest login_manager = new WebRequest(url + "/resources/",false,request); + WebRequest login_manager = new WebRequest(url + "/resources/",false,request,0); login_manager.addListener(this); login_manager.execute(); @@ -106,7 +106,7 @@ public class UtilityElectricity extends Fragment implements WebRequest.responseL void onFragmentInteraction(Uri uri); } - public void receivedResponse(boolean success, String result){ + public void receivedResponse(boolean success, String result,int reqid){ if(success){ try{ electricityUsage = new JSONObject(result); diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityMain.java b/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityMain.java index d2f4d8b..8549b37 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityMain.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/utility/UtilityMain.java @@ -36,7 +36,7 @@ public class UtilityMain extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState);one_bus[i][j] + super.onCreate(savedInstanceState); } diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VoteFragment.java b/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VoteFragment.java index e558c34..e87331b 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VoteFragment.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VoteFragment.java @@ -75,7 +75,7 @@ public class VoteFragment extends Fragment implements responseListener, imageLis FileActions file_manager = new FileActions(); url = file_manager.readFromFile(getContext(),"server.config").trim(); String url_vote = url + "/votings/" + vote_id; - WebRequest data_request = new WebRequest(url_vote,true,new HashMap()); + WebRequest data_request = new WebRequest(url_vote,true,new HashMap(),0); data_request.addListener(this); data_request.execute(); cntxt = getContext(); @@ -110,7 +110,7 @@ public class VoteFragment extends Fragment implements responseListener, imageLis void onFragmentInteraction(Uri uri); } - public void receivedResponse(boolean success,String response){ + public void receivedResponse(boolean success,String response, int reqid){ Log.i("[INFO]",response); if(success){ try{ @@ -170,7 +170,7 @@ public class VoteFragment extends Fragment implements responseListener, imageLis }catch (JSONException e){ Log.e("[ERROR]","Cannot get user data"); } - WebRequest vote_request = new WebRequest(url+"/vote",false, params); + WebRequest vote_request = new WebRequest(url+"/vote",false, params,0); vote_request.execute(); }else{ Toast.makeText(cntxt,"Please selet a vote!",Toast.LENGTH_SHORT).show(); diff --git a/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VotesFragment.java b/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VotesFragment.java index 81d27eb..72051d0 100644 --- a/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VotesFragment.java +++ b/MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/VotesFragment.java @@ -69,7 +69,7 @@ public class VotesFragment extends Fragment implements responseListener, imageLi } FileActions file_manager = new FileActions(); url = (file_manager.readFromFile(context,"server.config")).trim(); - WebRequest web_manager = new WebRequest(url + "/votings/",true,new HashMap()); + WebRequest web_manager = new WebRequest(url + "/votings/",true,new HashMap(),0); web_manager.addListener(this); web_manager.execute(); } @@ -98,7 +98,7 @@ public class VotesFragment extends Fragment implements responseListener, imageLi void onListFragmentInteraction(VoteItem item); } - public void receivedResponse(boolean success, String response){ + public void receivedResponse(boolean success, String response,int id){ if(success) { try { diff --git a/MyCity/app/src/main/res/drawable-v24/magnifier.xml b/MyCity/app/src/main/res/drawable-v24/magnifier.xml index 225255c..94a2ab3 100644 --- a/MyCity/app/src/main/res/drawable-v24/magnifier.xml +++ b/MyCity/app/src/main/res/drawable-v24/magnifier.xml @@ -6,5 +6,5 @@ + android:fillColor="#717171" /> \ No newline at end of file diff --git a/MyCity/app/src/main/res/drawable/circle_shape.xml b/MyCity/app/src/main/res/drawable/circle_shape.xml new file mode 100644 index 0000000..d4ddca4 --- /dev/null +++ b/MyCity/app/src/main/res/drawable/circle_shape.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/MyCity/app/src/main/res/drawable/line_shape.xml b/MyCity/app/src/main/res/drawable/line_shape.xml new file mode 100644 index 0000000..4d77aea --- /dev/null +++ b/MyCity/app/src/main/res/drawable/line_shape.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/MyCity/app/src/main/res/drawable/search_shape.xml b/MyCity/app/src/main/res/drawable/search_shape.xml new file mode 100644 index 0000000..9e6d3bd --- /dev/null +++ b/MyCity/app/src/main/res/drawable/search_shape.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/MyCity/app/src/main/res/layout/fragment_main.xml b/MyCity/app/src/main/res/layout/fragment_main.xml index 2c1eec8..5e59c39 100644 --- a/MyCity/app/src/main/res/layout/fragment_main.xml +++ b/MyCity/app/src/main/res/layout/fragment_main.xml @@ -5,7 +5,6 @@ android:layout_height="match_parent" tools:context=".MainFragment"> - + + + + + + + + + \ No newline at end of file diff --git a/MyCity/app/src/main/res/layout/fragment_utility.xml b/MyCity/app/src/main/res/layout/fragment_utility.xml index 7a19e60..b5dcbd0 100644 --- a/MyCity/app/src/main/res/layout/fragment_utility.xml +++ b/MyCity/app/src/main/res/layout/fragment_utility.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".utility.UtilityMain" android:orientation="vertical" - android:layout_marginTop="55dp"> + android:layout_marginTop="@dimen/fragment_margin"> diff --git a/MyCity/app/src/main/res/layout/popup_confirmation.xml b/MyCity/app/src/main/res/layout/popup_confirmation.xml index fa9862f..6d1fae1 100644 --- a/MyCity/app/src/main/res/layout/popup_confirmation.xml +++ b/MyCity/app/src/main/res/layout/popup_confirmation.xml @@ -1,9 +1,10 @@ - + android:orientation="vertical" android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingBottom="15dp"> + android:layout_centerHorizontal="true" android:textColor="#000000" + android:layout_marginTop="20dp" + app:layout_constraintTop_toBottomOf="@+id/imageView" app:layout_constraintStart_toStartOf="parent" + android:layout_marginStart="8dp" android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0"/>