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();
}
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();
}
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();
}
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]));
}
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);
}
Aggregations