mac
2024-06-04 630f9be46132b40e5509e509406ce9f2788f9308
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseSearchActivity.java
@@ -1,11 +1,13 @@
package com.hdl.photovoltaic.ui.powerstation;
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -147,6 +149,7 @@
                        loadNextPageHouseList(false, ++currentHouseListPage, false);
                    }
                }
            }
        });
        //清除
@@ -159,6 +162,8 @@
                viewBinding.listParent.setVisibility(View.GONE);
                viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
                searchHistoryAdapter.setList(searchHistoryTitleList);
                viewBinding.powerStationSearchEt.requestFocus();
                showSoftInput();
                clearData();
            }
        });
@@ -201,6 +206,23 @@
            }
        });
    }
    /**
     * 显示软键盘
     */
    public void showSoftInput() {
        InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.showSoftInput(viewBinding.powerStationSearchEt, 0);
    }
    /**
     * 隐藏软键盘
     */
    public void hideSoftInputFromWindow() {
        InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(viewBinding.getRoot().getWindowToken(), 0);
    }
    private void initView() {
@@ -442,4 +464,6 @@
    public String getHistoryFileNamePath() {
        return HdlFileLogic.getInstance().getCurrentUserRootPath() + "/house_history.txt";
    }
}