Browse Source

14:43设置营业时间界面画完了

FANGLH 8 years ago
parent
commit
cfb5a63178

+ 83 - 1
app_modular/appbooking/src/main/java/com/modular/booking/activity/services/BServiceListActivity.java

@@ -2,8 +2,14 @@ package com.modular.booking.activity.services;
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.support.v7.app.ActionBar;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.AdapterView;
+import android.widget.ImageView;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -15,8 +21,12 @@ import com.common.data.ListUtils;
 import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.OABaseActivity;
+import com.core.interfac.OnVoiceCompleteListener;
 import com.core.utils.BaiduMapUtil;
+import com.core.utils.CommonUtil;
 import com.core.utils.DistanceUtils;
+import com.core.utils.ToastUtil;
+import com.core.widget.ClearEditText;
 import com.core.widget.EmptyLayout;
 import com.core.widget.VoiceSearchView;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
@@ -65,8 +75,80 @@ public class BServiceListActivity extends OABaseActivity {
         emptyLayout=new EmptyLayout(mContext,mListView.getRefreshableView());
         mListAdapter=new ItemBserviceListAdapter(mContext,modelList);
         mListView.setAdapter(mListAdapter);
+
+        initSearchView();
     }
- 
+
+    private ImageView mBackImageView, mVoiceImageView;
+    private ClearEditText mSearchEditText;
+    private EmptyLayout mEmptyLayout;
+    private void initSearchView() {
+        View view = LayoutInflater.from(ct).inflate(R.layout.action_book_service_search, null);
+        mBackImageView = (ImageView) view.findViewById(R.id.book_service_search_back);
+        mVoiceImageView = (ImageView) view.findViewById(R.id.book_service_search_voice_iv);
+        mSearchEditText = (ClearEditText) view.findViewById(R.id.book_service_search_et);
+        ActionBar bar = this.getSupportActionBar();
+        bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
+        bar.setCustomView(view);
+        mBackImageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+        mVoiceImageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                CommonUtil.getVoiceText(ct, mSearchEditText, new OnVoiceCompleteListener() {
+                    @Override
+                    public void onVoiceComplete() {
+                        // TODO: 2017/9/30 语音输入后开始搜索
+                        ToastUtil.showToast(BServiceListActivity.this, "语音输入完毕");
+                    }
+                });
+            }
+        });
+
+        mEmptyLayout = new EmptyLayout(this, mListView.getRefreshableView());
+        mEmptyLayout.setShowEmptyButton(false);
+        mEmptyLayout.setShowErrorButton(false);
+        mEmptyLayout.setShowLoadingButton(false);
+
+        mSearchEditText.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                if (!TextUtils.isEmpty(s.toString())){
+                    if (!ListUtils.isEmpty(modelList)){
+                        List<SBListModel> tempList=new ArrayList<>();
+                        for (int i = 0; i <modelList.size() ; i++) {
+                            if (modelList.get(i).getName().contains(s.toString())){
+                                tempList.add(modelList.get(i));
+                            }
+                        }
+                        if (ListUtils.isEmpty(tempList))  mEmptyLayout.showEmpty();
+                        LogUtil.d(TAG,"tempList:"+JSON.toJSONString(tempList.toString()));
+                        mListAdapter.setObjects(tempList);
+                        mListAdapter.notifyDataSetChanged();
+
+                    }
+                }else{
+                    mListAdapter.setObjects(modelList);
+                    mListAdapter.notifyDataSetChanged();
+                }
+            }
+        });
+    }
+
     private void initEvent() {
         mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override

+ 1 - 0
app_modular/appbooking/src/main/java/com/modular/booking/activity/services/BServiceSearchActivity.java

@@ -91,6 +91,7 @@ public class BServiceSearchActivity extends OABaseActivity implements View.OnCli
                            tempList.add(mBServiceList.get(i));
                         }
                     }
+                    if (ListUtils.isEmpty(tempList)) mEmptyLayout.showEmpty();
                     LogUtil.d(TAG,"tempList:"+JSON.toJSONString(tempList.toString()));
                     mBserviceListAdapter.setObjects(tempList);
                     mBserviceListAdapter.notifyDataSetChanged();

+ 1 - 1
app_modular/appbooking/src/main/res/layout/action_book_service_search.xml

@@ -29,7 +29,7 @@
             android:background="@drawable/search_input"
             android:drawableLeft="@drawable/search"
             android:drawableRight="@drawable/search_clear"
-            android:hint="@string/search"
+            android:hint="请输入餐厅/KTV/医院/会所等名称"
             android:imeOptions="actionSearch"
             android:inputType="text"
             android:paddingRight="26dp"

+ 5 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BusinessHoursSetting.java

@@ -108,7 +108,12 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
                 try {
                     if (!JSONUtil.validate(o.toString()) || o == null) return;
                     LogUtil.prinlnLongMsg("appCompanyAdmin", o.toString()+"");
+// {"endtime":"17:00","result":"1","starttime":"10:00","url":"http://113.105.74.140:8081/u/123/100123/201709/o/ab6d93f74f9b4ec7a06f7dbfd725ec38.png"}
 
+                    if (o.toString().contains("starttime"))
+                        mTvStartTime.setText(JSON.parseObject(o.toString()).getString("starttime")+"");
+                    if (o.toString().contains("endtime"))
+                        mTvEndTime.setText(JSON.parseObject(o.toString()).getString("endtime"));
                 } catch (Exception e) {
                     e.printStackTrace();
                 }