Search in sources :

Example 81 with LinearLayout

use of android.widget.LinearLayout in project newsrob by marianokamp.

the class ArticleViewHelper method showShareWithNoteDialog.

private static void showShareWithNoteDialog(final Context context, final EntryManager entryManager, final Entry selectedEntry) {
    final LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setPadding(5, 5, 5, 5);
    final TextView noteLabel = new TextView(context);
    noteLabel.setText("Note");
    noteLabel.setTextColor(context.getResources().getColor(android.R.color.primary_text_dark));
    linearLayout.addView(noteLabel);
    final EditText noteEntry = new EditText(context);
    noteEntry.setLines(2);
    noteEntry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    linearLayout.addView(noteEntry);
    final LinearLayout shareNoteContainer = new LinearLayout(context);
    final CheckBox shareNoteCheckBox = new CheckBox(context);
    shareNoteCheckBox.setChecked(true);
    shareNoteContainer.addView(shareNoteCheckBox);
    final TextView shareLabel = new TextView(context);
    shareLabel.setText("Also share the new note");
    shareLabel.setTextColor(context.getResources().getColor(android.R.color.primary_text_dark));
    shareNoteContainer.addView(shareLabel);
    linearLayout.addView(shareNoteContainer);
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("Share With Note").setView(linearLayout).setCancelable(true);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(final DialogInterface dialog, final int which) {
            selectedEntry.setNote(noteEntry.getText().toString().trim());
            selectedEntry.setShouldNoteBeShared(shareNoteCheckBox.isChecked());
            entryManager.update(selectedEntry);
            entryManager.fireModelUpdated();
        }
    });
    builder.setNegativeButton(android.R.string.cancel, null);
    // .getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    builder.show();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 82 with LinearLayout

use of android.widget.LinearLayout in project LiveSDK-for-Android by liveservices.

the class ContactsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_contacts);
    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Contact contact = (Contact) parent.getItemAtPosition(position);
            ViewContactDialog dialog = new ViewContactDialog(ContactsActivity.this, contact);
            dialog.setOwnerActivity(ContactsActivity.this);
            dialog.show();
        }
    });
    LinearLayout layout = new LinearLayout(this);
    Button newCalendarButton = new Button(this);
    newCalendarButton.setText("New Contact");
    newCalendarButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            CreateContactDialog dialog = new CreateContactDialog(ContactsActivity.this);
            dialog.setOwnerActivity(ContactsActivity.this);
            dialog.show();
        }
    });
    layout.addView(newCalendarButton);
    lv.addHeaderView(layout);
    mAdapter = new ContactsListAdapter(this);
    setListAdapter(mAdapter);
    LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
    mClient = app.getConnectClient();
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ListView(android.widget.ListView) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) LiveSdkSampleApplication(com.microsoft.live.sample.LiveSdkSampleApplication) LinearLayout(android.widget.LinearLayout)

Example 83 with LinearLayout

use of android.widget.LinearLayout in project LiveSDK-for-Android by liveservices.

