wangwang 3 years ago
parent
commit
525af10ba8
41 changed files with 115 additions and 6316 deletions
  1. 0 26
      app/src/androidTest/java/com/wisdom/hydroponics/ExampleInstrumentedTest.java
  2. 15 12
      app/src/main/AndroidManifest.xml
  3. 0 14
      app/src/main/java/com/wisdom/hydroponics/MainActivity.java
  4. 0 94
      app/src/main/java/com/wisdom/hydroponics/adapters/BaoJingAdapter.java
  5. 0 116
      app/src/main/java/com/wisdom/hydroponics/adapters/Grid_Image_Adapter.java
  6. 0 63
      app/src/main/java/com/wisdom/hydroponics/base/ActivityManager.java
  7. 0 56
      app/src/main/java/com/wisdom/hydroponics/base/BaseActivity.java
  8. 0 42
      app/src/main/java/com/wisdom/hydroponics/base/BaseActivityFragment.java
  9. 0 47
      app/src/main/java/com/wisdom/hydroponics/base/BaseFragment.java
  10. 0 15
      app/src/main/java/com/wisdom/hydroponics/base/MyApplication.java
  11. 0 117
      app/src/main/java/com/wisdom/hydroponics/bean/BaoJingBean.java
  12. 0 39
      app/src/main/java/com/wisdom/hydroponics/bean/BindDeviceBean.java
  13. 0 183
      app/src/main/java/com/wisdom/hydroponics/bean/DeviceInfoBean.java
  14. 0 9
      app/src/main/java/com/wisdom/hydroponics/bean/DeviceNodeBean.java
  15. 0 221
      app/src/main/java/com/wisdom/hydroponics/bean/HomeDeviceItemBean.java
  16. 0 39
      app/src/main/java/com/wisdom/hydroponics/bean/LoginBean.java
  17. 0 37
      app/src/main/java/com/wisdom/hydroponics/bean/OnOffBean.java
  18. 0 192
      app/src/main/java/com/wisdom/hydroponics/ui/MainTabActivity.java
  19. 0 199
      app/src/main/java/com/wisdom/hydroponics/ui/activity/AddDevice_1_Activity.java
  20. 0 152
      app/src/main/java/com/wisdom/hydroponics/ui/activity/BaoJingActivity.java
  21. 0 455
      app/src/main/java/com/wisdom/hydroponics/ui/activity/DeviceDetailActivity.java
  22. 0 763
      app/src/main/java/com/wisdom/hydroponics/ui/activity/DingShiActivity.java
  23. 0 124
      app/src/main/java/com/wisdom/hydroponics/ui/activity/EditNameActivity.java
  24. 0 311
      app/src/main/java/com/wisdom/hydroponics/ui/activity/EspTouchActivity.java
  25. 0 176
      app/src/main/java/com/wisdom/hydroponics/ui/activity/EspTouchActivityAbs.java
  26. 0 89
      app/src/main/java/com/wisdom/hydroponics/ui/activity/EspTouchApp.java
  27. 0 118
      app/src/main/java/com/wisdom/hydroponics/ui/activity/LoginActivity.java
  28. 0 351
      app/src/main/java/com/wisdom/hydroponics/ui/activity/TiaoGuangActivity.java
  29. 0 530
      app/src/main/java/com/wisdom/hydroponics/ui/activity/XunHuanActivity.java
  30. 0 178
      app/src/main/java/com/wisdom/hydroponics/ui/fragment/HomeFragment.java
  31. 0 131
      app/src/main/java/com/wisdom/hydroponics/ui/fragment/MineFragment.java
  32. 0 80
      app/src/main/java/com/wisdom/hydroponics/ui/fragment/ShopFragment.java
  33. 0 101
      app/src/main/java/com/wisdom/hydroponics/ui/fragment/StrategyFragment.java
  34. 0 255
      app/src/main/java/com/wisdom/hydroponics/utils/GlideUtils.java
  35. 0 99
      app/src/main/java/com/wisdom/hydroponics/utils/SPUtil.java
  36. 0 257
      app/src/main/java/com/wisdom/hydroponics/utils/WQNetUtil.java
  37. 0 606
      app/src/main/java/com/wisdom/hydroponics/utils/WQUtils.java
  38. 98 0
      app/src/main/java/com/wisdom/pigs/ui/act1/PigsListActivity.java
  39. 1 1
      app/src/main/res/drawable/rect_radius_device_dark.xml
  40. 1 1
      app/src/main/res/values/strings.xml
  41. 0 17
      app/src/test/java/com/wisdom/hydroponics/ExampleUnitTest.java

+ 0 - 26
app/src/androidTest/java/com/wisdom/hydroponics/ExampleInstrumentedTest.java

@@ -1,26 +0,0 @@
-package com.wisdom.hydroponics;
-
-import android.content.Context;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
-    @Test
-    public void useAppContext() {
-        // Context of the app under test.
-        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
-        assertEquals("com.wisdom.hydroponics", appContext.getPackageName());
-    }
-}

+ 15 - 12
app/src/main/AndroidManifest.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.wisdom.hydroponics">
+    package="com.wisdom.pigs">
 
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.VIBRATE" />
@@ -18,7 +18,7 @@
 
 
     <application
-        android:name=".base.MyApplication"
+        android:name="com.wisdom.pigs.base.MyApplication"
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
@@ -26,7 +26,7 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
-        <activity android:name="com.wisdom.hydroponics.ui.activity.LoginActivity">
+        <activity android:name="com.wisdom.pigs.ui.act1.PigsHomeActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
@@ -34,15 +34,18 @@
             </intent-filter>
         </activity>
 
-        <activity android:name=".ui.activity.BaoJingActivity"></activity>
-        <activity android:name=".ui.activity.XunHuanActivity"></activity>
-        <activity android:name=".ui.activity.TiaoGuangActivity"></activity>
-        <activity android:name=".ui.activity.DingShiActivity"></activity>
-        <activity android:name=".ui.activity.EditNameActivity"></activity>
-        <activity android:name=".ui.MainTabActivity"></activity>
-        <activity android:name=".ui.activity.AddDevice_1_Activity"></activity>
-        <activity android:name=".ui.activity.EspTouchActivity"></activity>
-        <activity android:name=".ui.activity.DeviceDetailActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.act1.PigsListActivity"></activity>
+<!--        <activity android:name="com.wisdom.pigs.ui.activity.XunHuanActivity"></activity>-->
+
+        <activity android:name="com.wisdom.pigs.ui.activity.BaoJingActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.XunHuanActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.TiaoGuangActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.DingShiActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.EditNameActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.MainTabActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.AddDevice_1_Activity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.EspTouchActivity"></activity>
+        <activity android:name="com.wisdom.pigs.ui.activity.DeviceDetailActivity"></activity>
     </application>
 
 </manifest>

+ 0 - 14
app/src/main/java/com/wisdom/hydroponics/MainActivity.java

@@ -1,14 +0,0 @@
-package com.wisdom.hydroponics;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.os.Bundle;
-
-public class MainActivity extends AppCompatActivity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_bindingdevice);
-    }
-}

+ 0 - 94
app/src/main/java/com/wisdom/hydroponics/adapters/BaoJingAdapter.java

@@ -1,94 +0,0 @@
-package com.wisdom.hydroponics.adapters;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.bean.BaoJingBean;
-import com.wisdom.hydroponics.ui.activity.BaoJingActivity;
-
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-
-public class BaoJingAdapter extends RecyclerView.Adapter<BaoJingAdapter.ViewHolder> implements View.OnClickListener {
-
-    private BaoJingActivity context;
-    private List<BaoJingBean.ResultBean> list;
-
-    private OnRecyclerviewItemClickListener mOnRecyclerviewItemClickListener = null;
-
-    public interface OnRecyclerviewItemClickListener {
-        void onItemClickListener(View v, int position);
-    }
-
-    public BaoJingAdapter(BaoJingActivity context, List<BaoJingBean.ResultBean> list, OnRecyclerviewItemClickListener mOnRecyclerviewItemClickListener) {
-        this.context = context;
-        this.list = list;
-        this.mOnRecyclerviewItemClickListener = mOnRecyclerviewItemClickListener;
-    }
-
-    @Override
-    public int getItemCount() {
-        return list.size();
-    }
-
-    @Override
-    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        LayoutInflater inflater = LayoutInflater.from(context);
-        View view = null;
-        view = inflater.inflate(R.layout.item_baojing, parent, false);
-        view.setOnClickListener(this);
-        return new ViewHolder(view);
-    }
-
-    @Override
-    public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
-        //身体列表
-        final BaoJingBean.ResultBean data = list.get(position);
-
-        viewHolder.tvDeviceBaoJingTitle.setText(data.getRelay_Code_Detail() + "");
-        viewHolder.tvDeviceBaoJingText.setText(data.getFault_Details() + "");
-        viewHolder.tvDeviceBaoJingTime.setText(data.getFault_Time() + "");
-
-        viewHolder.btOK.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                context.isOK(data.getDeviceMac(), data.getFault_State());
-            }
-        });
-
-        viewHolder.itemView.setTag(position);
-    }
-
-    @Override
-    public void onClick(View v) {
-        mOnRecyclerviewItemClickListener.onItemClickListener(v, ((int) v.getTag()));
-    }
-
-    public static class ViewHolder extends RecyclerView.ViewHolder {
-
-        @BindView(R.id.tv_deviceBaoJing_title)
-        TextView tvDeviceBaoJingTitle;
-        @BindView(R.id.tv_deviceBaoJing_text)
-        TextView tvDeviceBaoJingText;
-        @BindView(R.id.tv_deviceBaoJing_time)
-        TextView tvDeviceBaoJingTime;
-        @BindView(R.id.bt_OK)
-        Button btOK;
-
-        public ViewHolder(View itemView) {
-            super(itemView);
-            ButterKnife.bind(this, itemView);
-        }
-    }
-
-
-}

+ 0 - 116
app/src/main/java/com/wisdom/hydroponics/adapters/Grid_Image_Adapter.java

@@ -1,116 +0,0 @@
-package com.wisdom.hydroponics.adapters;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.bean.HomeDeviceItemBean;
-import com.wisdom.hydroponics.utils.GlideUtils;
-
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-
-public class Grid_Image_Adapter extends RecyclerView.Adapter<Grid_Image_Adapter.ViewHolder> implements View.OnClickListener {
-
-    private Context context;
-    private List<HomeDeviceItemBean.ResultBean.ModelsBean> list;
-
-    private OnRecyclerviewItemClickListener mOnRecyclerviewItemClickListener = null;
-
-    public interface OnRecyclerviewItemClickListener {
-        void onItemClickListener(View v, int position);
-    }
-
-    public Grid_Image_Adapter(Context context, List<HomeDeviceItemBean.ResultBean.ModelsBean> list, OnRecyclerviewItemClickListener mOnRecyclerviewItemClickListener) {
-        this.context = context;
-        this.list = list;
-        this.mOnRecyclerviewItemClickListener = mOnRecyclerviewItemClickListener;
-    }
-
-    @Override
-    public int getItemCount() {
-        return list.size();
-    }
-
-    @Override
-    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        LayoutInflater inflater = LayoutInflater.from(context);
-        View view = null;
-        view = inflater.inflate(R.layout.item_home_device, parent, false);
-        view.setOnClickListener(this);
-        return new ViewHolder(view);
-    }
-
-    String url = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fcbu01.alicdn.com%2Fimg%2Fibank%2F2018%2F058%2F399%2F10195993850_428624366.310x310.jpg&refer=http%3A%2F%2Fcbu01.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624176154&t=91d40b85eae937450b02b720063928b3";
-
-    @Override
-    public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
-        //身体列表
-        final HomeDeviceItemBean.ResultBean.ModelsBean data = list.get(position);
-
-        if (data.getCurrent_online() == 1) {
-            viewHolder.itemHomeDevice.setText("已开启");
-            viewHolder.itemHomeDevice.setTextColor(Color.rgb(0x22, 0xB5, 0xAB));
-        } else {
-            viewHolder.itemHomeDevice.setText("未开启");
-            viewHolder.itemHomeDevice.setTextColor(Color.rgb(0x63, 0x63, 0x63));
-        }
-
-        switch (data.getFaultStatus()){
-            case 1:
-                viewHolder.item_home_baojing.setVisibility(View.VISIBLE);
-                viewHolder.item_home_baojing.setText("已报警");
-                break;
-            case 2:
-                viewHolder.item_home_baojing.setVisibility(View.VISIBLE);
-                viewHolder.item_home_baojing.setText("报警处理中");
-                break;
-            default:
-                viewHolder.item_home_baojing.setVisibility(View.GONE);
-                break;
-        }
-
-        viewHolder.itemHomeLocation.setText(data.getDeviceName() + "");
-
-        GlideUtils.displayImage(context, url, viewHolder.itemHomePic);
-
-        viewHolder.itemView.setTag(position);
-    }
-
-    @Override
-    public void onClick(View v) {
-        mOnRecyclerviewItemClickListener.onItemClickListener(v, ((int) v.getTag()));
-    }
-
-    public static class ViewHolder extends RecyclerView.ViewHolder {
-
-        @BindView(R.id.item_home_pic)
-        ImageView itemHomePic;
-        @BindView(R.id.item_home_device)
-        TextView itemHomeDevice;
-        @BindView(R.id.item_home_location)
-        TextView itemHomeLocation;
-        @BindView(R.id.item_home_sunshine)
-        TextView itemHomeSunshine;
-        @BindView(R.id.item_home_water)
-        TextView itemHomeWater;
-        @BindView(R.id.item_home_baojing)
-        TextView item_home_baojing;
-
-        public ViewHolder(View itemView) {
-            super(itemView);
-            ButterKnife.bind(this, itemView);
-        }
-    }
-
-}

+ 0 - 63
app/src/main/java/com/wisdom/hydroponics/base/ActivityManager.java

@@ -1,63 +0,0 @@
-package com.wisdom.hydroponics.base;
-
-import android.app.Activity;
-import android.content.Context;
-
-import java.lang.ref.SoftReference;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
-public class ActivityManager {
-
-	private Context context;
-
-	private static ActivityManager activityManager;
-
-	public static ActivityManager getActivityManager(Context context) {
-		if (activityManager == null) {
-			activityManager = new ActivityManager(context);
-		}
-		return activityManager;
-	}
-
-	private ActivityManager(Context context) {
-		this.context = context;
-	}
-
-	/**
-	 * task map,用于记录activity栈,方便退出程序(这里为了不影响系统回收activity,所以用软引用)
-	 */
-	private final HashMap<String, SoftReference<Activity>> taskMap = new HashMap<String, SoftReference<Activity>>();
-
-	/**
-	 * 往应用task map加入activity
-	 */
-	public final void putActivity(Activity atv) {
-		taskMap.put(atv.toString(), new SoftReference<Activity>(atv));
-	}
-
-	/**
-	 * 往应用task map加入activity
-	 */
-	public final void removeActivity(Activity atv) {
-		taskMap.remove(atv.toString());
-	}
-
-	/**
-	 * 清除应用的task栈,如果程序正常运行这会导致应用退回到桌面
-	 */
-	public final void exit() {
-		for (Iterator<Entry<String, SoftReference<Activity>>> iterator = taskMap
-				.entrySet().iterator(); iterator.hasNext();) {
-			SoftReference<Activity> activityReference = iterator.next()
-					.getValue();
-			Activity activity = activityReference.get();
-			if (activity != null) {
-				activity.finish();
-			}
-		}
-		taskMap.clear();
-	}
-
-}

+ 0 - 56
app/src/main/java/com/wisdom/hydroponics/base/BaseActivity.java

@@ -1,56 +0,0 @@
-package com.wisdom.hydroponics.base;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-import butterknife.ButterKnife;
-import butterknife.Unbinder;
-
-public abstract class BaseActivity extends Activity {
-
-    protected String TAG = getClass().getSimpleName();
-    private ActivityManager manager = ActivityManager.getActivityManager(this);
-    protected Unbinder unbinder;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(setView());
-
-        unbinder = ButterKnife.bind(this);
-
-        initView();
-
-//        //先把字符串dao转成baiDate类型
-//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-//        //此处会du抛异常zhi
-//        Date date = null;
-//        try {
-//            date = sdf.parse("2020-11-30");
-//        } catch (ParseException e) {
-//            e.printStackTrace();
-//        }
-//        //获取毫秒dao数
-//        long longDate = date.getTime();
-//        Log.e("wwqq", "目标时间:" + longDate + "当前事件:" + System.currentTimeMillis());
-//        if (System.currentTimeMillis() > longDate) {
-//            System.exit(0);
-//        }
-
-        manager.putActivity(this);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        if (unbinder != null){
-            unbinder.unbind();
-        }
-        manager.removeActivity(this);
-    }
-
-    protected abstract int setView();
-
-    public abstract void initView();
-
-}

+ 0 - 42
app/src/main/java/com/wisdom/hydroponics/base/BaseActivityFragment.java

@@ -1,42 +0,0 @@
-package com.wisdom.hydroponics.base;
-
-import android.os.Bundle;
-
-import androidx.fragment.app.FragmentActivity;
-
-import butterknife.ButterKnife;
-import butterknife.Unbinder;
-
-
-public abstract class BaseActivityFragment extends FragmentActivity {
-
-    protected String TAG = getClass().getSimpleName();
-    private ActivityManager manager = ActivityManager.getActivityManager(this);
-    protected Unbinder unbinder;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(setView());
-
-        unbinder = ButterKnife.bind(this);
-
-        initView();
-
-        manager.putActivity(this);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        if (unbinder != null){
-            unbinder.unbind();
-        }
-        manager.removeActivity(this);
-    }
-
-    protected abstract int setView();
-
-    public abstract void initView();
-
-}

+ 0 - 47
app/src/main/java/com/wisdom/hydroponics/base/BaseFragment.java

@@ -1,47 +0,0 @@
-package com.wisdom.hydroponics.base;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.fragment.app.Fragment;
-
-import butterknife.ButterKnife;
-import butterknife.Unbinder;
-
-public abstract class BaseFragment extends Fragment {
-
-    public Context context;
-    protected Unbinder unbinder;
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-
-        context = getActivity();
-
-        View view = initView(inflater, container);
-        unbinder = ButterKnife.bind(this,view);
-        initData();
-
-        Log.e("onCreateView", "fragment-- onCreateView");
-
-        return view;
-    }
-
-    public abstract View initView(LayoutInflater inflater, ViewGroup container);
-
-    public abstract void initData();
-
-    @Override
-    public void onDestroy() {
-        Log.e("onDestroy", "fragment-- onDestroy");
-        if (unbinder != null){
-            unbinder.unbind();
-        }
-        super.onDestroy();
-    }
-
-}

+ 0 - 15
app/src/main/java/com/wisdom/hydroponics/base/MyApplication.java

@@ -1,15 +0,0 @@
-package com.wisdom.hydroponics.base;
-
-import android.app.Application;
-
-import com.uuzuche.lib_zxing.activity.ZXingLibrary;
-
-public class MyApplication extends Application {
-
-    @Override
-    public void onCreate() {
-        super.onCreate();
-
-        ZXingLibrary.initDisplayOpinion(this);
-    }
-}

+ 0 - 117
app/src/main/java/com/wisdom/hydroponics/bean/BaoJingBean.java

@@ -1,117 +0,0 @@
-package com.wisdom.hydroponics.bean;
-
-import com.bumptech.glide.annotation.GlideModule;
-
-import java.util.List;
-
-public class BaoJingBean {
-    /**
-     * ReturnCode : 200
-     * Message : null
-     * Result : [{"DeviceMac":"38FFD4054E57333634811843","Relay_Code":null,"Relay_Code_Detail":"水位过低报警","Fault_Details":"设备名称:种植机2,水位过低报警,时间:20211201 08:46:06 \n","Fault_State":1,"Fault_Time":"2021-12-01T08:46:06","Fault_Comment":null}]
-     */
-
-    private int ReturnCode;
-    private Object Message;
-    private List<ResultBean> Result;
-
-    public int getReturnCode() {
-        return ReturnCode;
-    }
-
-    public void setReturnCode(int ReturnCode) {
-        this.ReturnCode = ReturnCode;
-    }
-
-    public Object getMessage() {
-        return Message;
-    }
-
-    public void setMessage(Object Message) {
-        this.Message = Message;
-    }
-
-    public List<ResultBean> getResult() {
-        return Result;
-    }
-
-    public void setResult(List<ResultBean> Result) {
-        this.Result = Result;
-    }
-
-    public static class ResultBean {
-        /**
-         * DeviceMac : 38FFD4054E57333634811843
-         * Relay_Code : null
-         * Relay_Code_Detail : 水位过低报警
-         * Fault_Details : 设备名称:种植机2,水位过低报警,时间:20211201 08:46:06
-         * Fault_State : 1
-         * Fault_Time : 2021-12-01T08:46:06
-         * Fault_Comment : null
-         */
-
-        private String DeviceMac;
-        private Object Relay_Code;
-        private String Relay_Code_Detail;
-        private String Fault_Details;
-        private int Fault_State;
-        private String Fault_Time;
-        private Object Fault_Comment;
-
-        public String getDeviceMac() {
-            return DeviceMac;
-        }
-
-        public void setDeviceMac(String DeviceMac) {
-            this.DeviceMac = DeviceMac;
-        }
-
-        public Object getRelay_Code() {
-            return Relay_Code;
-        }
-
-        public void setRelay_Code(Object Relay_Code) {
-            this.Relay_Code = Relay_Code;
-        }
-
-        public String getRelay_Code_Detail() {
-            return Relay_Code_Detail;
-        }
-
-        public void setRelay_Code_Detail(String Relay_Code_Detail) {
-            this.Relay_Code_Detail = Relay_Code_Detail;
-        }
-
-        public String getFault_Details() {
-            return Fault_Details;
-        }
-
-        public void setFault_Details(String Fault_Details) {
-            this.Fault_Details = Fault_Details;
-        }
-
-        public int getFault_State() {
-            return Fault_State;
-        }
-
-        public void setFault_State(int Fault_State) {
-            this.Fault_State = Fault_State;
-        }
-
-        public String getFault_Time() {
-            return Fault_Time;
-        }
-
-        public void setFault_Time(String Fault_Time) {
-            this.Fault_Time = Fault_Time;
-        }
-
-        public Object getFault_Comment() {
-            return Fault_Comment;
-        }
-
-        public void setFault_Comment(Object Fault_Comment) {
-            this.Fault_Comment = Fault_Comment;
-        }
-    }
-}

+ 0 - 39
app/src/main/java/com/wisdom/hydroponics/bean/BindDeviceBean.java

@@ -1,39 +0,0 @@
-package com.wisdom.hydroponics.bean;
-
-public class BindDeviceBean {
-
-
-    /**
-     * ReturnCode : 1
-     * Message : sample string 2
-     * Result : true
-     */
-
-    private int ReturnCode;
-    private String Message;
-    private boolean Result;
-
-    public int getReturnCode() {
-        return ReturnCode;
-    }
-
-    public void setReturnCode(int ReturnCode) {
-        this.ReturnCode = ReturnCode;
-    }
-
-    public String getMessage() {
-        return Message;
-    }
-
-    public void setMessage(String Message) {
-        this.Message = Message;
-    }
-
-    public boolean isResult() {
-        return Result;
-    }
-
-    public void setResult(boolean Result) {
-        this.Result = Result;
-    }
-}

+ 0 - 183
app/src/main/java/com/wisdom/hydroponics/bean/DeviceInfoBean.java

