Search in sources :

Example 21 with LayoutParams

use of android.widget.FrameLayout.LayoutParams in project little-bear-dictionary by daimajia.

the class AlertController method setupView.

private void setupView() {
    LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel);
    setupContent(contentPanel);
    boolean hasButtons = setupButtons();
    LinearLayout topPanel = (LinearLayout) mWindow.findViewById(R.id.topPanel);
    TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.AlertDialog, R.attr.alertDialogStyle, R.style.Holo_AlertDialog);
    boolean hasTitle = setupTitle(topPanel);
    View buttonPanel = mWindow.findViewById(R.id.buttonPanel);
    if (!hasButtons) {
        buttonPanel.setVisibility(View.GONE);
    // mWindow.setCloseOnTouchOutsideIfNotSet(true);
    }
    FrameLayout customPanel = null;
    if (mView != null) {
        customPanel = (FrameLayout) mWindow.findViewById(R.id.customPanel);
        FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
        custom.addView(mView, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
        if (mViewSpacingSpecified) {
            custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
        }
        if (mListView != null) {
            ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
        }
    } else {
        mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);
    }
    if (hasTitle) {
        View divider = null;
        if (mMessage != null || mView != null || mListView != null) {
            divider = mWindow.findViewById(R.id.titleDivider);
        } else {
            divider = mWindow.findViewById(R.id.titleDividerTop);
        }
        if (divider != null) {
            divider.setVisibility(View.VISIBLE);
        }
    }
    setBackground(topPanel, contentPanel, customPanel, hasButtons, a, hasTitle, buttonPanel);
    a.recycle();
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) TypedArray(android.content.res.TypedArray) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(org.holoeverywhere.widget.ListView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Example 22 with LayoutParams

use of android.widget.FrameLayout.LayoutParams in project android_frameworks_base by crdroidandroid.

the class RecentsTvActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents_on_tv);
    mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPipView = findViewById(R.id.pip);
    mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
    // Place mPipView at the PIP bounds for fine tuned focus handling.
    Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
    LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
    lp.width = pipBounds.width();
    lp.height = pipBounds.height();
    lp.leftMargin = pipBounds.left;
    lp.topMargin = pipBounds.top;
    mPipView.setLayoutParams(lp);
    mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    // Create the home intent runnable
    Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
    homeIntent.addCategory(Intent.CATEGORY_HOME);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
    mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
    mPipManager.addListener(mPipListener);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) LayoutParams(android.widget.FrameLayout.LayoutParams) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 23 with LayoutParams

use of android.widget.FrameLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.

the class RecentsTvActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFinishedOnStartup = false;
    // In the case that the activity starts up before the Recents component has initialized
    // (usually when debugging/pushing the SysUI apk), just finish this activity.
    SystemServicesProxy ssp = Recents.getSystemServices();
    if (ssp == null) {
        mFinishedOnStartup = true;
        finish();
        return;
    }
    mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
    // Register this activity with the event bus
    EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
    mPackageMonitor = new RecentsPackageMonitor();
    mPackageMonitor.register(this);
    // Set the Recents layout
    setContentView(R.layout.recents_on_tv);
    mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
    mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    mPipView = findViewById(R.id.pip);
    mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
    // Place mPipView at the PIP bounds for fine tuned focus handling.
    Rect pipBounds = mPipManager.getRecentsFocusedPipBounds();
    LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
    lp.width = pipBounds.width();
    lp.height = pipBounds.height();
    lp.leftMargin = pipBounds.left;
    lp.topMargin = pipBounds.top;
    mPipView.setLayoutParams(lp);
    mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
    getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
    // Create the home intent runnable
    Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
    homeIntent.addCategory(Intent.CATEGORY_HOME);
    homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    homeIntent.putExtra(RECENTS_HOME_INTENT_EXTRA, true);
    mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
    mPipManager.addListener(mPipListener);
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) LayoutParams(android.widget.FrameLayout.LayoutParams) RecentsPackageMonitor(com.android.systemui.recents.model.RecentsPackageMonitor) Intent(android.content.Intent)

Example 24 with LayoutParams

use of android.widget.FrameLayout.LayoutParams in project superCleanMaster by joyoyao.

the class SystemBarTintManager method setupStatusBarView.

private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
    mStatusBarTintView = new View(context);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
    params.gravity = Gravity.TOP;
    if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
        params.rightMargin = mConfig.getNavigationBarWidth();
    }
    mStatusBarTintView.setLayoutParams(params);
    mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
    mStatusBarTintView.setVisibility(View.GONE);
    decorViewGroup.addView(mStatusBarTintView);
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) View(android.view.View)

Example 25 with LayoutParams

use of android.widget.FrameLayout.LayoutParams in project superCleanMaster by joyoyao.

the class SystemBarTintManager method setupNavBarView.

private void setupNavBarView(Context context, ViewGroup decorViewGroup) {
    mNavBarTintView = new View(context);
    LayoutParams params;
    if (mConfig.isNavigationAtBottom()) {
        params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight());
        params.gravity = Gravity.BOTTOM;
    } else {
        params = new LayoutParams(mConfig.getNavigationBarWidth(), LayoutParams.MATCH_PARENT);
        params.gravity = Gravity.RIGHT;
    }
    mNavBarTintView.setLayoutParams(params);
    mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
    mNavBarTintView.setVisibility(View.GONE);
    decorViewGroup.addView(mNavBarTintView);
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) View(android.view.View)

Aggregations

LayoutParams (android.widget.FrameLayout.LayoutParams)36 View (android.view.View)19 FrameLayout (android.widget.FrameLayout)10 Intent (android.content.Intent)5 Rect (android.graphics.Rect)5 TextView (android.widget.TextView)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 RecentsPackageMonitor (com.android.systemui.recents.model.RecentsPackageMonitor)5 TypedArray (android.content.res.TypedArray)2 ViewGroup (android.view.ViewGroup)2 AbsListView (android.widget.AbsListView)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ScrollView (android.widget.ScrollView)2 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 Point (android.graphics.Point)1 GLSurfaceView (android.opengl.GLSurfaceView)1 MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)1 ViewTreeObserver (android.view.ViewTreeObserver)1