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

Commit 439c98b1 authored by kai.cao's avatar kai.cao
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
parent b03fc282
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -50,6 +50,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;
@@ -198,6 +199,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
@@ -512,6 +514,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);
@@ -887,6 +893,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);
            }
        };
@@ -896,6 +903,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
     */