|
|
@@ -4,6 +4,7 @@ import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
@@ -14,6 +15,7 @@ import com.common.data.JSONUtil;
|
|
|
import com.common.data.StringUtil;
|
|
|
import com.core.app.MyApplication;
|
|
|
import com.core.base.BaseActivity;
|
|
|
+import com.core.utils.CommonUtil;
|
|
|
import com.core.widget.view.selectcalendar.SelectCalendarActivity;
|
|
|
import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
@@ -34,6 +36,12 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
private TextView mTvStartTime;
|
|
|
private TextView mTvEndTime;
|
|
|
private Button mSubmitBtn;
|
|
|
+ private LinearLayout set_hour_ll;
|
|
|
+ private LinearLayout set_booktype_ll;
|
|
|
+ private TextView period_tv;
|
|
|
+ private TextView timpoint_tv;
|
|
|
+ private int sc_booktype = -1;
|
|
|
+ private int setType;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -46,6 +54,7 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
|
|
|
|
|
|
private void initView() {
|
|
|
+ setType = getIntent().getIntExtra("setType",-1);
|
|
|
|
|
|
mTvStartTime = (TextView) findViewById(R.id.tv_startTime);
|
|
|
mTvEndTime = (TextView) findViewById(R.id.tv_endTime);
|
|
|
@@ -54,12 +63,37 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
mTvStartTime.setOnClickListener(this);
|
|
|
mTvEndTime.setOnClickListener(this);
|
|
|
mSubmitBtn.setOnClickListener(this);
|
|
|
+
|
|
|
+ set_hour_ll = (LinearLayout)findViewById(R.id.set_hour_ll);
|
|
|
+ set_booktype_ll = (LinearLayout)findViewById(R.id.set_booktype_ll);
|
|
|
+
|
|
|
+ period_tv = (TextView) findViewById(R.id.period_tv);
|
|
|
+ period_tv.setOnClickListener(this);
|
|
|
+
|
|
|
+ timpoint_tv = (TextView) findViewById(R.id.timpoint_tv);
|
|
|
+ timpoint_tv.setOnClickListener(this);
|
|
|
+
|
|
|
+ if (setType == 1){
|
|
|
+ set_hour_ll.setVisibility(View.VISIBLE);
|
|
|
+ set_booktype_ll.setVisibility(View.GONE);
|
|
|
+ }else if (setType == 2){
|
|
|
+ set_hour_ll.setVisibility(View.GONE);
|
|
|
+ set_booktype_ll.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
+
|
|
|
if (v.getId() == R.id.submit_btn){
|
|
|
- doSaveBHours();
|
|
|
+ if (!CommonUtil.isNetWorkConnected(ct)){
|
|
|
+ ToastMessage(getString(R.string.common_notlinknet));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (setType == 1)
|
|
|
+ doSaveBHours();
|
|
|
+ else if (setType == 2)
|
|
|
+ doSaveTimeType();
|
|
|
}else if (v.getId() == R.id.tv_startTime){
|
|
|
startActivityForResult(new Intent(mContext, SelectCalendarActivity.class)
|
|
|
.putExtra("startDate", DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))
|
|
|
@@ -74,9 +108,52 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
.putExtra("hasMenu", false)
|
|
|
.putExtra("type", 2)
|
|
|
, 0x24);
|
|
|
+ }else if (v.getId() == R.id.period_tv){
|
|
|
+ sc_booktype = 1;
|
|
|
+ period_tv.setBackgroundResource(R.color.blue);
|
|
|
+ timpoint_tv.setBackgroundResource(R.color.white);
|
|
|
+ }else if (v.getId() == R.id.timpoint_tv){
|
|
|
+ sc_booktype = 0;
|
|
|
+ period_tv.setBackgroundResource(R.color.white);
|
|
|
+ timpoint_tv.setBackgroundResource(R.color.blue);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void doSaveTimeType() {
|
|
|
+ if (sc_booktype == -1){
|
|
|
+ ToastMessage("请选择预约时间类型");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
+ param.put("sc_uu",Constant.BASE_COMPANYID);
|
|
|
+ param.put("sc_booktype",sc_booktype);
|
|
|
+
|
|
|
+ LogUtil.prinlnLongMsg("appStoreUpdate",JSONUtil.map2JSON(param));
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("user/appStoreUpdate")
|
|
|
+ .add("map", JSONUtil.map2JSON(param))
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ try {
|
|
|
+ if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
+ LogUtil.prinlnLongMsg("appStoreUpdate", o.toString()+"");
|
|
|
+ //{"result":"true"}
|
|
|
+ if (o.toString().contains("result") && JSON.parseObject(o.toString()).getBooleanValue("result")){
|
|
|
+ Toast.makeText(ct,getString(R.string.save_success),Toast.LENGTH_LONG).show();
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
if (data == null) return;
|