zhaoyadi hai 6 meses
pai
achega
887d72af7e
Modificáronse 30 ficheiros con 1134 adicións e 68 borrados
  1. 2 0
      xiaodou/build.gradle
  2. 10 0
      xiaodou/src/main/java/com/luojigou/product/ProductSelectActivity.kt
  3. 10 0
      xiaodou/src/main/java/com/luojigou/product/base/BaseActivity.kt
  4. 18 9
      xiaodou/src/main/java/com/luojigou/product/ble/XDScanBLENormalFragment.kt
  5. 571 0
      xiaodou/src/main/java/com/luojigou/product/common/DividerDecoration.java
  6. 16 2
      xiaodou/src/main/java/com/luojigou/product/wifi/XDScanWifiAdapter.kt
  7. 25 3
      xiaodou/src/main/java/com/luojigou/product/wifi/XDScanWifiNormalFragment.kt
  8. 3 2
      xiaodou/src/main/java/com/luojigou/product/xiaodou/XDConnectActivity.kt
  9. 111 24
      xiaodou/src/main/java/com/luojigou/product/xiaodou/XDConnectService.kt
  10. 45 4
      xiaodou/src/main/java/com/luojigou/product/xiaodou/connect/XDConnectSuccessFragment.kt
  11. 20 0
      xiaodou/src/main/res/drawable/refresh.xml
  12. 25 0
      xiaodou/src/main/res/drawable/wifi_level1.xml
  13. 25 0
      xiaodou/src/main/res/drawable/wifi_level2.xml
  14. 25 0
      xiaodou/src/main/res/drawable/wifi_level3.xml
  15. 25 0
      xiaodou/src/main/res/drawable/wifi_level4.xml
  16. 32 0
      xiaodou/src/main/res/drawable/wifi_lock1.xml
  17. 32 0
      xiaodou/src/main/res/drawable/wifi_lock2.xml
  18. 32 0
      xiaodou/src/main/res/drawable/wifi_lock3.xml
  19. 32 0
      xiaodou/src/main/res/drawable/wifi_lock4.xml
  20. 6 0
      xiaodou/src/main/res/layout/fragment_connect_failure_bind.xml
  21. 5 2
      xiaodou/src/main/res/layout/fragment_connect_password.xml
  22. 10 13
      xiaodou/src/main/res/layout/fragment_connect_success.xml
  23. 6 0
      xiaodou/src/main/res/layout/fragment_connect_success_bind.xml
  24. 1 0
      xiaodou/src/main/res/layout/fragment_introduce_normal.xml
  25. 19 3
      xiaodou/src/main/res/layout/fragment_scanble_normal.xml
  26. 12 1
      xiaodou/src/main/res/layout/fragment_scanwifi_normal.xml
  27. 4 3
      xiaodou/src/main/res/layout/item_product.xml
  28. 4 1
      xiaodou/src/main/res/layout/item_wifi.xml
  29. 3 1
      xiaodou/src/main/res/layout/item_wifi_add.xml
  30. 5 0
      xiaodou/src/main/res/values/dimens.xml

+ 2 - 0
xiaodou/build.gradle

@@ -57,4 +57,6 @@ dependencies {
     implementation 'com.google.android.material:material:1.10.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
     implementation 'commons-codec:commons-codec:1.17.1'
+
+    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
 }

+ 10 - 0
xiaodou/src/main/java/com/luojigou/product/ProductSelectActivity.kt

@@ -1,6 +1,7 @@
 package com.luojigou.product
 
 import android.content.Intent
+import android.graphics.Color
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
@@ -8,6 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import androidx.recyclerview.widget.RecyclerView.LayoutManager
 import com.luojigou.product.base.BaseActivity
+import com.luojigou.product.common.DividerDecoration
 import com.luojigou.product.xiaodou.XDIntroduceActivity
 import com.google.android.material.R.drawable as MaterialDrawable
 
@@ -38,6 +40,14 @@ class ProductSelectActivity : BaseActivity() {
         productLayoutManager = LinearLayoutManager(this)
         productRecyclerView.layoutManager = productLayoutManager
         productRecyclerView.adapter = productAdapter
+
+        productRecyclerView.addItemDecoration(
+            DividerDecoration.Builder(this)
+                .color(Color.parseColor("#E1E1E1"))
+                .sizeResId(R.dimen.divide_width)
+                .marginResId(R.dimen.divide_margin)
+                .build()
+        )
     }
 
     override fun getLayoutId(): Int = R.layout.activity_product_select

+ 10 - 0
xiaodou/src/main/java/com/luojigou/product/base/BaseActivity.kt

@@ -6,6 +6,7 @@ import android.content.Intent
 import android.content.IntentFilter
 import android.graphics.drawable.ColorDrawable
 import android.os.Bundle
+import android.view.MenuItem
 import androidx.annotation.LayoutRes
 import androidx.appcompat.app.AppCompatActivity
 import androidx.core.content.ContextCompat
@@ -39,6 +40,15 @@ abstract class BaseActivity : AppCompatActivity() {
         }
     }
 