@@ -1,183 +0,0 @@
-package com.wisdom.hydroponics.bean;
-
-import java.util.List;
-
-public class DeviceInfoBean {
-    /**
-     * ReturnCode : 200
-     * Message : null
-     * Result : [{"DeviceName":"suny_mqtt_plant测试","DeviceMac":"30FFD8054155313626751757","DeviceNum":null,"DeviceVendors":null,"DeviceLocateAddress":null,"DeviceLocate":null,"Current_online":1,"Current_temperature":25,"Current_humidity":70,"Nutrient_solution_temperature1":24,"Environment_luminance":null,"User_id":null}]
-     */
-
-    private int ReturnCode;
-    private Object Message;
-    private List<ResultBean> Result;
-
-    public int getReturnCode() {
-        return ReturnCode;
-    }
-
-    public void setReturnCode(int ReturnCode) {
-        this.ReturnCode = ReturnCode;
-    }
-
-    public Object getMessage() {
-        return Message;
-    }
-
-    public void setMessage(Object Message) {
-        this.Message = Message;
-    }
-
-    public List<ResultBean> getResult() {
-        return Result;
-    }
-
-    public void setResult(List<ResultBean> Result) {
-        this.Result = Result;
-    }
-
-    public static class ResultBean {
-        /**
-         * DeviceName : suny_mqtt_plant测试
-         * DeviceMac : 30FFD8054155313626751757
-         * DeviceNum : null
-         * DeviceVendors : null
-         * DeviceLocateAddress : null
-         * DeviceLocate : null
-         * Current_online : 1
-         * Current_temperature : 25
-         * Current_humidity : 70
-         * Nutrient_solution_temperature1 : 24
-         * Environment_luminance : null
-         * User_id : null
-         */
-
-        private String DeviceName;
-        private String DeviceMac;
-        private Object DeviceNum;
-        private Object DeviceVendors;
-        private Object DeviceLocateAddress;
-        private Object DeviceLocate;
-        private int Current_online;
-        private int Current_temperature;
-        private int Current_humidity;
-        private int Nutrient_solution_temperature1;
-        private Object Environment_luminance;
-        private Object User_id;
-        private int Tds;
-        private String Device_Version;
-
-        public String getDevice_Version() {
-            return Device_Version;
-        }
-
-        public void setDevice_Version(String device_Version) {
-            Device_Version = device_Version;
-        }
-
-        public int getTds() {
-            return Tds;
-        }
-
-        public void setTds(int tds) {
-            Tds = tds;
-        }
-
-        public String getDeviceName() {
-            return DeviceName;
-        }
-
-        public void setDeviceName(String DeviceName) {
-            this.DeviceName = DeviceName;
-        }
-
-        public String getDeviceMac() {
-            return DeviceMac;
-        }
-
-        public void setDeviceMac(String DeviceMac) {
-            this.DeviceMac = DeviceMac;
-        }
-
-        public Object getDeviceNum() {
-            return DeviceNum;
-        }
-
-        public void setDeviceNum(Object DeviceNum) {
-            this.DeviceNum = DeviceNum;
-        }
-
-        public Object getDeviceVendors() {
-            return DeviceVendors;
-        }
-
-        public void setDeviceVendors(Object DeviceVendors) {
-            this.DeviceVendors = DeviceVendors;
-        }
-
-        public Object getDeviceLocateAddress() {
-            return DeviceLocateAddress;
-        }
-
-        public void setDeviceLocateAddress(Object DeviceLocateAddress) {
-            this.DeviceLocateAddress = DeviceLocateAddress;
-        }
-
-        public Object getDeviceLocate() {
-            return DeviceLocate;
-        }
-
-        public void setDeviceLocate(Object DeviceLocate) {
-            this.DeviceLocate = DeviceLocate;
-        }
-
-        public int getCurrent_online() {
-            return Current_online;
-        }
-
-        public void setCurrent_online(int Current_online) {
-            this.Current_online = Current_online;
-        }
-
-        public int getCurrent_temperature() {
-            return Current_temperature;
-        }
-
-        public void setCurrent_temperature(int Current_temperature) {
-            this.Current_temperature = Current_temperature;
-        }
-
-        public int getCurrent_humidity() {
-            return Current_humidity;
-        }
-
-        public void setCurrent_humidity(int Current_humidity) {
-            this.Current_humidity = Current_humidity;
-        }
-
-        public int getNutrient_solution_temperature1() {
-            return Nutrient_solution_temperature1;
-        }
-
-        public void setNutrient_solution_temperature1(int Nutrient_solution_temperature1) {
-            this.Nutrient_solution_temperature1 = Nutrient_solution_temperature1;
-        }
-
-        public Object getEnvironment_luminance() {
-            return Environment_luminance;
-        }
-
-        public void setEnvironment_luminance(Object Environment_luminance) {
-            this.Environment_luminance = Environment_luminance;
-        }
-
-        public Object getUser_id() {
-            return User_id;
-        }
-
-        public void setUser_id(Object User_id) {
-            this.User_id = User_id;
-        }
-    }
-}

File diff suppressed because it is too large
+ 0 - 9
app/src/main/java/com/wisdom/hydroponics/bean/DeviceNodeBean.java


+ 0 - 221
app/src/main/java/com/wisdom/hydroponics/bean/HomeDeviceItemBean.java

@@ -1,221 +0,0 @@
-package com.wisdom.hydroponics.bean;
-
-import java.util.List;
-
-public class HomeDeviceItemBean {
-
-    /**
-     * ReturnCode : 200
-     * Message : null
-     * Result : {"Total":2,"PageCount":1,"Models":[{"DeviceName":null,"DeviceMac":null,"DeviceNum":null,"DeviceVendors":null,"DeviceLocateAddress":null,"DeviceLocate":null,"Current_online":null,"Current_temperature":null,"Current_humidity":null,"Nutrient_solution_temperature1":null,"Environment_luminance":null,"User_id":null},{"DeviceName":null,"DeviceMac":null,"DeviceNum":null,"DeviceVendors":null,"DeviceLocateAddress":null,"DeviceLocate":null,"Current_online":null,"Current_temperature":null,"Current_humidity":null,"Nutrient_solution_temperature1":null,"Environment_luminance":null,"User_id":null}],"Data":null}
-     */
-
-    private int ReturnCode;
-    private Object Message;
-    private ResultBean Result;
-
-    public int getReturnCode() {
-        return ReturnCode;
-    }
-
-    public void setReturnCode(int ReturnCode) {
-        this.ReturnCode = ReturnCode;
-    }
-
-    public Object getMessage() {
-        return Message;
-    }
-
-    public void setMessage(Object Message) {
-        this.Message = Message;
-    }
-
-    public ResultBean getResult() {
-        return Result;
-    }
-
-    public void setResult(ResultBean Result) {
-        this.Result = Result;
-    }
-
-    public static class ResultBean {
-        /**
-         * Total : 2
-         * PageCount : 1
-         * Models : [{"DeviceName":null,"DeviceMac":null,"DeviceNum":null,"DeviceVendors":null,"DeviceLocateAddress":null,"DeviceLocate":null,"Current_online":null,"Current_temperature":null,"Current_humidity":null,"Nutrient_solution_temperature1":null,"Environment_luminance":null,"User_id":null},{"DeviceName":null,"DeviceMac":null,"DeviceNum":null,"DeviceVendors":null,"DeviceLocateAddress":null,"DeviceLocate":null,"Current_online":null,"Current_temperature":null,"Current_humidity":null,"Nutrient_solution_temperature1":null,"Environment_luminance":null,"User_id":null}]
-         * Data : null
-         */
-
-        private int Total;
-        private int PageCount;
-        private Object Data;
-        private List<ModelsBean> Models;
-
-        public int getTotal() {
-            return Total;
-        }
-
-        public void setTotal(int Total) {
-            this.Total = Total;
-        }
-
-        public int getPageCount() {
-            return PageCount;
-        }
-
-        public void setPageCount(int PageCount) {
-            this.PageCount = PageCount;
-        }
-
-        public Object getData() {
-            return Data;
-        }
-
-        public void setData(Object Data) {
-            this.Data = Data;
-        }
-
-        public List<ModelsBean> getModels() {
-            return Models;
-        }
-
-        public void setModels(List<ModelsBean> Models) {
-            this.Models = Models;
-        }
-
-        public static class ModelsBean {
-            /**
-             * DeviceName : null
-             * DeviceMac : null
-             * DeviceNum : null
-             * DeviceVendors : null
-             * DeviceLocateAddress : null
-             * DeviceLocate : null
-             * Current_online : null
-             * Current_temperature : null
-             * Current_humidity : null
-             * Nutrient_solution_temperature1 : null
-             * Environment_luminance : null
-             * User_id : null
-             */
-
-            private String DeviceName;
-            private String DeviceMac;
-            private String DeviceNum;
-            private Object DeviceVendors;
-            private Object DeviceLocateAddress;
-            private Object DeviceLocate;
-            private int Current_online;
-            private Object Current_temperature;
-            private Object Current_humidity;
-            private Object Nutrient_solution_temperature1;
-            private Object Environment_luminance;
-            private Object User_id;
-            private int FaultStatus;
-
-            public int getFaultStatus() {
-                return FaultStatus;
-            }
-
-            public void setFaultStatus(int faultStatus) {
-                FaultStatus = faultStatus;
-            }
-
-            public String getDeviceName() {
-                return DeviceName;
-            }
-
-            public void setDeviceName(String DeviceName) {
-                this.DeviceName = DeviceName;
-            }
-
-            public String getDeviceMac() {
-                return DeviceMac;
-            }
-
-            public void setDeviceMac(String DeviceMac) {
-                this.DeviceMac = DeviceMac;
-            }
-
-            public String getDeviceNum() {
-                return DeviceNum;
-            }
-
-            public void setDeviceNum(String DeviceNum) {
-                this.DeviceNum = DeviceNum;
-            }
-
-            public Object getDeviceVendors() {
-                return DeviceVendors;
-            }
-
-            public void setDeviceVendors(Object DeviceVendors) {
-                this.DeviceVendors = DeviceVendors;
-            }
-
-            public Object getDeviceLocateAddress() {
-                return DeviceLocateAddress;
-            }
-
-            public void setDeviceLocateAddress(Object DeviceLocateAddress) {
-                this.DeviceLocateAddress = DeviceLocateAddress;
-            }
-
-            public Object getDeviceLocate() {
-                return DeviceLocate;
-            }
-
-            public void setDeviceLocate(Object DeviceLocate) {
-                this.DeviceLocate = DeviceLocate;
-            }
-
-            public int getCurrent_online() {
-                return Current_online;
-            }
-
-            public void setCurrent_online(int Current_online) {
-                this.Current_online = Current_online;
-            }
-
-            public Object getCurrent_temperature() {
-                return Current_temperature;
-            }
-
-            public void setCurrent_temperature(Object Current_temperature) {
-                this.Current_temperature = Current_temperature;
-            }
-
-            public Object getCurrent_humidity() {
-                return Current_humidity;
-            }
-
-            public void setCurrent_humidity(Object Current_humidity) {
-                this.Current_humidity = Current_humidity;
-            }
-
-            public Object getNutrient_solution_temperature1() {
-                return Nutrient_solution_temperature1;
-            }
-
-            public void setNutrient_solution_temperature1(Object Nutrient_solution_temperature1) {
-                this.Nutrient_solution_temperature1 = Nutrient_solution_temperature1;
-            }
-
-            public Object getEnvironment_luminance() {
-                return Environment_luminance;
-            }
-
-            public void setEnvironment_luminance(Object Environment_luminance) {
-                this.Environment_luminance = Environment_luminance;
-            }
-
-            public Object getUser_id() {
-                return User_id;
-            }
-
-            public void setUser_id(Object User_id) {
-                this.User_id = User_id;
-            }
-        }
-    }
-}

+ 0 - 39
app/src/main/java/com/wisdom/hydroponics/bean/LoginBean.java

@@ -1,39 +0,0 @@
-package com.wisdom.hydroponics.bean;
-
-public class LoginBean {
-
-
-    /**
-     * ReturnCode : 1
-     * Message : sample string 2
-     * Result : true
-     */
-
-    private int ReturnCode;
-    private String Message;
-    private boolean Result;
-
-    public int getReturnCode() {
-        return ReturnCode;
-    }
-
-    public void setReturnCode(int ReturnCode) {
-        this.ReturnCode = ReturnCode;
-    }
-
-    public String getMessage() {
-        return Message;
-    }
-
-    public void setMessage(String Message) {
-        this.Message = Message;
-    }
-
-    public boolean isResult() {
-        return Result;
-    }
-
-    public void setResult(boolean Result) {
-        this.Result = Result;
-    }
-}

+ 0 - 37
app/src/main/java/com/wisdom/hydroponics/bean/OnOffBean.java

@@ -1,37 +0,0 @@
-package com.wisdom.hydroponics.bean;
-
-public class OnOffBean {
-    /**
-     * ReturnCode : 200
-     * Message : 操作失败
-     * Result : false
-     */
-
-    private int ReturnCode;
-    private String Message;
-    private boolean Result;
-
-    public int getReturnCode() {
-        return ReturnCode;
-    }
-
-    public void setReturnCode(int ReturnCode) {
-        this.ReturnCode = ReturnCode;
-    }
-
-    public String getMessage() {
-        return Message;
-    }
-
-    public void setMessage(String Message) {
-        this.Message = Message;
-    }
-
-    public boolean isResult() {
-        return Result;
-    }
-
-    public void setResult(boolean Result) {
-        this.Result = Result;
-    }
-}

+ 0 - 192
app/src/main/java/com/wisdom/hydroponics/ui/MainTabActivity.java

@@ -1,192 +0,0 @@
-package com.wisdom.hydroponics.ui;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.KeyEvent;
-import android.widget.RadioButton;
-import android.widget.RadioGroup;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
-
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.ui.fragment.HomeFragment;
-import com.wisdom.hydroponics.ui.fragment.MineFragment;
-import com.wisdom.hydroponics.ui.fragment.ShopFragment;
-import com.wisdom.hydroponics.ui.fragment.StrategyFragment;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-
-public class MainTabActivity extends FragmentActivity {
-
-    public static MainTabActivity context = null;
-
-
-    private RadioButton mMessage_bar;
-    private RadioButton foot_bar_work;
-
-    private static final String CURR_INDEX = "currIndex";
-    private static int currIndex = 0;
-    private RadioGroup mGroup;
-    private ArrayList<String> fragmentTags;
-    private FragmentManager fragmentManager;
-
-    private static final int MSG_SET_ALIAS = 1001;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_main_tab);
-
-        context = this;//全局context
-
-        fragmentManager = getSupportFragmentManager();
-        initData(savedInstanceState);
-        initViewMain();
-
-    }
-
-    private void initData(Bundle savedInstanceState) {
-        fragmentTags = new ArrayList<>(Arrays.asList("HomeFragment", "StrategyFragment", "ShopFragment", "MineFragment"));
-        currIndex = 0;
-        if (savedInstanceState != null) {
-            currIndex = savedInstanceState.getInt(CURR_INDEX);
-            hideSavedFragment();
-        }
-    }
-
-    private void hideSavedFragment() {
-        Fragment fragment = fragmentManager.findFragmentByTag(fragmentTags.get(currIndex));
-        if (fragment != null) {
-            fragmentManager.beginTransaction().hide(fragment).commit();
-        }
-    }
-
-    private void initViewMain() {
-        mGroup = (RadioGroup) findViewById(R.id.footer_group);
-        mMessage_bar = (RadioButton) findViewById(R.id.footer_bar_message);
-        foot_bar_work = (RadioButton) findViewById(R.id.foot_bar_work);
-
-        mGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
-            @Override
-            public void onCheckedChanged(RadioGroup group, int checkedId) {
-                switch (checkedId) {
-                    case R.id.foot_bar_home:
-                        currIndex = 0;
-                        break;
-                    case R.id.foot_bar_mission:
-                        currIndex = 2;
-                        break;
-
-                    case R.id.foot_bar_work:
-                        currIndex = 1;
-
-                        break;
-                    case R.id.footer_bar_me:
-                        currIndex = 3;
-                        break;
-                    default:
-                        break;
-                }
-                showFragment();
-            }
-        });
-        showFragment();
-    }
-
-    private void showFragment() {
-        //跳转拦截
-//        if (currIndex == 3) {
-//            UIHelper.showLogin(MainTabActivity.this);
-//        }
-
-        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
-        Fragment fragment = fragmentManager.findFragmentByTag(fragmentTags.get(currIndex));
-        if (fragment == null) {
-            fragment = instantFragment(currIndex);
-        }
-        for (int i = 0; i < fragmentTags.size(); i++) {
-            Fragment f = fragmentManager.findFragmentByTag(fragmentTags.get(i));
-            if (f != null && f.isAdded()) {
-                fragmentTransaction.hide(f);
-            }
-        }
-        if (fragment.isAdded()) {
-            fragmentTransaction.show(fragment);
-        } else {
-            fragmentTransaction.add(R.id.fragment_container, fragment, fragmentTags.get(currIndex));
-        }
-        fragmentTransaction.commitAllowingStateLoss();
-        fragmentManager.executePendingTransactions();
-    }
-
-    private Fragment instantFragment(int currIndex) {
-        switch (currIndex) {
-            case 0:
-                return new HomeFragment();
-//            case 4:
-//                return new StrategyFragment();
-            case 3:
-                return new MineFragment();
-            case 1:
-                return new StrategyFragment();
-            case 2:
-                return new ShopFragment();
-            default:
-                return new HomeFragment();
-        }
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        if (keyCode == KeyEvent.KEYCODE_BACK) {
-            exit();
-            return false;
-        }
-        return super.onKeyDown(keyCode, event);
-    }
-
-    private long exitTime = 0;
-
-    public void exit() {
-        if ((System.currentTimeMillis() - exitTime) > 2000) {
-//            SnackBarUtil.shortSnackbar(getWindow().getDecorView(), "再按一次退出程序", getResources().getColor(R.color.darkgray)).show();
-            WQUtils.say(this, "再按一次退出程序");
-            exitTime = System.currentTimeMillis();
-        } else {
-            moveTaskToBack(true);
-            finish();
-            System.exit(0);
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        if (resultCode == RESULT_OK) {
-
-//            SpecialListFragment fragment = (SpecialListFragment) fragmentManager.findFragmentByTag(fragmentTags.get(3));
-//
-//            switch (requestCode) {
-//                case PictureConfig.CHOOSE_REQUEST:
-//
-//                    fragment.isBack(data);
-//                    break;
-//                case 199:
-//
-//                    fragment.isBack_MediaNum(data);
-//                    break;
-//                case 101:
-//
-//                    fragment.isBack_VideoPath(data);
-//                    break;
-//            }
-        }
-    }
-
-}

+ 0 - 199
app/src/main/java/com/wisdom/hydroponics/ui/activity/AddDevice_1_Activity.java

@@ -1,199 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.Manifest;
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import androidx.annotation.Nullable;
-
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.resource.bitmap.CircleCrop;
-import com.bumptech.glide.request.RequestOptions;
-import com.google.gson.Gson;
-import com.luck.picture.lib.permissions.RxPermissions;
-import com.uuzuche.lib_zxing.activity.CaptureActivity;
-import com.uuzuche.lib_zxing.activity.CodeUtils;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.BindDeviceBean;
-import com.wisdom.hydroponics.utils.GlideUtils;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-import io.reactivex.Observer;
-import io.reactivex.disposables.Disposable;
-
-public class AddDevice_1_Activity extends BaseActivity {
-
-
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.tv_title_right)
-    TextView tvTitleRight;
-    @BindView(R.id.rl_base_activity_backround)
-    RelativeLayout rlBaseActivityBackround;
-    @BindView(R.id.iv_bindingdevice_img)
-    ImageView ivBindingdeviceImg;
-    @BindView(R.id.tv_bindingdevice_name)
-    TextView tvBindingdeviceName;
-    @BindView(R.id.tv_bindingdevice_shaoMiao)
-    TextView tvBindingdeviceShaoMiao;
-    @BindView(R.id.tv_bindingdevice_mac)
-    TextView tvBindingdeviceMac;
-    @BindView(R.id.bt_bindingdevice_next)
-    Button btBindingdeviceNext;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_bindingdevice;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("绑定设备");
-
-        GlideUtils.displayImage(this, "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fcbu01.alicdn.com%2Fimg%2Fibank%2F2018%2F058%2F399%2F10195993850_428624366.310x310.jpg&refer=http%3A%2F%2Fcbu01.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624176154&t=91d40b85eae937450b02b720063928b3", ivBindingdeviceImg);
-
-    }
-
-    private void getPermissions() {
-        RxPermissions permissions = new RxPermissions(this);
-        permissions.request(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION).subscribe(new Observer<Boolean>() {
-            @Override
-            public void onSubscribe(Disposable d) {
-            }
-
-            @Override
-            public void onNext(Boolean aBoolean) {
-                getMacCode(9);
-            }
-
-            @Override
-            public void onError(Throwable e) {
-            }
-
-            @Override
-            public void onComplete() {
-            }
-        });
-    }
-
-    private void getMacCode(int req) {
-        Intent intent = new Intent(this, CaptureActivity.class);
-        startActivityForResult(intent, req);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        switch (requestCode) {
-            case 9:
-                if (null != data) {
-                    Bundle bundle = data.getExtras();
-                    if (bundle == null) {
-                        return;
-                    }
-                    if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_SUCCESS) {
-                        String device_mac = bundle.getString(CodeUtils.RESULT_STRING);
-//                        if (device_mac.length() == 24) {
-                        tvBindingdeviceMac.setText("" + device_mac);
-//                        }
-
-                    } else if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_FAILED) {
-                        WQUtils.say(this, "解析二维码失败");
-                    }
-                }
-                break;
-        }
-    }
-
-
-    @OnClick({R.id.iv_base_activity_back, R.id.tv_bindingdevice_shaoMiao, R.id.bt_bindingdevice_next})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-            case R.id.tv_bindingdevice_shaoMiao:
-                getPermissions();
-                break;
-            case R.id.bt_bindingdevice_next:
-                String device_mac = tvBindingdeviceMac.getText().toString().trim();
-                if (!TextUtils.isEmpty(device_mac)) {
-                    bindData(device_mac);
-                }
-
-                break;
-        }
-    }
-
-    private void bindData(String device_mac) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("UserID", SPUtil.getString(this, "User_ID"));
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this,jsonObj, SPUtil.getString(this, "URL") + "Device/BindUserMac", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            BindDeviceBean getTokenBean = gson.fromJson(json, BindDeviceBean.class);
-
-            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-
-                isPeiWang(AddDevice_1_Activity.this,"是否需要为这台设备配置wifi");
-
-            } else {
-                WQUtils.tip(AddDevice_1_Activity.this, getTokenBean.getMessage() + "");
-            }
-        }
-    };
-
-    public void isPeiWang(Context context, String str) {
-        AlertDialog.Builder builder = new AlertDialog.Builder(context);
-        builder.setMessage(str);
-        builder.setTitle("提示");
-        builder.setPositiveButton("是", new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                WQUtils.startActivity(AddDevice_1_Activity.this, EspTouchActivity.class);
-                dialog.dismiss();
-                finish();
-            }
-        });
-        builder.setNegativeButton("否", new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-                finish();
-            }
-        });
-        builder.create().show();
-    }
-}

+ 0 - 152
app/src/main/java/com/wisdom/hydroponics/ui/activity/BaoJingActivity.java

@@ -1,152 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.content.Intent;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.adapters.BaoJingAdapter;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.BaoJingBean;
-import com.wisdom.hydroponics.bean.BindDeviceBean;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-public class BaoJingActivity extends BaseActivity {
-
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.tv_title_right)
-    TextView tvTitleRight;
-    @BindView(R.id.rl_base_activity_backround)
-    RelativeLayout rlBaseActivityBackround;
-    @BindView(R.id.mRecyclerView)
-    RecyclerView mRecyclerView;
-
-    private BaoJingAdapter.OnRecyclerviewItemClickListener onRecyclerviewClickListener;
-    private String deviceMac;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_baojing;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("报警管理");
-
-        Intent intent = getIntent();
-        deviceMac = intent.getStringExtra("Device_Mac");
-
-        if (!TextUtils.isEmpty(deviceMac)) {
-            getData(deviceMac);
-        }
-
-        initRecyclerView();
-    }
-
-    private void initRecyclerView() {
-        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
-        LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
-        mRecyclerView.setLayoutManager(mLayoutManager);
-        onRecyclerviewClickListener = new BaoJingAdapter.OnRecyclerviewItemClickListener() {
-            @Override
-            public void onItemClickListener(View v, int position) {
-
-
-            }
-        };
-    }
-
-    public void isOK(String deviceMac, int fault_State) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", deviceMac);
-            jsonObj.put("Fault_State", 3); //3 完成
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/UpdateDeviceFaultStatus", updtHandler);
-
-    }
-
-    //获取报警详情
-    private void getData(String device_mac) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/GetDeviceFaultDetail", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-            Gson gson = new Gson();
-            BaoJingBean baoJingBean = gson.fromJson(json, BaoJingBean.class);
-            if (baoJingBean != null && baoJingBean.getReturnCode() == 200) {
-                if (baoJingBean.getResult() != null && baoJingBean.getResult().size() > 0) {
-                    BaoJingAdapter adapter = new BaoJingAdapter(BaoJingActivity.this, baoJingBean.getResult(), onRecyclerviewClickListener);
-                    mRecyclerView.setAdapter(adapter);
-                }
-            } else {
-                WQUtils.tip(BaoJingActivity.this, baoJingBean.getMessage() + "");
-            }
-        }
-    };
-
-    private Handler updtHandler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-            Gson gson = new Gson();
-            BindDeviceBean deviceInfoBean = gson.fromJson(json, BindDeviceBean.class);
-            if (deviceInfoBean != null && deviceInfoBean.getReturnCode() == 200) {
-                if (deviceInfoBean.isResult()) {
-                    WQUtils.tip(BaoJingActivity.this, deviceInfoBean.getMessage() + "");
-                    getData(deviceMac);
-                }
-
-            } else {
-                WQUtils.tip(BaoJingActivity.this, deviceInfoBean.getMessage() + "");
-            }
-        }
-    };
-
-    @OnClick({R.id.iv_base_activity_back})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-
-        }
-    }
-
-
-}

