|
@@ -2,6 +2,7 @@ package com.ynstkz.shitu.android.fragment;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
+import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
@@ -16,6 +17,7 @@ import com.common.library.pulltorefresh.PullToRefreshListView;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.ynstkz.shitu.android.R;
|
|
|
import com.ynstkz.shitu.android.activity.OrgDetailActivity;
|
|
|
+import com.ynstkz.shitu.android.adapter.OrgFilterListAdapter;
|
|
|
import com.ynstkz.shitu.android.adapter.OrgListAdapter;
|
|
|
import com.ynstkz.shitu.android.base.BaseFragment;
|
|
|
import com.ynstkz.shitu.android.bean.OrgItemBean;
|
|
@@ -28,6 +30,7 @@ import org.greenrobot.eventbus.Subscribe;
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.Bind;
|
|
@@ -50,6 +53,16 @@ public class OrgListFragment extends BaseFragment implements PullToRefreshBase.O
|
|
|
LinearLayout llFilterMain;
|
|
|
@Bind(R.id.ll_home_title)
|
|
|
LinearLayout llHomeTitle;
|
|
|
+ @Bind(R.id.ll_filter_nearby)
|
|
|
+ LinearLayout llFilterNearby;
|
|
|
+ @Bind(R.id.ll_filter_org)
|
|
|
+ LinearLayout llFilterOrg;
|
|
|
+ @Bind(R.id.ll_filter_order)
|
|
|
+ LinearLayout llFilterOrder;
|
|
|
+ @Bind(R.id.lv_filter_content)
|
|
|
+ ListView lvFilterContent;
|
|
|
+ @Bind(R.id.ll_filter_content)
|
|
|
+ LinearLayout llFilterContent;
|
|
|
|
|
|
private int pageNumber;
|
|
|
private List<OrgItemBean> listOrg;
|
|
@@ -91,6 +104,44 @@ public class OrgListFragment extends BaseFragment implements PullToRefreshBase.O
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ //附近
|
|
|
+ llFilterNearby.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ llFilterContent.setVisibility(View.VISIBLE);
|
|
|
+ List<String> orgFilterLocation = Arrays.asList(getResources().getStringArray(R.array.org_filter_location));
|
|
|
+ showFilterContent(orgFilterLocation);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //机构
|
|
|
+ llFilterOrg.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ llFilterContent.setVisibility(View.VISIBLE);
|
|
|
+ List<String> orgFilterLocation = Arrays.asList(getResources().getStringArray(R.array.org_filter_org));
|
|
|
+ showFilterContent(orgFilterLocation);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //排序
|
|
|
+ llFilterOrder.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ llFilterContent.setVisibility(View.VISIBLE);
|
|
|
+ List<String> orgFilterLocation = Arrays.asList(getResources().getStringArray(R.array.org_filter_order));
|
|
|
+ showFilterContent(orgFilterLocation);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //关闭筛选
|
|
|
+ llFilterContent.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ llFilterContent.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -156,6 +207,20 @@ public class OrgListFragment extends BaseFragment implements PullToRefreshBase.O
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 筛选内容
|
|
|
+ *
|
|
|
+ * @param listContent
|
|
|
+ */
|
|
|
+ private void showFilterContent(List<String> listContent) {
|
|
|
+ if (listContent == null || listContent.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ OrgFilterListAdapter orgFilterListAdapter = new OrgFilterListAdapter(getActivity(), listContent);
|
|
|
+ lvFilterContent.setAdapter(orgFilterListAdapter);
|
|
|
+ orgFilterListAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 显示和隐藏筛选view
|
|
|
*
|
|
|
* @param visibility
|
|
@@ -175,6 +240,18 @@ public class OrgListFragment extends BaseFragment implements PullToRefreshBase.O
|
|
|
getOrgList(longitude + "," + latitude);
|
|
|
}
|
|
|
|
|
|
+ // 返回键按下时会被调用
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ if (keyCode == event.KEYCODE_BACK
|
|
|
+ && event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
|
+ if(llFilterContent != null && llFilterContent.getVisibility() == View.VISIBLE){
|
|
|
+ llFilterContent.setVisibility(View.GONE);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onDestroyView() {
|
|
|
super.onDestroyView();
|