Merge branch 'master' of github.com:sagidayan/TheSocialNotework-Android
This commit is contained in:
commit
f7abe47671
7 changed files with 370 additions and 102 deletions
|
@ -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<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() {
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -101,8 +118,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=<USER_ID>
|
||||
// The New "Add Button"
|
||||
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
|
||||
|
@ -359,7 +426,7 @@ public class PersonalFragment extends Fragment {
|
|||
date.setText(note.getDate());
|
||||
time.setText(note.getTime());
|
||||
location.setText(note.getAddress());
|
||||
if (likes != null) likes.setText("" + note.getLikes());
|
||||
if(likes !=null )likes.setText("" + note.getLikes());
|
||||
// tags.setText("Tags: "+ note.getTags().toString());
|
||||
permission.setText("" + (note.isPublic() ? "Public" : "Private"));
|
||||
Utils.URLtoImageView(avatar, note.getAvatar());
|
||||
|
@ -383,7 +450,6 @@ public class PersonalFragment extends Fragment {
|
|||
delNote.put("uid", userId);
|
||||
delNote.put("nid", note.getId());
|
||||
VolleyUtilSingleton.getInstance(getActivity()).post(BASE_URL + "/note/delete", delNote, Utils.deleteNoteSuccessListener, Utils.genericErrorListener);
|
||||
activity.getUser().setNumber_of_notes(activity.getUser().getNumber_of_notes()-1);
|
||||
listOfNotes.remove(position);
|
||||
|
||||
} catch (JSONException e) {
|
||||
|
|
BIN
app/src/main/res/drawable/location_filter.png
Normal file
BIN
app/src/main/res/drawable/location_filter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
BIN
app/src/main/res/drawable/users_filter.png
Normal file
BIN
app/src/main/res/drawable/users_filter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 354 B |
|
@ -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">
|
||||
|
||||
</fragment>
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/hello_blank_fragment" />
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
|
|
|
@ -18,31 +18,71 @@
|
|||
android:layout_marginBottom="5dp">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.1"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ps_filters_textview"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Filters and Shit"
|
||||
android:layout_weight="0.8"/>
|
||||
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/spinner"
|
||||
android:spinnerMode="dropdown" />
|
||||
android:contextClickable="false" >
|
||||
|
||||
<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>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/ps_list_listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.8" />
|
||||
android:layout_weight="0.8"
|
||||
android:layout_marginTop="10dp" />
|
||||
</LinearLayout>
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="70dp"
|
||||
|
@ -14,7 +15,8 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.6">
|
||||
android:layout_weight="0.6"
|
||||
android:layout_marginLeft="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -99,7 +101,8 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="1">
|
||||
android:weightSum="1"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
|
|
Loading…
Reference in a new issue