+ 0 - 455
app/src/main/java/com/wisdom/hydroponics/ui/activity/DeviceDetailActivity.java

@@ -1,455 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.Switch;
-import android.widget.TextView;
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.DeviceInfoBean;
-import com.wisdom.hydroponics.bean.DeviceNodeBean;
-import com.wisdom.hydroponics.bean.OnOffBean;
-import com.wisdom.hydroponics.utils.GlideUtils;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-import butterknife.OnClick;
-
-public class DeviceDetailActivity extends BaseActivity implements CompoundButton.OnCheckedChangeListener {
-
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.tv_title_right)
-    TextView tvTitleRight;
-    @BindView(R.id.iv_deviceDetail_img)
-    ImageView ivDeviceDetailImg;
-    @BindView(R.id.tv_deviceDetail_name)
-    TextView tvDeviceDetailName;
-    @BindView(R.id.tv_deviceDetail_editlocation)
-    TextView tvDeviceDetailEditlocation;
-    @BindView(R.id.tv_deviceDetail_location)
-    TextView tvDeviceDetailLocation;
-    @BindView(R.id.tv_deviceDetail_wenDu)
-    TextView tvDeviceDetailWenDu;
-    @BindView(R.id.tv_deviceDetail_ShiDu)
-    TextView tvDeviceDetailShiDu;
-    @BindView(R.id.tv_deviceDetail_yingYangYeWenDu)
-    TextView tvDeviceDetailYingYangYeWenDu;
-    @BindView(R.id.sw_deng_1)
-    Switch swDeng1;
-    @BindView(R.id.sw_deng_2)
-    Switch swDeng2;
-    @BindView(R.id.sw_deng_3)
-    Switch swDeng3;
-    @BindView(R.id.sw_deng_4)
-    Switch swDeng4;
-    @BindView(R.id.sw_shui_1)
-    Switch swShui1;
-    @BindView(R.id.sw_shui_2)
-    Switch swShui2;
-    @BindView(R.id.sw_shui_3)
-    Switch swShui3;
-    @BindView(R.id.sw_shui_4)
-    Switch swShui4;
-    @BindView(R.id.tv_devicedetail_deng_dingShi)
-    TextView tvDevicedetailDengDingShi;
-    @BindView(R.id.tv_devicedetail_shui_dingShi)
-    TextView tvDevicedetailShuiDingShi;
-    @BindView(R.id.tv_deviceDetail_tds)
-    TextView tv_deviceDetail_tds;
-    @BindView(R.id.tv_devicedetail_deng_dengGuang)
-    TextView tv_devicedetail_deng_dengGuang;
-    @BindView(R.id.tv_devicedetail_deng_xunhuan)
-    TextView tv_devicedetail_deng_xunhuan;
-
-
-    String url = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fcbu01.alicdn.com%2Fimg%2Fibank%2F2018%2F058%2F399%2F10195993850_428624366.310x310.jpg&refer=http%3A%2F%2Fcbu01.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624176154&t=91d40b85eae937450b02b720063928b3";
-    @BindView(R.id.rl_led1)
-    RelativeLayout rlLed1;
-    @BindView(R.id.rl_led2)
-    RelativeLayout rlLed2;
-    @BindView(R.id.rl_led3)
-    RelativeLayout rlLed3;
-    @BindView(R.id.rl_led4)
-    RelativeLayout rlLed4;
-    @BindView(R.id.rl_pump1)
-    RelativeLayout rlPump1;
-    @BindView(R.id.rl_pump2)
-    RelativeLayout rlPump2;
-    @BindView(R.id.rl_pump3)
-    RelativeLayout rlPump3;
-    @BindView(R.id.rl_pump4)
-    RelativeLayout rlPump4;
-    @BindView(R.id.tv_led1_name)
-    TextView tvLed1Name;
-    @BindView(R.id.tv_led2_name)
-    TextView tvLed2Name;
-    @BindView(R.id.tv_led3_name)
-    TextView tvLed3Name;
-    @BindView(R.id.tv_led4_name)
-    TextView tvLed4Name;
-    @BindView(R.id.tv_pump1_name)
-    TextView tvPump1Name;
-    @BindView(R.id.tv_pump2_name)
-    TextView tvPump2Name;
-    @BindView(R.id.tv_pump3_name)
-    TextView tvPump3Name;
-    @BindView(R.id.tv_pump4_name)
-    TextView tvPump4Name;
-    @BindView(R.id.tv_devicedetail_deng_baojingg)
-    TextView tv_devicedetail_deng_baojingg;
-
-    private String device_mac;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_devicedetail;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("设备详情");
-
-        GlideUtils.displayImage(this, url, ivDeviceDetailImg);
-
-        swDeng1.setOnCheckedChangeListener(this);
-        swDeng2.setOnCheckedChangeListener(this);
-        swDeng3.setOnCheckedChangeListener(this);
-        swDeng4.setOnCheckedChangeListener(this);
-        swShui1.setOnCheckedChangeListener(this);
-        swShui2.setOnCheckedChangeListener(this);
-        swShui3.setOnCheckedChangeListener(this);
-        swShui4.setOnCheckedChangeListener(this);
-
-        Intent intent = getIntent();
-        device_mac = intent.getStringExtra("Device_Mac");
-        int faultStatus = intent.getIntExtra("FaultStatus", 0);
-//        if (faultStatus==1 || faultStatus==2) {
-//            tv_devicedetail_deng_baojingg.setTextColor(getResources().getColor(R.color.base_error));
-//        }
-        if (!TextUtils.isEmpty(device_mac)) {
-            getData(device_mac);
-            getNodeData(device_mac);
-        }
-    }
-
-
-    @OnClick({R.id.iv_base_activity_back, R.id.tv_devicedetail_deng_baojingg, R.id.tv_devicedetail_deng_xunhuan, R.id.tv_deviceDetail_editlocation, R.id.tv_devicedetail_deng_dingShi, R.id.tv_devicedetail_shui_dingShi, R.id.tv_devicedetail_deng_dengGuang})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-            case R.id.tv_devicedetail_deng_baojingg:
-                Intent intent4 = new Intent(this, BaoJingActivity.class);
-                intent4.putExtra("Device_Mac", device_mac);
-                startActivity(intent4);
-                break;
-            case R.id.tv_deviceDetail_editlocation:
-                Intent intent = new Intent(this, EditNameActivity.class);
-                intent.putExtra("MAC", device_mac);
-                startActivityForResult(intent, 888);
-                break;
-            case R.id.tv_devicedetail_deng_dingShi:
-                Intent intent1 = new Intent(this, DingShiActivity.class);
-                intent1.putExtra("Device_Mac", device_mac);
-                startActivity(intent1);
-                break;
-            case R.id.tv_devicedetail_deng_xunhuan:
-                Intent intent2 = new Intent(this, XunHuanActivity.class);
-                intent2.putExtra("Device_Mac", device_mac);
-                startActivity(intent2);
-
-                break;
-            case R.id.tv_devicedetail_shui_dingShi:
-
-                break;
-            case R.id.tv_devicedetail_deng_dengGuang:
-                Intent intent3 = new Intent(this, TiaoGuangActivity.class);
-                intent3.putExtra("Device_Mac", device_mac);
-                startActivity(intent3);
-                break;
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        if (requestCode == 888 && resultCode == RESULT_OK && data != null) {
-            String name = data.getStringExtra("Name");
-            tvDeviceDetailLocation.setText(name);
-        }
-    }
-
-    @Override
-    public void onCheckedChanged(CompoundButton buttonView, boolean b) {
-        //防止初始化的时候出发监听
-        if (!buttonView.isPressed()) {
-            return;
-        }
-
-        switch (buttonView.getId()) {
-            case R.id.sw_deng_1:
-                if (b) {
-                    takeNodeOnOff(L1, 1, swDeng1);
-                } else {
-                    takeNodeOnOff(L1, 0, swDeng1);
-                }
-                break;
-            case R.id.sw_deng_2:
-                if (b) {
-                    takeNodeOnOff(L2, 1, swDeng2);
-                } else {
-                    takeNodeOnOff(L2, 0, swDeng2);
-                }
-                break;
-            case R.id.sw_deng_3:
-                if (b) {
-                    takeNodeOnOff(L3, 1, swDeng3);
-                } else {
-                    takeNodeOnOff(L3, 0, swDeng3);
-                }
-                break;
-            case R.id.sw_deng_4:
-                if (b) {
-                    takeNodeOnOff(L4, 1, swDeng4);
-                } else {
-                    takeNodeOnOff(L4, 0, swDeng4);
-                }
-                break;
-            case R.id.sw_shui_1:
-                if (b) {
-                    takeNodeOnOff(S1, 1, swShui1);
-                } else {
-                    takeNodeOnOff(S1, 0, swShui1);
-                }
-                break;
-            case R.id.sw_shui_2:
-                if (b) {
-                    takeNodeOnOff(S2, 1, swShui2);
-                } else {
-                    takeNodeOnOff(S2, 0, swShui2);
-                }
-                break;
-            case R.id.sw_shui_3:
-                if (b) {
-                    takeNodeOnOff(S3, 1, swShui3);
-                } else {
-                    takeNodeOnOff(S3, 0, swShui3);
-                }
-                break;
-            case R.id.sw_shui_4:
-                if (b) {
-                    takeNodeOnOff(S4, 1, swShui4);
-                } else {
-                    takeNodeOnOff(S4, 0, swShui4);
-                }
-                break;
-        }
-    }
-
-    private Switch aSwitch = null;
-    private String L1 = "";
-    private String L2 = "";
-    private String L3 = "";
-    private String L4 = "";
-    private String S1 = "";
-    private String S2 = "";
-    private String S3 = "";
-    private String S4 = "";
-
-    //设置开关
-    private void takeNodeOnOff(String node_mac, int type, Switch sw) {
-        this.aSwitch = sw;
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("NodeMac", node_mac);
-            jsonObj.put("OperationType", type);
-            jsonObj.put("CurrentOnline", current_online);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/SetDeviceOnOff", handler_OnOff);
-    }
-
-    //获取设备详情
-    private void getData(String device_mac) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/GetDeviceDetail", handler);
-    }
-
-    //获取节点列表
-    private void getNodeData(String device_mac) {
-        String user_id = SPUtil.getString(this, "User_ID");
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("PageIndex", 1);
-            jsonObj.put("PageSize", 99);
-            jsonObj.put("UserID", user_id);
-            jsonObj.put("GateWayMac", device_mac);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/GetAllNodeByMac", handler_node);
-    }
-
-    private int current_online;
-    //设备详情
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-            Gson gson = new Gson();
-            DeviceInfoBean deviceInfoBean = gson.fromJson(json, DeviceInfoBean.class);
-            if (deviceInfoBean != null && deviceInfoBean.getReturnCode() == 200) {
-                if (deviceInfoBean.getResult() != null && deviceInfoBean.getResult().size() > 0) {
-                    tvDeviceDetailLocation.setText(deviceInfoBean.getResult().get(0).getDeviceName());
-
-                    tvDeviceDetailShiDu.setText("湿度:" + deviceInfoBean.getResult().get(0).getCurrent_humidity() + "%");
-                    tvDeviceDetailWenDu.setText("温度:" + deviceInfoBean.getResult().get(0).getCurrent_temperature() + "℃");
-                    tvDeviceDetailYingYangYeWenDu.setText("营养液温度:" + deviceInfoBean.getResult().get(0).getNutrient_solution_temperature1() + "℃");
-                    tv_deviceDetail_tds.setText("TDS值:" + deviceInfoBean.getResult().get(0).getTds() + "mg/L");
-
-                    tvDeviceDetailName.setText("智能型号ABC-003 ("+ deviceInfoBean.getResult().get(0).getDevice_Version()+")");
-
-                    current_online = deviceInfoBean.getResult().get(0).getCurrent_online();
-                }
-            } else {
-                WQUtils.tip(DeviceDetailActivity.this, deviceInfoBean.getMessage() + "");
-            }
-        }
-    };
-
-    private Handler handler_node = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            DeviceNodeBean deviceNodeBean = gson.fromJson(json, DeviceNodeBean.class);
-            if (deviceNodeBean != null && deviceNodeBean.getReturnCode() == 200) {
-                if (deviceNodeBean.getResult() != null && deviceNodeBean.getResult().getModels() != null && deviceNodeBean.getResult().getModels().size() > 0) {
-                    List<DeviceNodeBean.ResultBean.ModelsBean> node_list = deviceNodeBean.getResult().getModels();
-                    if (node_list != null && node_list.size() > 0) {
-
-                        List<DeviceNodeBean.ResultBean.ModelsBean> led = new ArrayList<>();
-                        List<DeviceNodeBean.ResultBean.ModelsBean> pump = new ArrayList<>();
-                        for (int i = 0; i < node_list.size(); i++) {
-                            if (node_list.get(i).getDeviceMac().contains("LED") || node_list.get(i).getDeviceMac().contains("led")) {
-                                led.add(node_list.get(i));
-                            } else {
-                                pump.add(node_list.get(i));
-                            }
-                        }
-
-                        if (led.size() >= 1) {
-                            rlLed1.setVisibility(View.VISIBLE);
-                            tvLed1Name.setText(led.get(0).getDeviceName());
-                            swDeng1.setChecked(led.get(0).getCurrentOnOff() == 1 ? true : false);
-                            L1 = led.get(0).getDeviceMac();
-                        }
-                        if (led.size() >= 2) {
-                            rlLed2.setVisibility(View.VISIBLE);
-                            tvLed2Name.setText(led.get(1).getDeviceName());
-                            swDeng2.setChecked(led.get(1).getCurrentOnOff() == 1 ? true : false);
-                            L2 = led.get(1).getDeviceMac();
-                        }
-                        if (led.size() >= 3) {
-                            rlLed3.setVisibility(View.VISIBLE);
-                            tvLed3Name.setText(led.get(2).getDeviceName());
-                            swDeng3.setChecked(led.get(2).getCurrentOnOff() == 1 ? true : false);
-                            L3 = led.get(2).getDeviceMac();
-                        }
-                        if (led.size() >= 4) {
-                            rlLed4.setVisibility(View.VISIBLE);
-                            tvLed4Name.setText(led.get(3).getDeviceName());
-                            swDeng4.setChecked(led.get(3).getCurrentOnOff() == 1 ? true : false);
-                            L4 = led.get(3).getDeviceMac();
-                        }
-
-                        if (pump.size() >= 1) {
-                            rlPump1.setVisibility(View.VISIBLE);
-                            tvPump1Name.setText(pump.get(0).getDeviceName());
-                            swShui1.setChecked(pump.get(0).getCurrentOnOff() == 1 ? true : false);
-                            S1 = pump.get(0).getDeviceMac();
-                        }
-                        if (pump.size() >= 2) {
-                            rlPump2.setVisibility(View.VISIBLE);
-                            tvPump2Name.setText(pump.get(1).getDeviceName());
-                            swShui2.setChecked(pump.get(1).getCurrentOnOff() == 1 ? true : false);
-                            S2 = pump.get(1).getDeviceMac();
-                        }
-                        if (pump.size() >= 3) {
-                            rlPump3.setVisibility(View.VISIBLE);
-                            tvPump3Name.setText(pump.get(2).getDeviceName());
-                            swShui3.setChecked(pump.get(2).getCurrentOnOff() == 1 ? true : false);
-                            S3 = pump.get(2).getDeviceMac();
-                        }
-                        if (pump.size() >= 4) {
-                            rlPump4.setVisibility(View.VISIBLE);
-                            tvPump4Name.setText(pump.get(3).getDeviceName());
-                            swShui4.setChecked(pump.get(3).getCurrentOnOff() == 1 ? true : false);
-                            S4 = pump.get(3).getDeviceMac();
-                        }
-
-                    }
-                }
-            } else {
-                WQUtils.tip(DeviceDetailActivity.this, deviceNodeBean.getMessage() + "");
-            }
-        }
-    };
-
-    //设置开关状态
-    private Handler handler_OnOff = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-            Gson gson = new Gson();
-            OnOffBean onOffBean = gson.fromJson(json, OnOffBean.class);
-            if (onOffBean != null && onOffBean.getReturnCode() == 200) {
-                if (!onOffBean.isResult()) {
-                    //如果操作失败则退回之前状态
-                    aSwitch.setChecked(!aSwitch.isChecked());
-                }
-
-                WQUtils.tip(DeviceDetailActivity.this, onOffBean.getMessage() + "");
-            } else {
-                WQUtils.tip(DeviceDetailActivity.this, onOffBean.getMessage() + "");
-            }
-        }
-    };
-
-}

+ 0 - 763
app/src/main/java/com/wisdom/hydroponics/ui/activity/DingShiActivity.java

