List of usage examples for android.view Window ID_ANDROID_CONTENT
int ID_ANDROID_CONTENT
To view the source code for android.view Window ID_ANDROID_CONTENT.
Click Source Link
From source file:Main.java
public static int[] sizeActivity(Activity activity) { int[] size = new int[2]; Rect outRect = new Rect(); activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getDrawingRect(outRect); size[0] = outRect.width();/*from ww w . ja va2 s. co m*/ size[1] = outRect.height(); return size; }
From source file:Main.java
public static int getTitleBarHeight(Activity activity) { Rect rect = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); int sbh = rect.top; int contentTop = activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop(); int titleBarTop = contentTop - sbh; return titleBarTop; }
From source file:Main.java
/** * Tries to get the available width from the (previously measured) view of the activity. * If if fails then calls getDisplayWidth(). *///from ww w . j a va 2 s .c o m private static int getWindowWidth(Activity activity) { int width = 0; //Doesn't work on create method, should call it from another place? View content = activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT); if (content != null) width = content.getWidth(); if (width == 0) width = getDisplayWidth(activity); return width; }
From source file:Main.java
/** * get status bar plus app bar height, just content's({@link Window#ID_ANDROID_CONTENT}) top. * * @param activity/*from w w w.j ava 2s . c om*/ * @return */ public static int getContentTopHeight(Activity activity) { return activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop(); }
From source file:ru.noties.sbv.sample.SampleActivity.java
@Override public void onCreate(Bundle sis) { super.onCreate(sis); final Fragment fragment = fragment(); if (fragment != null) { getSupportFragmentManager().beginTransaction().replace(Window.ID_ANDROID_CONTENT, fragment) .commitAllowingStateLoss(); } else {//from www . ja v a 2s.c o m finish(); } }
From source file:com.tomeokin.lspush.biz.collect.ImageDialogFragment.java
@SuppressLint("InflateParams") @NonNull//ww w. jav a2 s .co m @Override protected BaseDialogFragment.Builder config(@NonNull BaseDialogFragment.Builder builder) { ImageView imageView = (ImageView) LayoutInflater.from(getContext()).inflate(R.layout.dialog_image, null); builder.setTitle(R.string.use_current_image).addCustomMessageView(imageView) .addPositiveButton(R.string.dialog_ok, this).addNegativeButton(R.string.dialog_cancel, this); final String url = getArguments().getString(ARG_IMAGE_URL); final Uri uri = Uri.parse(url); int width = getArguments().getInt(ARG_IMAGE_WIDTH); int height = getArguments().getInt(ARG_IMAGE_HEIGHT); final View content = getActivity().getWindow().findViewById(Window.ID_ANDROID_CONTENT); final FrameLayout container = builder.getCustomViewHolder(); final float radio = optimumRadio(content, container, width, height); width = (int) (width * radio); height = (int) (height * radio); ViewGroup.LayoutParams lp = container.getLayoutParams(); lp.width = width + container.getPaddingLeft() + container.getPaddingRight(); lp.height = height + container.getPaddingTop() + container.getPaddingBottom(); Glide.with(this).load(uri).diskCacheStrategy(DiskCacheStrategy.ALL).override(width, height).fitCenter() .into(imageView); return builder; }
From source file:tyrantgit.explosionfield.ExplosionField.java
public static ExplosionField attach2Window(Activity activity) { ViewGroup rootView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT); ExplosionField explosionField = new ExplosionField(activity); rootView.addView(explosionField, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return explosionField; }
From source file:com.yanzhenjie.nohttp.sample.activity.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DisplayUtils.initScreen(this); headViewSize = DisplayUtils.dip2px(42); setContentView(R.layout.activity_main); ButterKnife.bind(this); mIvHeadBackground.getLayoutParams().height = DisplayUtils.screenWidth * 12 / 13; mIvHeadBackground.requestLayout();/* w ww. jav a2 s. c om*/ // toolbar? boolean isHigh = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; if (isHigh) { ViewGroup mContentView = (ViewGroup) findViewById(Window.ID_ANDROID_CONTENT); View mChildView = mContentView.getChildAt(0); if (mChildView != null) { ViewCompat.setFitsSystemWindows(mChildView, false); } } ((ViewGroup.MarginLayoutParams) mToolbarRoot.getLayoutParams()).setMargins(-headViewSize, isHigh ? DisplayUtils.statusBarHeight : 0, 0, 0); mAppBarLayout.addOnOffsetChangedListener(offsetChangedListener); initialize(); }
From source file:com.tomeokin.lspush.biz.home.UriDialogFragment.java
@SuppressLint("InflateParams") @NonNull/*from w w w . j ava 2 s. com*/ @Override protected BaseDialogFragment.Builder config(@NonNull BaseDialogFragment.Builder builder) { View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_add_link, null); builder.addCustomMessageView(view); final View content = getActivity().getWindow().findViewById(Window.ID_ANDROID_CONTENT); final FrameLayout container = builder.getCustomViewHolder(); ViewGroup.LayoutParams lp = container.getLayoutParams(); lp.width = content.getWidth() / 6 * 5; container.setLayoutParams(lp); mUrlField = (EditText) view.findViewById(R.id.url_field); mNextButton = (TextView) view.findViewById(R.id.next_button); mNextButton.setTextColor(Color.BLACK); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getUrlInfo(); } }); mNextButton.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT && isAvailableCheck() && isValidWebUri(mUrlField.getText())) { getUrlInfo(); return true; } return false; } }); Drawable clear = getContext().getDrawable(R.drawable.search_clear); DrawableCompat.setTint(clear, ContextCompat.getColor(getContext(), R.color.blue_5_whiteout)); mNextButton.setCompoundDrawables(null, null, clear, null); mProgressBar = (ProgressBar) view.findViewById(R.id.next_progress); final String text = ClipboardUtils.getText(getContext()); if (!TextUtils.isEmpty(text) && isValidWebUri(text)) { mUrlField.setText(text); activeNextButton(); } else { disableNextButton(); } return builder; }
From source file:com.appnexus.opensdkapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Clog.v(Constants.BASE_LOG_TAG, "App created"); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); initTabHost();//www . j av a 2s . com initViewPager(); tabHost.setOnTabChangedListener(this); // Default to Preview tab new Handler() { @Override public void handleMessage(Message msg) { onPageSelected(TABS.PREVIEW.ordinal()); } }.sendEmptyMessage(0); btnMore = findViewById(R.id.btn_log); btnLog = findViewById(R.id.log_extension); btnMore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (btnLog.getVisibility() == View.VISIBLE) btnLog.setVisibility(View.GONE); else btnLog.setVisibility(View.VISIBLE); } }); btnLog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { view.setVisibility(View.GONE); showLogDialog(); } }); contentView = getWindow().findViewById(Window.ID_ANDROID_CONTENT); Clog.registerListener(logTabClogListener); }