the class SkyDriveActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.skydrive);
    mPrevFolderIds = new Stack<String>();
    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SkyDriveObject skyDriveObj = (SkyDriveObject) parent.getItemAtPosition(position);
            skyDriveObj.accept(new Visitor() {

                @Override
                public void visit(SkyDriveAlbum album) {
                    mPrevFolderIds.push(mCurrentFolderId);
                    loadFolder(album.getId());
                }

                @Override
                public void visit(SkyDrivePhoto photo) {
                    ViewPhotoDialog dialog = new ViewPhotoDialog(SkyDriveActivity.this, photo);
                    dialog.setOwnerActivity(SkyDriveActivity.this);
                    dialog.show();
                }

                @Override
                public void visit(SkyDriveFolder folder) {
                    mPrevFolderIds.push(mCurrentFolderId);
                    loadFolder(folder.getId());
                }

                @Override
                public void visit(SkyDriveFile file) {
                    Bundle b = new Bundle();
                    b.putString(JsonKeys.ID, file.getId());
                    b.putString(JsonKeys.NAME, file.getName());
                    showDialog(DIALOG_DOWNLOAD_ID, b);
                }

                @Override
                public void visit(SkyDriveVideo video) {
                    PlayVideoDialog dialog = new PlayVideoDialog(SkyDriveActivity.this, video);
                    dialog.setOwnerActivity(SkyDriveActivity.this);
                    dialog.show();
                }

                @Override
                public void visit(SkyDriveAudio audio) {
                    PlayAudioDialog audioDialog = new PlayAudioDialog(SkyDriveActivity.this, audio);
                    audioDialog.show();
                }
            });
        }
    });
    LinearLayout layout = new LinearLayout(this);
    Button newFolderButton = new Button(this);
    newFolderButton.setText("New Folder");
    newFolderButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            NewFolderDialog dialog = new NewFolderDialog(SkyDriveActivity.this);
            dialog.setOwnerActivity(SkyDriveActivity.this);
            dialog.show();
        }
    });
    layout.addView(newFolderButton);
    Button uploadFileButton = new Button(this);
    uploadFileButton.setText("Upload File");
    uploadFileButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getApplicationContext(), FilePicker.class);
            startActivityForResult(intent, FilePicker.PICK_FILE_REQUEST);
        }
    });
    layout.addView(uploadFileButton);
    lv.addHeaderView(layout);
    mPhotoAdapter = new SkyDriveListAdapter(this);
    setListAdapter(mPhotoAdapter);
    LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
    mClient = app.getConnectClient();
}
Also used : Visitor(com.microsoft.live.sample.skydrive.SkyDriveObject.Visitor) ListView(android.widget.ListView) Button(android.widget.Button) LiveSdkSampleApplication(com.microsoft.live.sample.LiveSdkSampleApplication) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) VideoView(android.widget.VideoView) OnClickListener(android.view.View.OnClickListener) LinearLayout(android.widget.LinearLayout) FilePicker(com.microsoft.live.sample.util.FilePicker)

Example 84 with LinearLayout

use of android.widget.LinearLayout in project AndroidTwitter by lorensiuswlt.

the class TwitterDialog method onCreate.

@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");
    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int width = 0;
    int height = 0;
    double[] dimensions = new double[2];
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        display.getSize(outSize);
        width = outSize.x;
        height = outSize.y;
    } else {
        width = display.getWidth();
        height = display.getHeight();
    }
    if (width < height) {
        dimensions[0] = 0.87 * width;
        dimensions[1] = 0.82 * height;
    } else {
        dimensions[0] = 0.75 * width;
        dimensions[1] = 0.75 * height;
    }
    addContentView(mContent, new FrameLayout.LayoutParams((int) dimensions[0], (int) dimensions[1]));
}
Also used : FrameLayout(android.widget.FrameLayout) Point(android.graphics.Point) ProgressDialog(android.app.ProgressDialog) LinearLayout(android.widget.LinearLayout) Point(android.graphics.Point) SuppressLint(android.annotation.SuppressLint) Display(android.view.Display)

Example 85 with LinearLayout

use of android.widget.LinearLayout in project NotificationPeekPort by lzanita09.

the class NotificationLayout method showNotificationContent.

private void showNotificationContent() {
    if (mContentShowing) {
        // Content is already showing.
        return;
    }
    mContentShowing = true;
    StatusBarNotification selectedNotification = (StatusBarNotification) mNotificationPeek.getNotificationView().getTag();
    View contentView = PeekLayoutFactory.createPeekLayout(getContext(), PeekLayoutFactory.LAYOUT_TYPE_CONTENT, selectedNotification);
    contentView.setId(R.id.notification_content);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    params.addRule(RelativeLayout.ABOVE, R.id.notification_layout);
    contentView.setLayoutParams(params);
    // Animations.
    LinearLayout contentTextLayout = (LinearLayout) contentView.findViewById(R.id.content_layout);
    contentTextLayout.setTranslationY(50);
    contentView.setAlpha(0);
    ((ViewGroup) getParent()).addView(contentView);
    contentView.animate().alpha(1f).setInterpolator(new DecelerateInterpolator()).start();
    contentTextLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
    // Send broadcast to NotificationPeekActivity and let it hide the other components
    // when the content is displayed.
    Intent intent = new Intent(NotificationPeekActivity.NotificationPeekReceiver.ACTION_SHOW_CONTENT);
    getContext().sendBroadcast(intent);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) StatusBarNotification(android.service.notification.StatusBarNotification) ViewGroup(android.view.ViewGroup) RelativeLayout(android.widget.RelativeLayout) Intent(android.content.Intent) View(android.view.View) 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