- filters added on map and personal space

- note view mini modified
This commit is contained in:
Matan Bar Yosef 2016-07-09 18:20:13 +03:00
parent c2fdbc6a22
commit 688602529a
7 changed files with 293 additions and 24 deletions

View file

@ -21,8 +21,10 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -65,6 +67,27 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
private MainActivity mainActivity; private MainActivity mainActivity;
private final int MAX_ZOOM = 16, MIN_ZOOM = 9, DEFAULT_ZOOM = 12; private final int MAX_ZOOM = 16, MIN_ZOOM = 9, DEFAULT_ZOOM = 12;
private HashMap<Marker, Note> eventMarkerMap; private HashMap<Marker, Note> 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() { public GmapFragment() {
@ -89,7 +112,6 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mainActivity = (MainActivity) getActivity(); mainActivity = (MainActivity) getActivity();
gpsUtils = mainActivity.getGPSUtils(); gpsUtils = mainActivity.getGPSUtils();
} }
@ -98,6 +120,8 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // 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); return inflater.inflate(R.layout.fragment_gmap, container, false);
} }
@ -106,6 +130,76 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
SupportMapFragment frag = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapFragment); SupportMapFragment frag = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapFragment);
frag.getMapAsync(this); 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 GoogleMap.InfoWindowAdapter infoWindowAdapter = new GoogleMap.InfoWindowAdapter() { // Use default InfoWindow frame
@Override @Override
public View getInfoWindow(Marker args) { public View getInfoWindow(Marker args) {

View file

@ -27,6 +27,7 @@ import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Switch; import android.widget.Switch;
import android.widget.TextView; import android.widget.TextView;
@ -62,6 +63,22 @@ public class PersonalFragment extends Fragment {
private final int FINE_PERM = 0, CAMERA_PERM = 1; 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() { public PersonalFragment() {
// Required empty public constructor // Required empty public constructor
} }
@ -98,8 +115,58 @@ public class PersonalFragment extends Fragment {
noteList.setAdapter(noteListAdapter); noteList.setAdapter(noteListAdapter);
noteList.setOnItemClickListener(new ItemClickedListener()); noteList.setOnItemClickListener(new ItemClickedListener());
Utils.showLoadingDialog(getActivity(), "Fetching..", "getting your notes"); 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(); getAllNotes();
//https://thesocialnotework-api.appspot.com/api/note/all?uid=<USER_ID> //https://thesocialnotework-api.appspot.com/api/note/all?uid=<USER_ID>
// The New "Add Button" // The New "Add Button"
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab); FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

View file

@ -9,13 +9,79 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/mapFragment" android:id="@+id/mapFragment"
class="com.google.android.gms.maps.SupportMapFragment"> class="com.google.android.gms.maps.SupportMapFragment"
android:layout_marginTop="50dp">
</fragment> </fragment>
<TextView <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:text="@string/hello_blank_fragment" /> android:paddingTop="15dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contextClickable="false">
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/map_date_filter"
android:layout_weight="1"
android:src="@drawable/date_icon"
android:scaleType="fitCenter" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/map_location_filter"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:scaleType="fitCenter"
android:src="@drawable/location_filter" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/map_user_filter"
android:layout_weight="1"
android:scaleType="fitCenter"
android:src="@drawable/users_filter" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contextClickable="false"
android:layout_marginTop="5dp"
android:visibility="invisible"
android:id="@+id/map_filter_options">
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text="filter 1"
android:id="@+id/map_small_filter"
android:layout_weight="1" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text="filter 2"
android:id="@+id/map_medium_filter"
android:layout_weight="1" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text="filter 3"
android:id="@+id/map_large_filter"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</FrameLayout> </FrameLayout>

View file

@ -18,31 +18,71 @@
android:layout_marginBottom="5dp"> android:layout_marginBottom="5dp">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content">
android:layout_weight="0.1"
android:orientation="horizontal">
<TextView <LinearLayout
android:id="@+id/ps_filters_textview" android:orientation="horizontal"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Filters and Shit"
android:layout_weight="0.8"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/spinner" android:contextClickable="false" >
android:spinnerMode="dropdown" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/personalSpace_date_filter"
android:layout_weight="1"
android:src="@drawable/date_icon"
android:scaleType="fitCenter" />
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/personalSpace_premission_filter"
android:layout_weight="1"
android:scaleType="fitCenter"
android:src="@drawable/permission_icon" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contextClickable="false"
android:layout_marginTop="5dp"
android:visibility="invisible"
android:id="@+id/personalSpace_filter_options" >
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text="filter 1"
android:id="@+id/personalSpace_small_filter"
android:layout_weight="1" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text="filter 2"
android:id="@+id/personalSpace_medium_filter"
android:layout_weight="1" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text="filter 3"
android:id="@+id/personalSpace_large_filter"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<ListView <ListView
android:id="@+id/ps_list_listview" android:id="@+id/ps_list_listview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="0.8" /> android:layout_weight="0.8"
android:layout_marginTop="10dp" />
</LinearLayout> </LinearLayout>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/fab" android:id="@+id/fab"

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent" android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:padding="5dp">
<TextView <TextView
android:layout_width="70dp" android:layout_width="70dp"
@ -14,7 +15,8 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.6"> android:layout_weight="0.6"
android:layout_marginLeft="15dp">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -99,7 +101,8 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:weightSum="1"> android:weightSum="1"
android:gravity="center">
<ImageView <ImageView
android:layout_width="40dp" android:layout_width="40dp"