Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Text Input Dialog in Landscape Form — Gideros Forum

Text Input Dialog in Landscape Form

SeebalSeebal Member
edited June 2013 in General questions
Is it possible to have text input dialog in Landscape form on android devices? I saw in a previous discussion (http://www.giderosmobile.com/forum/discussion/comment/11399) that it works if you enable auto-rotation for iPhone in the Project Properties tab but after testing on my Htc One, it did not work. Am i missing something, or is this just not implemented yet?

Thanks.

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    Hello @Seebal
    you need to explicitly state the orientation in AndroidManifest.xml as portrait or landscape, by default it's portrait. :)

    Likes: Seebal

    +1 -1 (+1 / -0 )Share on Facebook
  • Hello @Seebal
    you need to explicitly state the orientation in AndroidManifest.xml as portrait or landscape, by default it's portrait. :)
    This is a known issue for a long time. Do this during exporting the proejct should be a piece of cake for @atilim,why not reminder him to include it in this new release.

  • By the way, is there a normal TextField in Gideros? I think it is good for making some application!
    Coming soon
  • ar2rsawseenar2rsawseen Maintainer
    edited June 2013
  • @ar2rsawseen, but I don't see download button there :(
  • ar2rsawseenar2rsawseen Maintainer
    @sslivka you need to be logged in and upgraded to see the download button, here's an announcement of the labs if you missed it ;)
    http://blog.giderosmobile.com/post/53501495071/announcing-gideros-labs
  • @ar2rsawseen awesome! Hope that will be beta soon! :P
    Coming soon
  • MauMauMauMau Member
    edited November 2013
    "Hello @Seebal
    you need to explicitly state the orientation in AndroidManifest.xml as portrait or landscape, by default it's portrait. :)"

    " This is a known issue for a long time. Do this during exporting the proejct should be a piece of cake for @atilim,why not reminder him to include it in this new release."
    Obviously, this issue wasn't fixed meanwhile... I set my project's orientation property to "Landscape left" and the input dialog still shows up in portrait mode :-( :-(

    ...Any news on this?
  • @MauMau, I think that is an issue, some of the things like the Input Dialog are Portrait only and do not orient according to the device orientation.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Yes our current problem is proper manifest parsing on export (basically it should not only be manifest parsing, but also activity and anything that is on xcode part), that could allow us both, integrate settings and install plugins automatically, something we are experimenting on, but usually other features and bugs always get in the way :)

    Likes: chipster123

    +1 -1 (+1 / -0 )Share on Facebook
  • MauMauMauMau Member
    edited November 2013
    There is also another issue with the dialog box: when you try to change the box' text while it is shown, the cursor jumps back to the beginning of the text, not to the end, at least on Android. This is quite annoying.

    The background is, I am using an enter frame event to check the dialog box for invalid input (unwanted characters). If the user enters an invalid char, I want to remove it from the input box. This actually works, the only problem is that the cursor is set to the BEGINNING of the input text each time you are using inputTextDialog:setText().

    I am still somewhat traumatized by Corona's native input which has always been quite buggy, so I am quite disappointed to see that Gidero's native input has also a couple of flaws. It's always the native input... *sigh* :-(

  • @MauMau, I think your problem is using the validation in enterFrame...

    Use a flag when using this function in enterFrame (which I presume you are not having in your code)
     local isFunctionDoingSomething
     
     function checkForMauMausInput()
       if isFunctionDoingSomething then return end
     
      isFunctionDoingSomething = true
     
      inputDialog:setText()
     
     timer.delayedCall(1000, function() isFunctionDoingSomething = false end)
     end

    Hopefully this should give your code and some time to breathe and work as expected. If you want a specific resolution, then how you approach a problem is important, which can be seen by the community that can help via you sharing some code of what and how you are doing it.

    @Ar2rsawseen, @Atilim maybe this is where another event like KEY_PRESSED or INPUT_CHANGED would come in handy so that each character entered can be processed.

    MauMau, are you iterating thought the string? You can use the string.gsub to replace or rather remove the unwanted characters in one go.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Regarding the orientation issue: WHAT line do we have to edit exactly in the AndroidManifest.xml? And where can I find this file? I did a search in my Android SDK directory and four or five files named AndroidManifest.xml popped up -so which one is the right one?

    @OZApps: no, I do not check the input once every frame, the text correction only triggers when the dialog box has changed, of course, so that's not the problem.

    The problem is that the cursor is set to the beginning (LEFT side of the input text field), each time you are using inputTextdialog:setText() -just test it on an Android device (it does NOT happen on the PC).

    So when the user types some text and I have to remove an invalid char and copy the corrected string back into the dialog box using :setText(), the cursor jumps right to beginning of the input text, which is extremely annoying for the user, especially because he does not know WHY this happened now.

    However, you NEED to check an input text while the user is typing, not afterwards. If I would remove the invalid characters AFTER the user pressed the OK button, he would be suprised while his text suddenly changed and some characters disappeared.



  • @OZApps: no, I do not check the input once every frame, the text correction only triggers when the dialog box has changed, of course, so that's not the problem.

    The problem is that the cursor is set to the beginning (LEFT side of the input text field), each time you are using inputTextdialog:setText() -just test it on an Android device (it does NOT happen on the PC).
    The PC is not using the native controls and it is always advised to test the app on a device to know how it will work when deployed.

    However, you NEED to check an input text while the user is typing, not afterwards. If I would remove the invalid characters AFTER the user pressed the OK button, he would be suprised while his text suddenly changed and some characters disappeared.
    Yes, that is right and you want to change the input as it is made, which could mean capitalization, disallowing certain characters, etc. My point was either you can use the if..then commands or a single gsub on the string.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • MauMauMauMau Member
    edited November 2013
    Sure, but that doesn't make any difference because you have to write the modified text back to the dialog box then using :setText() -and this causes the cursor of the dialog box to jump back all to the left on an Android device.

    Here is a stripped down code to demonstrate this issue, which should allow to enter hexadecimal chars only, for example. Run it on the device and you'll see what's going on -the cursor jumps back all to the left once you enter an invalid character:
    -- INPUT COMPLETE
    function onComplete(event)
    	stage:removeEventListener  (Event.ENTER_FRAME, checkInput )
    	MyInput:removeEventListener(Event.COMPLETE, onComplete)
    	MyInput:hide()
    	MyInput = nil
    end
     
    -- CONSTANTLY CHECK INPUT DIALOG TEXT
    function checkInput(event)
     
    	-- INPUT TEXT DID NOT CHANGE? RETURN!
    	if MyInput:getText() == MyInput.lastText then return end
     
    	print("Input text changed!")
     
    	local txt = MyInput:getText()
     
    	-- CHECK FOR ALLOWED CHARS
    	local allowedChars = "0123456789abcdefABCDEF"
    	for i = 1, txt:len() do
    		local found = false 
    		for j = 1, allowedChars:len() do
    			if txt:sub(i,i) == allowedChars:sub(j,j) then found = true; break end
    		end
    		if found == false then txt = txt:sub(1,txt:len()-1) end
    	end
     
    	MyInput:setText(txt) -- THIS IS THE BUGGY PART!! CAUSES CURSOR TO JUMP BACK TO THE LEFT!
    	MyInput.lastText = txt
    end
     
     
    MyInput = TextInputDialog.new("Title","Message..." , "some text", "Cancel", "OK")
    MyInput.lastText = ""
    MyInput:setInputType    (TextInputDialog.TEXT)
    MyInput:addEventListener(Event.COMPLETE, onComplete)
    stage:addEventListener  (Event.ENTER_FRAME, checkInput )
    MyInput:show()
  • About orientation, inside AndroidManifest file in activity tag, there is a android:screenOrientation attribute, change its value to "landscape"

    About text input, understand the issue, but currently I doubt that current implementation will be modified much, as in we will probably drop it completely, when native UI on ios would reach a stable version
  • Is it this part of AndroidManifest.xml (located in AndroidSDK/sdk/tools/apps/SdkController/)?
            <activity
                android:name=".activities.MultiTouchActivity"
                android:launchMode="singleInstance"
                android:screenOrientation="portrait"
                android:theme="<a href="http://forum.giderosmobile.com/profile/style%2FTheme" rel="nofollow">@style/Theme</a>.MultiTouch"
                android:windowSoftInputMode="stateHidden"/>
    There are multiple documents named AndroidManifest.xml included with the SDK but this is the only one that contains the atribute "portrait" somewhere.

    About Native UI -will it be a premium feature only or will it become a part of the public Gideros version, too?
  • ar2rsawseenar2rsawseen Maintainer
    edited November 2013
    @MauMau you should edit the AndroidManifest of your exported app (inside the folder where you exported your app)

    And that activity should look something like:
     <activity android:label="<a href="http://forum.giderosmobile.com/profile/string%2Fapp_name%26quot" rel="nofollow">@string/app_name&quot</a>;
    android:name="com.giderosmobile.android.YourAppActivity"
    android:launchMode="singleTask" android:screenOrientation="landscape"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
    About Native UI I currently can't say for sure, the bridge will most probably be upgraded feature only, and as Native UI is based on bridge, then most probably it will also fall in same category
  • MauMauMauMau Member
    edited November 2013
    @MauMau you should edit the AndroidManifest of your exported app (inside the folder where you exported your app)
    I see. So we need to build the app first, there is no way to have a landscape input dialog when using the Gideros player on the device?



  • No, on Android this setting can only be changed before building an .apk file.

    But you can export your project, change this setting, then delete assets folder (which is inside assets folder) and build .apk, and you will have a Gideros Player with your changed settings
    http://docs.giderosmobile.com/deployment.html
Sign In or Register to comment.