@@ -1,763 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.app.AlertDialog;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.Button;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.Switch;
-import android.widget.TextView;
-import android.widget.TimePicker;
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.BindDeviceBean;
-import com.wisdom.hydroponics.bean.DeviceNodeBean;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-import butterknife.OnClick;
-
-public class DingShiActivity extends BaseActivity implements CompoundButton.OnCheckedChangeListener {
-
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.sw_dingshi_sw1)
-    Switch swDingshiSw1;
-    @BindView(R.id.tv_dingshi_start1)
-    TextView tvDingshiStart1;
-    @BindView(R.id.tv_dingshi_close1)
-    TextView tvDingshiClose1;
-    @BindView(R.id.bt_kongzhi_1)
-    Button btKongzhi1;
-    @BindView(R.id.sw_dingshi_sw2)
-    Switch swDingshiSw2;
-    @BindView(R.id.tv_dingshi_start2)
-    TextView tvDingshiStart2;
-    @BindView(R.id.tv_dingshi_close2)
-    TextView tvDingshiClose2;
-    @BindView(R.id.bt_kongzhi_2)
-    Button btKongzhi2;
-    @BindView(R.id.sw_dingshi_sw3)
-    Switch swDingshiSw3;
-    @BindView(R.id.tv_dingshi_start3)
-    TextView tvDingshiStart3;
-    @BindView(R.id.tv_dingshi_close3)
-    TextView tvDingshiClose3;
-    @BindView(R.id.bt_kongzhi_3)
-    Button btKongzhi3;
-    @BindView(R.id.sw_dingshi_sw4)
-    Switch swDingshiSw4;
-    @BindView(R.id.tv_dingshi_start4)
-    TextView tvDingshiStart4;
-    @BindView(R.id.tv_dingshi_close4)
-    TextView tvDingshiClose4;
-    @BindView(R.id.bt_kongzhi_4)
-    Button btKongzhi4;
-    @BindView(R.id.sw_dingshi_sw5)
-    Switch swDingshiSw5;
-    @BindView(R.id.tv_dingshi_start5)
-    TextView tvDingshiStart5;
-    @BindView(R.id.tv_dingshi_close5)
-    TextView tvDingshiClose5;
-    @BindView(R.id.bt_kongzhi_5)
-    Button btKongzhi5;
-    @BindView(R.id.sw_dingshi_sw6)
-    Switch swDingshiSw6;
-    @BindView(R.id.tv_dingshi_start6)
-    TextView tvDingshiStart6;
-    @BindView(R.id.tv_dingshi_close6)
-    TextView tvDingshiClose6;
-    @BindView(R.id.bt_kongzhi_6)
-    Button btKongzhi6;
-    @BindView(R.id.sw_dingshi_sw7)
-    Switch swDingshiSw7;
-    @BindView(R.id.tv_dingshi_start7)
-    TextView tvDingshiStart7;
-    @BindView(R.id.tv_dingshi_close7)
-    TextView tvDingshiClose7;
-    @BindView(R.id.bt_kongzhi_7)
-    Button btKongzhi7;
-    @BindView(R.id.sw_dingshi_sw8)
-    Switch swDingshiSw8;
-    @BindView(R.id.tv_dingshi_start8)
-    TextView tvDingshiStart8;
-    @BindView(R.id.tv_dingshi_close8)
-    TextView tvDingshiClose8;
-    @BindView(R.id.bt_kongzhi_8)
-    Button btKongzhi8;
-    @BindView(R.id.tv_led1_name)
-    TextView tvLed1Name;
-    @BindView(R.id.ll_led1)
-    LinearLayout llLed1;
-    @BindView(R.id.tv_led2_name)
-    TextView tvLed2Name;
-    @BindView(R.id.ll_led2)
-    LinearLayout llLed2;
-    @BindView(R.id.tv_led3_name)
-    TextView tvLed3Name;
-    @BindView(R.id.ll_led3)
-    LinearLayout llLed3;
-    @BindView(R.id.tv_led4_name)
-    TextView tvLed4Name;
-    @BindView(R.id.ll_led4)
-    LinearLayout llLed4;
-    @BindView(R.id.tv_pump1_name)
-    TextView tvPump1Name;
-    @BindView(R.id.ll_pump1)
-    LinearLayout llPump1;
-    @BindView(R.id.tv_pump2_name)
-    TextView tvPump2Name;
-    @BindView(R.id.ll_pump2)
-    LinearLayout llPump2;
-    @BindView(R.id.tv_pump3_name)
-    TextView tvPump3Name;
-    @BindView(R.id.ll_pump3)
-    LinearLayout llPump3;
-    @BindView(R.id.tv_pump4_name)
-    TextView tvPump4Name;
-    @BindView(R.id.ll_pump4)
-    LinearLayout llPump4;
-
-    private String device_mac;
-    private String L1 = "";
-    private String L2 = "";
-    private String L3 = "";
-    private String L4 = "";
-    private String S1 = "";
-    private String S2 = "";
-    private String S3 = "";
-    private String S4 = "";
-    private int currentOnline1;
-    private int currentOnline2;
-    private int currentOnline3;
-    private int currentOnline4;
-    private int currentOnline5;
-    private int currentOnline6;
-    private int currentOnline7;
-    private int currentOnline8;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_dengkongzhi;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("定时控制");
-
-        Intent intent = getIntent();
-        device_mac = intent.getStringExtra("Device_Mac");
-        if (!TextUtils.isEmpty(device_mac)) {
-            getNodeData(device_mac);
-        }
-
-        swDingshiSw1.setOnCheckedChangeListener(this);
-        swDingshiSw2.setOnCheckedChangeListener(this);
-        swDingshiSw3.setOnCheckedChangeListener(this);
-        swDingshiSw4.setOnCheckedChangeListener(this);
-        swDingshiSw5.setOnCheckedChangeListener(this);
-        swDingshiSw6.setOnCheckedChangeListener(this);
-        swDingshiSw7.setOnCheckedChangeListener(this);
-        swDingshiSw8.setOnCheckedChangeListener(this);
-    }
-
-    @OnClick({R.id.iv_base_activity_back, R.id.tv_dingshi_start1, R.id.tv_dingshi_close1, R.id.bt_kongzhi_1, R.id.tv_dingshi_start2, R.id.tv_dingshi_close2, R.id.bt_kongzhi_2, R.id.tv_dingshi_start3, R.id.tv_dingshi_close3, R.id.bt_kongzhi_3, R.id.tv_dingshi_start4, R.id.tv_dingshi_close4, R.id.bt_kongzhi_4, R.id.tv_dingshi_start5, R.id.tv_dingshi_close5, R.id.bt_kongzhi_5, R.id.tv_dingshi_start6, R.id.tv_dingshi_close6, R.id.bt_kongzhi_6, R.id.tv_dingshi_start7, R.id.tv_dingshi_close7, R.id.bt_kongzhi_7, R.id.tv_dingshi_start8, R.id.tv_dingshi_close8, R.id.bt_kongzhi_8})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-            case R.id.tv_dingshi_start1:
-                setTimeByView(tvDingshiStart1);
-                break;
-            case R.id.tv_dingshi_close1:
-                setTimeByView(tvDingshiClose1);
-                break;
-            case R.id.bt_kongzhi_1:
-                String s1 = tvDingshiStart1.getText().toString().trim();
-                String e1 = tvDingshiClose1.getText().toString().trim();
-                if (TextUtils.isEmpty(s1)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e1)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(L1, currentOnline1, s1, e1);
-                break;
-            case R.id.tv_dingshi_start2:
-                setTimeByView(tvDingshiStart2);
-                break;
-            case R.id.tv_dingshi_close2:
-                setTimeByView(tvDingshiClose2);
-                break;
-            case R.id.bt_kongzhi_2:
-                String s2 = tvDingshiStart2.getText().toString().trim();
-                String e2 = tvDingshiClose2.getText().toString().trim();
-                if (TextUtils.isEmpty(s2)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e2)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(L2, currentOnline2, s2, e2);
-                break;
-            case R.id.tv_dingshi_start3:
-                setTimeByView(tvDingshiStart3);
-                break;
-            case R.id.tv_dingshi_close3:
-                setTimeByView(tvDingshiClose3);
-                break;
-            case R.id.bt_kongzhi_3:
-                String s3 = tvDingshiStart3.getText().toString().trim();
-                String e3 = tvDingshiClose3.getText().toString().trim();
-                if (TextUtils.isEmpty(s3)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e3)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(L3, currentOnline3, s3, e3);
-                break;
-            case R.id.tv_dingshi_start4:
-                setTimeByView(tvDingshiStart4);
-                break;
-            case R.id.tv_dingshi_close4:
-                setTimeByView(tvDingshiClose4);
-                break;
-            case R.id.bt_kongzhi_4:
-                String s4 = tvDingshiStart4.getText().toString().trim();
-                String e4 = tvDingshiClose4.getText().toString().trim();
-                if (TextUtils.isEmpty(s4)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e4)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(L4, currentOnline4, s4, e4);
-                break;
-            case R.id.tv_dingshi_start5:
-                setTimeByView(tvDingshiStart5);
-                break;
-            case R.id.tv_dingshi_close5:
-                setTimeByView(tvDingshiClose5);
-                break;
-            case R.id.bt_kongzhi_5:
-                String s5 = tvDingshiStart5.getText().toString().trim();
-                String e5 = tvDingshiClose5.getText().toString().trim();
-                if (TextUtils.isEmpty(s5)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e5)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(S1, currentOnline5, s5, e5);
-                break;
-            case R.id.tv_dingshi_start6:
-                setTimeByView(tvDingshiStart6);
-                break;
-            case R.id.tv_dingshi_close6:
-                setTimeByView(tvDingshiClose6);
-                break;
-            case R.id.bt_kongzhi_6:
-                String s6 = tvDingshiStart6.getText().toString().trim();
-                String e6 = tvDingshiClose6.getText().toString().trim();
-                if (TextUtils.isEmpty(s6)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e6)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(S2, currentOnline6, s6, e6);
-                break;
-            case R.id.tv_dingshi_start7:
-                setTimeByView(tvDingshiStart7);
-                break;
-            case R.id.tv_dingshi_close7:
-                setTimeByView(tvDingshiClose7);
-                break;
-            case R.id.bt_kongzhi_7:
-                String s7 = tvDingshiStart7.getText().toString().trim();
-                String e7 = tvDingshiClose7.getText().toString().trim();
-                if (TextUtils.isEmpty(s7)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e7)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(S3, currentOnline7, s7, e7);
-                break;
-            case R.id.tv_dingshi_start8:
-                setTimeByView(tvDingshiStart8);
-                break;
-            case R.id.tv_dingshi_close8:
-                setTimeByView(tvDingshiClose8);
-                break;
-            case R.id.bt_kongzhi_8:
-                String s8 = tvDingshiStart8.getText().toString().trim();
-                String e8 = tvDingshiClose8.getText().toString().trim();
-                if (TextUtils.isEmpty(s8)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (TextUtils.isEmpty(e8)) {
-                    WQUtils.showToast(this, "请选择关闭时间");
-                    break;
-                }
-                takeData(S4, currentOnline8, s8, e8);
-                break;
-        }
-    }
-
-    private void offMode(String nodeMac, int currentOnline, int control_Mode) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("NodeMac", nodeMac);
-            jsonObj.put("CurrentOnline", currentOnline);
-            jsonObj.put("Control_Mode", control_Mode);//1手动 0自动
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/UpdateDeviceControlMode", handler_offMode);
-    }
-
-    private Handler handler_offMode = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            BindDeviceBean getTokenBean = gson.fromJson(json, BindDeviceBean.class);
-
-            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-
-                initButton(btt, startt, cloosee, sww.isChecked(), sww);
-
-//                btt.setVisibility(View.GONE);
-//                startt.setEnabled(false);
-//                cloosee.setEnabled(false);
-//                startt.setBackgroundResource(R.drawable.rect_radius_device_dark1);d
-//                cloosee.setBackgroundResource(R.drawable.rect_radius_device_dark1);
-
-                WQUtils.tip(DingShiActivity.this, getTokenBean.getMessage() + "");
-            } else {
-
-                sww.setChecked(true);
-                WQUtils.tip(DingShiActivity.this, getTokenBean.getMessage() + "");
-            }
-        }
-    };
-
-
-    private void takeData(String nodeMac, int currentOnline, String startTime, String endTime) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("NodeMac", nodeMac);
-            jsonObj.put("CurrentOnline", currentOnline);
-            jsonObj.put("Swith_Time1", startTime);
-            jsonObj.put("Swith_Time2", endTime);
-            jsonObj.put("Swith_Time3", "");
-            jsonObj.put("Swith_Time4", "");
-            jsonObj.put("Swith_Action1", 255);
-            jsonObj.put("Swith_Action2", 0);
-            jsonObj.put("Swith_Action3", 255);
-            jsonObj.put("Swith_Action4", 0);
-            jsonObj.put("Swith_Mode", 1);//1 每天  2每周
-            jsonObj.put("Control_Mode", 0);//1手动 0自动
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/EditDeviceGateWayOn", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            BindDeviceBean getTokenBean = gson.fromJson(json, BindDeviceBean.class);
-
-            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-
-                WQUtils.tip(DingShiActivity.this, getTokenBean.getMessage() + "");
-            } else {
-                WQUtils.tip(DingShiActivity.this, getTokenBean.getMessage() + "");
-            }
-        }
-    };
-
-    //获取节点列表
-    private void getNodeData(String device_mac) {
-        String user_id = SPUtil.getString(this, "User_ID");
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("PageIndex", 1);
-            jsonObj.put("PageSize", 99);
-            jsonObj.put("UserID", user_id);
-            jsonObj.put("GateWayMac", device_mac);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/GetAllNodeByMac", handler_node);
-    }
-
-    private Handler handler_node = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            DeviceNodeBean deviceNodeBean = gson.fromJson(json, DeviceNodeBean.class);
-            if (deviceNodeBean != null && deviceNodeBean.getReturnCode() == 200) {
-                if (deviceNodeBean.getResult() != null && deviceNodeBean.getResult().getModels() != null && deviceNodeBean.getResult().getModels().size() > 0) {
-                    List<DeviceNodeBean.ResultBean.ModelsBean> node_list = deviceNodeBean.getResult().getModels();
-                    if (node_list != null && node_list.size() > 0) {
-
-                        List<DeviceNodeBean.ResultBean.ModelsBean> led = new ArrayList<>();
-                        List<DeviceNodeBean.ResultBean.ModelsBean> pump = new ArrayList<>();
-                        for (int i = 0; i < node_list.size(); i++) {
-                            if (node_list.get(i).getDeviceMac().contains("LED") || node_list.get(i).getDeviceMac().contains("led")) {
-                                led.add(node_list.get(i));
-                            } else {
-                                pump.add(node_list.get(i));
-                            }
-                        }
-
-
-                        if (led.size() >= 1) {
-                            llLed1.setVisibility(View.VISIBLE);
-                            tvLed1Name.setText(led.get(0).getDeviceName());
-                            L1 = led.get(0).getDeviceMac();
-                            currentOnline1 = led.get(0).getCurrentOnline();
-
-                            if (led.get(0).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(led.get(0).getSwith_Time1())) {
-                                    tvDingshiStart1.setText(led.get(0).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(led.get(0).getSwith_Time2())) {
-                                    tvDingshiClose1.setText(led.get(0).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (led.get(0).getControl_Mode() == 0 || led.get(0).getControl_Mode() == 16) {
-                                initButton(btKongzhi1, tvDingshiStart1, tvDingshiClose1, true, swDingshiSw1);
-                            } else {
-                                initButton(btKongzhi1, tvDingshiStart1, tvDingshiClose1, false, swDingshiSw1);
-                            }
-                        }
-                        if (led.size() >= 2) {
-                            llLed2.setVisibility(View.VISIBLE);
-                            tvLed2Name.setText(led.get(1).getDeviceName());
-                            L2 = led.get(1).getDeviceMac();
-                            currentOnline2 = led.get(1).getCurrentOnline();
-
-                            if (led.get(1).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(led.get(1).getSwith_Time1())) {
-                                    tvDingshiStart2.setText(led.get(1).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(led.get(1).getSwith_Time2())) {
-                                    tvDingshiClose2.setText(led.get(1).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (led.get(1).getControl_Mode() == 0 || led.get(1).getControl_Mode() == 16) {
-                                initButton(btKongzhi2, tvDingshiStart2, tvDingshiClose2, true, swDingshiSw2);
-                            } else {
-                                initButton(btKongzhi2, tvDingshiStart2, tvDingshiClose2, false, swDingshiSw2);
-                            }
-                        }
-                        if (led.size() >= 3) {
-                            llLed3.setVisibility(View.VISIBLE);
-                            tvLed3Name.setText(led.get(2).getDeviceName());
-                            L3 = led.get(2).getDeviceMac();
-                            currentOnline3 = led.get(2).getCurrentOnline();
-
-                            if (led.get(2).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(led.get(2).getSwith_Time1())) {
-                                    tvDingshiStart3.setText(led.get(2).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(led.get(2).getSwith_Time2())) {
-                                    tvDingshiClose3.setText(led.get(2).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (led.get(2).getControl_Mode() == 0 || led.get(2).getControl_Mode() == 16) {
-                                initButton(btKongzhi3, tvDingshiStart3, tvDingshiClose3, true, swDingshiSw3);
-                            } else {
-                                initButton(btKongzhi3, tvDingshiStart3, tvDingshiClose3, false, swDingshiSw3);
-                            }
-                        }
-                        if (led.size() >= 4) {
-                            llLed4.setVisibility(View.VISIBLE);
-                            tvLed4Name.setText(led.get(3).getDeviceName());
-                            L4 = led.get(3).getDeviceMac();
-                            currentOnline4 = led.get(3).getCurrentOnline();
-
-                            if (led.get(3).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(led.get(3).getSwith_Time1())) {
-                                    tvDingshiStart4.setText(led.get(3).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(led.get(3).getSwith_Time2())) {
-                                    tvDingshiClose4.setText(led.get(3).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (led.get(3).getControl_Mode() == 0 || led.get(3).getControl_Mode() == 16) {
-                                initButton(btKongzhi4, tvDingshiStart4, tvDingshiClose4, true, swDingshiSw4);
-                            } else {
-                                initButton(btKongzhi4, tvDingshiStart4, tvDingshiClose4, false, swDingshiSw4);
-                            }
-                        }
-
-                        if (pump.size() >= 1) {
-                            llPump1.setVisibility(View.VISIBLE);
-                            tvPump1Name.setText(pump.get(0).getDeviceName());
-                            S1 = pump.get(0).getDeviceMac();
-                            currentOnline5 = pump.get(0).getCurrentOnline();
-
-                            if (pump.get(0).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(pump.get(0).getSwith_Time1())) {
-                                    tvDingshiStart5.setText(pump.get(0).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(pump.get(0).getSwith_Time2())) {
-                                    tvDingshiClose5.setText(pump.get(0).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (pump.get(0).getControl_Mode() == 0 || pump.get(0).getControl_Mode() == 16) {
-                                initButton(btKongzhi5, tvDingshiStart5, tvDingshiClose5, true, swDingshiSw5);
-                            } else {
-                                initButton(btKongzhi5, tvDingshiStart5, tvDingshiClose5, false, swDingshiSw5);
-                            }
-                        }
-                        if (pump.size() >= 2) {
-                            llPump2.setVisibility(View.VISIBLE);
-                            tvPump2Name.setText(pump.get(1).getDeviceName());
-                            S2 = pump.get(1).getDeviceMac();
-                            currentOnline6 = pump.get(1).getCurrentOnline();
-
-                            if (pump.get(1).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(pump.get(1).getSwith_Time1())) {
-                                    tvDingshiStart6.setText(pump.get(1).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(pump.get(1).getSwith_Time2())) {
-                                    tvDingshiClose6.setText(pump.get(1).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (pump.get(1).getControl_Mode() == 0 || pump.get(1).getControl_Mode() == 16) {
-                                initButton(btKongzhi6, tvDingshiStart6, tvDingshiClose6, true, swDingshiSw6);
-                            } else {
-                                initButton(btKongzhi6, tvDingshiStart6, tvDingshiClose6, false, swDingshiSw6);
-                            }
-                        }
-                        if (pump.size() >= 3) {
-                            llPump3.setVisibility(View.VISIBLE);
-                            tvPump3Name.setText(pump.get(2).getDeviceName());
-                            S3 = pump.get(2).getDeviceMac();
-                            currentOnline7 = pump.get(2).getCurrentOnline();
-
-                            if (pump.get(2).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(pump.get(2).getSwith_Time1())) {
-                                    tvDingshiStart7.setText(pump.get(2).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(pump.get(2).getSwith_Time2())) {
-                                    tvDingshiClose7.setText(pump.get(2).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (pump.get(2).getControl_Mode() == 0 || pump.get(2).getControl_Mode() == 16) {
-                                initButton(btKongzhi7, tvDingshiStart7, tvDingshiClose7, true, swDingshiSw7);
-                            } else {
-                                initButton(btKongzhi7, tvDingshiStart7, tvDingshiClose7, false, swDingshiSw7);
-                            }
-                        }
-                        if (pump.size() >= 4) {
-                            llPump4.setVisibility(View.VISIBLE);
-                            tvPump4Name.setText(pump.get(3).getDeviceName());
-                            S4 = pump.get(3).getDeviceMac();
-                            currentOnline8 = pump.get(3).getCurrentOnline();
-
-                            if (pump.get(3).getControl_Mode() != 16) {
-                                if (!TextUtils.isEmpty(pump.get(3).getSwith_Time1())) {
-                                    tvDingshiStart8.setText(pump.get(3).getSwith_Time1().substring(13, 18));
-                                }
-                                if (!TextUtils.isEmpty(pump.get(3).getSwith_Time2())) {
-                                    tvDingshiClose8.setText(pump.get(3).getSwith_Time2().substring(13, 18));
-                                }
-                            }
-                            if (pump.get(3).getControl_Mode() == 0 || pump.get(3).getControl_Mode() == 16) {
-                                initButton(btKongzhi8, tvDingshiStart8, tvDingshiClose8, true, swDingshiSw8);
-                            } else {
-                                initButton(btKongzhi8, tvDingshiStart8, tvDingshiClose8, false, swDingshiSw8);
-                            }
-                        }
-                    }
-                }
-            } else {
-                WQUtils.tip(DingShiActivity.this, deviceNodeBean.getMessage() + "");
-            }
-        }
-    };
-
-    @Override
-    public void onCheckedChanged(CompoundButton buttonView, boolean b) {
-        //防止初始化的时候出发监听
-        if (!buttonView.isPressed()) {
-            return;
-        }
-        switch (buttonView.getId()) {
-            case R.id.sw_dingshi_sw1:
-                setButton(btKongzhi1, tvDingshiStart1, tvDingshiClose1, b, L1, currentOnline1);
-                sww = swDingshiSw1;
-                break;
-            case R.id.sw_dingshi_sw2:
-                setButton(btKongzhi2, tvDingshiStart2, tvDingshiClose2, b, L2, currentOnline2);
-                sww = swDingshiSw2;
-                break;
-            case R.id.sw_dingshi_sw3:
-                setButton(btKongzhi3, tvDingshiStart3, tvDingshiClose3, b, L3, currentOnline3);
-                sww = swDingshiSw3;
-                break;
-            case R.id.sw_dingshi_sw4:
-                setButton(btKongzhi4, tvDingshiStart4, tvDingshiClose4, b, L4, currentOnline4);
-                sww = swDingshiSw4;
-                break;
-            case R.id.sw_dingshi_sw5:
-                setButton(btKongzhi5, tvDingshiStart5, tvDingshiClose5, b, S1, currentOnline5);
-                sww = swDingshiSw5;
-                break;
-            case R.id.sw_dingshi_sw6:
-                setButton(btKongzhi6, tvDingshiStart6, tvDingshiClose6, b, S2, currentOnline6);
-                sww = swDingshiSw6;
-                break;
-            case R.id.sw_dingshi_sw7:
-                setButton(btKongzhi7, tvDingshiStart7, tvDingshiClose7, b, S3, currentOnline7);
-                sww = swDingshiSw7;
-                break;
-            case R.id.sw_dingshi_sw8:
-                setButton(btKongzhi8, tvDingshiStart8, tvDingshiClose8, b, S4, currentOnline8);
-                sww = swDingshiSw8;
-                break;
-        }
-    }
-
-    private Switch sww;
-    private Button btt;
-    private TextView startt;
-    private TextView cloosee;
-
-    private void setButton(Button bt, TextView start, TextView cloose, boolean b, String node_mac, int currentOnline) {
-        if (b) {
-            btt = bt;
-            startt = start;
-            cloosee = cloose;
-
-            offMode(node_mac, currentOnline, 0);
-        } else {
-            btt = bt;
-            startt = start;
-            cloosee = cloose;
-            offMode(node_mac, currentOnline, 1);
-        }
-    }
-
-    private void initButton(Button bt, TextView start, TextView cloose, boolean b, Switch sw) {
-        Log.e("wwqq", "initButton  " + b);
-        if (b) {
-            bt.setVisibility(View.VISIBLE);
-            start.setEnabled(true);
-            cloose.setEnabled(true);
-            start.setBackgroundResource(R.drawable.rect_radius_device_dark);
-            cloose.setBackgroundResource(R.drawable.rect_radius_device_dark);
-
-            sw.setChecked(true);
-        } else {
-            bt.setVisibility(View.GONE);
-            start.setEnabled(false);
-            cloose.setEnabled(false);
-            start.setBackgroundResource(R.drawable.rect_radius_device_dark1);
-            cloose.setBackgroundResource(R.drawable.rect_radius_device_dark1);
-        }
-    }
-
-    private void setTimeByView(TextView tv) {
-
-        final AlertDialog ad = new AlertDialog.Builder(this).create();
-        ad.show();
-        LayoutInflater inflater = LayoutInflater.from(this);
-        View view = inflater.inflate(R.layout.time_dialog, null);
-        final TimePicker timePick = (TimePicker) view.findViewById(R.id.timePic1);
-        Button bt_yes = (Button) view.findViewById(R.id.bt_yes);
-        Button bt_no = (Button) view.findViewById(R.id.bt_no);
-        timePick.setIs24HourView(true);
-        bt_yes.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View arg0) {
-                int h = timePick.getCurrentHour();
-                int m = timePick.getCurrentMinute();
-
-                String hour = "";
-                String min = "";
-                if (h < 10) {
-                    hour = "0" + h;
-                } else {
-                    hour = h + "";
-                }
-                if (m < 10) {
-                    min = "0" + m;
-                } else {
-                    min = m + "";
-                }
-
-                Log.e("时间", "|" + hour + ":" + min);
-
-                tv.setText(hour + ":" + min);
-                ad.dismiss();
-            }
-        });
-        bt_no.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View arg0) {
-                ad.dismiss();
-            }
-        });
-        ad.getWindow().setContentView(view);
-    }
-
-}

+ 0 - 124
app/src/main/java/com/wisdom/hydroponics/ui/activity/EditNameActivity.java

@@ -1,124 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.BindDeviceBean;
-import com.wisdom.hydroponics.bean.DeviceInfoBean;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-import butterknife.OnClick;
-
-public class EditNameActivity extends BaseActivity {
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.tv_title_right)
-    TextView tvTitleRight;
-    @BindView(R.id.et_editName_text)
-    EditText etEditNameText;
-    @BindView(R.id.bt_editName_ok)
-    Button btEditNameOk;
-    private String mac;
-    private String ed_name;
-    private String edName;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_editname;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("编辑设备名称");
-
-        Intent intent = getIntent();
-        mac = intent.getStringExtra("MAC");
-    }
-
-
-    @OnClick({R.id.iv_base_activity_back, R.id.bt_editName_ok})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-            case R.id.bt_editName_ok:
-                edName = etEditNameText.getText().toString().trim();
-                if (!TextUtils.isEmpty(edName)) {
-                    setDataName(mac, edName);
-                } else {
-                    WQUtils.showToast(this,"请输入设备名称");
-                }
-
-                break;
-        }
-    }
-
-    //修改名称
-    private void setDataName(String device_mac, String device_name) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("DeviceName", device_name);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this,jsonObj, SPUtil.getString(this, "URL") + "Device/UpdateDeviceNameByMac", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-            Gson gson = new Gson();
-            BindDeviceBean bindDeviceBean = gson.fromJson(json, BindDeviceBean.class);
-            if (bindDeviceBean != null && bindDeviceBean.getReturnCode() == 200) {
-
-                showOK(bindDeviceBean.getMessage() + "");
-            } else {
-                WQUtils.tip(EditNameActivity.this, bindDeviceBean.getMessage() + "");
-            }
-        }
-    };
-
-    private void showOK(String str) {
-        AlertDialog.Builder builder = new AlertDialog.Builder(this);
-        builder.setMessage(str);
-        builder.setTitle("提示");
-        builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-                Intent intent = new Intent();
-                intent.putExtra("Name",edName);
-                setResult(RESULT_OK,intent);
-                finish();
-            }
-        });
-        builder.create().show();
-    }
-}

+ 0 - 311
app/src/main/java/com/wisdom/hydroponics/ui/activity/EspTouchActivity.java

@@ -1,311 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.pm.PackageManager;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.widget.Toast;
-
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.ActionBar;
-import androidx.appcompat.app.AlertDialog;
-
-import com.espressif.iot.esptouch.EsptouchTask;
-import com.espressif.iot.esptouch.IEsptouchResult;
-import com.espressif.iot.esptouch.IEsptouchTask;
-import com.espressif.iot.esptouch.util.ByteUtil;
-import com.espressif.iot.esptouch.util.TouchNetUtil;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.databinding.ActivityEsptouchBinding;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-public class EspTouchActivity extends EspTouchActivityAbs {
-    private static final String TAG = EspTouchActivity.class.getSimpleName();
-
-    private static final int REQUEST_PERMISSION = 0x01;
-
-    private EsptouchAsyncTask4 mTask;
-
-    private ActivityEsptouchBinding mBinding;
-
-    private String mSsid;
-    private byte[] mSsidBytes;
-    private String mBssid;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        mBinding = ActivityEsptouchBinding.inflate(getLayoutInflater());
-        setContentView(mBinding.getRoot());
-        mBinding.confirmBtn.setOnClickListener(v -> executeEsptouch());
-
-        mBinding.cancelButton.setOnClickListener(v -> {
-            showProgress(false);
-            if (mTask != null) {
-                mTask.cancelEsptouch();
-            }
-        });
-
-        mBinding.ivBaseActivityBack.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                finish();
-            }
-        });
-
-        mBinding.tvTitleCenter.setText("绑定wifi");
-
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            String[] permissions = {Manifest.permission.ACCESS_FINE_LOCATION};
-            requestPermissions(permissions, REQUEST_PERMISSION);
-        }
-
-//        EspTouchApp.getInstance().observeBroadcast(this, broadcast -> {
-//            Log.d(TAG, "onCreate: Broadcast=" + broadcast);
-//            onWifiChanged();
-//        });
-
-        onWifiChanged();
-
-        ActionBar actionBar = getSupportActionBar();
-        if (actionBar != null) {
-            actionBar.setDisplayHomeAsUpEnabled(true);
-        }
-    }
-
-    @Override
-    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
-        if (requestCode == REQUEST_PERMISSION) {
-            if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-                onWifiChanged();
-            } else {
-                new AlertDialog.Builder(this)
-                        .setTitle(R.string.esptouch1_location_permission_title)
-                        .setMessage(R.string.esptouch1_location_permission_message)
-                        .setCancelable(false)
-                        .setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
-                        .show();
-            }
-
-            return;
-        }
-
-        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
-    }
-
-    private void showProgress(boolean show) {
-        if (show) {
-            mBinding.content.setVisibility(View.INVISIBLE);
-            mBinding.progressView.setVisibility(View.VISIBLE);
-        } else {
-            mBinding.content.setVisibility(View.VISIBLE);
-            mBinding.progressView.setVisibility(View.GONE);
-        }
-    }
-
-    @Override
-    protected String getEspTouchVersion() {
-        return getString(R.string.esptouch1_about_version, IEsptouchTask.ESPTOUCH_VERSION);
-    }
-
-    private StateResult check() {
-        StateResult result = checkPermission();
-        if (!result.permissionGranted) {
-            return result;
-        }
-        result = checkLocation();
-        result.permissionGranted = true;
-        if (result.locationRequirement) {
-            return result;
-        }
-        result = checkWifi();
-        result.permissionGranted = true;
-        result.locationRequirement = false;
-        return result;
-    }
-
-    private void onWifiChanged() {
-        StateResult stateResult = check();
-        mSsid = stateResult.ssid;
-        mSsidBytes = stateResult.ssidBytes;
-        mBssid = stateResult.bssid;
-        CharSequence message = stateResult.message;
-        boolean confirmEnable = false;
-        if (stateResult.wifiConnected) {
-            confirmEnable = true;
-            if (stateResult.is5G) {
-                message = getString(R.string.esptouch1_wifi_5g_message);
-            }
-        } else {
-            if (mTask != null) {
-                mTask.cancelEsptouch();
-                mTask = null;
-                new AlertDialog.Builder(EspTouchActivity.this)
-                        .setMessage(R.string.esptouch1_configure_wifi_change_message)
-                        .setNegativeButton(android.R.string.cancel, null)
-                        .show();
-            }
-        }
-
-        mBinding.apSsidText.setText(mSsid);
-        mBinding.apBssidText.setText(mBssid);
-        mBinding.messageView.setText(message);
-        mBinding.confirmBtn.setEnabled(confirmEnable);
-    }
-
-    private void executeEsptouch() {
-        byte[] ssid = mSsidBytes == null ? ByteUtil.getBytesByString(this.mSsid)
-                : mSsidBytes;
-        CharSequence pwdStr = mBinding.apPasswordEdit.getText();
-        byte[] password = pwdStr == null ? null : ByteUtil.getBytesByString(pwdStr.toString());
-        byte[] bssid = TouchNetUtil.parseBssid2bytes(this.mBssid);
-        CharSequence devCountStr = mBinding.deviceCountEdit.getText();
-        byte[] deviceCount = devCountStr == null ? new byte[0] : devCountStr.toString().getBytes();
-        byte[] broadcast = {(byte) (mBinding.packageModeGroup.getCheckedRadioButtonId() == R.id.packageBroadcast
-                ? 1 : 0)};
-
-        Log.e(TAG, "->" + this.mSsid);
-        Log.e(TAG, "->" + this.mBssid);
-        Log.e(TAG, "->" + pwdStr);
-        Log.e(TAG, "->" + devCountStr);
-        Log.e(TAG, "->" + (byte) (mBinding.packageModeGroup.getCheckedRadioButtonId() == R.id.packageBroadcast
-                ? 1 : 0));
-
-        if (mTask != null) {
-            mTask.cancelEsptouch();
-        }
-        mTask = new EsptouchAsyncTask4(this);
-        mTask.execute(ssid, bssid, password, deviceCount, broadcast);
-    }
-
-    private static class EsptouchAsyncTask4 extends AsyncTask<byte[], IEsptouchResult, List<IEsptouchResult>> {
-        private final WeakReference<EspTouchActivity> mActivity;
-
-        private final Object mLock = new Object();
-        private AlertDialog mResultDialog;
-        private IEsptouchTask mEsptouchTask;
-
-        EsptouchAsyncTask4(EspTouchActivity activity) {
-            mActivity = new WeakReference<>(activity);
-        }
-
-        void cancelEsptouch() {
-            cancel(true);
-            EspTouchActivity activity = mActivity.get();
-            if (activity != null) {
-                activity.showProgress(false);
-            }
-            if (mResultDialog != null) {
-                mResultDialog.dismiss();
-            }
-            if (mEsptouchTask != null) {
-                mEsptouchTask.interrupt();
-            }
-        }
-
-        @Override
-        protected void onPreExecute() {
-            EspTouchActivity activity = mActivity.get();
-            activity.mBinding.testResult.setText("");
-            activity.showProgress(true);
-        }
-
-        @Override
-        protected void onProgressUpdate(IEsptouchResult... values) {
-            EspTouchActivity activity = mActivity.get();
-            if (activity != null) {
-                IEsptouchResult result = values[0];
-                Log.i(TAG, "EspTouchResult: " + result);
-                String text = result.getBssid() + " is connected to the wifi";
-                Toast.makeText(activity, text, Toast.LENGTH_SHORT).show();
-
-                activity.mBinding.testResult.append(String.format(
-                        Locale.ENGLISH,
-                        "%s,%s\n",
-                        result.getInetAddress().getHostAddress(),
-                        result.getBssid()
-                ));
-            }
-        }
-
-        @Override
-        protected List<IEsptouchResult> doInBackground(byte[]... params) {
-            EspTouchActivity activity = mActivity.get();
-            int taskResultCount;
-            synchronized (mLock) {
-                byte[] apSsid = params[0];
-                byte[] apBssid = params[1];
-                byte[] apPassword = params[2];
-                byte[] deviceCountData = params[3];
-                byte[] broadcastData = params[4];
-                taskResultCount = deviceCountData.length == 0 ? -1 : Integer.parseInt(new String(deviceCountData));
-                Context context = activity.getApplicationContext();
-                mEsptouchTask = new EsptouchTask(apSsid, apBssid, apPassword, context);
-                mEsptouchTask.setPackageBroadcast(broadcastData[0] == 1);
-                mEsptouchTask.setEsptouchListener(this::publishProgress);
-            }
-            return mEsptouchTask.executeForResults(taskResultCount);
-        }
-
-
-        @Override
-        protected void onPostExecute(List<IEsptouchResult> result) {
-            EspTouchActivity activity = mActivity.get();
-            activity.mTask = null;
-            activity.showProgress(false);
-            if (result == null) {
-                mResultDialog = new AlertDialog.Builder(activity)
-                        .setMessage(R.string.esptouch1_configure_result_failed_port)
-                        .setPositiveButton(android.R.string.ok, null)
-                        .show();
-                mResultDialog.setCanceledOnTouchOutside(false);
-                return;
-            }
-
-            // check whether the task is cancelled and no results received
-            IEsptouchResult firstResult = result.get(0);
-            if (firstResult.isCancelled()) {
-                return;
-            }
-            // the task received some results including cancelled while
-            // executing before receiving enough results
-
-            if (!firstResult.isSuc()) {
-                mResultDialog = new AlertDialog.Builder(activity)
-                        .setMessage("配网完成")
-                        .setPositiveButton(android.R.string.ok, null)
-                        .show();
-                mResultDialog.setCanceledOnTouchOutside(false);
-                return;
-            }
-
-            ArrayList<CharSequence> resultMsgList = new ArrayList<>(result.size());
-            for (IEsptouchResult touchResult : result) {
-                String message = activity.getString(R.string.esptouch1_configure_result_success_item,
-                        touchResult.getBssid(), touchResult.getInetAddress().getHostAddress());
-                resultMsgList.add(message);
-            }
-            CharSequence[] items = new CharSequence[resultMsgList.size()];
-            mResultDialog = new AlertDialog.Builder(activity)
-                    .setTitle(R.string.esptouch1_configure_result_success)
-                    .setItems(resultMsgList.toArray(items), null)
-                    .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-                        @Override
-                        public void onClick(DialogInterface dialog, int which) {
-                            mActivity.get().finish();
-                        }
-                    })
-                    .show();
-            mResultDialog.setCanceledOnTouchOutside(false);
-        }
-    }
-}

