|
@@ -22,6 +22,7 @@ import android.widget.RadioGroup;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
+import com.bigkoo.pickerview.OptionsPickerView;
|
|
|
import com.netease.nim.uikit.common.ui.popupmenu.PopupMenuItem;
|
|
|
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
|
|
import com.netease.nim.uikit.session.activity.BaseMessageActivity;
|
|
@@ -30,6 +31,7 @@ import com.sheishuo.app.R;
|
|
|
import com.sheishuo.app.SheishuoCache;
|
|
|
import com.sheishuo.app.cache.AccountCache;
|
|
|
import com.sheishuo.app.common.beans.TradeBean;
|
|
|
+import com.sheishuo.app.common.util.location.CityDataHelper;
|
|
|
import com.sheishuo.app.common.util.net.INet;
|
|
|
import com.sheishuo.app.common.util.net.NetImpl;
|
|
|
import com.sheishuo.app.common.util.net.ResponseCallback;
|
|
@@ -93,7 +95,7 @@ public class TradeListFragment extends MainTabFragment {
|
|
|
public String priorityBeanId;
|
|
|
|
|
|
|
|
|
- private String location = AccountCache.getAccount().getCity() + AccountCache.getAccount().getDistrict();
|
|
|
+ private String location;
|
|
|
private INet net = new NetImpl();
|
|
|
|
|
|
@Override
|
|
@@ -108,7 +110,6 @@ public class TradeListFragment extends MainTabFragment {
|
|
|
popupWindow = new TradeSortPopupWindow(getActivity());
|
|
|
findViews();
|
|
|
init();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -126,6 +127,9 @@ public class TradeListFragment extends MainTabFragment {
|
|
|
private void init(){
|
|
|
initToolbar();
|
|
|
parent.setSupportActionBar(toolbar);
|
|
|
+
|
|
|
+ setLocationTxt(AccountCache.getAccount().getCity() + AccountCache.getAccount().getDistrict());
|
|
|
+
|
|
|
layoutManager = new LinearLayoutManager(getActivity());
|
|
|
loadTradeList(TYPE_TO_LOAD, PAGE_TO_LOAD);
|
|
|
|
|
@@ -149,18 +153,19 @@ public class TradeListFragment extends MainTabFragment {
|
|
|
leftIcon.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- Intent intent = new Intent(getActivity(), LocationSelectActivity.class);
|
|
|
- startActivityForResult(intent, 0);
|
|
|
+// Intent intent = new Intent(getActivity(), LocationSelectActivity.class);
|
|
|
+// startActivityForResult(intent, 0);
|
|
|
+ showLocationSelect();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
toolbarLeftTxt = new TextView(getContext());
|
|
|
- toolbarLeftTxt.setText(location);
|
|
|
toolbarLeftTxt.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- Intent intent = new Intent(getActivity(), LocationSelectActivity.class);
|
|
|
- startActivityForResult(intent, 0);
|
|
|
+// Intent intent = new Intent(getActivity(), LocationSelectActivity.class);
|
|
|
+// startActivityForResult(intent, 0);
|
|
|
+ showLocationSelect();
|
|
|
}
|
|
|
});
|
|
|
toolbar.setLeftItems(new View[]{leftIcon, toolbarLeftTxt});
|
|
@@ -345,20 +350,20 @@ public class TradeListFragment extends MainTabFragment {
|
|
|
loadTradeList(0, 1);
|
|
|
}
|
|
|
}
|
|
|
- else if (LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE == resultCode) {
|
|
|
- String province = data.getExtras().getString(LocationSelectActivity.LOCATION_PROVINCE);
|
|
|
- String city = data.getExtras().getString(LocationSelectActivity.LOCATION_CITY);
|
|
|
- String area = data.getExtras().getString(LocationSelectActivity.LOCATION_AREA);
|
|
|
- updateAccountLocation(province, city, area);
|
|
|
-
|
|
|
- location = city + area;
|
|
|
- if (location.length() > 6) {
|
|
|
- location = location.substring(0, 6) + "...";
|
|
|
- }
|
|
|
-
|
|
|
- if(toolbarLeftTxt != null)
|
|
|
- toolbarLeftTxt.setText(location);
|
|
|
- }
|
|
|
+// else if (LocationSelectActivity.LOCATION_SELECTED_RESULT_CODE == resultCode) {
|
|
|
+// String province = data.getExtras().getString(LocationSelectActivity.LOCATION_PROVINCE);
|
|
|
+// String city = data.getExtras().getString(LocationSelectActivity.LOCATION_CITY);
|
|
|
+// String area = data.getExtras().getString(LocationSelectActivity.LOCATION_AREA);
|
|
|
+// updateAccountLocation(province, city, area);
|
|
|
+//
|
|
|
+// location = city + area;
|
|
|
+// if (location.length() > 6) {
|
|
|
+// location = location.substring(0, 6) + "...";
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(toolbarLeftTxt != null)
|
|
|
+// toolbarLeftTxt.setText(location);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -526,4 +531,31 @@ public class TradeListFragment extends MainTabFragment {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void showLocationSelect()
|
|
|
+ {
|
|
|
+ CityDataHelper.showPickerView(getContext(), new OptionsPickerView.OnOptionsSelectListener() {
|
|
|
+ @Override
|
|
|
+ public void onOptionsSelect(int options1, int options2, int options3, View v) {
|
|
|
+ String province = CityDataHelper.getAllProvince().get(options1);
|
|
|
+ String city = CityDataHelper.getAllCity().get(options1).get(options2);
|
|
|
+ String area = CityDataHelper.getAllDistrict().get(options1).get(options2).get(options3);
|
|
|
+
|
|
|
+ updateAccountLocation(province, city, area);
|
|
|
+ setLocationTxt(city+area);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setLocationTxt(String value)
|
|
|
+ {
|
|
|
+ location = value;
|
|
|
+ if (location.length() > 6) {
|
|
|
+ location = location.substring(0, 6) + "...";
|
|
|
+ }
|
|
|
+
|
|
|
+ if(toolbarLeftTxt != null)
|
|
|
+ toolbarLeftTxt.setText(location);
|
|
|
+ }
|
|
|
}
|