Search in sources :

Example 31 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project cube-sdk by liaohuqiu.

the class CubeFragmentActivity method hideKeyboardForCurrentFocus.

public void hideKeyboardForCurrentFocus() {
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if (getCurrentFocus() != null) {
        imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
    }
    imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 32 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project danci by ling0322.

the class MainActivity method openIME.

public void openIME(View view) {
    EditText et = (EditText) findViewById(R.id.editText1);
    if (et == null)
        return;
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.showSoftInput(view, 0);
    Log.d("lia", "open input method");
}
Also used : EditText(android.widget.EditText) InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 33 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project MusicDNA by harjot-oberai.

the class HomeActivity method onBackPressed.

////////////////////////////////////////////////////////////////////////////////////////////////
/*
     * Standard Activity methods
     */
@Override
public void onBackPressed() {
    PlayerFragment plFrag = playerFragment;
    LocalMusicViewPagerFragment flmFrag = (LocalMusicViewPagerFragment) fragMan.findFragmentByTag("local");
    LocalMusicFragment lFrag = null;
    if (flmFrag != null) {
        lFrag = (LocalMusicFragment) flmFrag.getFragmentByPosition(0);
    }
    QueueFragment qFrag = (QueueFragment) fragMan.findFragmentByTag("queue");
    EqualizerFragment eqFrag = (EqualizerFragment) fragMan.findFragmentByTag("equalizer");
    ViewSavedDNA vsdFrag = (ViewSavedDNA) fragMan.findFragmentByTag("allSavedDNAs");
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else if (showCase != null && showCase.isShowing()) {
        showCase.hide();
    } else if (plFrag != null && plFrag.isShowcaseVisible()) {
        plFrag.hideShowcase();
    } else if (lFrag != null && lFrag.isShowcaseVisible()) {
        lFrag.hideShowcase();
    } else if (qFrag != null && qFrag.isShowcaseVisible()) {
        qFrag.hideShowcase();
    } else if (eqFrag != null && eqFrag.isShowcaseVisible()) {
        eqFrag.hideShowcase();
    } else if (vsdFrag != null && vsdFrag.isShowcaseVisible()) {
        vsdFrag.hideShowcase();
    } else if (isFullScreenEnabled) {
        isFullScreenEnabled = false;
        plFrag.bottomContainer.setVisibility(View.VISIBLE);
        plFrag.seekBarContainer.setVisibility(View.VISIBLE);
        plFrag.toggleContainer.setVisibility(View.VISIBLE);
        plFrag.spToolbar.setVisibility(View.VISIBLE);
        onFullScreen();
    } else if (isEqualizerVisible) {
        showPlayer2();
    } else if (isQueueVisible) {
        showPlayer3();
    } else if (isPlayerVisible && !isPlayerTransitioning && playerFragment.smallPlayer != null) {
        hidePlayer();
        //            showTabs();
        isPlayerVisible = false;
    } else if (isLocalVisible && flmFrag != null && flmFrag.searchBox != null && flmFrag.isSearchboxVisible) {
        flmFrag.searchBox.setText("");
        flmFrag.searchBox.setVisibility(View.INVISIBLE);
        flmFrag.isSearchboxVisible = false;
        InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
        flmFrag.searchIcon.setImageResource(R.drawable.ic_search);
        flmFrag.fragTitle.setVisibility(View.VISIBLE);
    } else if (!searchView.isIconified()) {
        searchView.setQuery("", true);
        searchView.setIconified(true);
        new Thread(new CancelCall()).start();
        if (localRecyclerContainer.getVisibility() == View.VISIBLE || streamRecyclerContainer.getVisibility() == View.VISIBLE) {
            localRecyclerContainer.setVisibility(GONE);
            streamRecyclerContainer.setVisibility(GONE);
        }
    } else if (localRecyclerContainer.getVisibility() == View.VISIBLE || streamRecyclerContainer.getVisibility() == View.VISIBLE) {
        localRecyclerContainer.setVisibility(GONE);
        streamRecyclerContainer.setVisibility(GONE);
    } else {
        if (isEditVisible) {
            hideFragment("Edit");
        } else if (isAlbumVisible) {
            hideFragment("viewAlbum");
        } else if (isArtistVisible) {
            hideFragment("viewArtist");
        } else {
            if (isLocalVisible) {
                hideFragment("local");
                setTitle("Music DNA");
            } else if (isQueueVisible) {
                hideFragment("queue");
                setTitle("Music DNA");
            } else if (isStreamVisible) {
                hideFragment("stream");
                setTitle("Music DNA");
            } else if (isPlaylistVisible) {
                hideFragment("playlist");
                setTitle("Music DNA");
            } else if (isNewPlaylistVisible) {
                hideFragment("newPlaylist");
                setTitle("Music DNA");
            } else if (isEqualizerVisible) {
                finalSelectedTracks.clear();
                hideFragment("equalizer");
                setTitle("Music DNA");
            } else if (isFavouriteVisible) {
                hideFragment("favourite");
                setTitle("Music DNA");
            } else if (isAllPlaylistVisible) {
                hideFragment("allPlaylists");
                setTitle("Music DNA");
            } else if (isFolderContentVisible) {
                hideFragment("folderContent");
                setTitle("Folders");
            } else if (isAllFolderVisible) {
                hideFragment("allFolders");
                setTitle("Music DNA");
            } else if (isAllSavedDnaVisisble) {
                hideFragment("allSavedDNAs");
                setTitle("Music DNA");
            } else if (isSavedDNAVisible) {
                hideFragment("savedDNA");
                setTitle("Music DNA");
            } else if (isRecentVisible) {
                hideFragment("recent");
                setTitle("Music DNA");
            } else if (isAboutVisible) {
                hideFragment("About");
                setTitle("Settings");
            } else if (isSettingsVisible) {
                hideFragment("settings");
                new SaveSettings().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                setTitle("Music DNA");
            } else if (!isPlayerTransitioning) {
                startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
            }
        }
    }
}
Also used : LocalMusicViewPagerFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicViewPagerFragment) LocalMusicFragment(com.sdsmdg.harjot.MusicDNA.fragments.LocalMusicFragments.LocalMusicFragment) InputMethodManager(android.view.inputmethod.InputMethodManager) Intent(android.content.Intent) QueueFragment(com.sdsmdg.harjot.MusicDNA.fragments.QueueFragment.QueueFragment) DrawerLayout(android.support.v4.widget.DrawerLayout) ViewSavedDNA(com.sdsmdg.harjot.MusicDNA.fragments.ViewSavedDNAsFragment.ViewSavedDNA) PlayerFragment(com.sdsmdg.harjot.MusicDNA.fragments.PlayerFragment.PlayerFragment) EqualizerFragment(com.sdsmdg.harjot.MusicDNA.fragments.EqualizerFragment.EqualizerFragment)