+ 0 - 176
app/src/main/java/com/wisdom/hydroponics/ui/activity/EspTouchActivityAbs.java

@@ -1,176 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.Manifest;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.location.LocationManager;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-import android.os.Build;
-import android.os.Bundle;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.SpannableStringBuilder;
-import android.text.style.ForegroundColorSpan;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.location.LocationManagerCompat;
-
-import com.espressif.iot.esptouch2.provision.TouchNetUtil;
-import com.wisdom.hydroponics.R;
-
-import java.net.InetAddress;
-
-public abstract class EspTouchActivityAbs extends AppCompatActivity {
-    private static final int MENU_ITEM_ABOUT = 0;
-
-    private WifiManager mWifiManager;
-
-    protected abstract String getEspTouchVersion();
-
-    protected static class StateResult {
-        public CharSequence message = null;
-
-        public boolean permissionGranted = false;
-
-        public boolean locationRequirement = false;
-
-        public boolean wifiConnected = false;
-        public boolean is5G = false;
-        public InetAddress address = null;
-        public String ssid = null;
-        public byte[] ssidBytes = null;
-        public String bssid = null;
-    }
-
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        mWifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
-    }
-
-    private void showAboutDialog() {
-        String esptouchVerText = getEspTouchVersion();
-        String appVer = "";
-        PackageManager packageManager = getPackageManager();
-        try {
-            PackageInfo info = packageManager.getPackageInfo(getPackageName(), 0);
-            appVer = info.versionName;
-        } catch (PackageManager.NameNotFoundException e) {
-            e.printStackTrace();
-        }
-
-        CharSequence[] items = new CharSequence[]{
-                getString(R.string.about_app_version, appVer),
-                esptouchVerText
-        };
-        new AlertDialog.Builder(this)
-                .setTitle(R.string.menu_item_about)
-                .setIcon(R.drawable.baseline_info_black_24)
-                .setItems(items, null)
-                .show();
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        menu.add(Menu.NONE, MENU_ITEM_ABOUT, 0, R.string.menu_item_about)
-                .setIcon(R.drawable.ic_info_outline_white_24dp)
-                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-        return super.onCreateOptionsMenu(menu);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case android.R.id.home:
-                onBackPressed();
-                return true;
-            case MENU_ITEM_ABOUT:
-                showAboutDialog();
-                return true;
-        }
-
-        return super.onOptionsItemSelected(item);
-    }
-
-    protected StateResult checkPermission() {
-        StateResult result = new StateResult();
-        result.permissionGranted = false;
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
-            boolean locationGranted = checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)
-                    == PackageManager.PERMISSION_GRANTED;
-            if (!locationGranted) {
-                String[] splits = getString(R.string.esptouch_message_permission).split("\n");
-                if (splits.length != 2) {
-                    throw new IllegalArgumentException("Invalid String @RES esptouch_message_permission");
-                }
-                SpannableStringBuilder ssb = new SpannableStringBuilder(splits[0]);
-                ssb.append('\n');
-                SpannableString clickMsg = new SpannableString(splits[1]);
-                ForegroundColorSpan clickSpan = new ForegroundColorSpan(0xFF0022FF);
-                clickMsg.setSpan(clickSpan, 0, clickMsg.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-                ssb.append(clickMsg);
-                result.message = ssb;
-                return result;
-            }
-        }
-
-        result.permissionGranted = true;
-        return result;
-    }
-
-    protected StateResult checkLocation() {
-        StateResult result = new StateResult();
-        result.locationRequirement = true;
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
-            LocationManager manager = getSystemService(LocationManager.class);
-            boolean enable = manager != null && LocationManagerCompat.isLocationEnabled(manager);
-            if (!enable) {
-                result.message = getString(R.string.esptouch_message_location);
-                return result;
-            }
-        }
-
-        result.locationRequirement = false;
-        return result;
-    }
-
-    protected StateResult checkWifi() {
-        StateResult result = new StateResult();
-        result.wifiConnected = false;
-        WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
-        boolean connected = TouchNetUtil.isWifiConnected(mWifiManager);
-        if (!connected) {
-            result.message = getString(R.string.esptouch_message_wifi_connection);
-            return result;
-        }
-
-        String ssid = TouchNetUtil.getSsidString(wifiInfo);
-        int ipValue = wifiInfo.getIpAddress();
-        if (ipValue != 0) {
-            result.address = TouchNetUtil.getAddress(wifiInfo.getIpAddress());
-        } else {
-            result.address = TouchNetUtil.getIPv4Address();
-            if (result.address == null) {
-                result.address = TouchNetUtil.getIPv6Address();
-            }
-        }
-
-        result.wifiConnected = true;
-        result.message = "";
-        result.is5G = TouchNetUtil.is5G(wifiInfo.getFrequency());
-        if (result.is5G) {
-            result.message = getString(R.string.esptouch_message_wifi_frequency);
-        }
-        result.ssid = ssid;
-        result.ssidBytes = TouchNetUtil.getRawSsidBytesOrElse(wifiInfo, ssid.getBytes());
-        result.bssid = wifiInfo.getBSSID();
-
-        return result;
-    }
-}

+ 0 - 89
app/src/main/java/com/wisdom/hydroponics/ui/activity/EspTouchApp.java

@@ -1,89 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.app.Application;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.location.LocationManager;
-import android.net.wifi.WifiManager;
-import android.os.Build;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.Observer;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class EspTouchApp extends Application {
-    private static EspTouchApp app;
-
-    private MutableLiveData<String> mBroadcastData;
-
-    private Map<String, Object> mCacheMap;
-
-    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            String action = intent.getAction();
-            if (action == null) {
-                return;
-            }
-
-            switch (action) {
-                case WifiManager.NETWORK_STATE_CHANGED_ACTION:
-                case LocationManager.PROVIDERS_CHANGED_ACTION:
-                    mBroadcastData.setValue(action);
-                    break;
-            }
-        }
-    };
-
-    @Override
-    public void onCreate() {
-        super.onCreate();
-
-        app = this;
-
-        mCacheMap = new HashMap<>();
-
-        mBroadcastData = new MutableLiveData<>();
-        IntentFilter filter = new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION);
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
-            filter.addAction(LocationManager.PROVIDERS_CHANGED_ACTION);
-        }
-        registerReceiver(mReceiver, filter);
-    }
-
-    @Override
-    public void onTerminate() {
-        super.onTerminate();
-
-        unregisterReceiver(mReceiver);
-    }
-
-    public static EspTouchApp getInstance() {
-        return app;
-    }
-
-    public void observeBroadcast(LifecycleOwner owner, Observer<String> observer) {
-        mBroadcastData.observe(owner, observer);
-    }
-
-    public void observeBroadcastForever(Observer<String> observer) {
-        mBroadcastData.observeForever(observer);
-    }
-
-    public void removeBroadcastObserver(Observer<String> observer) {
-        mBroadcastData.removeObserver(observer);
-    }
-
-    public void putCache(String key, Object value) {
-        mCacheMap.put(key, value);
-    }
-
-    public Object takeCache(String key) {
-        return mCacheMap.remove(key);
-    }
-}

+ 0 - 118
app/src/main/java/com/wisdom/hydroponics/ui/activity/LoginActivity.java

@@ -1,118 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.content.DialogInterface;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.LoginBean;
-import com.wisdom.hydroponics.ui.MainTabActivity;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import butterknife.BindView;
-
-/**
- * A login screen that offers login via email/password.
- */
-public class LoginActivity extends BaseActivity {
-
-    @BindView(R.id.et_user)
-    EditText etUser;
-    @BindView(R.id.et_password)
-    EditText etPassword;
-    @BindView(R.id.email_sign_in_button)
-    Button emailSignInButton;
-    //    @BindView(R.id.service_29)
-//    RadioButton service29;
-//    @BindView(R.id.service_30)
-//    RadioButton service30;
-//    @BindView(R.id.service_178)
-//    RadioButton service178;
-
-    private String email;
-    private String password;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_login;
-    }
-
-    @Override
-    public void initView() {
-        SPUtil.put(this, "URL", "http://101.200.61.54:6500/api/");
-
-//        etUser.setText("admin");
-//        etPassword.setText("tian2020");
-
-//        etUser.setText(TextUtils.isEmpty(userName) ? "" : userName);
-//        etPassword.setText(TextUtils.isEmpty(userPassword) ? "" : userPassword);
-
-        emailSignInButton.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-
-                email = etUser.getText().toString();
-                password = etPassword.getText().toString();
-
-                if (TextUtils.isEmpty(email)) {
-                    etUser.setError("账号不能为空");
-                    return;
-                }
-
-                if (TextUtils.isEmpty(password)) {
-                    etPassword.setError("密码不能为空");//给用户提示密码无效
-                    return;
-                }
-
-                toLogin(email, password);
-            }
-        });
-
-    }
-
-    private void toLogin(String email, String password) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("UserName", email);
-            jsonObj.put("Password", password);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this,jsonObj, SPUtil.getString(this, "URL") + "User/UserLoin", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            LoginBean bean = gson.fromJson(json, LoginBean.class);
-
-            if (bean != null && bean.getReturnCode() == 200) {
-
-                SPUtil.put(LoginActivity.this, "User_ID", bean.getMessage() + "");
-                WQUtils.startActivity(LoginActivity.this, MainTabActivity.class);
-            } else {
-                WQUtils.tip(LoginActivity.this, bean.getMessage() + "");
-            }
-        }
-    };
-
-}
-

+ 0 - 351
app/src/main/java/com/wisdom/hydroponics/ui/activity/TiaoGuangActivity.java

@@ -1,351 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.BindDeviceBean;
-import com.wisdom.hydroponics.bean.DeviceNodeBean;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-import butterknife.OnClick;
-
-public class TiaoGuangActivity extends BaseActivity implements SeekBar.OnSeekBarChangeListener {
-
-
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.seekBar_red1)
-    SeekBar seekBarRed1;
-    @BindView(R.id.seekBar_blue1)
-    SeekBar seekBarBlue1;
-    @BindView(R.id.seekBar_red2)
-    SeekBar seekBarRed2;
-    @BindView(R.id.seekBar_blue2)
-    SeekBar seekBarBlue2;
-    @BindView(R.id.seekBar_red3)
-    SeekBar seekBarRed3;
-    @BindView(R.id.seekBar_blue3)
-    SeekBar seekBarBlue3;
-    @BindView(R.id.seekBar_red4)
-    SeekBar seekBarRed4;
-    @BindView(R.id.seekBar_blue4)
-    SeekBar seekBarBlue4;
-    @BindView(R.id.tv_red1)
-    TextView tvRed1;
-    @BindView(R.id.tv_blue1)
-    TextView tvBlue1;
-    @BindView(R.id.tv_red2)
-    TextView tvRed2;
-    @BindView(R.id.tv_blue2)
-    TextView tvBlue2;
-    @BindView(R.id.tv_red3)
-    TextView tvRed3;
-    @BindView(R.id.tv_blue3)
-    TextView tvBlue3;
-    @BindView(R.id.tv_red4)
-    TextView tvRed4;
-    @BindView(R.id.tv_blue4)
-    TextView tvBlue4;
-    @BindView(R.id.tv_led1_name)
-    TextView tvLed1Name;
-    @BindView(R.id.tv_led2_name)
-    TextView tvLed2Name;
-    @BindView(R.id.tv_led3_name)
-    TextView tvLed3Name;
-    @BindView(R.id.tv_led4_name)
-    TextView tvLed4Name;
-    @BindView(R.id.ll_led1)
-    LinearLayout llLed1;
-    @BindView(R.id.ll_led2)
-    LinearLayout llLed2;
-    @BindView(R.id.ll_led3)
-    LinearLayout llLed3;
-    @BindView(R.id.ll_led4)
-    LinearLayout llLed4;
-
-    private String device_mac;
-    private String L1 = "";
-    private String L2 = "";
-    private String L3 = "";
-    private String L4 = "";
-    private int currentOnline1;
-    private int currentOnline2;
-    private int currentOnline3;
-    private int currentOnline4;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_deng_tiaoguang;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("灯光控制");
-
-        Intent intent = getIntent();
-        device_mac = intent.getStringExtra("Device_Mac");
-        if (!TextUtils.isEmpty(device_mac)) {
-            getNodeData(device_mac);
-        }
-
-        seekBarRed1.setOnSeekBarChangeListener(this);
-        seekBarRed2.setOnSeekBarChangeListener(this);
-        seekBarRed3.setOnSeekBarChangeListener(this);
-        seekBarRed4.setOnSeekBarChangeListener(this);
-        seekBarBlue1.setOnSeekBarChangeListener(this);
-        seekBarBlue2.setOnSeekBarChangeListener(this);
-        seekBarBlue3.setOnSeekBarChangeListener(this);
-        seekBarBlue4.setOnSeekBarChangeListener(this);
-    }
-
-    //获取节点列表
-    private void getNodeData(String device_mac) {
-        String user_id = SPUtil.getString(this, "User_ID");
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("PageIndex", 1);
-            jsonObj.put("PageSize", 99);
-            jsonObj.put("UserID", user_id);
-            jsonObj.put("GateWayMac", device_mac);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/GetAllNodeByMac", handler_node);
-    }
-
-    //设置调光
-    private void setLightProgress(String device_mac, String node_mac, int dimming_mode, int currentOnline, int progress) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("NodeMac", node_mac);
-            jsonObj.put("Dimmer_Mode", dimming_mode);
-            jsonObj.put("CurrentOnline", currentOnline);
-            jsonObj.put("Device_Luminance", progress);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/UpdateBrightness", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-            Gson gson = new Gson();
-            BindDeviceBean bindDeviceBean = gson.fromJson(json, BindDeviceBean.class);
-            if (bindDeviceBean != null && bindDeviceBean.getReturnCode() == 200) {
-
-
-            } else {
-                WQUtils.tip(TiaoGuangActivity.this, bindDeviceBean.getMessage() + "");
-                seekBar.setProgress(pro_cache);
-                textView.setText(pro_cache + "%");
-            }
-        }
-    };
-
-    private Handler handler_node = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            DeviceNodeBean deviceNodeBean = gson.fromJson(json, DeviceNodeBean.class);
-            if (deviceNodeBean != null && deviceNodeBean.getReturnCode() == 200) {
-                if (deviceNodeBean.getResult() != null && deviceNodeBean.getResult().getModels() != null && deviceNodeBean.getResult().getModels().size() > 0) {
-                    List<DeviceNodeBean.ResultBean.ModelsBean> node_list = deviceNodeBean.getResult().getModels();
-                    if (node_list != null && node_list.size() > 0) {
-
-                        List<DeviceNodeBean.ResultBean.ModelsBean> led = new ArrayList<>();
-                        for (int i = 0; i < node_list.size(); i++) {
-                            if (node_list.get(i).getDeviceMac().contains("LED") || node_list.get(i).getDeviceMac().contains("led")) {
-                                led.add(node_list.get(i));
-                            }
-                        }
-
-                        if (led.size() >= 1) {
-                            llLed1.setVisibility(View.VISIBLE);
-                            tvLed1Name.setText(led.get(0).getDeviceName());
-                            L1 = led.get(0).getDeviceMac();
-                            currentOnline1 = led.get(0).getCurrentOnline();
-
-                            seekBarRed1.setProgress(led.get(0).getRed_Luminance());
-                            seekBarBlue1.setProgress(led.get(0).getBlue_Luminance());
-                            tvRed1.setText(led.get(0).getRed_Luminance() + "%");
-                        }
-                        if (led.size() >= 2) {
-                            llLed2.setVisibility(View.VISIBLE);
-                            tvLed2Name.setText(led.get(1).getDeviceName());
-                            L2 = led.get(1).getDeviceMac();
-                            currentOnline2 = led.get(1).getCurrentOnline();
-
-                            seekBarRed2.setProgress(led.get(1).getRed_Luminance());
-                            seekBarBlue2.setProgress(led.get(1).getBlue_Luminance());
-                            tvRed2.setText(led.get(1).getRed_Luminance() + "%");
-                        }
-                        if (led.size() >= 3) {
-                            llLed3.setVisibility(View.VISIBLE);
-                            tvLed3Name.setText(led.get(2).getDeviceName());
-                            L3 = led.get(2).getDeviceMac();
-                            currentOnline3 = led.get(2).getCurrentOnline();
-
-                            seekBarRed3.setProgress(led.get(2).getRed_Luminance());
-                            seekBarBlue3.setProgress(led.get(2).getBlue_Luminance());
-                            tvRed3.setText(led.get(2).getRed_Luminance() + "%");
-                        }
-                        if (led.size() >= 4) {
-                            llLed4.setVisibility(View.VISIBLE);
-                            tvLed4Name.setText(led.get(3).getDeviceName());
-                            L4 = led.get(3).getDeviceMac();
-                            currentOnline4 = led.get(3).getCurrentOnline();
-
-                            seekBarRed4.setProgress(led.get(3).getRed_Luminance());
-                            seekBarBlue4.setProgress(led.get(3).getBlue_Luminance());
-                            tvRed4.setText(led.get(3).getRed_Luminance() + "%");
-                        }
-
-                    }
-                }
-            } else {
-                WQUtils.tip(TiaoGuangActivity.this, deviceNodeBean.getMessage() + "");
-            }
-        }
-    };
-
-
-    @OnClick({R.id.iv_base_activity_back})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-        }
-    }
-
-    private SeekBar seekBar;
-    int pro_cache = 0;
-    private TextView textView;
-
-    @Override
-    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        switch (seekBar.getId()) {
-            case R.id.seekBar_red1:
-                tvRed1.setText(progress + "%");
-                break;
-            case R.id.seekBar_red2:
-                tvRed2.setText(progress + "%");
-                break;
-            case R.id.seekBar_red3:
-                tvRed3.setText(progress + "%");
-                break;
-            case R.id.seekBar_red4:
-                tvRed4.setText(progress + "%");
-                break;
-            case R.id.seekBar_blue1:
-                tvBlue1.setText(progress + "%");
-                break;
-            case R.id.seekBar_blue2:
-                tvBlue2.setText(progress + "%");
-                break;
-            case R.id.seekBar_blue3:
-                tvBlue3.setText(progress + "%");
-                break;
-            case R.id.seekBar_blue4:
-                tvBlue4.setText(progress + "%");
-                break;
-        }
-    }
-
-    @Override
-    public void onStartTrackingTouch(SeekBar seekBar) {
-        seekBar = seekBar;
-        pro_cache = seekBar.getProgress();
-
-        switch (seekBar.getId()) {
-            case R.id.seekBar_red1:
-                textView = tvRed1;
-                break;
-            case R.id.seekBar_red2:
-                textView = tvRed2;
-                break;
-            case R.id.seekBar_red3:
-                textView = tvRed3;
-                break;
-            case R.id.seekBar_red4:
-                textView = tvRed4;
-                break;
-            case R.id.seekBar_blue1:
-                textView = tvBlue1;
-                break;
-            case R.id.seekBar_blue2:
-                textView = tvBlue2;
-                break;
-            case R.id.seekBar_blue3:
-                textView = tvBlue3;
-                break;
-            case R.id.seekBar_blue4:
-                textView = tvBlue4;
-                break;
-        }
-    }
-
-    @Override
-    public void onStopTrackingTouch(SeekBar seekBar) {
-
-        switch (seekBar.getId()) {
-            case R.id.seekBar_red1:
-                setLightProgress(device_mac, L1, 0, currentOnline1, seekBar.getProgress());
-                break;
-            case R.id.seekBar_red2:
-                setLightProgress(device_mac, L2, 0, currentOnline2, seekBar.getProgress());
-                break;
-            case R.id.seekBar_red3:
-                setLightProgress(device_mac, L3, 0, currentOnline3, seekBar.getProgress());
-                break;
-            case R.id.seekBar_red4:
-                setLightProgress(device_mac, L4, 0, currentOnline4, seekBar.getProgress());
-                break;
-            case R.id.seekBar_blue1:
-                setLightProgress(device_mac, L1, 1, currentOnline1, seekBar.getProgress());
-                break;
-            case R.id.seekBar_blue2:
-                setLightProgress(device_mac, L2, 1, currentOnline2, seekBar.getProgress());
-                break;
-            case R.id.seekBar_blue3:
-                setLightProgress(device_mac, L3, 1, currentOnline3, seekBar.getProgress());
-                break;
-            case R.id.seekBar_blue4:
-                setLightProgress(device_mac, L4, 1, currentOnline4, seekBar.getProgress());
-                break;
-        }
-    }
-
-}

