Esempio n. 1
0
 /**
  * @param show
  * @param InputMethodManagerFlags 0 for regular (good for regular hide). or can use something like
  *     InputMethodManager.SHOW_FORCED or InputMethodManager.SHOW_IMPLICIT
  */
 public void hideShowKeyboard(boolean show, int InputMethodManagerFlags) {
   if (inputMethodManager == null) inputMethodManager = superTextActivity.getInputMethodManager();
   if (show) inputMethodManager.showSoftInput(autoCompleteTextView, InputMethodManagerFlags);
   else
     inputMethodManager.hideSoftInputFromWindow(
         autoCompleteTextView.getWindowToken(), InputMethodManagerFlags);
 }
 void showDropDownIfPossible(AutoCompleteTextView view) {
   // showDropDown() method crashes when the given view is not attached to window
   // (which happens when we change locale)
   // isAttachedToWindow() method is available only from API19
   // therefore it is possible to get the same effect by checking whether
   // getWindowToken() returns null or not
   if (view.getWindowToken() != null) {
     view.showDropDown();
   }
 }
Esempio n. 3
0
  private void hideSearch() {
    // set transiontn
    LayoutTransition l = new LayoutTransition();
    l.enableTransitionType(LayoutTransition.DISAPPEARING);
    RelativeLayout rl = (RelativeLayout) getView().findViewById(R.id.rl_vendorlist);
    rl.setLayoutTransition(l);
    // animate
    mActvSearch.setVisibility(View.GONE);
    // set text to ""
    mActvSearch.setText("");

    InputMethodManager imm =
        (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mActvSearch.getWindowToken(), 0);

    mSearchWasVisible = false;
  }
Esempio n. 4
0
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
          TypedSearchEntry tse = (TypedSearchEntry) arg0.getItemAtPosition(arg2);
          int modId = tse.getID();
          if (modId > 0) {
            InputMethodManager imm =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(mActvSearch.getWindowToken(), 0);

            Bundle args = new Bundle();
            args.putInt("ID", modId);
            args.putString("NAME", tse.getName());
            // FragmentCodeList fcl = new FragmentCodeList();
            FragmentVirtualController fcl = new FragmentVirtualController();
            fcl.setArguments(args);
            getFragmentManager()
                .beginTransaction()
                .replace(R.id.frame_contet, fcl)
                .addToBackStack(null)
                .commit();
          }
        }
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.header_left:
       finish();
       break;
     case R.id.header_right_2:
       mInputManager.hideSoftInputFromWindow(mAutoCompleteTextView.getWindowToken(), 0);
       String url = mAutoCompleteTextView.getText().toString().trim();
       String title = mTitle.getText().toString().trim();
       if (!Patterns.WEB_URL.matcher(url).matches()) {
         Toast.makeText(this, R.string.url_not_true, Toast.LENGTH_SHORT).show();
         return;
       }
       url = URLUtil.guessUrl(url);
       if (TextUtils.isEmpty(title)) {
         title = makeTitleByUrl(url);
       }
       NavigationInfo info = new NavigationInfo();
       info.setTitle(title);
       info.setUrl(url);
       NavigationInfoParser.getInstance(this).addNavigationInfo(info);
       Intent intent = new Intent(this, BrowserActivity.class);
       intent.setAction(Intent.ACTION_MAIN);
       intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
       startActivity(intent);
       overridePendingTransition(R.anim.activity_slide_do_nothing, R.anim.slide_down_out);
       break;
     case R.id.clear_address_button:
       mAutoCompleteTextView.setText("");
       break;
     case R.id.clear_title_button:
       mTitle.setText("");
       break;
     default:
       break;
   }
 }
Esempio n. 6
0
 public void showSearchUi(boolean show) {
   View titleBar = ((BaseActivity) getActivity()).getTitleBarContainer();
   View tabs = ((MainActivity) getActivity()).tabs;
   if (show) {
     if (mFakeTopBmp == null) {
       int w = 0,
           h = 0,
           titleBmpH = 0,
           tabsBmpH =
               (int) ShopApp.getContext().getResources().getDimension(R.dimen.tabs_visible_height);
       titleBar.setDrawingCacheEnabled(true);
       tabs.setDrawingCacheEnabled(true);
       Bitmap titleBmp = titleBar.getDrawingCache();
       Bitmap tabsBmp = tabs.getDrawingCache();
       if (titleBmp != null) {
         w = titleBmp.getWidth();
         mTitleHeight = titleBmpH = titleBmp.getHeight();
         h += titleBmpH;
       }
       if (tabsBmp != null) {
         if (w == 0) {
           w = tabsBmp.getWidth();
         }
         h += tabsBmpH;
       }
       mFakeTopBmp = Bitmap.createBitmap(w, h, Config.ARGB_8888);
       Canvas canvas = new Canvas(mFakeTopBmp);
       Paint paint = new Paint();
       if (titleBmp != null) {
         canvas.drawBitmap(titleBmp, 0, 0, paint);
         titleBmp.recycle();
       }
       titleBar.setDrawingCacheEnabled(false);
       if (tabsBmp != null) {
         paint.setColor(
             ShopApp.getContext().getResources().getColor(R.color.fake_search_background));
         canvas.drawRect(0, titleBmpH, w, titleBmpH + tabsBmpH, paint);
         canvas.drawBitmap(tabsBmp, 0, titleBmpH, paint);
         tabsBmp.recycle();
       }
       tabs.setDrawingCacheEnabled(false);
     }
     mCategoryListAdapter.showCoverView(true);
     mFakeBg.setVisibility(View.VISIBLE);
     mFakeBg.setLayoutParams(new LayoutParams(mFakeTopBmp.getWidth(), mFakeTopBmp.getHeight()));
     mFakeBg.setBackgroundDrawable(new BitmapDrawable(mFakeTopBmp));
     mTopView.setLayoutParams(
         new AbsListView.LayoutParams(mFakeTopBmp.getWidth(), mFakeTopBmp.getHeight()));
     mTopViewContent.setBackgroundColor(
         ShopApp.getContext().getResources().getColor(R.color.transparent));
     titleBar.setVisibility(View.GONE);
     tabs.setVisibility(View.GONE);
     int scrollDis =
         mTitleHeight
             + mFakeSearchView.getTop()
             + (int)
                 ShopApp.getContext()
                     .getResources()
                     .getDimension(R.dimen.fake_search_scroll_up_diff);
     mListView.smoothScrollBy(scrollDis, ANIMATION_DURATION);
     handler.sendEmptyMessageDelayed(UiHandler.MSG_SHOW_SEARCH, ACTION_DURATION);
     loadHint();
   } else {
     mInput.setText("");
     Utils.SoftInput.hide(getActivity(), mInput.getWindowToken());
     mSearchUi.setVisibility(View.GONE);
     int scrollDis =
         -mFakeTopBmp.getHeight()
             + (int)
                 ShopApp.getContext()
                     .getResources()
                     .getDimension(R.dimen.fake_search_scroll_down_diff);
     mListView.smoothScrollBy(scrollDis, ANIMATION_DURATION);
     handler.sendEmptyMessageDelayed(UiHandler.MSG_HIDE_SEARCH, ACTION_DURATION);
   }
 }
 public void hideSoftKeyboard() {
   // Hide Soft keyboard
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(autoCompView.getWindowToken(), 0);
 }
Esempio n. 8
0
 public void hideKeyboard() {
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(editFrom.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(editTo.getWindowToken(), 0);
 }