List of usage examples for android.view Window getContext
public final Context getContext()
From source file:Main.java
public static void hideSoftKeyBoard(final Window window) { new Handler().postDelayed(new Runnable() { @Override/*from ww w . j a v a2s. c om*/ public void run() { if (window.getCurrentFocus() != null) { InputMethodManager inputManager = (InputMethodManager) window.getContext() .getSystemService(Activity.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(window.getCurrentFocus().getWindowToken(), 0); } } }, 200); }
From source file:io.github.hidroh.materialistic.AppUtils.java
public static void setStatusBarDim(Window window, boolean dim) { setStatusBarColor(window,//from w w w. j a v a2 s .co m dim ? Color.TRANSPARENT : ContextCompat.getColor(window.getContext(), AppUtils.getThemedResId(window.getContext(), R.attr.colorPrimaryDark))); }
From source file:org.mariotaku.twidere.fragment.ActivityHostFragment.java
@SuppressWarnings({ "deprecation", "unchecked" }) @Override/*from www. ja v a 2 s . c om*/ public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Intent intent = new Intent(getActivity(), getActivityClass()); final Bundle args = getArguments(); if (args != null) { intent.putExtras(args); } final Window w = getLocalActivityManager().startActivity(ACTIVITY_TAG, intent); mAttachedActivity = null; final Context context = w.getContext(); if (context instanceof Activity) { try { mAttachedActivity = (A) context; if (context instanceof FragmentCallback) { ((FragmentCallback<A>) context).setCallbackFragment(this); } } catch (final ClassCastException e) { // This should't happen. e.printStackTrace(); } } final View wd = w != null ? w.getDecorView() : null; if (wd != null) { final ViewParent parent = wd.getParent(); if (parent != null) { final ViewGroup v = (ViewGroup) parent; v.removeView(wd); } wd.setVisibility(View.VISIBLE); wd.setFocusableInTouchMode(true); if (wd instanceof ViewGroup) { ((ViewGroup) wd).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); } } return wd; }