pec1985 / TiSMSView

Expandable Text Area Module - iOS - Titanium
Other
60 stars 18 forks source link

Can expandable textarea be used by itself (no bubble chat)? #47

Open bcpi opened 12 years ago

bcpi commented 12 years ago

Hi Pedro! Great work on the SMSview module. Is it possible to detach the keyboard toolbar elements (camera / textarea / send) from the bubble chat view in this module? I need to code a messaging element that will use the keyboard toolbar to allow the user to post a message (to a tableview, not bubble chats). Can your module be modified to do this? I'm not familiar with iPhone modules or Xcode to figure this one on my own. Any guidance you can provide is appreciated.

I opened a ticket (http://support.appcelerator.com/tickets/APP-258734/tickets) about trying to get something to work on the iPhone, and then noticed you posted a version of SMSview for Android that works great, but I need something for iPhone. Thanks!!!

pec1985 commented 12 years ago

Not right now, and I'm extremely busy with other high-priority projects. I will make it so you can have those options, but it will not be done at least within two or three weeks.

And by the way, it is not a keyboard toolbar. Toolbars cannot change height, this is no more than a view with a background image.

bcpi commented 12 years ago

Thanks Pedro!! I think this would be a great mod for chat / messaging systems, so I look forward to it. I appreciate your prompt response today.

amigoni commented 12 years ago

@bcpi. Just set starting to test this out!! Basically set the background to transparent. Disable the touch events. Change the functions to of the send button and picture button to what you want them to. You should be good to go.

This way all the events are passed to whatever you put behind the textArea. It seems to be working for me so far. Will let you know more.

add the following to the textArea. This allows to pass touch events to what ever is underneath. textArea = Ti.SMSView.createView({ touchEnabled: false, })

amigoni commented 12 years ago

Well, That was pretty dumb. If touchEnabled is set to false the typing area can't be touched either. I am trying to use the touchEnabled = false only on the scrollview. This would probably do the trick, but I can't seem to do it.

amigoni commented 12 years ago

I cant' figure a way around it.

I tried to listen for touchstart and touchend events to turn the touchEnabled on the textarea on and off when you touch the scrollview but it doesn't seem like Pedro exposed those.

Pedro if you could expose at least those two events, I think we might have a quick workaround to this. Thanks so much.

pec1985 commented 12 years ago

Why not adding things to the window itself AFTER adding the SMSView? then, they will be on top.

amigoni commented 12 years ago

The type area doesn't seem to scroll up if you add something on top.

Here is some code.

var textArea = Ti.SMSView.createView({ //maxLines:6, // <--- Defaults to 4 //minLines:2, // <--- Defaults to 1 backgroundColor: 'transparent', // <--- Defaults to #dae1eb assets: 'assets', // <--- Defauls to nothing, smsview.bundle can be places in the Resources dir // sendColor: 'Green', // <--- Defaults to "Green" // recieveColor: 'White', // <--- Defaults to "White" // selectedColor: 'Blue', // <--- Defaults to "Blue" // editable: true, // <--- Defautls to true, do no change it // animated: false, // <--- Defaults to true // buttonTitle: 'Something', // <--- Defaults to "Send" // font: { fontSize: 12 ... }, // <--- Defaults to... can't remember // autocorrect: false, // <--- Defaults to true // textAlignment: 'left', // <--- Defaulst to left // textColor: 'blue', // <--- Defaults to "black" returnType: Ti.SMSView.RETURNKEY_DONE, // <---- Defaults to Ti.SMSView.RETURNKEY_DEFAULT camButton: true, //touchEnabled: false, // <--- Defaults to false
});

var cover = Ti.UI.createView({ backgroundColor: 'red', width:320, height:200 }); cover.addEventListener('click', function (){ alert('ciao') });

win.add(textArea); win.add(cover)

amigoni commented 12 years ago

Pedro, thanks for your help. If I manage to get this one part working, I will be able to use my own tableview object and scrollview to display messages and enable touch events on them. I can generate my tableview rows called from your send button or camera button. It will be great.

bcpi commented 12 years ago

@amigoni: I have the same goal to use the module with my own tableview or scrollview. I think this a great module, very commonly used on other native apps (like Facebook) but unfortuanately is not possible to do create with just JS in Ti (see my ticket link above).

I am looking forward to Pedro's update to decouple it from the bubble chat; as I think many of us could benefit from this module. Appcelerator should even integrate this into Ti on a future update as well.

Thanks!

amigoni commented 12 years ago

@bcpi If we could only touchEnable = false on just the scrollview that would do the trick. It would work as then we can just use our own view to display all the stuff as you said.

amigoni commented 12 years ago

@bcpi I think I was able to modify the scrollview to achieve what we need. I rebuilt the module. I can't figure out how to install it. I read the instructions here but can't seem to understand how to do it.

bcpi commented 12 years ago

@amigoni: I'm not experienced with modules either, but these are basically the steps:

  1. Open the Xcode project and build as normal.
  2. From Terminal; execute ./build.py to package the module as an archive.
  3. Copy the archive to the Titanium directory to make it available:

cp ti.smsview-iphone-1.0.zip /Library/Application\ Support/Titanium/

then, register the module with your application by editing tiapp.xml:

<modules>
    <module version="1.0">ti.smsview</module>
</modules>
amigoni commented 12 years ago

I get this failure at the build.py Even with the normal code that is unmodified

llvm-gcc-4.2 failed with exit code 255

amigoni commented 12 years ago

@bcpi I get a build fail during the build.py, but it even happens with the normal unmodified file. I want to send you the zip file to see if you can do it but you don't have an email posted. mine is my username@gmail.com shoot me an email and I will forward you the zip file that needs to be built and all.

bcpi commented 12 years ago

@amigoni: You probably want to contact Pedro (https://github.com/pec1985) as he made this module. I don't know Xcode or the Ti build process to be able to help. The instructions I posted above I got from the README and they worked for me but that's about it. It is also a holiday weekend here in the USA and I will not have access to my work computer until late next week. Sorry.

bcpi commented 12 years ago

@amigoni: I'm back at work. sent you an email.

amigoni commented 12 years ago

Didn't get it.

bcpi commented 12 years ago

@amigoni: I got the code and I also get a build error, on both your version as well as the github code from pec1985.

@pec1985: this is the error message on ./build.py

I'm using Xcode 4.2


Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 255

** BUILD FAILED **

The following build commands failed:
    ProcessPCH /var/folders/96/qy55_k2s7clbt371lkhx53fr0000gp/C/com.apple.Xcode.502/SharedPrecompiledHeaders/TiSmsview_Prefix-fldznmxtcfpzomhanoxyjxpcznja/TiSmsview_Prefix.pch.gch TiSmsview_Prefix.pch normal armv6 objective-c com.apple.compilers.llvmgcc42
(1 failure)
xcodebuild failed
bcpi commented 12 years ago

Hi Pedro,

Just checking in to see if you are still planning a version update that decouples the expandable text area from the bubble chat.

Thanks!

pec1985 commented 12 years ago

This is not going to happen anytime soon, as I do not have the time to do it at the moment

bcpi commented 12 years ago

Ah... bummer. An expandable text area for messaging is a must feature for my app, and the lack of it on Titanium leaves me on a dead end. :/

Could you post some pointers as to how the decoupling could be achieved by modifying the Xcode source? Perhaps someone with Xcode experience and time can fork the code and mod it.

TIA.