private void applyFixedSizeWindow() { ContentFrameLayout cfl = (ContentFrameLayout) this.mSubDecor.findViewById(16908290); View windowDecor = this.mWindow.getDecorView(); cfl.setDecorPadding(windowDecor.getPaddingLeft(), windowDecor.getPaddingTop(), windowDecor.getPaddingRight(), windowDecor.getPaddingBottom()); TypedArray a = this.mContext.obtainStyledAttributes(R.styleable.AppCompatTheme); a.getValue(R.styleable.AppCompatTheme_windowMinWidthMajor, cfl.getMinWidthMajor()); a.getValue(R.styleable.AppCompatTheme_windowMinWidthMinor, cfl.getMinWidthMinor()); if (a.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMajor)) { a.getValue(R.styleable.AppCompatTheme_windowFixedWidthMajor, cfl.getFixedWidthMajor()); } if (a.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMinor)) { a.getValue(R.styleable.AppCompatTheme_windowFixedWidthMinor, cfl.getFixedWidthMinor()); } if (a.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMajor)) { a.getValue(R.styleable.AppCompatTheme_windowFixedHeightMajor, cfl.getFixedHeightMajor()); } if (a.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMinor)) { a.getValue(R.styleable.AppCompatTheme_windowFixedHeightMinor, cfl.getFixedHeightMinor()); } a.recycle(); cfl.requestLayout(); }
private void m1696t() { ContentFrameLayout contentFrameLayout = (ContentFrameLayout) this.f601v.findViewById(16908290); View decorView = this.b.getDecorView(); contentFrameLayout.m1767a(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom()); TypedArray obtainStyledAttributes = this.a.obtainStyledAttributes(C0243l.AppCompatTheme); obtainStyledAttributes.getValue(C0243l.AppCompatTheme_windowMinWidthMajor, contentFrameLayout.getMinWidthMajor()); obtainStyledAttributes.getValue(C0243l.AppCompatTheme_windowMinWidthMinor, contentFrameLayout.getMinWidthMinor()); if (obtainStyledAttributes.hasValue(C0243l.AppCompatTheme_windowFixedWidthMajor)) { obtainStyledAttributes.getValue(C0243l.AppCompatTheme_windowFixedWidthMajor, contentFrameLayout.getFixedWidthMajor()); } if (obtainStyledAttributes.hasValue(C0243l.AppCompatTheme_windowFixedWidthMinor)) { obtainStyledAttributes.getValue(C0243l.AppCompatTheme_windowFixedWidthMinor, contentFrameLayout.getFixedWidthMinor()); } if (obtainStyledAttributes.hasValue(C0243l.AppCompatTheme_windowFixedHeightMajor)) { obtainStyledAttributes.getValue(C0243l.AppCompatTheme_windowFixedHeightMajor, contentFrameLayout.getFixedHeightMajor()); } if (obtainStyledAttributes.hasValue(C0243l.AppCompatTheme_windowFixedHeightMinor)) { obtainStyledAttributes.getValue(C0243l.AppCompatTheme_windowFixedHeightMinor, contentFrameLayout.getFixedHeightMinor()); } obtainStyledAttributes.recycle(); contentFrameLayout.requestLayout(); }
private void initContainer(@Nullable Bundle savedInstanceState) { ContentFrameLayout container = new ContentFrameLayout(this); container.setId(R.id.delegate_container); setContentView(container); if (savedInstanceState == null) { loadRootFragment(R.id.delegate_container, setRootDelegate()); } }
private void destroy(View originalView, ContentFrameLayout container) { originalView.setAlpha(1.0F); copyImageView.setVisibility(View.GONE); r.setVisibility(View.GONE); container.removeView(copyImageView); container.removeView(r); animator = null; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_info_hands_shake_dialog, container, false); ContentFrameLayout mButtonOk = (ContentFrameLayout) view.findViewById(R.id.hands_shake_ok); ContentFrameLayout mButtonCancel = (ContentFrameLayout) view.findViewById(R.id.hands_shake_cancel); mButtonOk.setOnClickListener(this); mButtonCancel.setOnClickListener(this); return view; }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.hands_shake_enter_dialog, container, false); mNextButton = (ContentFrameLayout) view.findViewById(R.id.hands_shake_next_button); mNextButton.setOnClickListener(this); return view; }
private ViewGroup m1695s() { TypedArray obtainStyledAttributes = this.a.obtainStyledAttributes(C0243l.AppCompatTheme); if (obtainStyledAttributes.hasValue(C0243l.AppCompatTheme_windowActionBar)) { View view; if (obtainStyledAttributes.getBoolean(C0243l.AppCompatTheme_windowNoTitle, false)) { m1723c(1); } else if (obtainStyledAttributes.getBoolean(C0243l.AppCompatTheme_windowActionBar, false)) { m1723c((int) C0243l.AppCompatTheme_ratingBarStyleSmall); } if (obtainStyledAttributes.getBoolean(C0243l.AppCompatTheme_windowActionBarOverlay, false)) { m1723c((int) C0243l.AppCompatTheme_seekBarStyle); } if (obtainStyledAttributes.getBoolean(C0243l.AppCompatTheme_windowActionModeOverlay, false)) { m1723c(10); } this.k = obtainStyledAttributes.getBoolean(C0243l.AppCompatTheme_android_windowIsFloating, false); obtainStyledAttributes.recycle(); LayoutInflater from = LayoutInflater.from(this.a); if (this.l) { View view2 = this.j ? (ViewGroup) from.inflate(C0240i.abc_screen_simple_overlay_action_mode, null) : (ViewGroup) from.inflate(C0240i.abc_screen_simple, null); if (VERSION.SDK_INT >= 21) { bu.m985a(view2, new ag(this)); view = view2; } else { ((android.support.v7.widget.bu) view2).setOnFitSystemWindowsListener(new ah(this)); view = view2; } } else if (this.k) { r0 = (ViewGroup) from.inflate(C0240i.abc_dialog_title_material, null); this.i = false; this.h = false; view = r0; } else if (this.h) { TypedValue typedValue = new TypedValue(); this.a.getTheme().resolveAttribute(C0233b.actionBarTheme, typedValue, true); r0 = (ViewGroup) LayoutInflater.from(typedValue.resourceId != 0 ? new C0249e(this.a, typedValue.resourceId) : this.a).inflate(C0240i.abc_screen_toolbar, null); this.f597r = (br) r0.findViewById(C0238g.decor_content_parent); this.f597r.setWindowCallback(m1658o()); if (this.i) { this.f597r.m2295a(C0243l.AppCompatTheme_seekBarStyle); } if (this.f604y) { this.f597r.m2295a(2); } if (this.f605z) { this.f597r.m2295a(5); } view = r0; } else { view = null; } if (view == null) { throw new IllegalArgumentException("AppCompat does not support the current theme features: { windowActionBar: " + this.h + ", windowActionBarOverlay: " + this.i + ", android:windowIsFloating: " + this.k + ", windowActionModeOverlay: " + this.j + ", windowNoTitle: " + this.l + " }"); } if (this.f597r == null) { this.f602w = (TextView) view.findViewById(C0238g.title); } du.m2795b(view); ViewGroup viewGroup = (ViewGroup) this.b.findViewById(16908290); ContentFrameLayout contentFrameLayout = (ContentFrameLayout) view.findViewById(C0238g.action_bar_activity_content); while (viewGroup.getChildCount() > 0) { View childAt = viewGroup.getChildAt(0); viewGroup.removeViewAt(0); contentFrameLayout.addView(childAt); } this.b.setContentView(view); viewGroup.setId(-1); contentFrameLayout.setId(16908290); if (viewGroup instanceof FrameLayout) { ((FrameLayout) viewGroup).setForeground(null); } contentFrameLayout.setAttachListener(new ai(this)); return view; } obtainStyledAttributes.recycle(); throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity."); }
public void init(){ if (animator != null) { animator.cancel(); } container = (ContentFrameLayout) activity.findViewById(android.R.id.content); copyImageView = new PhotoView(activity); int matchParent = FrameLayout.LayoutParams.MATCH_PARENT; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(matchParent, matchParent); copyImageView.setLayoutParams(params); r = new RelativeLayout(activity); r.setLayoutParams(params); r.setBackgroundColor(Color.BLACK); if (originalView instanceof ImageView) { copyImageView.setImageDrawable(((ImageView) originalView).getDrawable()); } else { Bitmap bm = view2Bitmap(originalView); if (bm != null) { copyImageView.setImageBitmap(bm); } } copyImageView.setVisibility(View.GONE); r.setVisibility(View.GONE); container.addView(r); container.addView(copyImageView); startRect = new Rect(); endRect = new Rect(); Point offsetPoint = new Point(); originalView.getGlobalVisibleRect(startRect); /** * r 是 绝对(global)坐标参数,包含状态栏、ActionBar、底部虚拟键 * globalOffset 用于将global坐标转换成local坐标,这里的local坐标,是相对于内容区的坐标,也就是除了状态栏和action bar和虚拟按键的区域。 * */ container.getGlobalVisibleRect(endRect, offsetPoint); startRect.offset(-offsetPoint.x, -offsetPoint.y); endRect.offset(-offsetPoint.x, -offsetPoint.y); float scaleSize; float startScaleFinal; Log.d("garyhu","width == "+endRect.width()); Log.d("garyhu","height == "+endRect.height()); if ((float) endRect.width() / (float) endRect.height() > (float) startRect.width() / (float) startRect.height()) { startScale = (float) startRect.height() / (float) endRect.height(); scaleSize = startScale * (float) endRect.width(); startScaleFinal = (scaleSize - (float) startRect.width()) / 2.0F; startRect.left = (int) ((float) startRect.left - startScaleFinal); startRect.right = (int) ((float) startRect.right + startScaleFinal); } else { startScale = (float) startRect.width() / (float) endRect.width(); scaleSize = startScale * (float) endRect.height(); startScaleFinal = (scaleSize - (float) startRect.height()) / 2.0F; startRect.top = (int) ((float) startRect.top - startScaleFinal); startRect.bottom = (int) ((float) startRect.bottom + startScaleFinal); } }