Contents are not showing on bottom Full screen bottom sheet dialog - android-bottomsheetdialog

I used a bottom sheet dialog in my application I wanted it to be full screen but its contents are not showing on full screen I want those two button at the bottom of the screen
private fun setupDestinationStationDialog() {
//Initializing pickup station Dialog Binding
destinationStationDialogBinding = DialogDestinationStationBinding.inflate(layoutInflater)
destinationStationDialog.setContentView(destinationStationDialogBinding.root)
//Sheet behaviour
val bottomSheetBehavior = BottomSheetBehavior.from( destinationStationDialogBinding.root.parent as View)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED
destinationStationDialogBinding.coordinator.minimumHeight = Resources.getSystem().displayMetrics.heightPixels
destinationStationDialog.show()
}

Related

Context menu gets clipped on the right side

I show a context menu on right click but for every second click the right side of the menu gets clipped (about 1 to 2 character width) The basics that I can put here:
void initialise(Handler eventHandler) {
addMenuItem(eventHandler, "New", new NewAction(shell),false);
addMenuItem(eventHandler, "Edit", new EditAction(shell),false);
menuItems.add(new SeparatorMenuItem());
... more items
}
void addMenuItem(Handler eventHandler, String text, Action action, boolean isCheck) {
actions.add(action);
MenuItem it = isCheck ? new CheckMenuItem() : new MenuItem();
it.setText(text);
it.setData(action);
it.setDisable(true);
menuItems.add(it);
}
....
menu = new ContextMenu();
menu.getItems().clear();
menu.getItems().addAll(getMenuItems(getSelection()));
menu.setAutoHide(true);
...
What I've figured out is that it happens on every second right click and although the menu occupy the same rectangle, the drawn part is shifted by 12 pixels, giving the appearance that it's been clipped
You need to set the effect style to null in the code or the css file

In NativeScript, how do I change page/view in a modal page?

