Search in sources :

Example 16 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

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, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0);
    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(MATCH_PARENT, 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);
    }
    /* Only display the divider if we have a title and a 
         * custom view or a message.
         */
    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.view.ViewGroup.LayoutParams) TypedArray(android.content.res.TypedArray) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout)

Example 17 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class AlertController method setupTitle.

private boolean setupTitle(LinearLayout topPanel) {
    boolean hasTitle = true;
    if (mCustomTitleView != null) {
        // Add the custom title view directly to the topPanel layout
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        topPanel.addView(mCustomTitleView, 0, lp);
        // Hide the title template
        View titleTemplate = mWindow.findViewById(R.id.title_template);
        titleTemplate.setVisibility(View.GONE);
    } else {
        final boolean hasTextTitle = !TextUtils.isEmpty(mTitle);
        mIconView = (ImageView) mWindow.findViewById(R.id.icon);
        if (hasTextTitle) {
            /* Display the title if a title is supplied, else hide it */
            mTitleView = (TextView) mWindow.findViewById(R.id.alertTitle);
            mTitleView.setText(mTitle);
            /* Do this last so that if the user has supplied any
                 * icons we use them instead of the default ones. If the
                 * user has specified 0 then make it disappear.
                 */
            if (mIconId > 0) {
                mIconView.setImageResource(mIconId);
            } else if (mIcon != null) {
                mIconView.setImageDrawable(mIcon);
            } else if (mIconId == 0) {
                /* Apply the padding from the icon to ensure the
                     * title is aligned correctly.
                     */
                mTitleView.setPadding(mIconView.getPaddingLeft(), mIconView.getPaddingTop(), mIconView.getPaddingRight(), mIconView.getPaddingBottom());
                mIconView.setVisibility(View.GONE);
            }
        } else {
            // Hide the title template
            View titleTemplate = mWindow.findViewById(R.id.title_template);
            titleTemplate.setVisibility(View.GONE);
            mIconView.setVisibility(View.GONE);
            topPanel.setVisibility(View.GONE);
            hasTitle = false;
        }
    }
    return hasTitle;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout)

Example 18 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class MenuItemImpl method setActionView.

public MenuItem setActionView(int resId) {
    final Context context = mMenu.getContext();
    final LayoutInflater inflater = LayoutInflater.from(context);
    setActionView(inflater.inflate(resId, new LinearLayout(context), false));
    return this;
}
Also used : Context(android.content.Context) LayoutInflater(android.view.LayoutInflater) LinearLayout(android.widget.LinearLayout)

Example 19 with LinearLayout

use of android.widget.LinearLayout in project LolliPin by OrangeGangsters.

the class PinCodeView method initializeView.

private void initializeView(AttributeSet attrs, int defStyleAttr) {
    if (attrs != null) {
        final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.PinCodeView, defStyleAttr, 0);
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        LinearLayout view = (LinearLayout) inflater.inflate(R.layout.activity_pin_code, this);
    }
}
Also used : TypedArray(android.content.res.TypedArray) LayoutInflater(android.view.LayoutInflater) LinearLayout(android.widget.LinearLayout)

Example 20 with LinearLayout

use of android.widget.LinearLayout in project android_frameworks_base by ParanoidAndroid.

the class ConnectivityManagerTestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    log("onCreate, inst=" + Integer.toHexString(hashCode()));
    // Create a simple layout
    LinearLayout contentView = new LinearLayout(this);
    contentView.setOrientation(LinearLayout.VERTICAL);
    setContentView(contentView);
    setTitle("ConnectivityManagerTestActivity");
    // register a connectivity receiver for CONNECTIVITY_ACTION;
    mConnectivityReceiver = new ConnectivityReceiver();
    registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    mWifiReceiver = new WifiReceiver();
    IntentFilter mIntentFilter = new IntentFilter();
    mIntentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
    mIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
    mIntentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
    mIntentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
    mIntentFilter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
    mIntentFilter.addAction(ConnectivityManager.ACTION_TETHER_STATE_CHANGED);
    registerReceiver(mWifiReceiver, mIntentFilter);
    // Get an instance of ConnectivityManager
    mCM = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    // Get an instance of WifiManager
    mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    mContext = this;
    if (mWifiManager.isWifiApEnabled()) {
        // if soft AP is enabled, disable it
        mWifiManager.setWifiApEnabled(null, false);
        log("Disable soft ap");
    }
    initializeNetworkStates();
    log("Clear Wifi before we start the test.");
    removeConfiguredNetworksAndDisableWifi();
    mWifiRegexs = mCM.getTetherableWifiRegexs();
}
Also used : IntentFilter(android.content.IntentFilter) LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1171 View (android.view.View)457 TextView (android.widget.TextView)435 ViewGroup (android.view.ViewGroup)200 ImageView (android.widget.ImageView)189 Button (android.widget.Button)164 ScrollView (android.widget.ScrollView)123 ListView (android.widget.ListView)97 LayoutInflater (android.view.LayoutInflater)86 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)74 AdapterView (android.widget.AdapterView)71 EditText (android.widget.EditText)69 Intent (android.content.Intent)58 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)45 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42