Example 34 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project MusicDNA by harjot-oberai.

the class LocalMusicViewPagerFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ((HomeActivity) getActivity()).onQueryTextChange("");
    isSearchboxVisible = false;
    backBtn = (ImageView) view.findViewById(R.id.local_fragment_back_btn);
    backBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    fragTitle = (TextView) view.findViewById(R.id.local_fragment_title);
    if (SplashActivity.tf4 != null)
        fragTitle.setTypeface(SplashActivity.tf4);
    searchBox = (EditText) view.findViewById(R.id.local_fragment_search_box);
    searchBox.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            ((HomeActivity) getActivity()).onQueryTextChange(s.toString());
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    searchIcon = (ImageView) view.findViewById(R.id.local_fragment_search_icon);
    searchIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (isSearchboxVisible) {
                searchBox.setText("");
                searchBox.setVisibility(View.INVISIBLE);
                InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(getActivity().INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
                searchIcon.setImageResource(R.drawable.ic_search);
                fragTitle.setVisibility(View.VISIBLE);
            } else {
                searchBox.setVisibility(View.VISIBLE);
                searchBox.requestFocus();
                InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(getActivity().INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
                searchIcon.setImageResource(R.drawable.ic_cross_white);
                fragTitle.setVisibility(View.INVISIBLE);
            }
            isSearchboxVisible = !isSearchboxVisible;
        }
    });
    viewPager = (ViewPager) view.findViewById(R.id.viewpager);
    tabLayout = (TabLayout) view.findViewById(R.id.tabs);
    tabLayout.setBackgroundColor(Color.parseColor("#111111"));
    tabLayout.setSelectedTabIndicatorColor(HomeActivity.themeColor);
    viewPager.setAdapter(adapter);
    tabLayout.setupWithViewPager(viewPager);
}
Also used : HomeActivity(com.sdsmdg.harjot.MusicDNA.activities.HomeActivity) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) InputMethodManager(android.view.inputmethod.InputMethodManager) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 35 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project CameraKit-Android by flurgle.

the class AutoUnfocusEditText method closeKeyboard.

private void closeKeyboard() {
    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(getWindowToken(), 0);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Aggregations

InputMethodManager (android.view.inputmethod.InputMethodManager)631 View (android.view.View)120 TextView (android.widget.TextView)67 Paint (android.graphics.Paint)43 Spannable (android.text.Spannable)34 Editable (android.text.Editable)33 EditText (android.widget.EditText)33 ImageView (android.widget.ImageView)31 Intent (android.content.Intent)29 RemoteException (android.os.RemoteException)23 KeyEvent (android.view.KeyEvent)22 TextPaint (android.text.TextPaint)21 Point (android.graphics.Point)18 InputMethodInfo (android.view.inputmethod.InputMethodInfo)18 AdapterView (android.widget.AdapterView)18 Button (android.widget.Button)16 RemoteView (android.widget.RemoteViews.RemoteView)16 Resources (android.content.res.Resources)15 ListView (android.widget.ListView)15 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)14