- filters added on explore mode
This commit is contained in:
parent
ce683b3191
commit
db4af0dc2e
4 changed files with 180 additions and 7 deletions
|
@ -8,6 +8,9 @@ import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
|
@ -36,6 +39,27 @@ public class ExploreFragment extends Fragment {
|
||||||
private List<Note> notes;
|
private List<Note> notes;
|
||||||
protected ListView list_notes;
|
protected ListView list_notes;
|
||||||
|
|
||||||
|
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 exploreFilters;
|
||||||
|
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 others = "Others";
|
||||||
|
private final String all = "All";
|
||||||
|
|
||||||
public ExploreFragment() {
|
public ExploreFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
@ -55,6 +79,79 @@ public class ExploreFragment extends Fragment {
|
||||||
noteListAdapter = new ListAdapter(parent, notes);
|
noteListAdapter = new ListAdapter(parent, notes);
|
||||||
|
|
||||||
|
|
||||||
|
dateFilter = (ImageButton) view.findViewById(R.id.explore_date_filter);
|
||||||
|
locationFilter = (ImageButton) view.findViewById(R.id.explore_location_filter);
|
||||||
|
userFilter = (ImageButton) view.findViewById(R.id.explore_user_filter);
|
||||||
|
|
||||||
|
map_small_filter = (Button) view.findViewById(R.id.explore_small_filter);
|
||||||
|
map_medium_filter = (Button) view.findViewById(R.id.explore_medium_filter);
|
||||||
|
map_large_filter = (Button) view.findViewById(R.id.explore_large_filter);
|
||||||
|
|
||||||
|
exploreFilters = (LinearLayout) view.findViewById(R.id.explore_filter_options);
|
||||||
|
|
||||||
|
dateFilter.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// Log.d(TAG, "" + v.getId());
|
||||||
|
if (dateFilterIsVisible) {
|
||||||
|
dateFilterIsVisible = false;
|
||||||
|
exploreFilters.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
exploreFilters.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;
|
||||||
|
exploreFilters.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
exploreFilters.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;
|
||||||
|
exploreFilters.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
exploreFilters.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(others);
|
||||||
|
map_large_filter.setText(all);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: choose a default filter for openning explore mode
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getAllNotes();
|
getAllNotes();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
|
|
@ -144,7 +144,6 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
||||||
dateFilter.setOnClickListener(new View.OnClickListener() {
|
dateFilter.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// Log.d(TAG, "" + v.getId());
|
|
||||||
if (dateFilterIsVisible) {
|
if (dateFilterIsVisible) {
|
||||||
dateFilterIsVisible = false;
|
dateFilterIsVisible = false;
|
||||||
mapFilters.setVisibility(View.GONE);
|
mapFilters.setVisibility(View.GONE);
|
||||||
|
|
|
@ -8,9 +8,86 @@
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<!-- TODO: Update blank fragment layout -->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
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/explore_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/explore_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/explore_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="gone"
|
||||||
|
android:id="@+id/explore_filter_options" >
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="filter 1"
|
||||||
|
android:id="@+id/explore_small_filter"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="filter 2"
|
||||||
|
android:id="@+id/explore_medium_filter"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="filter 3"
|
||||||
|
android:id="@+id/explore_large_filter"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/list_notes"
|
android:id="@+id/list_notes"
|
||||||
android:choiceMode="none" />
|
android:choiceMode="none" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:contextClickable="false"
|
android:contextClickable="false"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:visibility="invisible"
|
android:visibility="gone"
|
||||||
android:id="@+id/map_filter_options">
|
android:id="@+id/map_filter_options">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
Loading…
Reference in a new issue