+ 0 - 530
app/src/main/java/com/wisdom/hydroponics/ui/activity/XunHuanActivity.java

@@ -1,530 +0,0 @@
-package com.wisdom.hydroponics.ui.activity;
-
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
-import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
-import com.bigkoo.pickerview.view.OptionsPickerView;
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseActivity;
-import com.wisdom.hydroponics.bean.BindDeviceBean;
-import com.wisdom.hydroponics.bean.DeviceNodeBean;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-public class XunHuanActivity extends BaseActivity {
-
-    @BindView(R.id.iv_base_activity_back)
-    ImageView ivBaseActivityBack;
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.tv_title_right)
-    TextView tvTitleRight;
-    @BindView(R.id.rl_base_activity_backround)
-    RelativeLayout rlBaseActivityBackround;
-    @BindView(R.id.tv_dingshi_start1)
-    TextView tvDingshiStart1;
-    @BindView(R.id.bt_kongzhi_1)
-    Button btKongzhi1;
-    @BindView(R.id.tv_dingshi_start2)
-    TextView tvDingshiStart2;
-    @BindView(R.id.bt_kongzhi_2)
-    Button btKongzhi2;
-    @BindView(R.id.tv_dingshi_start3)
-    TextView tvDingshiStart3;
-    @BindView(R.id.bt_kongzhi_3)
-    Button btKongzhi3;
-    @BindView(R.id.tv_dingshi_start4)
-    TextView tvDingshiStart4;
-    @BindView(R.id.bt_kongzhi_4)
-    Button btKongzhi4;
-    @BindView(R.id.tv_dingshi_start5)
-    TextView tvDingshiStart5;
-    @BindView(R.id.bt_kongzhi_5)
-    Button btKongzhi5;
-    @BindView(R.id.tv_dingshi_start6)
-    TextView tvDingshiStart6;
-    @BindView(R.id.bt_kongzhi_6)
-    Button btKongzhi6;
-    @BindView(R.id.tv_dingshi_start7)
-    TextView tvDingshiStart7;
-    @BindView(R.id.bt_kongzhi_7)
-    Button btKongzhi7;
-    @BindView(R.id.tv_dingshi_start8)
-    TextView tvDingshiStart8;
-    @BindView(R.id.bt_kongzhi_8)
-    Button btKongzhi8;
-    @BindView(R.id.tv_led1_name)
-    TextView tvLed1Name;
-    @BindView(R.id.ll_led1)
-    LinearLayout llLed1;
-    @BindView(R.id.tv_led2_name)
-    TextView tvLed2Name;
-    @BindView(R.id.ll_led2)
-    LinearLayout llLed2;
-    @BindView(R.id.tv_led3_name)
-    TextView tvLed3Name;
-    @BindView(R.id.ll_led3)
-    LinearLayout llLed3;
-    @BindView(R.id.tv_led4_name)
-    TextView tvLed4Name;
-    @BindView(R.id.ll_led4)
-    LinearLayout llLed4;
-    @BindView(R.id.tv_pump1_name)
-    TextView tvPump1Name;
-    @BindView(R.id.ll_pump1)
-    LinearLayout llPump1;
-    @BindView(R.id.tv_pump2_name)
-    TextView tvPump2Name;
-    @BindView(R.id.ll_pump2)
-    LinearLayout llPump2;
-    @BindView(R.id.tv_pump3_name)
-    TextView tvPump3Name;
-    @BindView(R.id.ll_pump3)
-    LinearLayout llPump3;
-    @BindView(R.id.tv_pump4_name)
-    TextView tvPump4Name;
-    @BindView(R.id.ll_pump4)
-    LinearLayout llPump4;
-
-    private String device_mac;
-    private String L1 = "";
-    private String L2 = "";
-    private String L3 = "";
-    private String L4 = "";
-    private String S1 = "";
-    private String S2 = "";
-    private String S3 = "";
-    private String S4 = "";
-    private int currentOnline1;
-    private int currentOnline2;
-    private int currentOnline3;
-    private int currentOnline4;
-    private int currentOnline5;
-    private int currentOnline6;
-    private int currentOnline7;
-    private int currentOnline8;
-
-    private ArrayList<Integer> list_data;
-    private List<DeviceNodeBean.ResultBean.ModelsBean> led;
-    private List<DeviceNodeBean.ResultBean.ModelsBean> pump;
-
-    @Override
-    protected int setView() {
-        return R.layout.activity_xunhuan;
-    }
-
-    @Override
-    public void initView() {
-        ivBaseActivityBack.setVisibility(View.VISIBLE);
-        tvTitleCenter.setText("循环控制");
-
-        Intent intent = getIntent();
-        device_mac = intent.getStringExtra("Device_Mac");
-        if (!TextUtils.isEmpty(device_mac)) {
-            getNodeData(device_mac);
-        }
-
-        list_data = new ArrayList<>();
-        list_data.add(10);
-        list_data.add(20);
-        list_data.add(30);
-        list_data.add(40);
-        list_data.add(50);
-    }
-
-    @OnClick({R.id.iv_base_activity_back, R.id.tv_dingshi_start1, R.id.bt_kongzhi_1, R.id.tv_dingshi_start2, R.id.bt_kongzhi_2, R.id.tv_dingshi_start3, R.id.bt_kongzhi_3, R.id.tv_dingshi_start4, R.id.bt_kongzhi_4, R.id.tv_dingshi_start5, R.id.bt_kongzhi_5, R.id.tv_dingshi_start6, R.id.bt_kongzhi_6, R.id.tv_dingshi_start7, R.id.bt_kongzhi_7, R.id.tv_dingshi_start8, R.id.bt_kongzhi_8})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_base_activity_back:
-                finish();
-                break;
-            case R.id.tv_dingshi_start1:
-                chooseType("选择时间", list_data, tvDingshiStart1);
-                break;
-
-            case R.id.bt_kongzhi_1:
-                String s1 = tvDingshiStart1.getText().toString().trim();
-                if (TextUtils.isEmpty(s1)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (led.get(0).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(L1, currentOnline1, s1);
-                break;
-            case R.id.tv_dingshi_start2:
-                chooseType("选择时间", list_data, tvDingshiStart2);
-                break;
-
-            case R.id.bt_kongzhi_2:
-                String s2 = tvDingshiStart2.getText().toString().trim();
-                if (TextUtils.isEmpty(s2)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (led.get(1).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(L2, currentOnline2, s2);
-                break;
-            case R.id.tv_dingshi_start3:
-                chooseType("选择时间", list_data, tvDingshiStart3);
-                break;
-
-            case R.id.bt_kongzhi_3:
-                String s3 = tvDingshiStart3.getText().toString().trim();
-                if (TextUtils.isEmpty(s3)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (led.get(2).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(L3, currentOnline3, s3);
-                break;
-            case R.id.tv_dingshi_start4:
-                chooseType("选择时间", list_data, tvDingshiStart4);
-                break;
-
-            case R.id.bt_kongzhi_4:
-                if (led.get(3).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                String s4 = tvDingshiStart4.getText().toString().trim();
-                if (TextUtils.isEmpty(s4)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                takeData(L4, currentOnline4, s4);
-                break;
-            case R.id.tv_dingshi_start5:
-                chooseType("选择时间", list_data, tvDingshiStart5);
-                break;
-
-            case R.id.bt_kongzhi_5:
-                String s5 = tvDingshiStart5.getText().toString().trim();
-                if (TextUtils.isEmpty(s5)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (pump.get(0).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(S1, currentOnline5, s5);
-                break;
-            case R.id.tv_dingshi_start6:
-                chooseType("选择时间", list_data, tvDingshiStart6);
-                break;
-
-            case R.id.bt_kongzhi_6:
-                String s6 = tvDingshiStart6.getText().toString().trim();
-                if (TextUtils.isEmpty(s6)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (pump.get(1).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(S2, currentOnline6, s6);
-                break;
-            case R.id.tv_dingshi_start7:
-                chooseType("选择时间", list_data, tvDingshiStart7);
-                break;
-
-            case R.id.bt_kongzhi_7:
-                String s7 = tvDingshiStart7.getText().toString().trim();
-                if (TextUtils.isEmpty(s7)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (pump.get(2).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(S3, currentOnline7, s7);
-                break;
-            case R.id.tv_dingshi_start8:
-                chooseType("选择时间", list_data, tvDingshiStart8);
-                break;
-
-            case R.id.bt_kongzhi_8:
-                String s8 = tvDingshiStart8.getText().toString().trim();
-                if (TextUtils.isEmpty(s8)) {
-                    WQUtils.showToast(this, "请选择打开时间");
-                    break;
-                }
-                if (pump.get(3).getControl_Mode() == 1) {
-                    WQUtils.showToast(this, "当前模式为手动模式");
-                    break;
-                }
-                takeData(S4, currentOnline8, s8);
-                break;
-        }
-    }
-
-    private void takeData(String nodeMac, int currentOnline, String startTime) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("DeviceMac", device_mac);
-            jsonObj.put("NodeMac", nodeMac);
-            jsonObj.put("CurrentOnline", currentOnline);
-            jsonObj.put("Swith_Time1", 0);
-            jsonObj.put("Swith_Time2", startTime);
-            jsonObj.put("Swith_Time3", "");
-            jsonObj.put("Swith_Time4", "");
-            jsonObj.put("Swith_Action1", 255);
-            jsonObj.put("Swith_Action2", 0);
-            jsonObj.put("Swith_Action3", 255);
-            jsonObj.put("Swith_Action4", 0);
-            jsonObj.put("Swith_Mode", 16);//1 每天  2每周
-            jsonObj.put("Control_Mode", 16);//1手动 0自动
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/EditDeviceGateWayOn", handler);
-    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            BindDeviceBean getTokenBean = gson.fromJson(json, BindDeviceBean.class);
-
-            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-
-                WQUtils.tip(XunHuanActivity.this, getTokenBean.getMessage() + "");
-            } else {
-                WQUtils.tip(XunHuanActivity.this, getTokenBean.getMessage() + "");
-            }
-        }
-    };
-
-    //获取节点列表
-    private void getNodeData(String device_mac) {
-        String user_id = SPUtil.getString(this, "User_ID");
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("PageIndex", 1);
-            jsonObj.put("PageSize", 99);
-            jsonObj.put("UserID", user_id);
-            jsonObj.put("GateWayMac", device_mac);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(this, jsonObj, SPUtil.getString(this, "URL") + "Device/GetAllNodeByMac", handler_node);
-    }
-
-    private Handler handler_node = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            DeviceNodeBean deviceNodeBean = gson.fromJson(json, DeviceNodeBean.class);
-            if (deviceNodeBean != null && deviceNodeBean.getReturnCode() == 200) {
-                if (deviceNodeBean.getResult() != null && deviceNodeBean.getResult().getModels() != null && deviceNodeBean.getResult().getModels().size() > 0) {
-                    List<DeviceNodeBean.ResultBean.ModelsBean> node_list = deviceNodeBean.getResult().getModels();
-                    if (node_list != null && node_list.size() > 0) {
-
-                        led = new ArrayList<>();
-                        pump = new ArrayList<>();
-                        for (int i = 0; i < node_list.size(); i++) {
-                            if (node_list.get(i).getDeviceMac().contains("LED") || node_list.get(i).getDeviceMac().contains("led")) {
-                                led.add(node_list.get(i));
-                            } else {
-                                pump.add(node_list.get(i));
-                            }
-                        }
-
-                        if (led.size() >= 1) {
-                            llLed1.setVisibility(View.VISIBLE);
-                            tvLed1Name.setText(led.get(0).getDeviceName());
-                            L1 = led.get(0).getDeviceMac();
-                            currentOnline1 = led.get(0).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(led.get(0).getSwith_Time2())) {
-                                if (led.get(0).getControl_Mode() == 16) {
-                                    tvDingshiStart1.setText(led.get(0).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart1.setText("");
-                                }
-                            }
-                        }
-                        if (led.size() >= 2) {
-                            llLed2.setVisibility(View.VISIBLE);
-                            tvLed2Name.setText(led.get(1).getDeviceName());
-                            L2 = led.get(1).getDeviceMac();
-                            currentOnline2 = led.get(1).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(led.get(1).getSwith_Time2())) {
-                                if (led.get(1).getControl_Mode() == 16) {
-                                    tvDingshiStart2.setText(led.get(1).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart2.setText("");
-                                }
-                            }
-                        }
-                        if (led.size() >= 3) {
-                            llLed3.setVisibility(View.VISIBLE);
-                            tvLed3Name.setText(led.get(2).getDeviceName());
-                            L3 = led.get(2).getDeviceMac();
-                            currentOnline3 = led.get(2).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(led.get(2).getSwith_Time2())) {
-                                if (led.get(2).getControl_Mode() == 16) {
-                                    tvDingshiStart3.setText(led.get(2).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart3.setText("");
-                                }
-                            }
-                        }
-                        if (led.size() >= 4) {
-                            llLed4.setVisibility(View.VISIBLE);
-                            tvLed4Name.setText(led.get(3).getDeviceName());
-                            L4 = led.get(3).getDeviceMac();
-                            currentOnline4 = led.get(3).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(led.get(3).getSwith_Time2())) {
-                                if (led.get(3).getControl_Mode() == 16) {
-                                    tvDingshiStart4.setText(led.get(3).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart4.setText("");
-                                }
-                            }
-                        }
-
-                        if (pump.size() >= 1) {
-                            llPump1.setVisibility(View.VISIBLE);
-                            tvPump1Name.setText(pump.get(0).getDeviceName());
-                            S1 = pump.get(0).getDeviceMac();
-                            currentOnline5 = pump.get(0).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(pump.get(0).getSwith_Time2())) {
-                                if (pump.get(0).getControl_Mode() == 16) {
-                                    tvDingshiStart5.setText(pump.get(0).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart5.setText("");
-                                }
-                            }
-                        }
-                        if (pump.size() >= 2) {
-                            llPump2.setVisibility(View.VISIBLE);
-                            tvPump2Name.setText(pump.get(1).getDeviceName());
-                            S2 = pump.get(1).getDeviceMac();
-                            currentOnline6 = pump.get(1).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(pump.get(1).getSwith_Time2())) {
-                                if (pump.get(1).getControl_Mode() == 16) {
-                                    tvDingshiStart6.setText(pump.get(1).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart6.setText("");
-                                }
-                            }
-                        }
-                        if (pump.size() >= 3) {
-                            llPump3.setVisibility(View.VISIBLE);
-                            tvPump3Name.setText(pump.get(2).getDeviceName());
-                            S3 = pump.get(2).getDeviceMac();
-                            currentOnline7 = pump.get(2).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(pump.get(2).getSwith_Time2())) {
-                                if (pump.get(2).getControl_Mode() == 16) {
-                                    tvDingshiStart7.setText(pump.get(2).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart7.setText("");
-                                }
-                            }
-                        }
-                        if (pump.size() >= 4) {
-                            llPump4.setVisibility(View.VISIBLE);
-                            tvPump4Name.setText(pump.get(3).getDeviceName());
-                            S4 = pump.get(3).getDeviceMac();
-                            currentOnline8 = pump.get(3).getCurrentOnline();
-
-                            if (!TextUtils.isEmpty(pump.get(3).getSwith_Time2())) {
-                                if (pump.get(3).getControl_Mode() == 16) {
-                                    tvDingshiStart8.setText(pump.get(3).getSwith_Time2().substring(16, 18));
-                                } else {
-                                    tvDingshiStart8.setText("");
-                                }
-                            }
-                        }
-
-                    }
-                }
-            } else {
-                WQUtils.tip(XunHuanActivity.this, deviceNodeBean.getMessage() + "");
-            }
-        }
-    };
-
-    private int current_choose_project = 0;
-
-    private void chooseType(final String title, final ArrayList<Integer> list, final TextView tv) {
-        //条件选择器
-        OptionsPickerView pvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {
-            @Override
-            public void onOptionsSelect(int options1, int option2, int options3, View v) {
-                //返回的分别是三个级别的选中位置
-                tv.setText(list.get(options1) + "");
-                //选择了第几个方案
-                current_choose_project = options1;//记录当前选择的哪一个
-            }
-        }).setSubmitText("确定")//确定按钮文字
-                .setCancelText("取消")//取消按钮文字
-                .setTitleText(title)//标题
-                .setSubCalSize(15)//确定和取消文字大小
-                .setTitleSize(20)//标题文字大小
-                .setContentTextSize(15)//滚轮文字大小
-                .setTitleColor(Color.BLACK)//标题文字颜色
-                .setSubmitColor(getResources().getColor(R.color.base_blue))//确定按钮文字颜色
-                .setCancelColor(getResources().getColor(R.color.base_blue))//取消按钮文字颜色
-                .setTitleBgColor(Color.WHITE)//标题背景颜色 Night mode
-                .setBgColor(Color.WHITE)//滚轮背景颜色 Night mode
-                .setContentTextSize(18)//滚轮文字大小
-                .isCenterLabel(false) //是否只显示中间选中项的 label 文字,false 则每项 item 全部都带有 label。
-                .setCyclic(false, false, false)//循环与否
-                .setSelectOptions(current_choose_project)  //设置默认选中项
-                .setOutSideCancelable(false)//点击外部 dismiss default true
-                .isDialog(true)//是否显示为对话框样式
-                .isRestoreItem(true)//切换时是否还原,设置默认���中第一项。
-                .build();
-        ;
-        pvOptions.setPicker(list);
-        pvOptions.show();
-    }
-}

+ 0 - 178
app/src/main/java/com/wisdom/hydroponics/ui/fragment/HomeFragment.java

@@ -1,178 +0,0 @@
-package com.wisdom.hydroponics.ui.fragment;
-
-import android.content.Intent;
-import android.graphics.Rect;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.resource.bitmap.CircleCrop;
-import com.bumptech.glide.request.RequestOptions;
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.adapters.Grid_Image_Adapter;
-import com.wisdom.hydroponics.base.BaseFragment;
-import com.wisdom.hydroponics.bean.HomeDeviceItemBean;
-import com.wisdom.hydroponics.ui.activity.AddDevice_1_Activity;
-import com.wisdom.hydroponics.ui.activity.DeviceDetailActivity;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-/**
- * Created by wq on 2018/1/16.
- */
-
-public class HomeFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener {
-
-    @BindView(R.id.iv_home_icon)
-    ImageView ivHomeIcon;
-    @BindView(R.id.tv_home_name)
-    TextView tvHomeName;
-    @BindView(R.id.tv_home_add)
-    TextView tvHomeAdd;
-    @BindView(R.id.mRecyclerView)
-    RecyclerView mRecyclerView;
-    @BindView(R.id.refreshLayout)
-    SwipeRefreshLayout refreshLayout;
-
-    @Override
-    public View initView(LayoutInflater inflater, ViewGroup container) {
-        View view = inflater.inflate(R.layout.fragment_home, container, false);
-        return view;
-    }
-
-    @Override
-    public void initData() {
-        refreshLayout.setOnRefreshListener(this);
-        refreshLayout.setColorScheme(R.color.base_online,
-                R.color.base_down,
-                R.color.base_error,
-                R.color.base_todo);
-
-        tvHomeName.setText("阿打 >");
-        Glide.with(context).load("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201409%2F22%2F20140922122621_fxvj8.thumb.700_0.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624158465&t=90c78370fbc0a5322f02c04f8d991d39")
-                .apply(RequestOptions.bitmapTransform(new CircleCrop()))
-                .into(ivHomeIcon);
-
-        String user_id = SPUtil.getString(context, "User_ID");
-        if (!TextUtils.isEmpty(user_id)) {
-            getData(user_id);
-        }
-
-    }
-
-    private void getData(String user_id) {
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("PageIndex", 1);
-            jsonObj.put("PageSize", 10);
-            jsonObj.put("KeyWords", "");
-            jsonObj.put("Sort", "");
-            jsonObj.put("IsAsc", true);
-            jsonObj.put("UserID", user_id);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        // 发送网络请求
-        WQNetUtil.postHttp(context, jsonObj, SPUtil.getString(context, "URL") + "Device/GetAllUserBindMac", handler);
-    }
-
-    private List<HomeDeviceItemBean.ResultBean.ModelsBean> list;
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-            HomeDeviceItemBean homeDeviceItemBean = gson.fromJson(json, HomeDeviceItemBean.class);
-            if (homeDeviceItemBean != null && homeDeviceItemBean.getReturnCode() == 200) {
-                if (homeDeviceItemBean.getResult() != null && homeDeviceItemBean.getResult().getModels() != null && homeDeviceItemBean.getResult().getModels().size() > 0) {
-                    list = homeDeviceItemBean.getResult().getModels();
-                    initHomeData();
-                }
-            } else {
-                WQUtils.tip(context, homeDeviceItemBean.getMessage() + "");
-            }
-        }
-    };
-
-    private Grid_Image_Adapter.OnRecyclerviewItemClickListener onRecyclerviewItemClickListener;
-
-    private void initHomeData() {
-        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
-        GridLayoutManager mLayoutManager = new GridLayoutManager(context, 2);
-        mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
-            @Override
-            public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
-                super.getItemOffsets(outRect, view, parent, state);
-//                outRect.bottom = 15;
-//                outRect.right = 15;
-            }
-
-        });
-        mRecyclerView.setLayoutManager(mLayoutManager);
-        onRecyclerviewItemClickListener = new Grid_Image_Adapter.OnRecyclerviewItemClickListener() {
-            @Override
-            public void onItemClickListener(View v, int position) {
-                Intent intent = new Intent(context, DeviceDetailActivity.class);
-                intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
-                intent.putExtra("Device_Mac", list.get(position).getDeviceMac());
-                intent.putExtra("FaultStatus", list.get(position).getFaultStatus());
-                context.startActivity(intent);
-
-            }
-        };
-        Grid_Image_Adapter adapter = new Grid_Image_Adapter(context, list, onRecyclerviewItemClickListener);
-        mRecyclerView.setAdapter(adapter);
-    }
-
-    @Override
-    public void onRefresh() {
-        new Handler().postDelayed(new Runnable() {//模拟耗时操作
-            @Override
-            public void run() {
-                String user_id = SPUtil.getString(context, "User_ID");
-                if (!TextUtils.isEmpty(user_id)) {
-                    getData(user_id);
-                }
-                refreshLayout.setRefreshing(false);//取消刷新
-            }
-        }, 2700);
-    }
-
-
-    @OnClick({R.id.iv_home_icon, R.id.tv_home_name, R.id.tv_home_add})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.iv_home_icon:
-                break;
-            case R.id.tv_home_name:
-                break;
-            case R.id.tv_home_add:
-                WQUtils.startActivity(context, AddDevice_1_Activity.class);
-                break;
-        }
-    }
-}
-