I would like to create a multiple step modal dialog - like a wizard. A series of screens that follow on from one another.
I'm using the code from NativeScript's site to display a modal (https://docs.nativescript.org/core-concepts/navigation#modal-pages)
var modalPageModule = "./modal-views-demo/login-page";
var context = "some custom context";
var fullscreen = true;
mainPage.showModal(modalPageModule, context, function closeCallback(username, password) {
// Log the user in...
}, fullscreen);
The code works, but I'm unsure how to change the modalPageModule once the modal is displayed.
Possible duplicate
Nativescript: How to use navigation in modals
https://github.com/NativeScript/NativeScript/issues/3753

Simple popup or dialog box in Google Apps Script

I'm looking for simple code that adds a popup in my Google Apps Script Ui that comes up when I hit a submit button. The popup box would display a message and have a button to close the popup.
I've looked all over the place - everything seems so complicated and does way more than I need it to do.
This is the current code I have for the submit button.
function doGet() {
var app = UiApp.createApplication();
app.setTitle("My Logbook");
var hPanel_01 = app.createHorizontalPanel();
var vPanel_01 = app.createVerticalPanel();
var vPanel_02 = app.createVerticalPanel();
var vPanel_03 = app.createVerticalPanel();
var submitButton = app.createButton("Submit");
//Create click handler
var clickHandler = app.createServerHandler("submitData");
submitButton.addClickHandler(clickHandler);
clickHandler.addCallbackElement(hPanel_01);
////Test PopUp Panel
var app = UiApp.getActiveApplication();
var app = UiApp.createApplication;
var dialog = app.createDialogBox();
var closeHandler = app.createClientHandler().forTargets(dialog).setVisible(false);
submitButton.addClickHandler(closeHandler);
var button= app.createButton('Close').addClickHandler(closeHandler);
dialog.add(button);
app.add(dialog);
//////
return app;
}
Since UiApp is depreciated, HTMLService should be used to create custom user interfaces.
To prompt simple popup to display a message, use alert method of Ui class
var ui = DocumentApp.getUi();
ui.alert('Hello world');
will prompt simple popup with hello world and an ok button.
To display customized html template in Dialog, use HTMLService to create template and then pass it to showModalDialog method of Ui Class
var html = HtmlService.createHtmlOutput("<div>Hello world</div>").setSandboxMode(HtmlService.SandboxMode.IFRAME);
DocumentApp.getUi().showModalDialog(html, "My Dialog");
HtmlService.createHtmlOutputFromFile allows you to display html that is in a separate file. see the documentation
Have you tried using zIndex? It places the panel above all of your other panels...
var popupPanel = app.createVerticalPanel().setId('popupPanel')
.setVisible(false)
.setStyleAttribute('left', x)
.setStyleAttribute('top', y)
.setStyleAttribute('zIndex', '1')
.setStyleAttribute('position', 'fixed');
x = panel position from the left portion of your app
y = panel position from the top portion of your app
zIndex = the 'layer' your panel will appear on. You can stack panels using '1', '2', '3' etc.
position = your panel will be in a fixed position denoted by (x,y)
Visibility is set to false until you click submit, then have a client handler for your submit button make the popupPanel visible. When you click the button on your popupPanel, have the client handler set visibility to false once again and it will disappear.
One more thing, I noticed you get the active app and then create a new app. You do not need to create a new app...just new panels inside your app.
Hope this helps!
You can use a dialogbox to popup.
Add a button to the dialog-box. Add a client handler that sets the dialog box invisible,once you click the button.
var app = UiApp.createApplication;
var dialog = app.createDialogBox();
var closeHandler = app.createClientHandler().forTargets(dialog).setVisible(false);
var button= app.createButton('Close').addClickHandler(closeHandler);
dialog.add(button);
app.add(dialog);
This should help.
EDIT
Added "()" after .createClientHandler. That should remove issues related to TypeError: Cannot find function createDialogBox in object function createApplication() {/* */}
Popup - use something like this:
var table = app.createFlexTable();
table.setStyleAttribute("position", "absolute");
table.setStyleAttribute("background", "white");
add items to the table and hide and show as needed.

How to set a Popup to be always visible on the top in GWT

I have a loading popup that I need to display on the top of the page, even if the user scroll down.
What I tried so far is to set the popup position as follows
setPopupPosition(Window.getClientWidth()/2 , 0);
The popup shows up on the absolut top.
The situation can be resolved easily if you view it from a different angle: Not the popup position should adjust to the page - instead, the page should scroll behind the centering popup, e.g.:
final ScrollPanel scrollPanel = new ScrollPanel();
RootLayoutPanel.get().add(scrollPanel);
pagePanel = new FlowPanel();
scrollPanel.setWidget(pagePanel);
pagePanel.add(...);
Now add the entire page contents to pagePanel (instead of adding them directly to rootPanel).
Then you can create popups like this:
final PopupPanel popupPanel = new PopupPanel();
popupPanel.add(...);
popupPanel.center();
You'll still have to re-center the popup when the window resizes, but apart from that, the popup will always be at the center in front of the scrolling page.
To achieve this you can implement Window.addWindowScrollHandler. It will always be on top whatever you do.
DialogBox dialog = new DialogBox();
dialog.setWidget(...);
Window.addWindowScrollHandler(new ScrollHandler() {
#Override
public void onWindowScroll(ScrollEvent event) {
dialog.setPopupPosition((Window.getClientWidth() - widthOfDialog) / 2, event.getScrollTop());
}
});
Hope this helps.. Thanks..
The solution that worked for me is this
setPopupPosition(Window.getClientWidth()/2 , Window.getScrollTop());

Facebook Application iFrame Fixed Element

I would like to have a fixed element (a DIV) in the iFrame for my Facebook Application. So when the user scrolls down the page, that element is still fixed on the top of the browser window?
The basic: You add stuff to a bag, while you are scrolling down, and a fixed DIV will show you your "score" while you add these things to the bag. The "score counter" should always be visible while scrolling.
Thank you!
This is not possible if you are using facebook's iframe auto-resize features. Once the iframe is resized so that scrolling is not necessary, the only scroll available will be the one of the parent window. However, the child iframe has no information about the scroll of the parent window (since they are not on the same domain...) and trying to listen to scroll events or scroll position will only return that the scrollbar is at position 0, or topmost.
You can however listen to click events and extract the offset of the click event or the clicked element.
Some examples:
$('.clickme').click(function(e) {
e.preventDefault();
var top;
// Using click position (e.pageY and e.pageX available)
top = e.pageY;
// Using clicked element position
top = $(this).offset().top;
$('#moveme').css({'top': top - 100 + 'px'}); //
}
Maybe you can base your interaction on this principle instead?
I don't know about you Erik but this really doens not help me much.
Could FB.Canvas.getPageInfo help?
Maybe that would help : I was ussing
(function() {
var el = $("header:first");
var elpos_original = el.offset().top;
$(window).scroll(function(){
var elpos = el.offset().top;
var windowpos = $(window).scrollTop();
var finaldestination = windowpos;
if(windowpos<elpos_original) {
finaldestination = elpos_original;
el.stop().css({'top':0});
} else {
el.stop().animate({'top':finaldestination-elpos_original},0);
}
});
})();