In google's Cardboard API we can use CardboardView.setSettingsButtonEnabled(boolean) method to hide the settings button on the bottom of the screen.
Now,Google VR API is graded to 1.0. Use GvrView insteads of 'CardboardView', and the settings button is moved to top|right when adding a close button on left|top, but I can't find any GvrView's methods which can hide the two buttons.
Please help me how to fix it, Thanks
In the current version (1.170.0) of the GVR SDK. You can find the buttons and remove them (but only in older versions of Android):
// Settings Button
val settingsButton = gvrView.findViewById<ImageButton>(R.id.ui_settings_button)
settingsButton.visibility = View.GONE
// Back Button
val backButton = gvrView.findViewById<ImageButton>(R.id.ui_back_button)
backButton.visibility = View.GONE
// Alignment Marker
val alignmentMarker = gvrView.findViewById<RelativeLayout>(R.id.ui_alignment_marker)
alignmentMarker.visibility = View.GONE
Yes ,I think the developers don't plan to add this method.
[https://github.com/googlevr/gvr-android-sdk/issues/252][1]
Related
In my application I have created my own Loading indicator with the help of Page class in xamarin.forms, and I use 'PushModalAsync' api to show Loading Indicator wherever needed like below
var loadingindicator=new LoadingIndicator();
MyApp.CurrentAppInstance.MainPage.Navigation.PushModalAsync(loadingindicator,false);
Everything works as expected and It is looking fine and I also managed to make it look like AndHUD by tweeking the alpha for the controls in that page until I hit an issue,
The issue is that, every time I show and hide the loadingindicator page 'OnAppearing()' getting called on the current top page on view stack.
I can fix this by introducing one additional functionality on all pages where I am using my LoadingIndicator, But I feel there might be some other cleaner way to solve this issue.
Can you guys suggest me if there is any cleaner approach available to solve this issue?
(I target this solution mainly for android and I want to achieve it through common code)
If I have understand the problem, I think there are some way to add Loading indicator.
Use ActivityIndicator
Use aritchie/userdialogs's Loading
using (this.Dialogs.Loading("Test Loading"))
await Task.Delay(3000);
Create a PopUp With Rg.Plugins.Popup
// Use these methods in PopupNavigation globally or Navigation in your pages
// Open new PopupPage
Task PushAsync(PopupPage page, bool animate = true) // Navigation.PushPopupAsync
// Hide last PopupPage
Task PopAsync(bool animate = true) // Navigation.PopPopupAsync
// Hide all PopupPage with animations
Task PopAllAsync(bool animate = true) // Navigation.PopAllPopupAsync
// Remove one popup page in stack
Task RemovePageAsync(PopupPage page, bool animate = true) // Navigation.RemovePopupPageAsync
Which component do I choose to achieve custom dialog at the bottom as shown in the below image? Shall I choose alertdialog,popupwindow, or fragmentdialog?
Try this
BottomSheetDialog dialog = new BottomSheetDialog(YourActivity.this);
dialog.setContentView(YourView);
dialog.show();
Edit: I didn't there was a built in component in Android to do so. Good to know! Also, check this out:
https://medium.com/glucosio-project/moving-from-dialogs-to-bottomsheetdialogs-on-android-15fb8d140295#
I would recommend FragmentDialog without a doubt.
It's so much easier to create a customized Dialog regarding location & layout design.
Kotlin code for run custom ButtomSheetDialog (run inside Activity)
var CustomSelectProfilePicBottomSheetDialog = BottomSheetDialog(this)
val layoutButtomSheetView = this.layoutInflater.inflate(R.layout.ly_custom_buttom_sheet_frg_dialog, null)
CustomSelectProfilePicBottomSheetDialog.setContentView(layoutButtomSheetView)
CustomSelectProfilePicBottomSheetDialog.show()
I'm developing an Android TV application which is using Leanback library. There is a login form with email, password and a login button. I'd like to enable the login button only when the email and password are valid.
Here is my code:
mLoginButtonAction = new GuidedAction.Builder(this.getActivity())
.id(id)
.title(title)
.description(desc)
.build();
actions.add(action);
I disable it at first:
mLoginButtonAction.setEnabled(false);
And then enable it when it's valid:
mLoginButtonAction.setEnabled(valid);
The button is then enabled and I'm able to click it. But the color of the button is still the same color as in disable mode. Any idea? Thanks.
Modification to actions do not trigger notifications to the GuidedStepFragment and must be done so manually.
To notify an action change you first need the items index.
int idx = findActionPositionById(actionId);
Get and modify your action
GuidedAction someAction = getActions().get(idx);
someAction.setEnabled(valid);
Next notify the fragment of the update
notifyActionChanged(idx);
So building a new app specifically for the Android TV interface (lollipop leanback) and I'm using the PlaybackOverlayFragment that is provided by the framework which has a PlaybackControlsRow with all the usual controls on it.
The problem is, the default behavior is for the user to have to click the "Play" button to start the video and I want it to start automatically. That part is easy and I have it working but then the Play/Pause icons on the provided control are out of sync (showing play when should be pause) because the item was started outside of the events of clicking on that control.
Documentation is sparse on these framework elements and examining the class I can't find any public method that would allow me to put this control in the proper "mode" or tell it to display the play or pause icon myself.
Anyone with experience with these yet that would know how to do this?
In order to change the state of the button, even after adding your Actions to the Adapter, you'll need to notify the changes to the adapter that has your Action.
mPlayPauseAction.nextIndex(); // next index, if it was pause, it'll be play
notifyChanged(mPlayPauseAction);
// where notifyChanged(Action action) is:
private void notifyChanged(Action action) {
ArrayObjectAdapter adapter = mPrimaryActionsAdapter; // reference to your adapter
if (adapter.indexOf(action) >= 0) {
adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
return;
}
}
Well, I partially answered my own question.
If I know before the PlaybackControlsRow is created that I want to set it to the pause state (actually, playing state but showing pause button) then if I call setIndex(PlaypauseAction.PAUSE) on the PlayPauseAction before adding it to the controlsrow then it works.
It doesn't appear that I can modify it myself after adding it but that may be something else I'm doing wrong.
I am curreny using the menudrawer from https://github.com/SimonVT/android-menudrawer.
When i try to display the menu from the top & bottom, with the apropiate gestures, i get only one response. Do you know if there can be used more than 1 menus in the same activity?
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.TOP);
mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
mMenuDrawer.setContentView(R.layout.activity_main);
mMenuDrawer.setMenuView(R.layout.mt_main);
mMenuDrawer2 = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.BOTTOM);
mMenuDrawer2.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
mMenuDrawer2.setContentView(R.layout.activity_main);
mMenuDrawer2.setMenuView(R.layout.mb_main);
I use two menudrawers in my activity and I use them as follow (and its working for me)
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.TOP);
mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
mMenuDrawer.setDropShadowEnabled(false);
mMenuDrawerRight = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.RIGHT);
mMenuDrawerRight.setTouchMode(MenuDrawer.TOUCH_MODE_BEZEL );
mMenuDrawerRight.setTouchBezelSize(10);
mMenuDrawerRight.setDropShadowEnabled(false);
If the library supports such a thing MenuDrawer.TOUCH_MODE_FULLSCREEN won't help at all... try with MenuDrawer.TOUCH_MODE_BEZEL
Last I checked, MenuDrawer didn't officially support multiple drawers without possibly using some kind of hack. SlidngMenu does support adding multiple drawers, wherever you want. I think MenuDrawer performs better, but SlidingMenu gives you more options and flexibility.
It is possible to attach two MenuDrawer (on left and right) to same activity
Default mode for MenuDrawer is MENU_DRAG_CONTENT but we need to use MENU_DRAG_WINDOW
Note: Don't set the ContentView for MenuDrawers
//In onCreate() of the activity
MenuDrawer slidingMenuLeft = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY, Position.LEFT, MenuDrawer.MENU_DRAG_WINDOW);
slidingMenuLeft.setMenuView(R.layout.navigation_menu_left); // Set layout for Left menu
MenuDrawer slidingMenuRight = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY, Position.RIGHT, MenuDrawer.MENU_DRAG_WINDOW);
slidingMenuRight.setMenuView(R.layout.navigation_menu_right); // Set layout for Right menu
I haven't tested this with touch mode MenuDrawer.TOUCH_MODE_FULLSCREEN