+ 0 - 131
app/src/main/java/com/wisdom/hydroponics/ui/fragment/MineFragment.java

@@ -1,131 +0,0 @@
-package com.wisdom.hydroponics.ui.fragment;
-
-import android.os.Handler;
-import android.os.Message;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.resource.bitmap.CircleCrop;
-import com.bumptech.glide.request.RequestOptions;
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseFragment;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-/**
- * Created by wq on 2018/1/16.
- */
-
-public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener {
-
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-    @BindView(R.id.tv_title_right)
-    TextView tvTitleRight;
-    @BindView(R.id.iv_user_pic)
-    ImageView ivUserPic;
-    @BindView(R.id.tv_user_name)
-    TextView tvUserName;
-    @BindView(R.id.rl_me_info)
-    RelativeLayout rlMeInfo;
-    @BindView(R.id.rl_me_ys)
-    RelativeLayout rlMeYs;
-    @BindView(R.id.tv_me_cache)
-    TextView tvMeCache;
-    @BindView(R.id.rl_me_cache)
-    RelativeLayout rlMeCache;
-    @BindView(R.id.tv_me_verson)
-    TextView tvMeVerson;
-    @BindView(R.id.rl_me_verson)
-    RelativeLayout rlMeVerson;
-    @BindView(R.id.rl_me_about)
-    RelativeLayout rlMeAbout;
-
-    @Override
-    public View initView(LayoutInflater inflater, ViewGroup container) {
-        View view = inflater.inflate(R.layout.fragment_mine, container, false);
-        return view;
-    }
-
-    @Override
-    public void initData() {
-        tvTitleCenter.setText("我的");
-
-        tvUserName.setText("阿打");
-        Glide.with(context).load("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201409%2F22%2F20140922122621_fxvj8.thumb.700_0.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624158465&t=90c78370fbc0a5322f02c04f8d991d39")
-                .apply(RequestOptions.bitmapTransform(new CircleCrop()))
-                .into(ivUserPic);
-    }
-
-//    private void getData(String user_id) {
-//        JSONObject jsonObj = new JSONObject();
-//        try {
-//            jsonObj.put("PageIndex", 1);
-//            jsonObj.put("PageSize", 10);
-//            jsonObj.put("KeyWords", "");
-//            jsonObj.put("Sort", "");
-//            jsonObj.put("IsAsc", true);
-//            jsonObj.put("UserID", user_id);
-//        } catch (JSONException e) {
-//            e.printStackTrace();
-//        }
-//
-//        // 发送网络请求
-//        WQNetUtil.postHttp(jsonObj, SPUtil.getString(context, "URL") + "Device/GetAllUserBindMac", handler);
-//    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-//            GetTokenBean getTokenBean = gson.fromJson(json, GetTokenBean.class);
-//
-//            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-//
-//                SPUtil.put(LoginActivity.this, "TOKEN", getTokenBean.getResult().getToken() + "");
-//
-//            } else {
-//                WQUtils.tip(LoginActivity.this, getTokenBean.getMessage() + "");
-//            }
-        }
-    };
-
-
-    @Override
-    public void onRefresh() {
-
-    }
-
-
-    @OnClick({ R.id.rl_me_info, R.id.rl_me_ys, R.id.rl_me_cache, R.id.rl_me_verson, R.id.rl_me_about})
-    public void onViewClicked(View view) {
-        switch (view.getId()) {
-            case R.id.rl_me_info:
-
-                break;
-            case R.id.rl_me_ys:
-
-                break;
-            case R.id.rl_me_cache:
-
-                break;
-            case R.id.rl_me_verson:
-
-                break;
-            case R.id.rl_me_about:
-
-                break;
-        }
-    }
-}
-

+ 0 - 80
app/src/main/java/com/wisdom/hydroponics/ui/fragment/ShopFragment.java

@@ -1,80 +0,0 @@
-package com.wisdom.hydroponics.ui.fragment;
-
-import android.os.Handler;
-import android.os.Message;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.base.BaseFragment;
-
-import butterknife.BindView;
-
-/**
- * Created by wq on 2018/1/16.
- */
-
-public class ShopFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener {
-
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-
-    @Override
-    public View initView(LayoutInflater inflater, ViewGroup container) {
-        View view = inflater.inflate(R.layout.fragment_shop, container, false);
-        return view;
-    }
-
-    @Override
-    public void initData() {
-        tvTitleCenter.setText("商城");
-    }
-
-//    private void getData(String user_id) {
-//        JSONObject jsonObj = new JSONObject();
-//        try {
-//            jsonObj.put("PageIndex", 1);
-//            jsonObj.put("PageSize", 10);
-//            jsonObj.put("KeyWords", "");
-//            jsonObj.put("Sort", "");
-//            jsonObj.put("IsAsc", true);
-//            jsonObj.put("UserID", user_id);
-//        } catch (JSONException e) {
-//            e.printStackTrace();
-//        }
-//
-//        // 发送网络请求
-//        WQNetUtil.postHttp(jsonObj, SPUtil.getString(context, "URL") + "Device/GetAllUserBindMac", handler);
-//    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-//            GetTokenBean getTokenBean = gson.fromJson(json, GetTokenBean.class);
-//
-//            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-//
-//                SPUtil.put(LoginActivity.this, "TOKEN", getTokenBean.getResult().getToken() + "");
-//
-//            } else {
-//                WQUtils.tip(LoginActivity.this, getTokenBean.getMessage() + "");
-//            }
-        }
-    };
-
-
-    @Override
-    public void onRefresh() {
-
-    }
-
-
-}
-

+ 0 - 101
app/src/main/java/com/wisdom/hydroponics/ui/fragment/StrategyFragment.java

@@ -1,101 +0,0 @@
-package com.wisdom.hydroponics.ui.fragment;
-
-import android.graphics.Rect;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
-
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.resource.bitmap.CircleCrop;
-import com.bumptech.glide.request.RequestOptions;
-import com.google.gson.Gson;
-import com.wisdom.hydroponics.R;
-import com.wisdom.hydroponics.adapters.Grid_Image_Adapter;
-import com.wisdom.hydroponics.base.BaseFragment;
-import com.wisdom.hydroponics.ui.activity.AddDevice_1_Activity;
-import com.wisdom.hydroponics.utils.SPUtil;
-import com.wisdom.hydroponics.utils.WQNetUtil;
-import com.wisdom.hydroponics.utils.WQUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-/**
- * Created by wq on 2018/1/16.
- */
-
-public class StrategyFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener {
-
-    @BindView(R.id.tv_title_center)
-    TextView tvTitleCenter;
-
-    @Override
-    public View initView(LayoutInflater inflater, ViewGroup container) {
-        View view = inflater.inflate(R.layout.fragment_strategy, container, false);
-        return view;
-    }
-
-    @Override
-    public void initData() {
-        tvTitleCenter.setText("攻略");
-    }
-
-//    private void getData(String user_id) {
-//        JSONObject jsonObj = new JSONObject();
-//        try {
-//            jsonObj.put("PageIndex", 1);
-//            jsonObj.put("PageSize", 10);
-//            jsonObj.put("KeyWords", "");
-//            jsonObj.put("Sort", "");
-//            jsonObj.put("IsAsc", true);
-//            jsonObj.put("UserID", user_id);
-//        } catch (JSONException e) {
-//            e.printStackTrace();
-//        }
-//
-//        // 发送网络请求
-//        WQNetUtil.postHttp(jsonObj, SPUtil.getString(context, "URL") + "Device/GetAllUserBindMac", handler);
-//    }
-
-    private Handler handler = new Handler() {
-        public void handleMessage(Message msg) {
-            String json = (String) msg.obj;
-
-            Gson gson = new Gson();
-//            GetTokenBean getTokenBean = gson.fromJson(json, GetTokenBean.class);
-//
-//            if (getTokenBean != null && getTokenBean.getReturnCode() == 200) {
-//
-//                SPUtil.put(LoginActivity.this, "TOKEN", getTokenBean.getResult().getToken() + "");
-//
-//            } else {
-//                WQUtils.tip(LoginActivity.this, getTokenBean.getMessage() + "");
-//            }
-        }
-    };
-
-
-    @Override
-    public void onRefresh() {
-
-    }
-
-
-}
-

+ 0 - 255
app/src/main/java/com/wisdom/hydroponics/utils/GlideUtils.java

