Search in sources :

Example 31 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class VerticalFocusSearch method addSkinny.

/**
     * Add a skinny button that takes up just less than half of the screen
     * horizontally.
     * @param root The layout to add the button to.
     * @param label The label of the button.
     * @param atRight Which side to put the button on.
     * @return The newly created button.
     */
private Button addSkinny(LinearLayout root, String label, boolean atRight) {
    Button button = new MyButton(this);
    button.setText(label);
    button.setLayoutParams(new LinearLayout.LayoutParams(// width
    0, ViewGroup.LayoutParams.WRAP_CONTENT, 480));
    TextView filler = new TextView(this);
    filler.setText("filler");
    filler.setLayoutParams(new LinearLayout.LayoutParams(// width
    0, ViewGroup.LayoutParams.WRAP_CONTENT, 520));
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.HORIZONTAL);
    ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    if (atRight) {
        ll.addView(filler);
        ll.addView(button);
        root.addView(ll);
    } else {
        ll.addView(button);
        ll.addView(filler);
        root.addView(ll);
    }
    return button;
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 32 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class AdjacentListsWithAdjacentISVsInside method combineAdjacent.

private static View combineAdjacent(View... views) {
    if (views.length < 2) {
        throw new IllegalArgumentException("you should pass at least 2 views in");
    }
    final LinearLayout ll = new LinearLayout(views[0].getContext());
    ll.setOrientation(LinearLayout.HORIZONTAL);
    final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f);
    for (View view : views) {
        ll.addView(view, lp);
    }
    return ll;
}
Also used : View(android.view.View) InternalSelectionView(android.util.InternalSelectionView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout)

Example 33 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class FocusAfterRemoval method onCreate.

protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.focus_after_removal);
    final LinearLayout left = (LinearLayout) findViewById(R.id.leftLayout);
    // top left makes parent layout GONE
    Button topLeftButton = (Button) findViewById(R.id.topLeftButton);
    topLeftButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            left.setVisibility(View.GONE);
        }
    });
    // bottom left makes parent layout INVISIBLE
    // top left makes parent layout GONE
    Button bottomLeftButton = (Button) findViewById(R.id.bottomLeftButton);
    bottomLeftButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            left.setVisibility(View.INVISIBLE);
        }
    });
    // top right button makes top right button GONE
    final Button topRightButton = (Button) findViewById(R.id.topRightButton);
    topRightButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            topRightButton.setVisibility(View.GONE);
        }
    });
    // bottom right button makes bottom right button INVISIBLE
    final Button bottomRightButton = (Button) findViewById(R.id.bottomRightButton);
    bottomRightButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            bottomRightButton.setVisibility(View.INVISIBLE);
        }
    });
}
Also used : Button(android.widget.Button) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 34 with LinearLayout

use of android.widget.LinearLayout in project platform_frameworks_base by android.

the class HorizontalFocusSearch method addShort.

private Button addShort(LinearLayout root, String label, boolean atBottom) {
    Button button = new MyButton(this);
    button.setText(label);
    button.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, // height
    0, 490));
    TextView filler = new TextView(this);
    filler.setText("filler");
    filler.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, // height
    0, 510));
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
    if (atBottom) {
        ll.addView(filler);
        ll.addView(button);
        root.addView(ll);
    } else {
        ll.addView(button);
        ll.addView(filler);
        root.addView(ll);
    }
    return button;
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 35 with LinearLayout

use of android.widget.LinearLayout in project Conversations by siacs.

the class TrustKeysActivity method populateView.

private void populateView() {
    setTitle(getString(R.string.trust_omemo_fingerprints));
    ownKeys.removeAllViews();
    foreignKeys.removeAllViews();
    boolean hasOwnKeys = false;
    boolean hasForeignKeys = false;
    for (final String fingerprint : ownKeysToTrust.keySet()) {
        hasOwnKeys = true;
        addFingerprintRowWithListeners(ownKeys, mAccount, fingerprint, false, FingerprintStatus.createActive(ownKeysToTrust.get(fingerprint)), false, false, new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                ownKeysToTrust.put(fingerprint, isChecked);
            // own fingerprints have no impact on locked status.
            }
        });
    }
    synchronized (this.foreignKeysToTrust) {
        for (Map.Entry<Jid, Map<String, Boolean>> entry : foreignKeysToTrust.entrySet()) {
            hasForeignKeys = true;
            final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.keys_card, foreignKeys, false);
            final Jid jid = entry.getKey();
            final TextView header = (TextView) layout.findViewById(R.id.foreign_keys_title);
            final LinearLayout keysContainer = (LinearLayout) layout.findViewById(R.id.foreign_keys_details);
            final TextView informNoKeys = (TextView) layout.findViewById(R.id.no_keys_to_accept);
            header.setText(jid.toString());
            final Map<String, Boolean> fingerprints = entry.getValue();
            for (final String fingerprint : fingerprints.keySet()) {
                addFingerprintRowWithListeners(keysContainer, mAccount, fingerprint, false, FingerprintStatus.createActive(fingerprints.get(fingerprint)), false, false, new CompoundButton.OnCheckedChangeListener() {

                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        fingerprints.put(fingerprint, isChecked);
                        lockOrUnlockAsNeeded();
                    }
                });
            }
            if (fingerprints.size() == 0) {
                informNoKeys.setVisibility(View.VISIBLE);
                informNoKeys.setText(getString(R.string.no_keys_just_confirm, mAccount.getRoster().getContact(jid).getDisplayName()));
            } else {
                informNoKeys.setVisibility(View.GONE);
            }
            foreignKeys.addView(layout);
        }
    }
    ownKeysTitle.setText(mAccount.getJid().toBareJid().toString());
    ownKeysCard.setVisibility(hasOwnKeys ? View.VISIBLE : View.GONE);
    foreignKeys.setVisibility(hasForeignKeys ? View.VISIBLE : View.GONE);
    if (hasPendingKeyFetches()) {
        setFetching();
        lock();
    } else {
        if (!hasForeignKeys && hasNoOtherTrustedKeys()) {
            keyErrorMessageCard.setVisibility(View.VISIBLE);
            if (lastFetchReport == AxolotlService.FetchStatus.ERROR || mAccount.getAxolotlService().fetchMapHasErrors(contactJids)) {
                keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error);
            } else {
                keyErrorMessage.setText(R.string.error_no_keys_to_trust);
            }
            ownKeys.removeAllViews();
            ownKeysCard.setVisibility(View.GONE);
            foreignKeys.removeAllViews();
            foreignKeys.setVisibility(View.GONE);
        }
        lockOrUnlockAsNeeded();
        setDone();
    }
}
Also used : Jid(eu.siacs.conversations.xmpp.jid.Jid) TextView(android.widget.TextView) HashMap(java.util.HashMap) Map(java.util.Map) CompoundButton(android.widget.CompoundButton) LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1205 View (android.view.View)473 TextView (android.widget.TextView)455 ViewGroup (android.view.ViewGroup)203 ImageView (android.widget.ImageView)196 Button (android.widget.Button)167 ScrollView (android.widget.ScrollView)125 ListView (android.widget.ListView)100 LayoutInflater (android.view.LayoutInflater)90 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)80 AdapterView (android.widget.AdapterView)74 EditText (android.widget.EditText)74 Intent (android.content.Intent)66 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)46 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42