From 688602529ab4319e124d54f9b792d609ee69e95e Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 9 Jul 2016 18:20:13 +0300 Subject: [PATCH] - filters added on map and personal space - note view mini modified --- .../sagi/thesocialnotework/GmapFragment.java | 97 +++++++++++++++++- .../thesocialnotework/PersonalFragment.java | 67 ++++++++++++ app/src/main/res/drawable/location_filter.png | Bin 0 -> 318 bytes app/src/main/res/drawable/users_filter.png | Bin 0 -> 354 bytes app/src/main/res/layout/fragment_gmap.xml | 74 ++++++++++++- app/src/main/res/layout/fragment_personal.xml | 70 ++++++++++--- app/src/main/res/layout/note_view_mini.xml | 9 +- 7 files changed, 293 insertions(+), 24 deletions(-) create mode 100644 app/src/main/res/drawable/location_filter.png create mode 100644 app/src/main/res/drawable/users_filter.png diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java index 2ec294e..15c9f48 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java @@ -21,8 +21,10 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; +import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -65,6 +67,27 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback { private MainActivity mainActivity; private final int MAX_ZOOM = 16, MIN_ZOOM = 9, DEFAULT_ZOOM = 12; private HashMap eventMarkerMap; + private ImageButton dateFilter; + private ImageButton locationFilter; + private ImageButton userFilter; + private Button map_small_filter; + private Button map_medium_filter; + private Button map_large_filter; + private LinearLayout mapFilters; + private boolean dateFilterIsVisible = false; + private boolean locationFilterIsVisible = false; + private boolean userFilterIsVisible = false; + + private final String day = "24 hours"; + private final String week = "Week"; + private final String month = "Month"; + private final String hundredMeters = "100 meters"; + private final String kilometer = "1 Km"; + private final String threeKilometer = "3 Km"; + private final String mine = "mine"; + private final String everyoneButMine = "all w/o me"; + private final String everyone = "everyone's"; + public GmapFragment() { @@ -89,7 +112,6 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainActivity = (MainActivity) getActivity(); - gpsUtils = mainActivity.getGPSUtils(); } @@ -98,6 +120,8 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_personal, container, false); + return inflater.inflate(R.layout.fragment_gmap, container, false); } @@ -106,6 +130,76 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback { super.onViewCreated(view, savedInstanceState); SupportMapFragment frag = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapFragment); frag.getMapAsync(this); + + dateFilter = (ImageButton) view.findViewById(R.id.map_date_filter); + locationFilter = (ImageButton) view.findViewById(R.id.map_location_filter); + userFilter = (ImageButton) view.findViewById(R.id.map_user_filter); + + map_small_filter = (Button) view.findViewById(R.id.map_small_filter); + map_medium_filter = (Button) view.findViewById(R.id.map_medium_filter); + map_large_filter = (Button) view.findViewById(R.id.map_large_filter); + + mapFilters = (LinearLayout) view.findViewById(R.id.map_filter_options); + + dateFilter.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (dateFilterIsVisible) { + dateFilterIsVisible = false; + mapFilters.setVisibility(View.INVISIBLE); + } else { + mapFilters.setVisibility(View.VISIBLE); + dateFilterIsVisible = true; + locationFilterIsVisible = false; + userFilterIsVisible = false; + + // set text button in the right filter string + map_small_filter.setText(day); + map_medium_filter.setText(week); + map_large_filter.setText(month); + } + } + }); + + locationFilter.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (locationFilterIsVisible) { + locationFilterIsVisible = false; + mapFilters.setVisibility(View.INVISIBLE); + } else { + mapFilters.setVisibility(View.VISIBLE); + locationFilterIsVisible = true; + dateFilterIsVisible = false; + userFilterIsVisible = false; + + // set text button in the right filter string + map_small_filter.setText(hundredMeters); + map_medium_filter.setText(kilometer); + map_large_filter.setText(threeKilometer); + } + } + }); + + userFilter.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (userFilterIsVisible) { + userFilterIsVisible = false; + mapFilters.setVisibility(View.INVISIBLE); + } else { + mapFilters.setVisibility(View.VISIBLE); + userFilterIsVisible = true; + dateFilterIsVisible = false; + locationFilterIsVisible = false; + + // set text button in the right filter string + map_small_filter.setText(mine); + map_medium_filter.setText(everyoneButMine); + map_large_filter.setText(everyone); + } + } + }); } @@ -162,7 +256,6 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback { } - GoogleMap.InfoWindowAdapter infoWindowAdapter = new GoogleMap.InfoWindowAdapter() { // Use default InfoWindow frame @Override public View getInfoWindow(Marker args) { diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java index 519ab0f..2830ad8 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java @@ -27,6 +27,7 @@ import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Switch; import android.widget.TextView; @@ -62,6 +63,22 @@ public class PersonalFragment extends Fragment { private final int FINE_PERM = 0, CAMERA_PERM = 1; + private ImageButton dateFilter; + private ImageButton userFilter; + private Button map_small_filter; + private Button map_medium_filter; + private Button map_large_filter; + private LinearLayout personalSpaceFilters; + private boolean dateFilterIsVisible = false; + private boolean userFilterIsVisible = false; + + private final String day = "24 hours"; + private final String week = "Week"; + private final String month = "Month"; + private final String privateNote = "Private"; + private final String publicNote = "Public"; + private final String privateAndPublic = "All"; + public PersonalFragment() { // Required empty public constructor } @@ -98,8 +115,58 @@ public class PersonalFragment extends Fragment { noteList.setAdapter(noteListAdapter); noteList.setOnItemClickListener(new ItemClickedListener()); Utils.showLoadingDialog(getActivity(), "Fetching..", "getting your notes"); + + dateFilter = (ImageButton) view.findViewById(R.id.personalSpace_date_filter); + userFilter = (ImageButton) view.findViewById(R.id.personalSpace_premission_filter); + + map_small_filter = (Button) view.findViewById(R.id.personalSpace_small_filter); + map_medium_filter = (Button) view.findViewById(R.id.personalSpace_medium_filter); + map_large_filter = (Button) view.findViewById(R.id.personalSpace_large_filter); + + personalSpaceFilters = (LinearLayout) view.findViewById(R.id.personalSpace_filter_options); + + dateFilter.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (dateFilterIsVisible) { + dateFilterIsVisible = false; + personalSpaceFilters.setVisibility(View.INVISIBLE); + } else { + personalSpaceFilters.setVisibility(View.VISIBLE); + dateFilterIsVisible = true; + userFilterIsVisible = false; + + // set text button in the right filter string + map_small_filter.setText(day); + map_medium_filter.setText(week); + map_large_filter.setText(month); + } + } + }); + + userFilter.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (userFilterIsVisible) { + userFilterIsVisible = false; + personalSpaceFilters.setVisibility(View.INVISIBLE); + } else { + personalSpaceFilters.setVisibility(View.VISIBLE); + userFilterIsVisible = true; + dateFilterIsVisible = false; + + // set text button in the right filter string + map_small_filter.setText(privateNote); + map_medium_filter.setText(publicNote); + map_large_filter.setText(privateAndPublic); + } + } + }); + + // get all notes according to some default filter ? // TODO: Aran? getAllNotes(); + //https://thesocialnotework-api.appspot.com/api/note/all?uid= // The New "Add Button" FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab); diff --git a/app/src/main/res/drawable/location_filter.png b/app/src/main/res/drawable/location_filter.png new file mode 100644 index 0000000000000000000000000000000000000000..de879d37a15015d202ce7517949171cdaee9f63b GIT binary patch literal 318 zcmV-E0m1%>P)?(Iq z_ML3TxPpS?_|uFaWMSI_5*S2Qe!+(Q{G%Azuo25H5l$Dfr7xCzCW9$t+X0SY(lLCf zM>NJ_%3Wd^Ks3*B7X$nFMLu(g?tFAzAeeT<#9wH7KnfFxscq~mSZYe3Q;NGklC-x(j^tFiibQBvOYVi)J%wa0r(JI2TGk2zw9%B@6pgu1y{1q z|H)+l^Ju86lBVnK={rKED|;r-?WE(SZx$Xn=wE6$<*K{JhORkn3x^F%d=awV>-b9t zjHN=b%7 literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/fragment_gmap.xml b/app/src/main/res/layout/fragment_gmap.xml index c0a1fc9..c6018ba 100644 --- a/app/src/main/res/layout/fragment_gmap.xml +++ b/app/src/main/res/layout/fragment_gmap.xml @@ -9,13 +9,79 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/mapFragment" - class="com.google.android.gms.maps.SupportMapFragment"> + class="com.google.android.gms.maps.SupportMapFragment" + android:layout_marginTop="50dp"> - + android:layout_height="wrap_content" + android:paddingTop="15dp"> + + + + + + + + + + + + +