@@ -1,255 +0,0 @@
-package com.wisdom.hydroponics.utils;
-
-import android.app.Activity;
-import android.app.Fragment;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapShader;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.RectF;
-import android.text.TextUtils;
-import android.widget.ImageView;
-
-import androidx.annotation.NonNull;
-
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
-import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
-import com.bumptech.glide.request.RequestOptions;
-
-import java.security.MessageDigest;
-
-/**
- * Created by niushibin on 2018/8/1.
- */
-public class GlideUtils {
-
-    public static void displayImage(Context context, String url, ImageView imageView, int def) {
-        if (context != null) {
-            if (TextUtils.isEmpty(url)) {
-                imageView.setImageResource(def);
-                return;
-            }
-            Glide.with(context)
-                    .load(url)
-                    .into(imageView);
-        }
-
-    }
-
-    /**
-     * 普通加载图片
-     *
-     * @param context
-     * @param url       网络图片
-     * @param imageView 图片控件
-     */
-    public static void displayImage(Context context, String url, ImageView imageView) {
-        if (context != null) {
-            if (TextUtils.isEmpty(url)) return;
-//            Glide.with(context)
-//                    .load(url)
-//                    .into(imageView);
-
-            Glide.with(context.getApplicationContext())
-                    .setDefaultRequestOptions(
-                            new RequestOptions()
-//                                        .frame(3000000)
-//                                    .centerCrop()
-                                    .fitCenter()  //让图片全充,
-                    )
-                    .load(url)
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 普通加载图片
-     *
-     * @param activity
-     * @param url       网络图片
-     * @param imageView 图片控件
-     */
-    public static void displayImage(Activity activity, String url, ImageView imageView) {
-        if (activity != null ) {
-            if (TextUtils.isEmpty(url)) return;
-            Glide.with(activity)
-                    .load(url)
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 普通加载图片
-     *
-     * @param fragment
-     * @param url       网络图片
-     * @param imageView 图片控件
-     */
-    public static void displayImage(Fragment fragment, String url, ImageView imageView) {
-        if (fragment != null && fragment.getActivity() != null) {
-            if (TextUtils.isEmpty(url)) return;
-            Glide.with(fragment)
-                    .load(url)
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 加载圆形图片
-     *
-     * @param context
-     * @param url       网络图片
-     * @param imageView 图片控件
-     * @param def       展位图 和 错误图
-     */
-    public static void displayImageCircle(Context context, String url, ImageView imageView, int def) {
-        if (context != null) {
-            Glide.with(context)
-                    .load(url)
-                    .apply(new RequestOptions().circleCrop().error(def).placeholder(def).dontAnimate())
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 加载圆形图片
-     *
-     * @param activity
-     * @param url       网络图片
-     * @param imageView 图片控件
-     * @param def       展位图 和 错误图
-     */
-    public static void displayImageCircle(Activity activity, String url, ImageView imageView, int def) {
-        if (activity != null ) {
-            Glide.with(activity)
-                    .load(url)
-                    .apply(new RequestOptions().circleCrop().error(def).placeholder(def).dontAnimate())
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 加载圆形图片
-     *
-     * @param fragment
-     * @param url       网络图片
-     * @param imageView 图片控件
-     * @param def       展位图 和 错误图
-     */
-    public static void displayImageCircle(Fragment fragment, String url, ImageView imageView, int def) {
-        if (fragment != null && fragment.getActivity() != null) {
-            Glide.with(fragment)
-                    .load(url)
-                    .apply(new RequestOptions().circleCrop().error(def).placeholder(def).dontAnimate())
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 加载圆角图片
-     *
-     * @param context
-     * @param url       网络图片
-     * @param imageView 图片控件
-     * @param def       展位图 和 错误图
-     * @param dp        圆角尺寸
-     */
-    public static void displayRoundImg(Context context, String url, ImageView imageView, int def, int dp) {
-        if (context != null) {
-            if (TextUtils.isEmpty(url)) {
-                imageView.setImageResource(def);
-                return;
-            }
-            Glide.with(context)
-                    .load(url)
-                    .apply(new RequestOptions().bitmapTransform(new GlideRoundTransform(dp)).error(def).placeholder(def))
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 加载圆角图片
-     *
-     * @param activity
-     * @param url       网络图片
-     * @param imageView 图片控件
-     * @param def       展位图 和 错误图
-     * @param dp        圆角尺寸
-     */
-    public static void displayRoundImg(Activity activity, String url, ImageView imageView, int def, int dp) {
-        if (activity != null ) {
-            if (TextUtils.isEmpty(url)) {
-                imageView.setImageResource(def);
-                return;
-            }
-            Glide.with(activity)
-                    .load(url)
-                    .apply(new RequestOptions().bitmapTransform(new GlideRoundTransform(dp)).error(def).placeholder(def))
-                    .into(imageView);
-        }
-    }
-
-    /**
-     * 加载圆角图片
-     *
-     * @param fragment
-     * @param url       网络图片
-     * @param imageView 图片控件
-     * @param def       展位图 和 错误图
-     * @param dp        圆角尺寸
-     */
-    public static void displayRoundImg(Fragment fragment, String url, ImageView imageView, int def, int dp) {
-        if (fragment != null && fragment.getActivity() != null) {
-            if (TextUtils.isEmpty(url)) {
-                imageView.setImageResource(def);
-                return;
-            }
-            Glide.with(fragment)
-                    .load(url)
-                    .apply(new RequestOptions().bitmapTransform(new GlideRoundTransform(dp)).error(def).placeholder(def))
-                    .into(imageView);
-        }
-    }
-
-
-    static class GlideRoundTransform extends BitmapTransformation {
-        private static float radius = 0f;
-
-        public GlideRoundTransform() {
-            this(4);
-        }
-
-        public GlideRoundTransform(int dp) {
-            super();
-            this.radius = Resources.getSystem().getDisplayMetrics().density * dp;
-        }
-
-        @Override
-        protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
-            return roundCrop(pool, toTransform);
-        }
-
-        private static Bitmap roundCrop(BitmapPool pool, Bitmap source) {
-            if (source == null) return null;
-            Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
-            if (result == null) {
-                result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
-            }
-            Canvas canvas = new Canvas(result);
-            Paint paint = new Paint();
-            paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
-            paint.setAntiAlias(true);
-            RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
-            canvas.drawRoundRect(rectF, radius, radius, paint);
-            return result;
-        }
-
-        @Override
-        public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
-
-        }
-    }
-}

+ 0 - 99
app/src/main/java/com/wisdom/hydroponics/utils/SPUtil.java

@@ -1,99 +0,0 @@
-package com.wisdom.hydroponics.utils;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-
-/**
- * 
- * @author WQ
- * 
- */
-public class SPUtil {
-
-	/**
-	 * 获取SharedPreferences
-	 * 
-	 * @param context
-	 * @return
-	 */
-	public static SharedPreferences getSharedPreference(Context context) {
-		SharedPreferences sp = context.getSharedPreferences("spConfig",
-				Context.MODE_PRIVATE);
-		return sp;
-	}
-
-	/**
-	 * 从SharedPreferences获取String值
-	 * 
-	 * @param context
-	 * @param key
-	 * @return
-	 */
-	public static String getString(Context context, String key) {
-		SharedPreferences sp = getSharedPreference(context);
-		String result = sp.getString(key, null);
-		return result;
-	}
-
-	/**
-	 * 从SharedPreferences获取int值
-	 * 
-	 * @param context
-	 * @param key
-	 * @return
-	 */
-	public static int getInt(Context context, String key) {
-		SharedPreferences sp = getSharedPreference(context);
-		int result = sp.getInt(key, 0);
-		return result;
-	}
-
-	/**
-	 * 从SharedPreferences获取boolean值
-	 * 
-	 * @param context
-	 * @param key
-	 * @return
-	 */
-	public static boolean getBoolean(Context context, String key) {
-		SharedPreferences sp = getSharedPreference(context);
-		boolean result = sp.getBoolean(key, false);
-		return result;
-	}
-
-	/**
-	 * 存储数据到SharedPreferences中,仅限于String,Integer,Boolean三种数据类型
-	 * 
-	 * @param context
-	 * @param key
-	 * @param value
-	 */
-	public static void put(Context context, String key, Object value) {
-		SharedPreferences sp = getSharedPreference(context);
-		Editor editor = sp.edit();
-		if (value instanceof String) {
-			editor.putString(key, (String) value);
-		} else if (value instanceof Integer) {
-			editor.putInt(key, (Integer) value);
-		} else if (value instanceof Boolean) {
-			editor.putBoolean(key, (Boolean) value);
-		}
-
-		editor.commit();
-	}
-
-	/**
-	 * 从SP中删除数据
-	 * 
-	 * @param context
-	 * @param key
-	 */
-	public static void delete(Context context, String key) {
-		SharedPreferences sp = getSharedPreference(context);
-		Editor editor = sp.edit();
-		editor.remove(key);
-		editor.commit();
-	}
-
-}

+ 0 - 257
app/src/main/java/com/wisdom/hydroponics/utils/WQNetUtil.java

@@ -1,257 +0,0 @@
-package com.wisdom.hydroponics.utils;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.tu.loadingdialog.LoadingDailog;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.IOException;
-
-import okhttp3.Call;
-import okhttp3.Callback;
-import okhttp3.MediaType;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.RequestBody;
-import okhttp3.Response;
-
-/**
- * Created by Administrator on 2018/10/12.
- */
-
-public class WQNetUtil {
-
-    public static void getHttp(final String url, final Handler handler) {
-        //1.创建OkHttpClient对象
-        OkHttpClient okHttpClient = new OkHttpClient();
-        //2.创建Request对象,设置一个url地址(百度地址),设置请求方式。
-        Request request = new Request.Builder().url(url).method("GET", null).build();
-        //3.创建一个call对象,参数就是Request请求对象
-        Call call = okHttpClient.newCall(request);
-        //4.请求加入调度,重写回调方法
-        call.enqueue(new Callback() {
-            //请求失败执行的方法
-            @Override
-            public void onFailure(Call call, IOException e) {
-            }
-
-            //请求成功执行的方法
-            @Override
-            public void onResponse(Call call, Response response) throws IOException {
-                String strResult = response.body().string();
-                Log.e("http_log", url + "");
-                Log.e("http_log", strResult + "");
-                Message message = new Message();
-                message.obj = strResult;
-                handler.sendMessage(message);
-            }
-        });
-    }
-
-    public static void postHttp2(String json, final String url, final Handler handler) {
-        Log.e("http_send", json + "");
-
-        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");//"类型,字节码"
-        //1.创建OkHttpClient对象
-        OkHttpClient okHttpClient = new OkHttpClient();
-        //2.通过RequestBody.create 创建requestBody对象
-        RequestBody requestBody = RequestBody.create(mediaType, json);
-        //3.创建Request对象,设置URL地址,将RequestBody作为post方法的参数传入
-
-        Request request = new Request.Builder().url(url).post(requestBody).build();
-
-        //4.创建一个call对象,参数就是Request请求对象
-        Call call = okHttpClient.newCall(request);
-        //5.请求加入调度,重写回调方法
-        call.enqueue(new Callback() {
-            @Override
-            public void onFailure(Call call, IOException e) {
-                Log.e("http_failure", url + "");
-                Log.e("http_result", e.toString() + "");
-            }
-
-            @Override
-            public void onResponse(Call call, Response response) throws IOException {
-                String strResult = response.body().string();
-                Log.e("http_ok", "--------------------------------------------");
-                Log.e("http_url", url + "");
-                Log.e("http_result", strResult + "");
-                Message message = new Message();
-                message.obj = strResult;
-                handler.sendMessage(message);
-
-            }
-        });
-    }
-
-    //张帆搞得第二套后台
-    public static void postHttp(Context context,JSONObject obj, final String url, final Handler handler) {
-
-        final LoadingDailog.Builder loadBuilder = new LoadingDailog.Builder(context)
-                .setMessage("加载中...")
-                .setCancelable(true)
-                .setCancelOutside(true);
-        final LoadingDailog dialog = loadBuilder.create();
-        dialog.show();
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("Body", obj);
-//            jsonObj.put("Sign", "");
-//            jsonObj.put("Timestamp", System.currentTimeMillis());
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        Log.e("http_send", jsonObj.toString() + "");
-
-        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");//"类型,字节码"
-        //1.创建OkHttpClient对象
-        OkHttpClient okHttpClient = new OkHttpClient();
-        //2.通过RequestBody.create 创建requestBody对象
-        RequestBody requestBody = RequestBody.create(mediaType, jsonObj.toString());
-        //3.创建Request对象,设置URL地址,将RequestBody作为post方法的参数传入
-        Request request = new Request.Builder().url(url).post(requestBody).build();
-        //4.创建一个call对象,参数就是Request请求对象
-        Call call = okHttpClient.newCall(request);
-        //5.请求加入调度,重写回调方法
-        call.enqueue(new Callback() {
-            @Override
-            public void onFailure(Call call, IOException e) {
-                Log.e("http_log", url + "");
-                Message message = new Message();
-                message.obj = "{\"ReturnCode\":88,\"Message\":\"网络请求超时\"}";
-                handler.sendMessage(message);
-                dialog.dismiss();
-            }
-
-            @Override
-            public void onResponse(Call call, Response response) throws IOException {
-                String strResult = response.body().string();
-                Log.e("http_ok", "--------------------------------------------");
-                Log.e("http_url", url + "");
-                Log.e("http_result", strResult + "");
-                Message message = new Message();
-                message.obj = strResult;
-                handler.sendMessage(message);
-
-                dialog.dismiss();
-            }
-        });
-    }
-
-    //黄欢的第一套后台
-    public static void postHttp(Context context, String json, final String url, final Handler handler) {
-        final LoadingDailog.Builder loadBuilder = new LoadingDailog.Builder(context)
-                .setMessage("加载中...")
-                .setCancelable(true)
-                .setCancelOutside(true);
-        final LoadingDailog dialog = loadBuilder.create();
-        dialog.show();
-
-        Log.e("http_send", json + "");
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("obj", json);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        String token = SPUtil.getString(context, "TOKEN1");
-
-        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");//"类型,字节码"
-        //1.创建OkHttpClient对象
-        OkHttpClient okHttpClient = new OkHttpClient();
-        //2.通过RequestBody.create 创建requestBody对象
-        RequestBody requestBody = RequestBody.create(mediaType, jsonObj.toString());
-        //3.创建Request对象,设置URL地址,将RequestBody作为post方法的参数传入
-        Request request = null;
-        if (TextUtils.isEmpty(token)) {
-            request = new Request.Builder().url(url).post(requestBody).build();
-
-        } else {
-            request = new Request.Builder().url(url).addHeader("token", token).addHeader("identity", "1").post(requestBody).build();
-        }
-        //4.创建一个call对象,参数就是Request请求对象
-        Call call = okHttpClient.newCall(request);
-        //5.请求加入调度,重写回调方法
-        call.enqueue(new Callback() {
-            @Override
-            public void onFailure(Call call, IOException e) {
-                Log.e("http_log", url + "");
-                Log.e("http_result_fail", e.toString() + "");
-                dialog.dismiss();
-            }
-
-            @Override
-            public void onResponse(Call call, Response response) throws IOException {
-                String strResult = response.body().string();
-                Log.e("http_ok", "--------------------------------------------");
-                Log.e("http_url", url + "");
-                Log.e("http_result", strResult + "");
-                Message message = new Message();
-                message.obj = strResult;
-                handler.sendMessage(message);
-
-                dialog.dismiss();
-            }
-        });
-    }
-
-    public static void postHttp_a(Context context, String json, final String url, final Handler handler) {
-        Log.e("http_send", json + "");
-
-        JSONObject jsonObj = new JSONObject();
-        try {
-            jsonObj.put("obj", json);
-        } catch (JSONException e) {
-            e.printStackTrace();
-        }
-
-        MediaType mediaType = MediaType.parse("application/json; charset=utf-8");//"类型,字节码"
-        //1.创建OkHttpClient对象
-        OkHttpClient okHttpClient = new OkHttpClient();
-        //2.通过RequestBody.create 创建requestBody对象
-        RequestBody requestBody = RequestBody.create(mediaType, jsonObj.toString());
-        //3.创建Request对象,设置URL地址,将RequestBody作为post方法的参数传入
-        String token = SPUtil.getString(context, "TOKEN1");
-        Request request = null;
-        if (TextUtils.isEmpty(token)) {
-            request = new Request.Builder().url(url).post(requestBody).build();
-
-        } else {
-            request = new Request.Builder().url(url).addHeader("token", token).addHeader("identity", "1").post(requestBody).build();
-        }
-
-        //4.创建一个call对象,参数就是Request请求对象
-        Call call = okHttpClient.newCall(request);
-        //5.请求加入调度,重写回调方法
-        call.enqueue(new Callback() {
-            @Override
-            public void onFailure(Call call, IOException e) {
-                Log.e("http_log", url + "");
-
-            }
-
-            @Override
-            public void onResponse(Call call, Response response) throws IOException {
-                String strResult = response.body().string();
-                Log.e("http_ok", "--------------------------------------------");
-                Log.e("http_url", url + "");
-                Log.e("http_result", strResult + "");
-                Message message = new Message();
-                message.obj = strResult;
-                handler.sendMessage(message);
-
-            }
-        });
-    }
-
-}

+ 0 - 606
app/src/main/java/com/wisdom/hydroponics/utils/WQUtils.java

@@ -1,606 +0,0 @@
-package com.wisdom.hydroponics.utils;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
-import android.app.PendingIntent;
-import android.app.PendingIntent.CanceledException;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.CompressFormat;
-import android.graphics.BitmapFactory;
-import android.location.LocationManager;
-import android.media.MediaMetadataRetriever;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.Uri;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-import android.os.Build;
-import android.os.Environment;
-import android.provider.MediaStore;
-import android.text.TextUtils;
-import android.util.Base64;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.Toast;
-
-import com.github.johnpersano.supertoasts.library.Style;
-import com.github.johnpersano.supertoasts.library.SuperActivityToast;
-import com.wisdom.hydroponics.R;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-public class WQUtils {
-
-    public static int getLocalVideoDuration(String videoPath) {
-        //除以 1000 返回是秒
-        int duration;
-        try {
-            MediaMetadataRetriever mmr = new MediaMetadataRetriever();
-            mmr.setDataSource(videoPath);
-            duration = Integer.parseInt(mmr.extractMetadata
-                    (MediaMetadataRetriever.METADATA_KEY_DURATION)) / 1000;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return 0;
-        }
-        return duration;
-    }
-
-    /**
-     * 得到全局唯一UUID
-     */
-    public static String getSerial_Num() {
-        String serialNum = android.os.Build.SERIAL;
-        if (!TextUtils.isEmpty(serialNum)) {
-            return serialNum;
-        }
-        return "unkown";
-    }
-
-    public static String getVersionName(Context context) throws Exception {
-        // 获取packagemanager的实例
-        PackageManager packageManager = context.getPackageManager();
-        // getPackageName()是你当前类的包名,0代表是获取版本信息
-        PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
-        String version = packInfo.versionName;
-        return version;
-    }
-
-    public static String addDate_Day(String day, int x) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");//24小时制
-        //SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");//12小时制
-        Date date = null;
-        try {
-            date = format.parse(day);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-        if (date == null) return "";
-        Calendar cal = Calendar.getInstance();
-        cal.setTime(date);
-        cal.add(Calendar.DATE, x);//24小时制
-        //cal.add(Calendar.HOUR, x);12小时制
-        date = cal.getTime();
-
-        cal = null;
-        return format.format(date);
-    }
-
-    public static String addDate(String day, int x) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy/M/d H:mm:ss");//24小时制
-        //SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");//12小时制
-        Date date = null;
-        try {
-            date = format.parse(day);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-        if (date == null) return "";
-        Calendar cal = Calendar.getInstance();
-        cal.setTime(date);
-        cal.add(Calendar.DATE, x);//24小时制
-        //cal.add(Calendar.HOUR, x);12小时制
-        date = cal.getTime();
-
-        cal = null;
-        return format.format(date);
-    }
-
-    //Eooji禁止
-    public static boolean isEmojiCharacter(char codePoint) {
-        return !((codePoint == 0x0) || (codePoint == 0x9) || (codePoint == 0xA) || (codePoint == 0xD) || ((codePoint >= 0x20) && codePoint <= 0xD7FF)) || ((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) || ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF));
-    }
-
-    //把String转化为double
-    public static double convertToDouble(String number, double defaultValue) {
-        if (TextUtils.isEmpty(number)) {
-            return defaultValue;
-        }
-        try {
-            return Double.parseDouble(number);
-        } catch (Exception e) {
-            return defaultValue;
-        }
-
-    }
-
-    public static void say(Context context, String say) {
-        SuperActivityToast.create(context, new Style(), Style.TYPE_STANDARD)
-//                .setButtonText("UNDO")
-//                .setButtonIconResource(R.drawable.ic_undo)
-//                .setOnButtonClickListener("good_tag_name", null, onButtonClickListener)
-//                .setProgressBarColor(Color.WHITE)
-                .setGravity(Gravity.CENTER)
-                .setText(say)
-                .setDuration(Style.DURATION_SHORT)
-                .setFrame(Style.FRAME_STANDARD)
-                .setColor(context.getResources().getColor(R.color.black))
-                .setAnimations(Style.ANIMATIONS_POP).show();
-    }
-
-    /**
-     * 提供精确的减法运算。
-     *
-     * @param v1 被减数
-     * @param v2 减数
-     * @return 两个参数的差
-     */
-
-    public static double sub(double v1, double v2) {
-        BigDecimal b1 = new BigDecimal(Double.toString(v1));
-        BigDecimal b2 = new BigDecimal(Double.toString(v2));
-        return b1.subtract(b2).doubleValue();
-    }
-
-    @SuppressLint("NewApi")
-    public static void tip(Context context, String str) {
-        Builder builder = new Builder(context, AlertDialog.THEME_HOLO_LIGHT);
-        builder.setMessage(str);
-        builder.setTitle("提示");
-        builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-            }
-        });
-        builder.create().show();
-    }
-
-    @SuppressLint("NewApi")
-    public static void showOK(final Activity context, String str) {
-        Builder builder = new Builder(context);
-        builder.setMessage(str);
-        builder.setTitle("提示");
-        builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
-            public void onClick(DialogInterface dialog, int which) {
-                dialog.dismiss();
-                context.finish();
-            }
-        });
-        builder.create().show();
-    }
-
-
-    /**
-     * 避免button多次点击工具 使用时在监听处添加判断即可
-     */
-    private static long lastClickTime;
-
-    public static boolean isFastDoubleClick() {
-        long time = System.currentTimeMillis();
-        long timeD = time - lastClickTime;
-        if (0 < timeD && timeD < 800) {
-            return true;
-        }
-        lastClickTime = time;
-        return false;
-    }
-
-    /**
-     * 弹出Toast
-     *
-     * @param context
-     * @param text
-     */
-    public static void showToast(Context context, String text) {
-
-        Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
-    }
-
-    /*
-     * 量取listview的高度
-     */
-    public static void setListViewHeight(ListView listView) {
-        if (listView == null)
-            return;
-        ListAdapter listAdapter = listView.getAdapter();
-        if (listAdapter == null) {
-            return;
-        }
-        int totalHeight = 0;
-        for (int i = 0; i < listAdapter.getCount(); i++) {
-            View listItem = listAdapter.getView(i, null, listView);
-            listItem.measure(0, 0);
-            totalHeight += listItem.getMeasuredHeight();
-        }
-        ViewGroup.LayoutParams params = listView.getLayoutParams();
-        params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
-        listView.setLayoutParams(params);
-    }
-
-//	// 序列化对象
-//	public static String serialize(UserInfo userinfo) throws IOException {
-//		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-//		ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
-//		objectOutputStream.writeObject(userinfo);
-//		String serStr = byteArrayOutputStream.toString("ISO-8859-1");
-//		serStr = java.net.URLEncoder.encode(serStr, "UTF-8");
-//		objectOutputStream.close();
-//		byteArrayOutputStream.close();
-//		return serStr;
-//	}
-//
-//	// 反序列化用户信息
-//	public static UserInfo deSerialization(String str) throws IOException, ClassNotFoundException {
-//		String redStr = java.net.URLDecoder.decode(str, "UTF-8");
-//		ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(redStr.getBytes("ISO-8859-1"));
-//		ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
-//		UserInfo userinfo = (UserInfo) objectInputStream.readObject();
-//		objectInputStream.close();
-//		byteArrayInputStream.close();
-//		return userinfo;
-//	}
-
-
-    // 开启新activity
-    public static void startActivity(Context context, Class<? extends Activity> clazz) {
-
-        Intent intent = new Intent(context, clazz);
-        intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);// 防止重复的实例生成,如果栈里有,则调用栈里的,不重新生成
-        context.startActivity(intent);
-    }
-
-    /**
-     * 通过uri获取Bitmap对象
-     *
-     * @return
-     */
-    public static Bitmap getBitmapFromUri(Uri uri, Context context) {
-        try {
-            // 读取uri所在的图片
-            Bitmap bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri);
-            return bitmap;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * 通过Base32将Bitmap转换成Base64字符串
-     *
-     * @param bit
-     * @return
-     */
-    public static String Bitmap2StrByBase64(Bitmap bit) {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        bit.compress(CompressFormat.JPEG, 70, bos);// 参数100表示不压缩
-        byte[] bytes = bos.toByteArray();
-        return Base64.encodeToString(bytes, Base64.DEFAULT);
-    }
-
-    /**
-     * 将base64转换成bitmap图片
-     *
-     * @param string base64字符串
-     * @return bitmap
-     */
-    public static Bitmap stringtoBitmap(String string) {
-        // 将字符串转换成Bitmap类型
-        Bitmap bitmap = null;
-        try {
-            byte[] bitmapArray;
-            bitmapArray = Base64.decode(string, Base64.DEFAULT);
-            bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return bitmap;
-    }
-
-    /**
-     * 根据图片的url路径获得Bitmap对象
-     *
-     * @param url
-     * @return
-     */
-    public static Bitmap returnBitmap(String url) {
-        URL fileUrl = null;
-        Bitmap bitmap = null;
-        try {
-            fileUrl = new URL(url);
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        }
-        try {
-            HttpURLConnection conn = (HttpURLConnection) fileUrl.openConnection();
-            conn.setDoInput(true);
-            conn.connect();
-            InputStream is = conn.getInputStream();
-            bitmap = BitmapFactory.decodeStream(is);
-            is.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return bitmap;
-
-    }
-
-    /**
-     * 获取手机mac地址<br/>
-     * 错误返回12个0
-     */
-    public static String getMacAddress(Context context) {
-        // 获取mac地址:
-        String macAddress = "000000000000";
-        try {
-            WifiManager wifiMgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-            @SuppressLint("MissingPermission") WifiInfo info = (null == wifiMgr ? null : wifiMgr.getConnectionInfo());
-            if (null != info) {
-                if (!TextUtils.isEmpty(info.getMacAddress()))
-                    macAddress = info.getMacAddress().replace(":", "");
-                else
-                    return macAddress;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            return macAddress;
-        }
-        return macAddress;
-    }
-
-    /**
-     * 判断是否在wifi网络环境下
-     */
-    public static boolean isWifi(Context context) {
-        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
-        @SuppressLint("MissingPermission") NetworkInfo networkINfo = cm.getActiveNetworkInfo();
-        if (networkINfo != null && networkINfo.getType() == ConnectivityManager.TYPE_WIFI) {
-            return true;
-        }
-        return false;
-    }
-
-    public static boolean haveSDcard() {
-        String status = Environment.getExternalStorageState();
-        if (status.equals(Environment.MEDIA_MOUNTED)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // 判断电话号码格式的正则
-    public static boolean isMobileNO(String phone) {
-
-        if (phone.substring(0, 3).equals("888")) {
-            return true;
-        }
-
-        /*
-         * 移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188
-         * 联通:130、131、132、152、155、156、185、186 电信:133、153、180、189、(1349卫通)
-         * 总结起来就是第一位必定为1,第二位必定为3或5或8,其他位置的可以为0-9
-         */
-        String telRegex = "[1][3456789]\\d{9}";// "[1]"代表第1位为数字1,"[34578]"代表第二位可以为3、5、8中的一个,"\\d{9}"代表后面是可以是0~9的数字,有9位。
-        if (TextUtils.isEmpty(phone)) {
-            return false;
-        } else {
-            return phone.matches(telRegex);
-        }
-    }
-
-    // 判断身份证号码格式的正则
-    public static boolean isIDCard(String IDcard) {
-        String telRegex = "(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])";
-        if (TextUtils.isEmpty(IDcard)) {
-            return false;
-        } else {
-            return IDcard.matches(telRegex);
-        }
-    }
-
-    // 判断邮箱格式的正则
-    public static boolean isEmail(String email) {
-        String telRegex = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
-        if (TextUtils.isEmpty(email)) {
-            return false;
-        } else {
-            return Pattern.matches(telRegex, email);
-        }
-    }
-
-    // MAP通过value取出key
-    public static Object keyString(HashMap<Integer, String> mapIMG, Object o) {
-        Iterator<Integer> it = mapIMG.keySet().iterator();
-        while (it.hasNext()) {
-            Object keyString = it.next();
-            if (mapIMG.get(keyString).equals(o))
-                return keyString;
-        }
-        return 0;
-    }
-
-    // 判断是否能转化为double
-    public static boolean isDouble(String str) {
-        {
-            try {
-                Double.parseDouble(str);
-                return true;
-            } catch (NumberFormatException ex) {
-                return false;
-            }
-        }
-    }
-
-    // 判断是否能转化为int
-    public static boolean isInteger(String str) {
-        {
-            try {
-                Integer.parseInt(str);
-                return true;
-            } catch (NumberFormatException ex) {
-                return false;
-            }
-        }
-    }
-
-    public static String getCurrentTime(String format) {
-        Date date = new Date();
-        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.getDefault());
-        String currentTime = sdf.format(date);
-        return currentTime;
-    }
-
-    public static String getCurrentTime() {
-        return getCurrentTime("yyyy-MM-dd  HH:mm:ss");
-    }
-
-    // 获取bitmap大小
-    public static int getBitmapSize(Bitmap bitmap) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {// API
-            // 12
-            return bitmap.getByteCount();
-        }
-        return bitmap.getRowBytes() * bitmap.getHeight(); // earlier version
-    }
-
-    // 过滤非法字符串正则
-    public static String stringFilter(String str) throws PatternSyntaxException {
-        String regEx = "[/\\:*?<>|\"\n\t]"; // 要过滤掉的字符
-        Pattern p = Pattern.compile(regEx);
-        Matcher m = p.matcher(str);
-        return m.replaceAll("").trim();
-    }
-
-    /**
-     * 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的
-     *
-     * @param context
-     * @return true 表示开启
-     */
-    public static final boolean isOPen(final Context context) {
-        LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
-        // 通过GPS卫星定位,定位级别可以精确到街(通过24颗卫星定位,在室外和空旷的地方定位准确、速度快)
-        boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
-        // 通过WLAN或移动网络(3G/2G)确定的位置(也称作AGPS,辅助GPS定位。主要用于在室内或遮盖物(建筑群或茂密的深林等)密集的地方定位)
-        boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
-        if (gps || network) {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * 强制帮用户打开GPS
-     *
-     * @param context
-     */
-    public static final void openGPS(Context context) {
-        Intent GPSIntent = new Intent();
-        GPSIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
-        GPSIntent.addCategory("android.intent.category.ALTERNATIVE");
-        GPSIntent.setData(Uri.parse("custom:3"));
-        try {
-            PendingIntent.getBroadcast(context, 0, GPSIntent, 0).send();
-        } catch (CanceledException e) {
-            e.printStackTrace();
-        }
-    }
-
-    //------------------------------------分割线-------------------------------------------
-
-//    /**
-//     * 获取领域list,对比状态展示领域名称
-//     *
-//     * @param context
-//     */
-//    public static List<FieldBean> getFieldBean(Context context) {
-//        List<FieldBean> list = null;
-//        Gson gson = new Gson();
-//        String json = SPUtil.getString(context, "Field");
-//        if (!TextUtils.isEmpty(json)) {
-//            list = gson.fromJson(json, new TypeToken<List<FieldBean>>() {
-//            }.getType());
-//        }
-//        return list;
-//    }
-//
-//    /**
-//     * 获取领域list,对比状态展示领域名称
-//     *
-//     * @param context
-//     */
-//    public static List<ContractConfigBean> getContractConfigBean(Context context) {
-//        List<ContractConfigBean> list = null;
-//        Gson gson = new Gson();
-//        String json = SPUtil.getString(context, "ContractConfig");
-//        if (!TextUtils.isEmpty(json)) {
-//            list = gson.fromJson(json, new TypeToken<List<ContractConfigBean>>() {
-//            }.getType());
-//        }
-//        return list;
-//    }
-//
-//    /**
-//     * 获取城市list,对比状态展示领域名称
-//     *
-//     * @param context
-//     */
-//    public static CityDataBean getCityConfigBean(Context context) {
-//        CityDataBean bean = null;
-//        Gson gson = new Gson();
-//        String json = SPUtil.getString(context, "CityCode");
-//        if (!TextUtils.isEmpty(json)) {
-//            bean = gson.fromJson(json, new TypeToken<CityDataBean>() {
-//            }.getType());
-//        }
-//        return bean;
-//    }
-//
-//    public static List<AskConfigs> getAskConfig(Context context) {
-//        List<AskConfigs> bean = null;
-//        Gson gson = new Gson();
-//        String json = SPUtil.getString(context, "AskConfig");
-//        if (!TextUtils.isEmpty(json)) {
-//            bean = gson.fromJson(json, new TypeToken<List<AskConfigs>>() {
-//            }.getType());
-//        }
-//        return bean;
-//    }
-}

+ 98 - 0
app/src/main/java/com/wisdom/pigs/ui/act1/PigsListActivity.java

@@ -0,0 +1,98 @@
+package com.wisdom.pigs.ui.act1;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.wisdom.pigs.R;
+import com.wisdom.pigs.adapters.PigHomeAdapter;
+import com.wisdom.pigs.adapters.PigListAdapter;
+import com.wisdom.pigs.base.BaseActivity;
+import com.wisdom.pigs.bean.WWBean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+/**
+ * A login screen that offers login via email/password.
+ */
+public class PigsListActivity extends BaseActivity {
+
+
+    @BindView(R.id.iv_base_activity_back)
+    ImageView ivBaseActivityBack;
+    @BindView(R.id.tv_title_center)
+    TextView tvTitleCenter;
+    @BindView(R.id.tv_title_right)
+    TextView tvTitleRight;
+    @BindView(R.id.rl_base_activity_backround)
+    RelativeLayout rlBaseActivityBackround;
+    @BindView(R.id.et_bank_search)
+    EditText etBankSearch;
+    @BindView(R.id.mRecyclerView)
+    RecyclerView mRecyclerView;
+
+    private PigListAdapter.OnRecyclerviewItemClickListener onRecyclerviewClickListener;
+    private PigListAdapter adapter;
+
+    @Override
+    protected int setView() {
+        return R.layout.activity_piglist;
+    }
+
+    @Override
+    public void initView() {
+        ivBaseActivityBack.setVisibility(View.VISIBLE);
+        tvTitleRight.setVisibility(View.GONE);
+        ivBaseActivityBack.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                finish();
+            }
+        });
+
+        Intent intent = getIntent();
+        intent.getStringExtra("Name");
+        tvTitleCenter.setText(intent.getStringExtra("Name") + "");
+
+        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
+        LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
+        mRecyclerView.setLayoutManager(mLayoutManager);
+        onRecyclerviewClickListener = new PigListAdapter.OnRecyclerviewItemClickListener() {
+            @Override
+            public void onItemClickListener(View v, int i1) {
+
+
+            }
+        };
+
+        WWBean wwBean1 = new WWBean("ABC-0001", "133kg", 1);
+        WWBean wwBean2 = new WWBean("ABC-0002", "136kg", 1);
+        WWBean wwBean3 = new WWBean("ABC-0003", "138kg", 1);
+        WWBean wwBean4 = new WWBean("ABC-0004", "130kg", 0);
+        WWBean wwBean5 = new WWBean("ABC-0005", "142kg", 0);
+
+        List<WWBean> list = new ArrayList<>();
+        list.add(wwBean1);
+        list.add(wwBean2);
+        list.add(wwBean3);
+        list.add(wwBean4);
+        list.add(wwBean5);
+
+        adapter = new PigListAdapter(this, list, onRecyclerviewClickListener);
+        mRecyclerView.setAdapter(adapter);
+    }
+
+}
+

+ 1 - 1
app/src/main/res/drawable/rect_radius_device_dark.xml

@@ -15,5 +15,5 @@
     </stroke>
 
     <!-- 矩形的圆角半径 -->
-    <corners android:radius="@dimen/y8" />
+    <corners android:radius="@dimen/y3" />
 </shape>

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -1,5 +1,5 @@
 <resources>
-    <string name="app_name">智慧水培APP</string>
+    <string name="app_name">猪舍</string>
 
     <string name="selected_picture_text">最多只能选择</string>
     <string name="selected_picture_text2">张图片哦</string>

+ 0 - 17
app/src/test/java/com/wisdom/hydroponics/ExampleUnitTest.java

@@ -1,17 +0,0 @@
-package com.wisdom.hydroponics;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-public class ExampleUnitTest {
-    @Test
-    public void addition_isCorrect() {
-        assertEquals(4, 2 + 2);
-    }
-}

Some files were not shown because too many files changed in this diff