Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5438781 authored by kai.cao's avatar kai.cao Committed by Martin Brabham
Browse files

[CMFileManager]Fix the software don't hide when the drawerlayout open.

Procedures

1.Go to “File Manager”.
2.Press Search button and let the software popup.
3.Open the DrawerLayout.

the software still show when the drawerlayout popup.

Change-Id: I14b4d995b76bb12ae9c71b70dd6bb4b582bd5aa7
(cherry picked from commit 439c98b1)
parent 8e90efea
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
@@ -206,6 +207,7 @@ public class NavigationActivity extends Activity
    private Toolbar mToolBar;
    private SearchView mSearchView;
    private NavigationCustomTitleView mCustomTitleView;
    private InputMethodManager mImm;

    private final BroadcastReceiver mNotificationReceiver = new BroadcastReceiver() {
        @Override
@@ -518,6 +520,10 @@ public class NavigationActivity extends Activity
        newFilter.addDataScheme(ContentResolver.SCHEME_FILE);
        registerReceiver(mNotificationReceiver, newFilter);

        //the input manager service
        mImm = (InputMethodManager) this.getSystemService(
                Context.INPUT_METHOD_SERVICE);

        // Set the theme before setContentView
        Theme theme = ThemeManager.getCurrentTheme(this);
        theme.setBaseThemeNoActionBar(this);
@@ -893,6 +899,7 @@ public class NavigationActivity extends Activity

            /** Called when a drawer has settled in a completely open state. */
            public void onDrawerOpened(View drawerView) {
                onDrawerLayoutOpened(drawerView);
                super.onDrawerOpened(drawerView);
            }
        };
@@ -902,6 +909,26 @@ public class NavigationActivity extends Activity
        mDrawerLayout.setDrawerListener(mDrawerToggle);
    }

    /***
     * Method that do something when the DrawerLayout opened.
     */
    private void onDrawerLayoutOpened(View drawerView){
        if (mSearchView != null && mSearchView.getVisibility() == View.VISIBLE) {
            closeSearch();
            hideSoftInput(drawerView);
        }
    }

    /**
     * Method that hide the software when the software showing.
     *
     * */
    private void hideSoftInput(View view){
        if (mImm != null) {
            mImm.hideSoftInputFromWindow(view.getWindowToken(), 0);
        }
    }

    /**
     * Method that adds a history entry to the history list in the drawer
     */