|
|
@@ -4,11 +4,15 @@ import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.Html;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
import android.view.WindowManager;
|
|
|
+import android.view.animation.Animation;
|
|
|
+import android.view.animation.LinearInterpolator;
|
|
|
+import android.view.animation.RotateAnimation;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.ListView;
|
|
|
@@ -17,6 +21,7 @@ import android.widget.SimpleAdapter;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.common.LogUtil;
|
|
|
+import com.common.data.CalendarUtil;
|
|
|
import com.common.data.DateFormatUtil;
|
|
|
import com.common.data.TextUtil;
|
|
|
import com.common.system.DisplayUtil;
|
|
|
@@ -24,6 +29,7 @@ import com.core.api.wxapi.ApiPlatform;
|
|
|
import com.core.api.wxapi.ApiUtils;
|
|
|
import com.core.app.Constants;
|
|
|
import com.core.base.OABaseActivity;
|
|
|
+import com.core.utils.time.wheel.DateTimePicker;
|
|
|
import com.core.widget.MyListView;
|
|
|
import com.core.widget.view.MyGridView;
|
|
|
import com.modular.apputils.activity.BillInputActivity;
|
|
|
@@ -67,7 +73,8 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
private CustomerListAdapter mCustomerCareAdapter;//客户关怀适配器
|
|
|
private EasyBaseAdapter mVisitAdapter;//拜访记录
|
|
|
|
|
|
- private PopupWindow menuPopWindow;
|
|
|
+ private PopupWindow menuPopWindow;
|
|
|
+ private RotateAnimation mRotateAnimation;//动画
|
|
|
|
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
@@ -77,7 +84,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
|
|
|
@Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
- if (item.getItemId()==R.id.add_item){
|
|
|
+ if (item.getItemId() == R.id.add_item) {
|
|
|
showPopupWindow(getWindow().findViewById(R.id.add_item));
|
|
|
}
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
@@ -155,18 +162,32 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
return R.layout.item_customer_manage_add;
|
|
|
}
|
|
|
});
|
|
|
+ showCustomerTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YM));
|
|
|
+
|
|
|
mCustomerManagePresenter = new CustomerManagePresenter(ct, this);
|
|
|
mCustomerManagePresenter.loadAllData();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private Animation getImgAnimation() {
|
|
|
+ if (mRotateAnimation == null) {
|
|
|
+ mRotateAnimation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
|
|
|
+ LinearInterpolator lin = new LinearInterpolator();
|
|
|
+ mRotateAnimation.setInterpolator(lin);
|
|
|
+ mRotateAnimation.setDuration(1000);//设置动画持续时间
|
|
|
+ mRotateAnimation.setRepeatCount(-1);//设置重复次数
|
|
|
+ mRotateAnimation.setFillAfter(true);//动画执行完后是否停留在执行完的状态
|
|
|
+ mRotateAnimation.setStartOffset(10);//执行前的等待时间
|
|
|
+ }
|
|
|
+ return mRotateAnimation;
|
|
|
+ }
|
|
|
|
|
|
public void showPopupWindow(View parent) {
|
|
|
if (menuPopWindow == null) {
|
|
|
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
View view = layoutInflater.inflate(R.layout.pop_crm_list, null);
|
|
|
- ListView plist = view.findViewById(R.id.mList);
|
|
|
+ ListView plist = view.findViewById(R.id.mList);
|
|
|
SimpleAdapter adapter = new SimpleAdapter(ct, getPopData(),
|
|
|
R.layout.item_pop_list, new String[]{"item_name"}, new int[]{R.id.tv_item_name});
|
|
|
plist.setAdapter(adapter);
|
|
|
@@ -174,14 +195,14 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
toAddPager(position);
|
|
|
- if(menuPopWindow!=null){
|
|
|
+ if (menuPopWindow != null) {
|
|
|
menuPopWindow.dismiss();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- menuPopWindow =new PopupWindow(view);
|
|
|
- menuPopWindow.setWidth(DisplayUtil.dip2px(ct,140));
|
|
|
- menuPopWindow.setHeight(DisplayUtil.dip2px(ct,160));
|
|
|
+ menuPopWindow = new PopupWindow(view);
|
|
|
+ menuPopWindow.setWidth(DisplayUtil.dip2px(ct, 140));
|
|
|
+ menuPopWindow.setHeight(DisplayUtil.dip2px(ct, 160));
|
|
|
}
|
|
|
// 使其聚集
|
|
|
menuPopWindow.setFocusable(true);
|
|
|
@@ -197,12 +218,13 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
// 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
|
|
|
menuPopWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.top_bubble));
|
|
|
// 显示的位置为:屏幕的宽度的一半-PopupWindow的高度的一半
|
|
|
- menuPopWindow.showAsDropDown(parent, -DisplayUtil.dip2px(ct,50), 0);
|
|
|
+ menuPopWindow.showAsDropDown(parent, -DisplayUtil.dip2px(ct, 50), 0);
|
|
|
}
|
|
|
+
|
|
|
private List<Map<String, Object>> getPopData() {
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("item_name","正式客户");
|
|
|
+ map.put("item_name", "正式客户");
|
|
|
list.add(map);
|
|
|
|
|
|
map = new HashMap<>();
|
|
|
@@ -210,11 +232,11 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
list.add(map);
|
|
|
|
|
|
map = new HashMap<>();
|
|
|
- map.put("item_name","客户联系人");
|
|
|
+ map.put("item_name", "客户联系人");
|
|
|
list.add(map);
|
|
|
|
|
|
map = new HashMap<>();
|
|
|
- map.put("item_name","拜访报告");
|
|
|
+ map.put("item_name", "拜访报告");
|
|
|
list.add(map);
|
|
|
return list;
|
|
|
}
|
|
|
@@ -282,7 +304,19 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
public void onClick(View view) {
|
|
|
int id = view.getId();
|
|
|
if (R.id.showCustomerTv == id) {
|
|
|
- //客户看板时间
|
|
|
+ showDataSelect();
|
|
|
+ } else if (showCustomerRefIv == view || forgetCustomerRefIv == view || customerCareRefIv == view || visitRefIv == view) {
|
|
|
+ view.setAnimation(getImgAnimation());
|
|
|
+ view.startAnimation(getImgAnimation());
|
|
|
+ if (showCustomerRefIv == view) {
|
|
|
+ mCustomerManagePresenter.loadShowCustomerItems(showCustomerTv.getText().toString());
|
|
|
+ } else if (forgetCustomerRefIv == view) {
|
|
|
+ mCustomerManagePresenter.loadForgetCustomer();
|
|
|
+ } else if (customerCareRefIv == view) {
|
|
|
+ mCustomerManagePresenter.loadCustomerCare();
|
|
|
+ } else if (visitRefIv == view) {
|
|
|
+ mCustomerManagePresenter.loadVisitStatistics();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -299,32 +333,50 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
};
|
|
|
|
|
|
|
|
|
+ private void showDataSelect() {
|
|
|
+ DateTimePicker picker = new DateTimePicker(this, DateTimePicker.YEAR_MONTH);
|
|
|
+ picker.setRange(CalendarUtil.getYear() - 10, CalendarUtil.getYear() + 10);
|
|
|
+ picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
|
|
|
+ picker.setOnDateTimePickListener(new DateTimePicker.OnYearMonthPickListener() {
|
|
|
+ @Override
|
|
|
+ public void onDateTimePicked(String year, String month, String hour, String minute) {
|
|
|
+ if (!TextUtils.isEmpty(year) && !TextUtils.isEmpty(month)) {
|
|
|
+ showCustomerTv.setText(year + "-" + month);
|
|
|
+ mCustomerManagePresenter.loadShowCustomerItems(showCustomerTv.getText().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ picker.show();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void toAddPager(int position) {
|
|
|
- LogUtil.i("gong","position="+position);
|
|
|
+ LogUtil.i("gong", "position=" + position);
|
|
|
String mCaller = "";
|
|
|
String mTitle = "";
|
|
|
int mId = 0;
|
|
|
- Class clazz=null;
|
|
|
+ Class clazz = null;
|
|
|
switch (position) {
|
|
|
case 0:
|
|
|
mCaller = "Customer!Base";
|
|
|
mTitle = "正式客户";
|
|
|
- clazz=CustomerBillInputActivity.class;
|
|
|
+ clazz = CustomerBillInputActivity.class;
|
|
|
break;
|
|
|
case 1:
|
|
|
mCaller = "PreCustomer";
|
|
|
mTitle = "预录入客户";
|
|
|
- clazz=CustomerBillInputActivity.class;
|
|
|
+ clazz = CustomerBillInputActivity.class;
|
|
|
break;
|
|
|
case 2:
|
|
|
mCaller = "Contact";
|
|
|
mTitle = "客户联系人";
|
|
|
- clazz=BillInputActivity.class;
|
|
|
+ clazz = BillInputActivity.class;
|
|
|
break;
|
|
|
case 3:
|
|
|
mCaller = "VisitRecord";
|
|
|
mTitle = "拜访报告";
|
|
|
- clazz=BillInputActivity.class;
|
|
|
+ clazz = BillInputActivity.class;
|
|
|
break;
|
|
|
}
|
|
|
startActivity(new Intent(ct, clazz)
|
|
|
@@ -346,6 +398,8 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
|
|
|
@Override
|
|
|
public void setShowCustomerAdapter(List<EasyBaseModel> models) {
|
|
|
+
|
|
|
+ showCustomerRefIv.setAnimation(null);
|
|
|
showCustomerRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
|
|
|
if (showCustomerAdapter == null) {
|
|
|
showCustomerAdapter = new EasyBaseAdapter(ct, models) {
|
|
|
@@ -385,6 +439,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
|
|
|
@Override
|
|
|
public void setForgetCustomerAdapter(List<EasyBaseModel> models) {
|
|
|
+ forgetCustomerRefIv.setAnimation(null);
|
|
|
forgetCustomerRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
|
|
|
if (mCustomerForgetAdapter == null) {
|
|
|
mCustomerForgetAdapter = new CustomerListAdapter(ct, models, 1);
|
|
|
@@ -396,6 +451,8 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
|
|
|
@Override
|
|
|
public void setCustomerCareAdapter(List<EasyBaseModel> models) {
|
|
|
+
|
|
|
+ customerCareRefIv.setAnimation(null);
|
|
|
customerCareRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
|
|
|
if (mCustomerCareAdapter == null) {
|
|
|
mCustomerCareAdapter = new CustomerListAdapter(ct, models, 2);
|
|
|
@@ -407,6 +464,7 @@ public class CustomerManageActivity extends OABaseActivity implements ICustomerM
|
|
|
|
|
|
@Override
|
|
|
public void setVisitAdapter(List<EasyBaseModel> models) {
|
|
|
+ visitRefIv.setAnimation(null);
|
|
|
visitRefTimeTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
|
|
|
if (mVisitAdapter == null) {
|
|
|
mVisitAdapter = new EasyBaseAdapter(ct, models) {
|