List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:com.freerdp.freerdpcore.presentation.SessionActivity.java
private void showKeyboard(boolean showSystemKeyboard, boolean showExtendedKeyboard) { // no matter what we are doing ... hide the zoom controls // TODO: this is not working correctly as hiding the keyboard issues a onScrollChange notification showing the control again ... uiHandler.removeMessages(UIHandler.HIDE_ZOOMCONTROLS); if (zoomControls.getVisibility() == View.VISIBLE) zoomControls.hide();/*from w ww.java2 s .c om*/ InputMethodManager mgr; if (showSystemKeyboard) { // hide extended keyboard keyboardView.setVisibility(View.GONE); // show system keyboard mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (!mgr.isActive(sessionView)) Log.e(TAG, "Failed to show system keyboard: SessionView is not the active view!"); mgr.showSoftInput(sessionView, 0); // show modifiers keyboard modifiersKeyboardView.setVisibility(View.VISIBLE); } else if (showExtendedKeyboard) { // hide system keyboard mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(sessionView.getWindowToken(), 0); // show extended keyboard keyboardView.setKeyboard(specialkeysKeyboard); keyboardView.setVisibility(View.VISIBLE); modifiersKeyboardView.setVisibility(View.VISIBLE); } else { // hide both mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(sessionView.getWindowToken(), 0); keyboardView.setVisibility(View.GONE); modifiersKeyboardView.setVisibility(View.GONE); // clear any active key modifiers) keyboardMapper.clearlAllModifiers(); } sysKeyboardVisible = showSystemKeyboard; extKeyboardVisible = showExtendedKeyboard; }
From source file:android.support.v7.widget.SearchView.java
private void setImeVisibility(final boolean visible) { if (visible) { post(mShowImeRunnable);//from w ww .ja v a 2 s . com } else { removeCallbacks(mShowImeRunnable); InputMethodManager imm = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(getWindowToken(), 0); } } }
From source file:com.chrynan.guitarchords.view.GuitarChordView.java
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { if (editable) { final InputConnectionAccomodatingLatinIMETypeNullIssues baseInputConnection = new InputConnectionAccomodatingLatinIMETypeNullIssues( this, false); outAttrs.actionLabel = null;// w ww . ja v a 2 s. c o m outAttrs.inputType = InputType.TYPE_NULL; outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (editable) { if (event .getUnicodeChar() == (int) EditableAccomodatingLatinIMETypeNullIssues.ONE_UNPROCESSED_CHARACTER .charAt(0)) { //We are ignoring this character, and we want everyone else to ignore it, too, so // we return true indicating that we have handled it (by ignoring it). return true; } if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) { //Trap the Done key and close the keyboard if it is pressed (if that's what you want to do) InputMethodManager imm = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(GuitarChordView.this.getWindowToken(), 0); if (touchEventMarker != null) { Integer finger; try { finger = Integer.valueOf(baseInputConnection.getEditable().toString()); } catch (Exception e) { e.printStackTrace(); finger = touchEventMarker.getFinger(); } touchEventMarker = new ChordMarker(touchEventMarker.getStartString(), touchEventMarker.getEndString(), touchEventMarker.getFret(), finger); alertOnChordSelected(null, new ChordMarker(touchEventMarker), chord.contains(touchEventMarker)); } return true; } } return false; } }); return baseInputConnection; } return null; }
From source file:com.zertinteractive.wallpaper.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e(LOG_TAG, "onCreate()"); setContentView(R.layout.activity_main); context = this; checkPermission();/*from w w w . j a v a 2s . c o m*/ DetailActivity.setContext(this); initDownloadComponents(); downloadTestImage(); initSearchGridView(); progressBar = (ProgressBar) findViewById(R.id.progressBarImageSearch); progressBar.setVisibility(View.GONE); searchQueryButton = (ImageView) findViewById(R.id.search_query_ok); searchQueryButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); in.hideSoftInputFromWindow(searchKey.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); searchActionMethod(); } }); searchKey = (EditText) findViewById(R.id.search_key); searchKey.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // if (event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { // InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // in.hideSoftInputFromWindow(searchKey.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); // Log.e("SEARCH", searchKey.getText().toString()); // } searchActionMethod(); return false; } }); searchQueryClear = (ImageView) findViewById(R.id.search_query_clear); searchQueryClear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { searchKey.setText(""); } }); // Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in // values/strings.xml. mAdView = (AdView) findViewById(R.id.adView); mAdView.setVisibility(View.GONE); // mAdView.setScaleX(1.3f); AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build(); // Start loading the ad in sthe background. mAdView.loadAd(adRequest); mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { super.onAdLoaded(); mAdView.setVisibility(View.VISIBLE); } }); // AdView mAdView = (AdView) findViewById(R.id.adView); // AdRequest adRequest = new AdRequest.Builder().build(); // mAdView.loadAd(adRequest); initWallpaperLists(); initRecyclerView(GRIDVIEW_COLUMN); initSearchView(); initFab(); initToolbar(); setupDrawerLayout(); setCategorySutter(false); categorySutterChange(1200); // setNotification(); setupWindowAnimations(); reminderCount = 0; timerTasks = new TimerTasks(context); timerTasks.startTimerTask(); currentWallpaperCategory = WallpaperCategory.ALL; DetailActivity.checkDir(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { setRecyclerAdapter(recyclerView, 0); currentWallpaperCategory = WallpaperCategory.ALL; } LinearLayout categoryHappyWallpaper = (LinearLayout) findViewById(R.id.category_happy); LinearLayout categorySadWallpaper = (LinearLayout) findViewById(R.id.category_sad); LinearLayout categorySurpriseWallpaper = (LinearLayout) findViewById(R.id.category_surprise); LinearLayout categoryAngryWallpaper = (LinearLayout) findViewById(R.id.category_angry); LinearLayout categoryFunnyWallpaper = (LinearLayout) findViewById(R.id.category_funny); LinearLayout categoryAmazedWallpaper = (LinearLayout) findViewById(R.id.category_amazed); categoryHappyWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 1); currentWallpaperCategory = WallpaperCategory.HAPPY; } }); categorySadWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 2); currentWallpaperCategory = WallpaperCategory.SAD; } }); categorySurpriseWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 3); currentWallpaperCategory = WallpaperCategory.SURPRISE; } }); categoryAngryWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 4); currentWallpaperCategory = WallpaperCategory.ANGRY; } }); categoryFunnyWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 5); currentWallpaperCategory = WallpaperCategory.FUNNY; } }); categoryAmazedWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 6); currentWallpaperCategory = WallpaperCategory.AMAZED; } }); ImageView category_daily = (ImageView) findViewById(R.id.category_daily); ImageView category_featured = (ImageView) findViewById(R.id.category_featured); ImageView category_favourite = (ImageView) findViewById(R.id.category_favourite); category_daily.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 7); currentWallpaperCategory = WallpaperCategory.DAILY; } }); category_featured.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 8); currentWallpaperCategory = WallpaperCategory.FEATURED; } }); category_favourite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 9); currentWallpaperCategory = WallpaperCategory.FAVOURITE; } }); LinearLayout categoryWallpaper = (LinearLayout) findViewById(R.id.categoryButtonArrow); LinearLayout categoryAllWallpaper = (LinearLayout) findViewById(R.id.categoryWallpaper); LinearLayout kidsyWallpaperAction = (LinearLayout) findViewById(R.id.kidsyWallpaperAction); LinearLayout keepCalmWallpaperAction = (LinearLayout) findViewById(R.id.keepCalmWallpaperAction); LinearLayout romanticWallpaperAction = (LinearLayout) findViewById(R.id.romanticWallpaperAction); LinearLayout materialWallpaperAction = (LinearLayout) findViewById(R.id.materialWallpaperAction); categoryAllWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setRecyclerAdapter(recyclerView, 0); currentWallpaperCategory = WallpaperCategory.ALL; } }); categoryWallpaper.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { categorySutterChange(600); // YoYo.with(Techniques.RotateAntiClockWise) // .duration(300) // .interpolate(new AccelerateDecelerateInterpolator()) // .withListener(new Animator.AnimatorListener() { // @Override // public void onAnimationStart(Animator animation) { // // } // // @Override // public void onAnimationEnd(Animator animation) { // // } // // @Override // public void onAnimationCancel(Animator animation) { // Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show(); // } // // @Override // public void onAnimationRepeat(Animator animation) { // // } // }) // .playOn(findViewById(R.id.categoryButtonArrow)); } }); kidsyWallpaperAction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openUri(PLAY_STORE_URL); } }); keepCalmWallpaperAction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openUri(PLAY_STORE_URL); } }); romanticWallpaperAction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openUri(PLAY_STORE_URL); } }); materialWallpaperAction.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openUri(PLAY_STORE_URL); } }); // Button button = (Button) findViewById(R.id.testButton); // button.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Roboto-LightItalic.ttf"); // SnackbarManager.show( // SnackBar.with(MainActivity.this) // .text("Something has been done") // .actionLabel("Undo") // .margin(15, 15) // .backgroundDrawable(R.drawable.custom_shape) // .actionLabelTypeface(tf) // .actionListener(new ActionClickListener() { // @Override // public void onActionClicked(SnackBar snackBar) { // Toast.makeText(MainActivity.this, // "Action undone", // Toast.LENGTH_SHORT).show(); // } // })); // } // }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } else { // do something for lower version } recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (dy > 0 && isSearchOn && !isSearchAnimationRunning) { isSearchOn = false; isSearchAnimationRunning = true; YoYo.with(Techniques.ZoomOutPosition).duration(500) .interpolate(new AccelerateDecelerateInterpolator()) .withListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { fabSearchWallpaper.setVisibility(View.GONE); isSearchAnimationRunning = false; } @Override public void onAnimationCancel(Animator animation) { Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show(); } @Override public void onAnimationRepeat(Animator animation) { } }).playOn(findViewById(R.id.fab_search_wallpaper)); } else if (dy < 0 && !isSearchOn && !isSearchAnimationRunning) { isSearchOn = true; isSearchAnimationRunning = true; fabSearchWallpaper.setVisibility(View.VISIBLE); YoYo.with(Techniques.ZoomInPosition).duration(500) .interpolate(new AccelerateDecelerateInterpolator()) .withListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { isSearchAnimationRunning = false; } @Override public void onAnimationCancel(Animator animation) { Toast.makeText(MainActivity.this, "canceled", Toast.LENGTH_SHORT).show(); } @Override public void onAnimationRepeat(Animator animation) { } }).playOn(findViewById(R.id.fab_search_wallpaper)); } } }); }
From source file:com.stikyhive.stikyhive.ChattingActivity.java
public void hideKeyboard(View view) { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService( Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }
From source file:com.fvd.nimbus.PaintActivity.java
public void onClick(View v) { //ImageButton b = (ImageButton)findViewById(R.id.bToolColor); ImageButton bs = (ImageButton) findViewById(R.id.bToolShape); int zcolor = 123; switch (v.getId()) { case R.id.bSave2Nimbus: drawView.deselectShapes();//from w ww . ja va 2s . c o m drawView.hideCrop(); ((ImageButton) findViewById(R.id.bToolCrop)).setSelected(false); drawView.startEdit(); setSelectedFoot(0); if (sessionId.length() == 0) showSettings(); else { v.postDelayed(new Runnable() { @Override public void run() { sendShot(); } }, 200); } break; case R.id.bSave2SD: drawView.deselectShapes(); drawView.hideCrop(); ((ImageButton) findViewById(R.id.bToolCrop)).setSelected(false); drawView.startEdit(); setSelectedFoot(0); v.postDelayed(new Runnable() { @Override public void run() { screenCapture(); } }, 200); break; case R.id.btnBack: drawView.hideCrop(); if (isTabletLandscape) ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(2); else ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(0); break; case R.id.bToolShape: if (findViewById(R.id.flTools).getVisibility() == View.VISIBLE) { if (findViewById(R.id.draw_tools).getVisibility() != View.VISIBLE) { drawView.hideCrop(); drawView.reset(); findViewById(R.id.draw_tools).setVisibility(View.VISIBLE); setSelectedFoot(1); updateColorDialog(dWidth, fWidth, dColor); } else { findViewById(R.id.draw_tools).setVisibility(View.GONE); drawView.hideCrop(); drawView.startEdit(); setSelectedFoot(0); } return; } if (findViewById(R.id.draw_tools).getVisibility() != View.VISIBLE) { drawView.hideCrop(); drawView.reset(); showToolsPopup(findViewById(R.id.bEditPage)); setSelectedFoot(1); updateColorDialog(dWidth, fWidth, dColor); } else { findViewById(R.id.draw_tools).setVisibility(View.GONE); drawView.hideCrop(); drawView.startEdit(); setSelectedFoot(0); } break; case R.id.bToolCrop: hideTools(); drawView.setShape(10); ImageButton iv = (ImageButton) findViewById(R.id.bToolCrop); if (iv.isSelected()) { iv.setSelected(false); drawView.startEdit(); setSelectedFoot(0); } else setSelectedFoot(4); break; case R.id.bToolText: if (findViewById(R.id.text_field).getVisibility() != View.VISIBLE) { drawView.hideCrop(); drawView.setShape(8); hideTools(); setSelectedFoot(2); updateColorDialog(dWidth, fWidth, dColor); } else { findViewById(R.id.text_field).setVisibility(View.GONE); drawView.hideCrop(); drawView.startEdit(); setSelectedFoot(0); } break; case R.id.bApplyText: drawView.setText(((EditText) findViewById(R.id.etEditorText)).getText().toString(), (boolean) findViewById(R.id.bStroke).isSelected()); drawView.startEdit(); findViewById(R.id.text_field).setVisibility(View.GONE); setSelectedFoot(0); InputMethodManager im = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); im.hideSoftInputFromWindow(findViewById(R.id.etEditorText).getWindowToken(), 0); break; case R.id.bEditPage: drawView.hideCrop(); drawView.startEdit(); hideTools(); setSelectedFoot(0); break; case R.id.bToolColor: if (findViewById(R.id.color_menu).getVisibility() != View.VISIBLE) { drawView.hideCrop(); showColorPopup(findViewById(R.id.bToolColor)); setSelectedFoot(3); } else { findViewById(R.id.color_menu).setVisibility(View.GONE); drawView.hideCrop(); drawView.startEdit(); setSelectedFoot(0); } break; case R.id.bErase: drawView.hideCrop(); drawView.startEdit(); hideTools(); drawView.setShape(11); //findViewById(R.id.draw_tools).setVisibility(View.GONE); setSelectedFoot(5); break; case R.id.bDraw1: drawView.setShape(0); bs.setImageResource(R.drawable.draw_tools_01); setSelectedFoot(1); findViewById(R.id.draw_tools).setVisibility(View.GONE); break; case R.id.bDraw2: drawView.setShape(5); bs.setImageResource(R.drawable.draw_tools_03); setSelectedFoot(1); findViewById(R.id.draw_tools).setVisibility(View.GONE); break; case R.id.bDraw3: drawView.setShape(3); bs.setImageResource(R.drawable.draw_tools_02); findViewById(R.id.draw_tools).setVisibility(View.GONE); break; case R.id.bDraw4: drawView.setShape(7); findViewById(R.id.draw_tools).setVisibility(View.GONE); bs.setImageResource(R.drawable.draw_tools_04); break; case R.id.bDraw5: drawView.setShape(6); findViewById(R.id.draw_tools).setVisibility(View.GONE); bs.setImageResource(R.drawable.draw_tools_06); break; case R.id.bDraw6: drawView.setShape(1); findViewById(R.id.draw_tools).setVisibility(View.GONE); bs.setImageResource(R.drawable.draw_tools_07); break; case R.id.bDraw8: drawView.setShape(9); findViewById(R.id.draw_tools).setVisibility(View.GONE); bs.setImageResource(R.drawable.draw_tools_05); break; case R.id.ls_bColor1: case R.id.bColor1: drawView.setColour(Color.CYAN); setPaletteColor(Color.CYAN); zcolor = Color.CYAN; /*b.setImageResource(R.drawable.icon_color_blue); ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_blue); ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_blue);*/ setLandColorSelected(R.id.ls_bColor1); findViewById(R.id.color_menu).setVisibility(View.GONE); break; case R.id.ls_bColor2: case R.id.bColor2: drawView.setColour(Color.RED); setPaletteColor(Color.RED); zcolor = Color.RED; /*b.setImageResource(R.drawable.icon_color_red); ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_red); ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_red);*/ setLandColorSelected(R.id.ls_bColor2); findViewById(R.id.color_menu).setVisibility(View.GONE); break; case R.id.ls_bColor3: case R.id.bColor3: drawView.setColour(Color.GREEN); setPaletteColor(Color.GREEN); zcolor = Color.GREEN; /*b.setImageResource(R.drawable.icon_color_yellow); ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_yellow); ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_yellow);*/ setLandColorSelected(R.id.ls_bColor3); findViewById(R.id.color_menu).setVisibility(View.GONE); break; case R.id.ls_bColor4: case R.id.bColor4: drawView.setColour(Color.BLACK); setPaletteColor(Color.BLACK); zcolor = Color.BLACK; /*b.setImageResource(R.drawable.icon_color_black); ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_black); ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_black);*/ setLandColorSelected(R.id.ls_bColor4); findViewById(R.id.color_menu).setVisibility(View.GONE); break; case R.id.ls_bColor5: case R.id.bColor5: openDialog(false); /*drawView.setColour(7); color=7; b.setImageResource(R.drawable.icon_color_black); ((ImageButton)findViewById(R.id.bToolColor_land)).setImageResource(R.drawable.icon_color_black); ((ImageButton)findViewById(R.id.bToolColor_land1)).setImageResource(R.drawable.icon_color_black); setLandColorSelected(R.id.ls_bColor5);*/ findViewById(R.id.color_menu).setVisibility(View.GONE); break; case R.id.bUndo: drawView.undo(); break; case R.id.btnShare: drawView.deselectShapes(); drawView.hideCrop(); v.postDelayed(new Runnable() { @Override public void run() { shareCapture(); } }, 200); break; case R.id.bDone: if (storePath.length() > 0) { drawView.deselectShapes(); drawView.hideCrop(); ((ImageButton) findViewById(R.id.bToolCrop)).setSelected(false); drawView.startEdit(); setSelectedFoot(0); v.postDelayed(new Runnable() { @Override public void run() { screenCapture(); } }, 200); } else { ((ViewAnimator) findViewById(R.id.top_switcher)).setDisplayedChild(1); } break; case R.id.bClearAll: drawView.clear(); break; case R.id.bTurnLeft: drawView.deselectShapes(); drawView.setAngle(-90); break; case R.id.bTurnRight: drawView.deselectShapes(); drawView.setAngle(90); break; } if (zcolor != 123) { ccolor = zcolor; dColor = zcolor; Editor e = prefs.edit(); e.putInt(pColor, dColor); e.commit(); } }
From source file:dentex.youtube.downloader.DashboardActivity.java
public void hideSearchBar() { Utils.logger("d", "hiding searchbar...", DEBUG_TAG); LinearLayout layout = (LinearLayout) findViewById(R.id.dashboard); EditText inputSearch = (EditText) findViewById(999); // hide keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(inputSearch.getWindowToken(), 0); // store text and remove EditText searchText = inputSearch.getEditableText(); layout.removeView(inputSearch);//from ww w.j ava 2 s. c o m Utils.reload(DashboardActivity.this); isSearchBarVisible = false; }
From source file:dentex.youtube.downloader.DashboardActivity.java
private void rename(final DashboardListItem currentItem) { AlertDialog.Builder adb = new AlertDialog.Builder(boxThemeContextWrapper); LayoutInflater adbInflater = LayoutInflater.from(DashboardActivity.this); View inputFilename = adbInflater.inflate(R.layout.dialog_input_filename, null); userFilename = (TextView) inputFilename.findViewById(R.id.input_filename); userFilename.setText(currentItem.getFilename()); adb.setView(inputFilename);// www. ja v a 2 s . co m adb.setTitle(getString(R.string.rename_dialog_title)); //adb.setMessage(getString(R.string.rename_dialog_msg)); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String input = userFilename.getText().toString(); File in = new File(currentItem.getPath(), currentItem.getFilename()); File renamed = new File(currentItem.getPath(), input); if (in.renameTo(renamed)) { // set new name to the list item currentItem.setFilename(input); // update the JSON file entry Json.addEntryToJsonFile(DashboardActivity.this, currentItem.getId(), currentItem.getType(), currentItem.getYtId(), currentItem.getPos(), currentItem.getStatus(), currentItem.getPath(), input, Utils.getFileNameWithoutExt(input), currentItem.getAudioExt(), currentItem.getSize(), false); // remove references for the old file String mediaUriString = Utils.getContentUriFromFilePath(in.getAbsolutePath(), getContentResolver()); //Utils.logger("d", "mediaString: " + mediaUriString, DEBUG_TAG); removeFromMediaStore(in, mediaUriString); // scan the new file Utils.scanMedia(DashboardActivity.this, new String[] { renamed.getAbsolutePath() }, new String[] { "video/*" }); // refresh the dashboard refreshlist(DashboardActivity.this); Utils.logger("d", "'" + in.getName() + "' renamed to '" + input + "'", DEBUG_TAG); } else { Log.e(DEBUG_TAG, "'" + in.getName() + "' NOT renamed"); } // hide keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(userFilename.getWindowToken(), 0); } }); adb.setNegativeButton(getString(R.string.dialogs_negative), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // cancel } }); secureShowDialog(adb); }
From source file:com.maskyn.fileeditorpro.activity.MainActivity.java
private void closeKeyBoard() throws NullPointerException { // Central system API to the overall input method framework (IMF) architecture InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // Base interface for a remotable object IBinder windowToken = getCurrentFocus().getWindowToken(); // Hide type/* w ww . j av a2 s . com*/ int hideType = InputMethodManager.HIDE_NOT_ALWAYS; // Hide the KeyBoard inputManager.hideSoftInputFromWindow(windowToken, hideType); }
From source file:com.ichi2.anki.AbstractFlashcardViewer.java
protected void displayCardAnswer() { Timber.d("displayCardAnswer()"); // prevent answering (by e.g. gestures) before card is loaded if (mCurrentCard == null) { return;//from ww w .jav a 2 s. c o m } // Explicitly hide the soft keyboard. It *should* be hiding itself automatically, // but sometimes failed to do so (e.g. if an OnKeyListener is attached). if (typeAnswer()) { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(mAnswerField.getWindowToken(), 0); } sDisplayAnswer = true; String answer = mCurrentCard.a(); mSoundPlayer.stopSounds(); answer = getCol().getMedia().escapeImages(answer); mAnswerField.setVisibility(View.GONE); // Clean up the user answer and the correct answer String userAnswer; if (mUseInputTag) { userAnswer = cleanTypedAnswer(mTypeInput); } else { userAnswer = cleanTypedAnswer(mAnswerField.getText().toString()); } String correctAnswer = cleanCorrectAnswer(mTypeCorrect); Timber.d("correct answer = %s", correctAnswer); Timber.d("user answer = %s", userAnswer); answer = typeAnsAnswerFilter(answer, userAnswer, correctAnswer); mIsSelecting = false; updateCard(enrichWithQADiv(answer, true)); showEaseButtons(); // If the user want to show next question automatically if (mPrefUseTimer) { mTimeoutHandler.removeCallbacks(mShowQuestionTask); mTimeoutHandler.postDelayed(mShowQuestionTask, mWaitQuestionSecond * 1000); } }