+    override fun onOptionsItemSelected(item: MenuItem): Boolean {
+        if (item.itemId == android.R.id.home) {
+            finish()
+            return true
+        }
+
+        return super.onOptionsItemSelected(item)
+    }
+
     protected fun setFragment(fragment: Fragment) {
         val fragmentManager = supportFragmentManager;
         val beginTransaction = fragmentManager.beginTransaction()

+ 18 - 9
xiaodou/src/main/java/com/luojigou/product/ble/XDScanBLENormalFragment.kt

@@ -11,7 +11,9 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.widget.Button
+import android.widget.ImageView
 import android.widget.ProgressBar
+import android.widget.TextView
 import androidx.activity.result.ActivityResultLauncher
 import androidx.activity.result.contract.ActivityResultContracts
 import androidx.core.content.ContextCompat
@@ -21,8 +23,8 @@ import androidx.recyclerview.widget.RecyclerView
 import com.luojigou.product.R
 import com.luojigou.product.wifi.XDScanWifiActivity
 import com.luojigou.product.xiaodou.XDConnectService
-import com.luojigou.product.xiaodou.XDConnectService.Companion.ACTION_SCAN_RESULT
-import com.luojigou.product.xiaodou.XDConnectService.Companion.ACTION_SCAN_RESULT_DATA
+import com.luojigou.product.xiaodou.XDConnectService.Companion.ACTION_SCAN_BLE_RESULT
+import com.luojigou.product.xiaodou.XDConnectService.Companion.ACTION_SCAN_BLE_RESULT_DATA
 import com.luojigou.product.xiaodou.XDConnectService.Companion.ACTION_START_SCAN
 import com.luojigou.product.xiaodou.XDConnectService.Companion.ACTION_STOP_SCAN
 import kotlinx.coroutines.CoroutineScope
@@ -42,10 +44,12 @@ class XDScanBLENormalFragment(private val host: XDScanBLEStatus.Host) : Fragment
 
     private lateinit var bluetoothReceiver: BroadcastReceiver
 
-    private lateinit var restartScanButton: Button
+    private lateinit var restartScanButton: ImageView
 
     private lateinit var scanProgress: ProgressBar
 
+    private lateinit var scanEmpty:TextView
+
     override fun onCreateView(
         inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
     ): View? {
@@ -59,8 +63,9 @@ class XDScanBLENormalFragment(private val host: XDScanBLEStatus.Host) : Fragment
             it.data
         }
         scanProgress = view.findViewById(R.id.scan_progress)
+        scanEmpty = view.findViewById(R.id.scan_empty)
 
-        restartScanButton = view.findViewById<Button>(R.id.scan_again)
+        restartScanButton = view.findViewById(R.id.scan_again)
         restartScanButton.setOnClickListener { restartScan() }
 
         val recyclerView = view.findViewById<RecyclerView>(R.id.scan_list)
@@ -82,26 +87,30 @@ class XDScanBLENormalFragment(private val host: XDScanBLEStatus.Host) : Fragment
                     ACTION_START_SCAN -> {
                         scanProgress.visibility = View.VISIBLE
                         restartScanButton.visibility = View.INVISIBLE
+                        scanEmpty.visibility = View.INVISIBLE
                     }
 
                     ACTION_STOP_SCAN -> {
                         scanProgress.visibility = View.INVISIBLE
                         restartScanButton.visibility = View.VISIBLE
+                        if(adapter.itemCount == 0){
+                            scanEmpty.visibility = View.VISIBLE
+                        }
                     }
 
-                    ACTION_SCAN_RESULT -> {
+                    ACTION_SCAN_BLE_RESULT -> {
                         val list = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                             intent.getParcelableArrayListExtra(
-                                ACTION_SCAN_RESULT_DATA, XDScanBLEDevice::class.java
+                                ACTION_SCAN_BLE_RESULT_DATA, XDScanBLEDevice::class.java
                             )
                         } else {
-                            intent.getParcelableArrayListExtra(ACTION_SCAN_RESULT_DATA)
+                            intent.getParcelableArrayListExtra(ACTION_SCAN_BLE_RESULT_DATA)
                         }
 
                         if (list != null) {
                             setAdapterValue(list)
 
-                            if (list.size == 1) {
+                            if (isResumed && list.size == 1) {
                                 val selectIntent = Intent(XDConnectService.ACTION_SELECT_BLE_DEVICE)
                                 selectIntent.putExtra(
                                     XDConnectService.ACTION_SELECT_BLE_DEVICE_DATA,
@@ -122,7 +131,7 @@ class XDScanBLENormalFragment(private val host: XDScanBLEStatus.Host) : Fragment
         val intentFilter = IntentFilter()
         intentFilter.addAction(ACTION_START_SCAN)
         intentFilter.addAction(ACTION_STOP_SCAN)
-        intentFilter.addAction(ACTION_SCAN_RESULT)
+        intentFilter.addAction(ACTION_SCAN_BLE_RESULT)
         ContextCompat.registerReceiver(
             requireContext(),
             bluetoothReceiver,

+ 571 - 0
xiaodou/src/main/java/com/luojigou/product/common/DividerDecoration.java

@@ -0,0 +1,571 @@
+package com.luojigou.product.common;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.view.View;
+
+import androidx.annotation.ColorRes;
+import androidx.annotation.DimenRes;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.ViewCompat;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+public class DividerDecoration extends RecyclerView.ItemDecoration {
+
+  private static final int DEFAULT_SIZE = 2;
+  private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
+
+  protected enum DividerType {
+    DRAWABLE, PAINT, COLOR
+  }
+
+  private MarginProvider mMarginProvider;
+
+  protected DividerType mDividerType = DividerType.DRAWABLE;
+  protected VisibilityProvider mVisibilityProvider;
+  protected PaintProvider mPaintProvider;
+  protected ColorProvider mColorProvider;
+  protected DrawableProvider mDrawableProvider;
+  protected SizeProvider mSizeProvider;
+  protected boolean mShowLastDivider;
+  protected boolean mPositionInsideItem;
+  private Paint mPaint;
+
+  protected DividerDecoration(Builder builder) {
+    if (builder.mPaintProvider != null) {
+      mDividerType = DividerType.PAINT;
+      mPaintProvider = builder.mPaintProvider;
+    } else if (builder.mColorProvider != null) {
+      mDividerType = DividerType.COLOR;
+      mColorProvider = builder.mColorProvider;
+      mPaint = new Paint();
+      setSizeProvider(builder);
+    } else {
+      mDividerType = DividerType.DRAWABLE;
+      if (builder.mDrawableProvider == null) {
+        TypedArray a = builder.mContext.obtainStyledAttributes(ATTRS);
+        final Drawable divider = a.getDrawable(0);
+        a.recycle();
+        mDrawableProvider = new DrawableProvider() {
+          @Override
+          public Drawable drawableProvider(int position, RecyclerView parent) {
+            return divider;
+          }
+        };
+      } else {
+        mDrawableProvider = builder.mDrawableProvider;
+      }
+      mSizeProvider = builder.mSizeProvider;
+    }
+
+    mVisibilityProvider = builder.mVisibilityProvider;
+    mShowLastDivider = builder.mShowLastDivider;
+    mPositionInsideItem = builder.mPositionInsideItem;
+    mMarginProvider = builder.mMarginProvider;
+  }
+
+  private void setSizeProvider(Builder builder) {
+    mSizeProvider = builder.mSizeProvider;
+    if (mSizeProvider == null) {
+      mSizeProvider = new SizeProvider() {
+        @Override
+        public int dividerSize(int position, RecyclerView parent) {
+          return DEFAULT_SIZE;
+        }
+      };
+    }
+  }
+
+  @Override
+  public void onDraw(@NonNull Canvas c, RecyclerView parent, @NonNull RecyclerView.State state) {
+    RecyclerView.Adapter<?> adapter = parent.getAdapter();
+    if (adapter == null) {
+      return;
+    }
+
+    int itemCount = adapter.getItemCount();
+    int lastDividerOffset = getLastDividerOffset(parent);
+    int validChildCount = parent.getChildCount();
+    int lastChildPosition = -1;
+    for (int i = 0; i < validChildCount; i++) {
+      View child = parent.getChildAt(i);
+      int childPosition = parent.getChildAdapterPosition(child);
+
+      if (childPosition < lastChildPosition) {
+        // Avoid remaining divider when animation starts
+        continue;
+      }
+      lastChildPosition = childPosition;
+
+      if (!mShowLastDivider && childPosition >= itemCount - lastDividerOffset) {
+        // Don't draw divider for last line if mShowLastDivider = false
+        continue;
+      }
+
+      if (wasDividerAlreadyDrawn(childPosition, parent)) {
+        // No need to draw divider again as it was drawn already by previous column
+        continue;
+      }
+
+      int groupIndex = getGroupIndex(childPosition, parent);
+      if (mVisibilityProvider.shouldHideDivider(groupIndex, parent)) {
+        continue;
+      }
+
+      Rect bounds = getDividerBound(groupIndex, parent, child);
+      switch (mDividerType) {
+        case DRAWABLE:
+          Drawable drawable = mDrawableProvider.drawableProvider(groupIndex, parent);
+          drawable.setBounds(bounds);
+          drawable.draw(c);
+          break;
+        case PAINT:
+          mPaint = mPaintProvider.dividerPaint(groupIndex, parent);
+          c.drawLine(bounds.left, bounds.top, bounds.right, bounds.bottom, mPaint);
+          break;
+        case COLOR:
+          mPaint.setColor(mColorProvider.dividerColor(groupIndex, parent));
+          mPaint.setStrokeWidth(mSizeProvider.dividerSize(groupIndex, parent));
+          c.drawLine(bounds.left, bounds.top, bounds.right, bounds.bottom, mPaint);
+          break;
+      }
+    }
+  }
+
+  @Override
+  public void getItemOffsets(@NonNull Rect rect, @NonNull View v, RecyclerView parent, RecyclerView.State state) {
+    int position = parent.getChildAdapterPosition(v);
+    int itemCount = parent.getAdapter().getItemCount();
+    int lastDividerOffset = getLastDividerOffset(parent);
+    if (!mShowLastDivider && position >= itemCount - lastDividerOffset) {
+      // Don't set item offset for last line if mShowLastDivider = false
+      return;
+    }
+
+    int groupIndex = getGroupIndex(position, parent);
+    if (mVisibilityProvider.shouldHideDivider(groupIndex, parent)) {
+      return;
+    }
+
+    setItemOffsets(rect, groupIndex, parent);
+  }
+
+  /**
+   * Check if recyclerview is reverse layout
+   *
+   * @param parent RecyclerView
+   * @return true if recyclerview is reverse layout
+   */
+  protected boolean isReverseLayout(RecyclerView parent) {
+    RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
+    if (layoutManager instanceof LinearLayoutManager) {
+      return ((LinearLayoutManager) layoutManager).getReverseLayout();
+    } else {
+      return false;
+    }
+  }
+
+  /**
+   * In the case mShowLastDivider = false,
+   * Returns offset for how many views we don't have to draw a divider for,
+   * for LinearLayoutManager it is as simple as not drawing the last child divider,
+   * but for a GridLayoutManager it needs to take the span count for the last items into account
+   * until we use the span count configured for the grid.
+   *
+   * @param parent RecyclerView
+   * @return offset for how many views we don't have to draw a divider or 1 if its a
+   * LinearLayoutManager
+   */
+  private int getLastDividerOffset(RecyclerView parent) {
+    if (parent.getLayoutManager() instanceof GridLayoutManager) {
+      GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
+      GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup();
+      int spanCount = layoutManager.getSpanCount();
+      int itemCount = parent.getAdapter().getItemCount();
+      for (int i = itemCount - 1; i >= 0; i--) {
+        if (spanSizeLookup.getSpanIndex(i, spanCount) == 0) {
+          return itemCount - i;
+        }
+      }
+    }
+
+    return 1;
+  }
+
+  /**
+   * Determines whether divider was already drawn for the row the item is in,
+   * effectively only makes sense for a grid
+   *
+   * @param position current view position to draw divider
+   * @param parent   RecyclerView
+   * @return true if the divider can be skipped as it is in the same row as the previous one.
+   */
+  private boolean wasDividerAlreadyDrawn(int position, RecyclerView parent) {
+    if (parent.getLayoutManager() instanceof GridLayoutManager) {
+      GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
+      GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup();
+      int spanCount = layoutManager.getSpanCount();
+      return spanSizeLookup.getSpanIndex(position, spanCount) > 0;
+    }
+
+    return false;
+  }
+
+  /**
+   * Returns a group index for GridLayoutManager.
+   * for LinearLayoutManager, always returns position.
+   *
+   * @param position current view position to draw divider
+   * @param parent   RecyclerView
+   * @return group index of items
+   */
+  private int getGroupIndex(int position, RecyclerView parent) {
+    if (parent.getLayoutManager() instanceof GridLayoutManager) {
+      GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
+      GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup();
+      int spanCount = layoutManager.getSpanCount();
+      return spanSizeLookup.getSpanGroupIndex(position, spanCount);
+    }
+
+    return position;
+  }
+
+  protected Rect getDividerBound(int position, RecyclerView parent, View child) {
+    Rect bounds = new Rect(0, 0, 0, 0);
+    int transitionX = (int) ViewCompat.getTranslationX(child);
+    int transitionY = (int) ViewCompat.getTranslationY(child);
+    RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
+    bounds.left = parent.getPaddingLeft() + mMarginProvider.dividerLeftMargin(position, parent) + transitionX;
+    bounds.right = parent.getWidth() - parent.getPaddingRight() - mMarginProvider.dividerRightMargin(position, parent) + transitionX;
+
+    int dividerSize = getDividerSize(position, parent);
+    boolean isReverseLayout = isReverseLayout(parent);
+    if (mDividerType == DividerType.DRAWABLE) {
+      // set top and bottom position of divider
+      if (isReverseLayout) {
+        bounds.bottom = child.getTop() - params.topMargin + transitionY;
+        bounds.top = bounds.bottom - dividerSize;
+      } else {
+        bounds.top = child.getBottom() + params.bottomMargin + transitionY;
+        bounds.bottom = bounds.top + dividerSize;
+      }
+    } else {
+      // set center point of divider
+      int halfSize = dividerSize / 2;
+      if (isReverseLayout) {
+        bounds.top = child.getTop() - params.topMargin - halfSize + transitionY;
+      } else {
+        bounds.top = child.getBottom() + params.bottomMargin + halfSize + transitionY;
+      }
+      bounds.bottom = bounds.top;
+    }
+
+    if (mPositionInsideItem) {
+      if (isReverseLayout) {
+        bounds.top += dividerSize;
+        bounds.bottom += dividerSize;
+      } else {
+        bounds.top -= dividerSize;
+        bounds.bottom -= dividerSize;
+      }
+    }
+
+    return bounds;
+  }
+
+  protected void setItemOffsets(Rect outRect, int position, RecyclerView parent) {
+    if (mPositionInsideItem) {
+      outRect.set(0, 0, 0, 0);
+      return;
+    }
+
+    if (isReverseLayout(parent)) {
+      outRect.set(0, getDividerSize(position, parent), 0, 0);
+    } else {
+      outRect.set(0, 0, 0, getDividerSize(position, parent));
+    }
+  }
+
+  private int getDividerSize(int position, RecyclerView parent) {
+    if (mPaintProvider != null) {
+      return (int) mPaintProvider.dividerPaint(position, parent).getStrokeWidth();
+    } else if (mSizeProvider != null) {
+      return mSizeProvider.dividerSize(position, parent);
+    } else if (mDrawableProvider != null) {
+      Drawable drawable = mDrawableProvider.drawableProvider(position, parent);
+      return drawable.getIntrinsicHeight();
+    }
+    throw new RuntimeException("failed to get size");
+  }
+
+  /**
+   * Interface for controlling divider visibility
+   */
+  public interface VisibilityProvider {
+
+    /**
+     * Returns true if divider should be hidden.
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return True if the divider at position should be hidden
+     */
+    boolean shouldHideDivider(int position, RecyclerView parent);
+  }
+
+  /**
+   * Interface for controlling paint instance for divider drawing
+   */
+  public interface PaintProvider {
+
+    /**
+     * Returns {@link android.graphics.Paint} for divider
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return Paint instance
+     */
+    Paint dividerPaint(int position, RecyclerView parent);
+  }
+
+  /**
+   * Interface for controlling divider color
+   */
+  public interface ColorProvider {
+
+    /**
+     * Returns {@link android.graphics.Color} value of divider
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return Color value
+     */
+    int dividerColor(int position, RecyclerView parent);
+  }
+
+  /**
+   * Interface for controlling drawable object for divider drawing
+   */
+  public interface DrawableProvider {
+
+    /**
+     * Returns drawable instance for divider
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return Drawable instance
+     */
+    Drawable drawableProvider(int position, RecyclerView parent);
+  }
+
+  /**
+   * Interface for controlling divider size
+   */
+  public interface SizeProvider {
+
+    /**
+     * Returns size value of divider.
+     * Height for horizontal divider, width for vertical divider
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return Size of divider
+     */
+    int dividerSize(int position, RecyclerView parent);
+  }
+
+  public static class Builder {
+
+    private Context mContext;
+    protected Resources mResources;
+    private PaintProvider mPaintProvider;
+    private ColorProvider mColorProvider;
+    private DrawableProvider mDrawableProvider;
+    private SizeProvider mSizeProvider;
+    private VisibilityProvider mVisibilityProvider = new VisibilityProvider() {
+      @Override
+      public boolean shouldHideDivider(int position, RecyclerView parent) {
+        return false;
+      }
+    };
+    private boolean mShowLastDivider = false;
+    private boolean mPositionInsideItem = false;
+
+    private MarginProvider mMarginProvider = new MarginProvider() {
+      @Override
+      public int dividerLeftMargin(int position, RecyclerView parent) {
+        return 0;
+      }
+
+      @Override
+      public int dividerRightMargin(int position, RecyclerView parent) {
+        return 0;
+      }
+    };
+
+    public Builder(Context context) {
+      mContext = context;
+      mResources = context.getResources();
+    }
+
+    public Builder paint(final Paint paint) {
+      return paintProvider(new PaintProvider() {
+        @Override
+        public Paint dividerPaint(int position, RecyclerView parent) {
+          return paint;
+        }
+      });
+    }
+
+    public Builder paintProvider(PaintProvider provider) {
+      mPaintProvider = provider;
+      return this;
+    }
+
+    public Builder color(final int color) {
+      return colorProvider(new ColorProvider() {
+        @Override
+        public int dividerColor(int position, RecyclerView parent) {
+          return color;
+        }
+      });
+    }
+
+    public Builder colorResId(@ColorRes int colorId) {
+      return color(ContextCompat.getColor(mContext, colorId));
+    }
+
+    public Builder colorProvider(ColorProvider provider) {
+      mColorProvider = provider;
+      return this;
+    }
+
+    public Builder drawable(@DrawableRes int id) {
+      return drawable(ContextCompat.getDrawable(mContext, id));
+    }
+
+    public Builder drawable(final Drawable drawable) {
+      return drawableProvider(new DrawableProvider() {
+        @Override
+        public Drawable drawableProvider(int position, RecyclerView parent) {
+          return drawable;
+        }
+      });
+    }
+
+    public Builder drawableProvider(DrawableProvider provider) {
+      mDrawableProvider = provider;
+      return this;
+    }
+
+    public Builder size(final int size) {
+      return sizeProvider(new SizeProvider() {
+        @Override
+        public int dividerSize(int position, RecyclerView parent) {
+          return size;
+        }
+      });
+    }
+
+    public Builder sizeResId(@DimenRes int sizeId) {
+      return size(mResources.getDimensionPixelSize(sizeId));
+    }
+
+    public Builder sizeProvider(SizeProvider provider) {
+      mSizeProvider = provider;
+      return this;
+    }
+
+    public Builder visibilityProvider(VisibilityProvider provider) {
+      mVisibilityProvider = provider;
+      return this;
+    }
+
+    public Builder showLastDivider() {
+      mShowLastDivider = true;
+      return this;
+    }
+
+    public Builder positionInsideItem(boolean positionInsideItem) {
+      mPositionInsideItem = positionInsideItem;
+      return this;
+    }
+
+    public Builder margin(final int leftMargin, final int rightMargin) {
+      return marginProvider(new MarginProvider() {
+        @Override
+        public int dividerLeftMargin(int position, RecyclerView parent) {
+          return leftMargin;
+        }
+
+        @Override
+        public int dividerRightMargin(int position, RecyclerView parent) {
+          return rightMargin;
+        }
+      });
+    }
+
+    public Builder margin(int horizontalMargin) {
+      return margin(horizontalMargin, horizontalMargin);
+    }
+
+    public Builder marginResId(@DimenRes int leftMarginId, @DimenRes int rightMarginId) {
+      return margin(mResources.getDimensionPixelSize(leftMarginId), mResources.getDimensionPixelSize(rightMarginId));
+    }
+
+    public Builder marginResId(@DimenRes int horizontalMarginId) {
+      return marginResId(horizontalMarginId, horizontalMarginId);
+    }
+
+    public Builder marginProvider(MarginProvider provider) {
+      mMarginProvider = provider;
+      return this;
+    }
+
+    public DividerDecoration build() {
+      checkBuilderParams();
+      return new DividerDecoration(this);
+    }
+
+    protected void checkBuilderParams() {
+      if (mPaintProvider != null) {
+        if (mColorProvider != null) {
+          throw new IllegalArgumentException("Use setColor method of Paint class to specify line color. Do not provider ColorProvider if you set PaintProvider.");
+        }
+        if (mSizeProvider != null) {
+          throw new IllegalArgumentException("Use setStrokeWidth method of Paint class to specify line size. Do not provider SizeProvider if you set PaintProvider.");
+        }
+      }
+    }
+  }
+
+  public interface MarginProvider {
+
+    /**
+     * Returns left margin of divider.
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return left margin
+     */
+    int dividerLeftMargin(int position, RecyclerView parent);
+
+    /**
+     * Returns right margin of divider.
+     *
+     * @param position Divider position (or group index for GridLayoutManager)
+     * @param parent   RecyclerView
+     * @return right margin
+     */
+    int dividerRightMargin(int position, RecyclerView parent);
+  }
+}

+ 16 - 2
xiaodou/src/main/java/com/luojigou/product/wifi/XDScanWifiAdapter.kt

@@ -45,9 +45,23 @@ class XDScanWifiAdapter(
             holder.name.text = item.ssid()
 
             if (item.capabilities.contains("WPA")) {
-                holder.img.setImageResource(R.drawable.ic_lock)
+                holder.img.setImageResource(
+                    when (item.level) {
+                        in 0 downTo -30 -> R.drawable.wifi_lock4
+                        in -31 downTo -67 -> R.drawable.wifi_lock3
+                        in -68 downTo -79 -> R.drawable.wifi_lock2
+                        else -> R.drawable.wifi_lock1
+                    }
+                )
             } else {
-                holder.img.setImageIcon(null)
+                holder.img.setImageResource(
+                    when (item.level) {
+                        in 0 downTo -30 -> R.drawable.wifi_level4
+                        in -31 downTo -67 -> R.drawable.wifi_level3
+                        in -68 downTo -79 -> R.drawable.wifi_level2
+                        else -> R.drawable.wifi_level1
+                    }
+                )
             }
 
             holder.itemView.setOnClickListener {

+ 25 - 3
xiaodou/src/main/java/com/luojigou/product/wifi/XDScanWifiNormalFragment.kt

@@ -5,22 +5,29 @@ import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
+import android.graphics.Color
 import android.net.wifi.WifiManager
 import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import android.widget.ProgressBar
 import androidx.core.content.ContextCompat
 import androidx.fragment.app.Fragment
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import com.luojigou.product.R
+import com.luojigou.product.common.DividerDecoration
 import com.luojigou.product.xiaodou.XDConnectActivity
 
 @SuppressLint("MissingPermission")
 class XDScanWifiNormalFragment(private val host: XDScanWifiStatus.Host) : Fragment() {
     private lateinit var wifiScanReceiver: BroadcastReceiver
 
+    private lateinit var scanProgress: ProgressBar
+
+    private lateinit var scanList: RecyclerView
+
     private val adapter = XDScanWifiAdapter {
         XDConnectActivity.startConnect(requireContext(), it)
     }
@@ -34,10 +41,20 @@ class XDScanWifiNormalFragment(private val host: XDScanWifiStatus.Host) : Fragme
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
         super.onViewCreated(view, savedInstanceState)
 
-        val recyclerView = view.findViewById<RecyclerView>(R.id.scan_list)
+        scanProgress = view.findViewById(R.id.scan_progress)
+
+        scanList = view.findViewById<RecyclerView>(R.id.scan_list)
         val layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false)
-        recyclerView.layoutManager = layoutManager
-        recyclerView.adapter = adapter
+        scanList.layoutManager = layoutManager
+        scanList.adapter = adapter
+
+        scanList.addItemDecoration(
+            DividerDecoration.Builder(requireContext())
+                .color(Color.parseColor("#E1E1E1"))
+                .sizeResId(R.dimen.divide_width)
+                .marginResId(R.dimen.divide_margin)
+                .build()
+        )
     }
 
     override fun onResume() {
@@ -52,6 +69,11 @@ class XDScanWifiNormalFragment(private val host: XDScanWifiStatus.Host) : Fragme
                             scanResults.forEach {
                                 adapter.addValue(it)
                             }
+
+                            if (adapter.itemCount > 0) {
+                                scanProgress.visibility = View.GONE
+                                scanList.visibility = View.VISIBLE
+                            }
                         }
                     }
                 }

+ 3 - 2
xiaodou/src/main/java/com/luojigou/product/xiaodou/XDConnectActivity.kt

@@ -30,7 +30,6 @@ class XDConnectActivity : BaseActivity() {
     }
 
     private val connectingFragment = XDConnectConnectingFragment()
-    private val successFragment = XDConnectSuccessFragment()
     private val failFragment = XDConnectFailFragment()
 
     private val connectReceiver = object : BroadcastReceiver() {
@@ -39,7 +38,9 @@ class XDConnectActivity : BaseActivity() {
                 when (intent.action) {
                     XDConnectService.ACTION_CONNECT_WIFI_RESULT_TIMEOUT -> failFragment
                     XDConnectService.ACTION_CONNECT_WIFI_RESULT_ERROR -> failFragment
-                    XDConnectService.ACTION_CONNECT_WIFI_RESULT_SUCCESS -> successFragment
+                    XDConnectService.ACTION_CONNECT_WIFI_RESULT_SUCCESS -> XDConnectSuccessFragment(
+                        intent.getStringExtra("EXTRA_DATA")!!
+                    )
                     XDConnectService.ACTION_CONNECT_WIFI_RESULT_CONNECTING -> connectingFragment
                     XDConnectService.ACTION_CONNECT_WIFI_RESULT_FAIL -> failFragment
                     XDConnectService.ACTION_CONNECT_WIFI_RESULT_NOT_FOUND -> failFragment

+ 111 - 24
xiaodou/src/main/java/com/luojigou/product/xiaodou/XDConnectService.kt

@@ -18,6 +18,8 @@ import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
+import android.net.wifi.WifiManager
+import android.os.Binder
 import android.os.Build
 import android.os.IBinder
 import android.util.Log
@@ -39,8 +41,10 @@ class XDConnectService : Service() {
         const val ACTION_STOP_SCAN = "com.luojigou.xiaodou.ble.ACTION_STOP_SCAN"
         const val ACTION_RESTART_SCAN = "com.luojigou.xiaodou.ble.ACTION_RESTART_SCAN"
 
-        const val ACTION_SCAN_RESULT = "com.luojigou.xiaodou.ble.ACTION_SCAN_RESULT"
-        const val ACTION_SCAN_RESULT_DATA = "com.luojigou.xiaodou.ble.ACTION_SCAN_RESULT_DATA"
+        const val ACTION_SCAN_BLE_RESULT = "com.luojigou.xiaodou.ble.ACTION_SCAN_RESULT"
+        const val ACTION_SCAN_BLE_RESULT_DATA = "com.luojigou.xiaodou.ble.ACTION_SCAN_RESULT_DATA"
+        const val ACTION_SCAN_WIFI_RESULT = "com.luojigou.xiaodou.ble.ACTION_SCAN_WIFI_RESULT"
+        const val ACTION_SCAN_WIFI_RESULT_DATA = "com.luojigou.xiaodou.ble.ACTION_SCAN_WIFI_RESULT_DATA"
 
         const val ACTION_SELECT_BLE_DEVICE = "com.luojigou.xiaodou.ble.ACTION_SELECT_BLE_DEVICE"
         const val ACTION_SELECT_BLE_DEVICE_DATA = "com.luojigou.xiaodou.ble.ACTION_SELECT_BLE_DEVICE_DATA"
@@ -66,18 +70,32 @@ class XDConnectService : Service() {
         private val wifiConnectNotifyUUID = UUID.fromString("0000ae82-0000-1000-8000-00805f9b34fb")
         private val wifiConnectNotifyDescUUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
 
+        private val snNumberServiceUUID = UUID.fromString("0000ae00-0000-1000-8000-00805f9b34fb")
+        private val snNumberWriteUUID = UUID.fromString("0000ae01-0000-1000-8000-00805f9b34fb")
+        private val snNumberNotifyUUID = UUID.fromString("0000ae02-0000-1000-8000-00805f9b34fb")
+        private val snNumberNotifyDescUUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
         private val bleChannelName = "BLE-CHANNEL"
     }
 
+    private val binder = ConnectBinder()
+
     private val bluetoothDevices: MutableList<XDScanBLEDevice> = mutableListOf()
 
+    private var wifiScanResults: MutableList<android.net.wifi.ScanResult> = mutableListOf()
+
     private lateinit var bluetoothManager: BluetoothManager
 
     private lateinit var bluetoothAdapter: BluetoothAdapter
 
+    private lateinit var wifiManager: WifiManager
+
     private var bluetoothGatt: BluetoothGatt? = null
 
     private var writeCharacteristic: BluetoothGattCharacteristic? = null
+    private var notifyCharacteristic: BluetoothGattCharacteristic? = null
+    private var snNumberCharacteristic: BluetoothGattCharacteristic? = null
+
+    private var snNumber: String? = null
 
     private var bluetoothReceiver: BroadcastReceiver = object : BroadcastReceiver() {
         override fun onReceive(context: Context?, intent: Intent) {
@@ -112,13 +130,32 @@ class XDConnectService : Service() {
                     wifiInfo?.let { connectWifi(wifiInfo) }
                 }
 
-                ACTION_CONNECT_FINISH->{
+                ACTION_CONNECT_FINISH -> {
                     stopSelf()
                 }
             }
         }
     }
 
+    private var wifiScanReceiver = object : BroadcastReceiver() {
+        override fun onReceive(context: Context?, intent: Intent) {
+            when (intent.action) {
+                WifiManager.SCAN_RESULTS_AVAILABLE_ACTION -> {
+                    if (intent.getBooleanExtra(WifiManager.EXTRA_RESULTS_UPDATED, false)) {
+                        wifiScanResults = wifiManager.scanResults
+
+                        val intent = Intent(ACTION_SCAN_WIFI_RESULT)
+                        intent.putParcelableArrayListExtra(
+                            ACTION_SCAN_WIFI_RESULT_DATA,
+                            java.util.ArrayList(wifiScanResults)
+                        )
+                        sendBroadcast(intent)
+                    }
+                }
+            }
+        }
+    }
+
     @Volatile
     private var bleScanning = false
 
@@ -161,7 +198,7 @@ class XDConnectService : Service() {
             result.apply {
                 if (device.name == null) return
 
-//                if (!device.name.startsWith("XiaoDouAI")) return
+                if (!device.name.startsWith("XiaoDouAI")) return
 
                 val device = XDScanBLEDevice(
                     name = device.name ?: "unknown",
@@ -183,6 +220,7 @@ class XDConnectService : Service() {
         super.onCreate()
         goForeground()
         initBluetooth()
+        //        initWifiManager()
     }
 
     private fun goForeground() {
@@ -223,15 +261,29 @@ class XDConnectService : Service() {
         startScan()
     }
 
-    override fun onBind(intent: Intent?): IBinder? {
-        return null
+    private fun initWifiManager() {
+        wifiManager = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
+        val intentFilter = IntentFilter().apply {
+            addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)
+        }
+
+        ContextCompat.registerReceiver(
+            this, wifiScanReceiver, intentFilter, ContextCompat.RECEIVER_EXPORTED
+        )
+
+        wifiManager.startScan()
     }
 
+    override fun onBind(intent: Intent?): IBinder = binder
+
     private fun startScan() {
         bluetoothGatt?.disconnect()
         bluetoothGatt?.close()
 
         writeCharacteristic = null
+        notifyCharacteristic = null
+        snNumberCharacteristic = null
+        snNumber = null
 
         if (!bleScanning) {
             bleScanning = true
@@ -262,9 +314,9 @@ class XDConnectService : Service() {
     }
 
     private fun sendResult() {
-        val intent = Intent(ACTION_SCAN_RESULT)
+        val intent = Intent(ACTION_SCAN_BLE_RESULT)
         intent.putParcelableArrayListExtra(
-            ACTION_SCAN_RESULT_DATA, ArrayList(bluetoothDevices)
+            ACTION_SCAN_BLE_RESULT_DATA, ArrayList(bluetoothDevices)
         )
         sendBroadcast(intent)
     }
@@ -273,6 +325,9 @@ class XDConnectService : Service() {
         bluetoothGatt?.disconnect()
         bluetoothGatt?.close()
         writeCharacteristic = null
+        notifyCharacteristic = null
+        snNumberCharacteristic = null
+        snNumber = null
 
         broadcastUpdate(ACTION_CONNECT_BLE)
         val bleDevice = bluetoothDevices.firstOrNull { it.address == device.address }?.device
@@ -287,7 +342,7 @@ class XDConnectService : Service() {
     }
 
     private fun connectWifi(device: XDScanWifiInfo) {
-        if (bluetoothGatt == null || writeCharacteristic == null) return
+        if (bluetoothGatt == null || writeCharacteristic == null || snNumberCharacteristic == null) return
 
         val bytes = XDBLEUtils.convertToConnectRequest(
             device.ssid, device.password
@@ -314,8 +369,11 @@ class XDConnectService : Service() {
         Log.d("XDScanBLEService", "onDestroy: service destroyed")
     }
 
-    private fun broadcastUpdate(action: String) {
+    private fun broadcastUpdate(action: String, data: String? = null) {
         val intent = Intent(action)
+        if (data != null) {
+            intent.putExtra("EXTRA_DATA", data)
+        }
         sendBroadcast(intent)
     }
 
@@ -342,24 +400,33 @@ class XDConnectService : Service() {
             when (status) {
                 BluetoothGatt.GATT_SUCCESS -> {
                     val service = gatt.getService(wifiConnectServiceUUID)!!
+                    val service2 = gatt.getService(snNumberServiceUUID)!!
 
-                    val notifyCharacteristic = service.getCharacteristic(wifiConnectNotifyUUID)
+                    notifyCharacteristic = service.getCharacteristic(wifiConnectNotifyUUID)
                     writeCharacteristic = service.getCharacteristic(wifiConnectWriteUUID)
+                    snNumberCharacteristic = service2.getCharacteristic(snNumberNotifyUUID)
 
-                    if (notifyCharacteristic == null || writeCharacteristic == null) {
+                    if (notifyCharacteristic == null || writeCharacteristic == null || snNumberCharacteristic == null) {
                         broadcastUpdate(ACTION_CONNECT_BLE_RESULT_ERROR)
                         return
                     }
 
-                    gatt.setCharacteristicNotification(notifyCharacteristic, true)
-
-                    val notifyDescriptor = notifyCharacteristic.getDescriptor(
-                        wifiConnectNotifyDescUUID
+                    //                    gatt.setCharacteristicNotification(notifyCharacteristic, true)
+                    //                    val notifyDescriptor = notifyCharacteristic!!.getDescriptor(
+                    //                        wifiConnectNotifyDescUUID
+                    //                    )
+                    //                    if (notifyDescriptor != null) {
+                    //                        notifyDescriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
+                    //                        gatt.writeDescriptor(notifyDescriptor)
+                    //                    }
+
+                    gatt.setCharacteristicNotification(snNumberCharacteristic, true)
+                    val snNumberDescriptor = snNumberCharacteristic!!.getDescriptor(
+                        snNumberNotifyDescUUID
                     )
-
-                    if (notifyDescriptor != null) {
-                        notifyDescriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
-                        gatt.writeDescriptor(notifyDescriptor)
+                    if (snNumberDescriptor != null) {
+                        snNumberDescriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
+                        gatt.writeDescriptor(snNumberDescriptor)
                     }
 
                     broadcastUpdate(ACTION_CONNECT_BLE_RESULT_SUCCESS)
@@ -371,9 +438,23 @@ class XDConnectService : Service() {
             gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, value: ByteArray
         ) {
             super.onCharacteristicChanged(gatt, characteristic, value)
-            val response = XDBLEUtils.parseConnectResponse(value)
-            response.toAction()
-            Log.d("XDScanBLEService", "onCharacteristicChanged: $response")
+
+            if (characteristic.uuid == wifiConnectNotifyUUID) {
+                val response = XDBLEUtils.parseConnectResponse(value)
+                response.toAction()
+                Log.d("XDScanBLEService", "onCharacteristicChanged: CO-->$response")
+            } else if (characteristic.uuid == snNumberNotifyUUID) {
+                snNumber = value.decodeToString()
+                Log.d("XDScanBLEService", "onCharacteristicChanged: SN-->$snNumber")
+                gatt.setCharacteristicNotification(notifyCharacteristic, true)
+                val notifyDescriptor = notifyCharacteristic!!.getDescriptor(
+                    wifiConnectNotifyDescUUID
+                )
+                if (notifyDescriptor != null) {
+                    notifyDescriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
+                    gatt.writeDescriptor(notifyDescriptor)
+                }
+            }
         }
 
         override fun onCharacteristicWrite(
@@ -392,7 +473,7 @@ class XDConnectService : Service() {
             -99 -> {}
             -2 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_TIMEOUT)
             -1 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_ERROR)
-            0 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_SUCCESS)
+            0 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_SUCCESS,snNumber)
             1 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_CONNECTING)
             2 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_FAIL)
             3 -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_NOT_FOUND)
@@ -400,4 +481,10 @@ class XDConnectService : Service() {
             else -> broadcastUpdate(ACTION_CONNECT_WIFI_RESULT_ERROR)
         }
     }
+
+    inner class ConnectBinder : Binder() {
+        fun getService(): XDConnectService {
+            return this@XDConnectService
+        }
+    }
 }

+ 45 - 4
xiaodou/src/main/java/com/luojigou/product/xiaodou/connect/XDConnectSuccessFragment.kt

@@ -1,19 +1,24 @@
 package com.luojigou.product.xiaodou.connect
 
+import android.content.Context
 import android.content.Intent
 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 com.luojigou.product.R
 import com.luojigou.product.xiaodou.XDConnectService
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import okhttp3.RequestBody.Companion.toRequestBody
 
-class XDConnectSuccessFragment : Fragment() {
+class XDConnectSuccessFragment(private val snNumber: String) : Fragment() {
+
+    private val client: OkHttpClient = OkHttpClient()
     override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?
+        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
     ): View? {
         return inflater.inflate(R.layout.fragment_connect_success, container, false)
     }
@@ -21,7 +26,43 @@ class XDConnectSuccessFragment : Fragment() {
     override fun onResume() {
         super.onResume()
 
+        val sp = requireActivity().getSharedPreferences(
+            "FlutterSharedPreferences",
+            Context.MODE_PRIVATE
+        )
+        val token = sp.getString("flutter.token", "")
+
+        val request = Request.Builder()
+            .url("https://open.test.luojigou.vip:8899/xiaodou-ai/mobile/home/device")
+            .header("token", token!!)
+            .post(mapOf("snCode" to snNumber).toString().toRequestBody())
+            .build()
+
+        client.newCall(request).enqueue(object : okhttp3.Callback {
+            override fun onFailure(call: okhttp3.Call, e: java.io.IOException) {
+                Log.e("XDConnectSuccessFragment", "onFailure: $e")
+            }
+
+            override fun onResponse(call: okhttp3.Call, response: okhttp3.Response) {
+                Log.d("XDConnectSuccessFragment", "onResponse: ${response.body?.string()}")
+                if (response.isSuccessful) {
+                    finishOtherPage()
+                }
+            }
+        })
+    }
+
+    private fun setSuccessView() {
+
+    }
+
+    private fun setFailureView() {
+
+    }
+
+    private fun finishOtherPage() {
         val intent = Intent(XDConnectService.ACTION_CONNECT_FINISH)
         requireActivity().sendBroadcast(intent)
+
     }
 }

+ 20 - 0
xiaodou/src/main/res/drawable/refresh.xml

@@ -0,0 +1,20 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:pathData="M20,11a8.1,8.1 0,0 0,-15.5 -2m-0.5,-4v4h4"
+      android:strokeLineJoin="round"
+      android:strokeWidth="2"
+      android:fillColor="#00000000"
+      android:strokeColor="#FF1E1E1E"
+      android:strokeLineCap="round"/>
+  <path
+      android:pathData="M4,13a8.1,8.1 0,0 0,15.5 2m0.5,4v-4h-4"
+      android:strokeLineJoin="round"
+      android:strokeWidth="2"
+      android:fillColor="#00000000"
+      android:strokeColor="#FF1E1E1E"
+      android:strokeLineCap="round"/>
+</vector>

+ 25 - 0
xiaodou/src/main/res/drawable/wifi_level1.xml

@@ -0,0 +1,25 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55,88a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,49.22Q108.22,46.9 106.1,44.8Q98.07,36.82 87.64,31.99Q74.45,25.9 59.92,26Q45.39,26.1 32.29,32.38Q21.92,37.35 14,45.44Q11.92,47.57 10,49.92L14.37,53.48C25.71,39.93 42.46,32.07 60.13,32L60.14,32Q65.83,31.98 71.3,33C84.74,35.49 96.92,42.49 105.84,52.85L110.16,49.22Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.34,62.07Q92.39,59.74 90.19,57.73Q85.12,53.09 78.75,50.15Q69.62,45.93 59.56,46Q49.5,46.07 40.43,50.42Q34.1,53.45 29.1,58.16Q26.92,60.2 25,62.56L28.87,65.72C36.47,56.4 47.85,51 59.87,51C71.7,51 82.91,56.23 90.51,65.29L94.34,62.07Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M79.52,74.93Q77.54,72.57 75.11,70.8Q73.14,69.36 70.86,68.31Q65.79,65.96 60.2,66Q54.61,66.04 49.57,68.45Q47.31,69.54 45.35,71.01Q42.95,72.81 41,75.2L45.38,78.77C49.16,74.48 54.59,72.02 60.3,72L60.32,72Q60.77,72 61.22,72.02Q61.23,72.02 61.24,72.02C66.58,72.25 71.6,74.61 75.19,78.57L79.52,74.93Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+  </group>
+</vector>

+ 25 - 0
xiaodou/src/main/res/drawable/wifi_level2.xml

@@ -0,0 +1,25 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55.37,88a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,49.22Q108.22,46.9 106.1,44.8Q98.07,36.82 87.64,31.99Q74.45,25.9 59.92,26Q45.39,26.1 32.29,32.38Q21.92,37.35 14,45.44Q11.92,47.57 10,49.92L14.37,53.48C25.71,39.93 42.46,32.07 60.13,32L60.14,32Q65.83,31.98 71.3,33C84.74,35.49 96.92,42.49 105.84,52.85L110.16,49.22Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.84,62.07Q92.89,59.74 90.69,57.73Q85.61,53.09 79.25,50.15Q70.12,45.93 60.06,46Q50,46.07 40.93,50.42Q34.6,53.45 29.59,58.16Q27.42,60.2 25.5,62.56L29.37,65.72C36.97,56.4 48.35,51 60.37,51C72.2,51 83.41,56.23 91.01,65.29L94.84,62.07Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M79.52,74.93Q77.54,72.57 75.11,70.8Q73.13,69.36 70.86,68.31Q65.78,65.96 60.2,66Q54.61,66.04 49.57,68.45Q47.31,69.54 45.35,71.01Q42.94,72.81 41,75.2L45.37,78.77C49.15,74.48 54.59,72.02 60.3,72L60.31,72Q60.77,72 61.22,72.02Q61.23,72.02 61.23,72.02C66.57,72.25 71.6,74.61 75.19,78.57L79.52,74.93Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+  </group>
+</vector>

+ 25 - 0
xiaodou/src/main/res/drawable/wifi_level3.xml

@@ -0,0 +1,25 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55,88a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,49.22Q108.22,46.9 106.1,44.8Q98.07,36.82 87.64,31.99Q74.45,25.9 59.92,26Q45.39,26.1 32.29,32.38Q21.92,37.35 14,45.44Q11.92,47.57 10,49.92L14.37,53.48C25.71,39.93 42.46,32.07 60.13,32L60.14,32Q65.83,31.98 71.3,33C84.74,35.49 96.92,42.49 105.84,52.85L110.16,49.22Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.34,62.07Q92.39,59.74 90.19,57.73Q85.12,53.09 78.75,50.15Q69.62,45.93 59.56,46Q49.5,46.07 40.43,50.42Q34.1,53.45 29.1,58.16Q26.92,60.2 25,62.56L28.87,65.72C36.47,56.4 47.85,51 59.87,51C71.7,51 82.91,56.23 90.51,65.29L94.34,62.07Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M78.52,74.93Q76.54,72.57 74.11,70.8Q72.14,69.36 69.86,68.31Q64.79,65.96 59.2,66Q53.61,66.04 48.57,68.45Q46.31,69.54 44.35,71.01Q41.95,72.81 40,75.2L44.38,78.77C48.16,74.48 53.59,72.02 59.3,72L59.32,72Q59.77,72 60.22,72.02Q60.23,72.02 60.24,72.02C65.58,72.25 70.6,74.61 74.19,78.57L78.52,74.93Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+  </group>
+</vector>

+ 25 - 0
xiaodou/src/main/res/drawable/wifi_level4.xml

@@ -0,0 +1,25 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55.37,88a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,49.22Q108.22,46.9 106.1,44.8Q98.07,36.82 87.64,31.99Q74.45,25.9 59.92,26Q45.39,26.1 32.29,32.38Q21.92,37.35 14,45.44Q11.92,47.57 10,49.92L14.37,53.48C25.71,39.93 42.46,32.07 60.13,32L60.14,32Q65.83,31.98 71.3,33C84.74,35.49 96.92,42.49 105.84,52.85L110.16,49.22Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.84,62.07Q92.89,59.74 90.69,57.73Q85.61,53.09 79.25,50.15Q70.12,45.93 60.06,46Q50,46.07 40.93,50.42Q34.6,53.45 29.59,58.16Q27.42,60.2 25.5,62.56L29.37,65.72C36.97,56.4 48.35,51 60.37,51C72.2,51 83.41,56.23 91.01,65.29L94.84,62.07Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M79.52,74.93Q77.54,72.57 75.11,70.8Q73.13,69.36 70.86,68.31Q65.78,65.96 60.2,66Q54.61,66.04 49.57,68.45Q47.31,69.54 45.35,71.01Q42.94,72.81 41,75.2L45.37,78.77C49.15,74.48 54.59,72.02 60.3,72L60.31,72Q60.77,72 61.22,72.02Q61.23,72.02 61.23,72.02C66.57,72.25 71.6,74.61 75.19,78.57L79.52,74.93Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+  </group>
+</vector>

+ 32 - 0
xiaodou/src/main/res/drawable/wifi_lock1.xml

@@ -0,0 +1,32 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55.37,87a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,48.22Q108.22,45.9 106.1,43.8Q98.07,35.82 87.64,30.99Q74.45,24.9 59.92,25Q45.39,25.1 32.29,31.38Q21.92,36.35 14,44.44Q11.92,46.57 10,48.92L14.37,52.48C25.71,38.93 42.46,31.07 60.13,31L60.14,31Q65.83,30.98 71.3,32C84.74,34.49 96.92,41.49 105.84,51.85L110.16,48.22Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.84,61.07Q92.89,58.74 90.69,56.73Q85.61,52.09 79.25,49.15Q70.12,44.93 60.06,45Q50,45.07 40.93,49.42Q34.6,52.45 29.59,57.16Q27.42,59.2 25.5,61.56L29.37,64.72C36.97,55.4 48.35,50 60.37,50C72.2,50 83.41,55.23 91.01,64.29L94.84,61.07Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M79.52,73.93Q77.54,71.57 75.11,69.8Q73.13,68.36 70.86,67.31Q65.78,64.96 60.2,65Q54.61,65.04 49.57,67.45Q47.31,68.54 45.35,70.01Q42.94,71.81 41,74.2L45.37,77.77C49.15,73.48 54.59,71.02 60.3,71L60.31,71Q60.77,71 61.22,71.02Q61.23,71.02 61.23,71.02C66.57,71.25 71.6,73.61 75.19,77.57L79.52,73.93Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <group>
+      <clip-path
+          android:pathData="M81.37,76h18v18h-18z"/>
+      <path
+          android:pathData="M90.37,77.5C92.44,77.5 94.12,79.18 94.12,81.25L94.12,83.5C95.36,83.5 96.37,84.51 96.37,85.75L96.37,90.25C96.37,91.49 95.36,92.5 94.12,92.5L86.62,92.5C85.38,92.5 84.37,91.49 84.37,90.25L84.37,85.75C84.37,84.51 85.38,83.5 86.62,83.5L86.62,81.25C86.62,79.18 88.3,77.5 90.37,77.5ZM90.37,86.5C89.59,86.5 88.93,87.1 88.88,87.89L88.87,88C88.87,88.83 89.54,89.5 90.37,89.5C91.2,89.5 91.87,88.83 91.87,88C91.87,87.17 91.2,86.5 90.37,86.5ZM90.37,79C89.13,79 88.12,80.01 88.12,81.25L88.12,83.5L92.62,83.5L92.62,81.25C92.62,80.01 91.61,79 90.37,79Z"
+          android:fillColor="#000000"/>
+    </group>
+  </group>
+</vector>

+ 32 - 0
xiaodou/src/main/res/drawable/wifi_lock2.xml

@@ -0,0 +1,32 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55.37,87a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,48.22Q108.22,45.9 106.1,43.8Q98.07,35.82 87.64,30.99Q74.45,24.9 59.92,25Q45.39,25.1 32.29,31.38Q21.92,36.35 14,44.44Q11.92,46.57 10,48.92L14.37,52.48C25.71,38.93 42.46,31.07 60.13,31L60.14,31Q65.83,30.98 71.3,32C84.74,34.49 96.92,41.49 105.84,51.85L110.16,48.22Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.84,61.07Q92.89,58.74 90.69,56.73Q85.61,52.09 79.25,49.15Q70.12,44.93 60.06,45Q50,45.07 40.93,49.42Q34.6,52.45 29.59,57.16Q27.42,59.2 25.5,61.56L29.37,64.72C36.97,55.4 48.35,50 60.37,50C72.2,50 83.41,55.23 91.01,64.29L94.84,61.07Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M79.52,73.93Q77.54,71.57 75.11,69.8Q73.13,68.36 70.86,67.31Q65.78,64.96 60.2,65Q54.61,65.04 49.57,67.45Q47.31,68.54 45.35,70.01Q42.94,71.81 41,74.2L45.37,77.77C49.15,73.48 54.59,71.02 60.3,71L60.31,71Q60.77,71 61.22,71.02Q61.23,71.02 61.23,71.02C66.57,71.25 71.6,73.61 75.19,77.57L79.52,73.93Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <group>
+      <clip-path
+          android:pathData="M81.37,76h18v18h-18z"/>
+      <path
+          android:pathData="M90.37,77.5C92.44,77.5 94.12,79.18 94.12,81.25L94.12,83.5C95.36,83.5 96.37,84.51 96.37,85.75L96.37,90.25C96.37,91.49 95.36,92.5 94.12,92.5L86.62,92.5C85.38,92.5 84.37,91.49 84.37,90.25L84.37,85.75C84.37,84.51 85.38,83.5 86.62,83.5L86.62,81.25C86.62,79.18 88.3,77.5 90.37,77.5ZM90.37,86.5C89.59,86.5 88.93,87.1 88.88,87.89L88.87,88C88.87,88.83 89.54,89.5 90.37,89.5C91.2,89.5 91.87,88.83 91.87,88C91.87,87.17 91.2,86.5 90.37,86.5ZM90.37,79C89.13,79 88.12,80.01 88.12,81.25L88.12,83.5L92.62,83.5L92.62,81.25C92.62,80.01 91.61,79 90.37,79Z"
+          android:fillColor="#000000"/>
+    </group>
+  </group>
+</vector>

+ 32 - 0
xiaodou/src/main/res/drawable/wifi_lock3.xml

@@ -0,0 +1,32 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55.37,87a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M79.52,73.93Q77.54,71.57 75.11,69.8Q73.13,68.36 70.86,67.31Q65.78,64.96 60.2,65Q54.61,65.04 49.57,67.45Q47.31,68.54 45.35,70.01Q42.94,71.81 41,74.2L45.37,77.77C49.15,73.48 54.59,71.02 60.3,71L60.31,71Q60.77,71 61.22,71.02Q61.23,71.02 61.23,71.02C66.57,71.25 71.6,73.61 75.19,77.57L79.52,73.93Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.84,61.07Q92.89,58.74 90.69,56.73Q85.61,52.09 79.25,49.15Q70.12,44.93 60.06,45Q50,45.07 40.93,49.42Q34.6,52.45 29.59,57.16Q27.42,59.2 25.5,61.56L29.37,64.72C36.97,55.4 48.35,50 60.37,50C72.2,50 83.41,55.23 91.01,64.29L94.84,61.07Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M110.16,48.22Q108.22,45.9 106.1,43.8Q98.07,35.82 87.64,30.99Q74.45,24.9 59.92,25Q45.39,25.1 32.29,31.38Q21.92,36.35 14,44.44Q11.92,46.57 10,48.92L14.37,52.48C25.71,38.93 42.46,31.07 60.13,31L60.14,31Q65.83,30.98 71.3,32C84.74,34.49 96.92,41.49 105.84,51.85L110.16,48.22Z"
+        android:fillColor="#C8C8C8"
+        android:fillType="evenOdd"/>
+    <group>
+      <clip-path
+          android:pathData="M81.37,76h18v18h-18z"/>
+      <path
+          android:pathData="M90.37,77.5C92.44,77.5 94.12,79.18 94.12,81.25L94.12,83.5C95.36,83.5 96.37,84.51 96.37,85.75L96.37,90.25C96.37,91.49 95.36,92.5 94.12,92.5L86.62,92.5C85.38,92.5 84.37,91.49 84.37,90.25L84.37,85.75C84.37,84.51 85.38,83.5 86.62,83.5L86.62,81.25C86.62,79.18 88.3,77.5 90.37,77.5ZM90.37,86.5C89.59,86.5 88.93,87.1 88.88,87.89L88.87,88C88.87,88.83 89.54,89.5 90.37,89.5C91.2,89.5 91.87,88.83 91.87,88C91.87,87.17 91.2,86.5 90.37,86.5ZM90.37,79C89.13,79 88.12,80.01 88.12,81.25L88.12,83.5L92.62,83.5L92.62,81.25C92.62,80.01 91.61,79 90.37,79Z"
+          android:fillColor="#000000"/>
+    </group>
+  </group>
+</vector>

+ 32 - 0
xiaodou/src/main/res/drawable/wifi_lock4.xml

@@ -0,0 +1,32 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="120dp"
+    android:viewportWidth="120"
+    android:viewportHeight="120">
+  <group>
+    <clip-path
+        android:pathData="M0,0h120v120h-120z"/>
+    <path
+        android:pathData="M55.37,87a5,5 0,1 0,10 0a5,5 0,1 0,-10 0z"
+        android:fillColor="#000000"/>
+    <path
+        android:pathData="M110.16,48.22Q108.22,45.9 106.1,43.8Q98.07,35.82 87.64,30.99Q74.45,24.9 59.92,25Q45.39,25.1 32.29,31.38Q21.92,36.35 14,44.44Q11.92,46.57 10,48.92L14.37,52.48C25.71,38.93 42.46,31.07 60.13,31L60.14,31Q65.83,30.98 71.3,32C84.74,34.49 96.92,41.49 105.84,51.85L110.16,48.22Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M94.84,61.07Q92.89,58.74 90.69,56.73Q85.61,52.09 79.25,49.15Q70.12,44.93 60.06,45Q50,45.07 40.93,49.42Q34.6,52.45 29.59,57.16Q27.42,59.2 25.5,61.56L29.37,64.72C36.97,55.4 48.35,50 60.37,50C72.2,50 83.41,55.23 91.01,64.29L94.84,61.07Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <path
+        android:pathData="M79.52,73.93Q77.54,71.57 75.11,69.8Q73.13,68.36 70.86,67.31Q65.78,64.96 60.2,65Q54.61,65.04 49.57,67.45Q47.31,68.54 45.35,70.01Q42.94,71.81 41,74.2L45.37,77.77C49.15,73.48 54.59,71.02 60.3,71L60.31,71Q60.77,71 61.22,71.02Q61.23,71.02 61.23,71.02C66.57,71.25 71.6,73.61 75.19,77.57L79.52,73.93Z"
+        android:fillColor="#000000"
+        android:fillType="evenOdd"/>
+    <group>
+      <clip-path
+          android:pathData="M81.37,76h18v18h-18z"/>
+      <path
+          android:pathData="M90.37,77.5C92.44,77.5 94.12,79.18 94.12,81.25L94.12,83.5C95.36,83.5 96.37,84.51 96.37,85.75L96.37,90.25C96.37,91.49 95.36,92.5 94.12,92.5L86.62,92.5C85.38,92.5 84.37,91.49 84.37,90.25L84.37,85.75C84.37,84.51 85.38,83.5 86.62,83.5L86.62,81.25C86.62,79.18 88.3,77.5 90.37,77.5ZM90.37,86.5C89.59,86.5 88.93,87.1 88.88,87.89L88.87,88C88.87,88.83 89.54,89.5 90.37,89.5C91.2,89.5 91.87,88.83 91.87,88C91.87,87.17 91.2,86.5 90.37,86.5ZM90.37,79C89.13,79 88.12,80.01 88.12,81.25L88.12,83.5L92.62,83.5L92.62,81.25C92.62,80.01 91.61,79 90.37,79Z"
+          android:fillColor="#000000"/>
+    </group>
+  </group>
+</vector>

+ 6 - 0
xiaodou/src/main/res/layout/fragment_connect_failure_bind.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 5 - 2
xiaodou/src/main/res/layout/fragment_connect_password.xml

@@ -4,10 +4,13 @@
     android:orientation="vertical"
     android:padding="16dp">
 
-    <TextView
+    <EditText
         android:id="@+id/tv_ssid"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content"
+        android:enabled="false"
+        android:focusable="false"
+        android:inputType="none" />
 
     <EditText
         android:id="@+id/et_pwd"

+ 10 - 13
xiaodou/src/main/res/layout/fragment_connect_success.xml

@@ -4,26 +4,23 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <ImageView
-        android:id="@+id/pb_connecting"
-        android:layout_width="320dp"
-        android:layout_height="400dp"
-        android:paddingLeft="140dp"
-        android:paddingTop="180dp"
-        android:paddingRight="140dp"
-        android:paddingBottom="180dp"
-        android:background="@android:color/holo_green_light"
-        app:layout_constraintBottom_toBottomOf="parent"
+    <TextView
+        android:id="@+id/tv_connecting"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="设备配网成功"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
     <TextView
-        android:id="@+id/tv_connecting"
+        android:id="@+id/tv_connecting_msg"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="配网成功"
+        android:text="准备绑定账号"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/pb_connecting" />
+        app:layout_constraintTop_toBottomOf="@id/tv_connecting" />
+
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 6 - 0
xiaodou/src/main/res/layout/fragment_connect_success_bind.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 0
xiaodou/src/main/res/layout/fragment_introduce_normal.xml

@@ -20,5 +20,6 @@
         android:layout_height="wrap_content"
         android:layout_margin="16dp"
         android:text="确认并进入下一步"
+        android:textSize="18sp"
         app:layout_constraintBottom_toBottomOf="parent" />
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 19 - 3
xiaodou/src/main/res/layout/fragment_scanble_normal.xml

@@ -18,11 +18,27 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
-    <Button
-        android:id="@+id/scan_again"
+    <TextView
+        android:id="@+id/scan_empty"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="重新扫描"
+        android:text="未扫描到小逗AI设备"
+        android:textColor="#999999"
+        android:layout_marginBottom="40dp"
+        android:visibility="invisible"
+        android:textSize="18sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/scan_again"
+        android:layout_width="32dp"
+        android:layout_height="32dp"
+        android:layout_marginBottom="16dp"
+        android:src="@drawable/refresh"
         app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent" />
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 12 - 1
xiaodou/src/main/res/layout/fragment_scanwifi_normal.xml

@@ -1,11 +1,22 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/scan_list"
         android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+        android:layout_height="match_parent"
+        android:visibility="invisible" />
+
+    <ProgressBar
+        android:id="@+id/scan_progress"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 4 - 3
xiaodou/src/main/res/layout/item_product.xml

@@ -13,12 +13,13 @@
         android:layout_weight="1"
         android:gravity="center_vertical"
         android:text=""
-        android:textSize="14pt" />
+        android:textSize="24sp" />
 
     <ImageView
+        android:layout_gravity="center_vertical"
         android:id="@+id/iv_product_img"
-        android:layout_width="64dp"
-        android:layout_height="64dp"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
         android:scaleType="fitCenter"
         android:layout_marginHorizontal="16dp" />
 

+ 4 - 1
xiaodou/src/main/res/layout/item_wifi.xml

@@ -6,11 +6,13 @@
 
     <ImageView
         android:id="@+id/iv_wifi_rssi"
-        android:layout_width="48dp"
+        android:layout_width="32dp"
         android:layout_height="0dp"
+        android:layout_marginHorizontal="16dp"
         android:contentDescription="wifi rssi"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@id/tv_wifi_name"
         app:layout_constraintTop_toTopOf="parent" />
 
     <TextView
@@ -18,6 +20,7 @@
         android:layout_width="0dp"
         android:layout_height="0dp"
         android:gravity="center_vertical"
+        android:textSize="16dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toRightOf="@id/iv_wifi_rssi"
         app:layout_constraintRight_toRightOf="parent"

+ 3 - 1
xiaodou/src/main/res/layout/item_wifi_add.xml

@@ -6,12 +6,14 @@
 
     <ImageView
         android:id="@+id/iv_wifi_rssi"
-        android:layout_width="48dp"
+        android:layout_width="24dp"
         android:layout_height="0dp"
+        android:layout_marginHorizontal="16dp"
         android:contentDescription="wifi rssi"
         android:src="@android:drawable/ic_menu_add"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@id/tv_wifi_name"
         app:layout_constraintTop_toTopOf="parent" />
 
     <TextView

+ 5 - 0
xiaodou/src/main/res/values/dimens.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <dimen name="divide_width">1dp</dimen>
+    <dimen name="divide_margin">12dp</dimen>
+</resources>