TiSMSView icon indicating copy to clipboard operation
TiSMSView copied to clipboard

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

Open bcpi opened this issue 13 years ago • 21 comments

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!!!

bcpi avatar Nov 17 '11 17:11 bcpi

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.

pec1985 avatar Nov 17 '11 17:11 pec1985

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.

bcpi avatar Nov 17 '11 17:11 bcpi

@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 avatar Nov 19 '11 15:11 amigoni

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 avatar Nov 19 '11 15:11 amigoni

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.

amigoni avatar Nov 19 '11 16:11 amigoni

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

pec1985 avatar Nov 19 '11 17:11 pec1985

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 avatar Nov 19 '11 17:11 amigoni

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.

amigoni avatar Nov 19 '11 18:11 amigoni

@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!

bcpi avatar Nov 19 '11 18:11 bcpi

@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 avatar Nov 19 '11 19:11 amigoni

@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.

amigoni avatar Nov 25 '11 14:11 amigoni

@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>

bcpi avatar Nov 25 '11 19:11 bcpi

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 avatar Nov 25 '11 20:11 amigoni

@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 [email protected] shoot me an email and I will forward you the zip file that needs to be built and all.

amigoni avatar Nov 25 '11 20:11 amigoni

@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 avatar Nov 25 '11 21:11 bcpi

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

bcpi avatar Nov 30 '11 16:11 bcpi

Didn't get it.

amigoni avatar Nov 30 '11 19:11 amigoni

@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 avatar Dec 02 '11 14:12 bcpi

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!

bcpi avatar Dec 15 '11 03:12 bcpi

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

pec1985 avatar Dec 21 '11 15:12 pec1985

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.

bcpi avatar Dec 22 '11 21:12 bcpi