0

enter image description here

Is it possible to implement the above default blackberry text messages conversation list view in an application. If yes, how do I do it? I am totally blank about it, and I do not find any lead to go forward on this. I will get the above messages from my application server. Please help!!

Hades
  • 75
  • 1
  • 12
  • Create two images like that.Add the messages on the corresponding images.Then if you get a message from server, show it in the right side of the screen, if you send a message show it on left side. – Rince Thomas Jun 07 '12 at 13:50
  • Yes Signare I did give I thought about that. But I was thinking of using the native message list view of blackberry, because if the message content is longer, then the height of that cell will change accordingly, where as the image height will be static. – Hades Jun 07 '12 at 14:19
  • create like this final Border rightBorder = BorderFactory.createBitmapBorder(new XYEdges(16, 23, 27, 16), Bitmap.getBitmapResource( "bubble_right.png" ) ); final Border leftBorder = BorderFactory.createBitmapBorder(new XYEdges(16, 16, 27, 23), Bitmap.getBitmapResource( "bubble_left.png" ) ); – Rince Thomas Jun 07 '12 at 14:22
  • then field.setBorder(rightBorder or leftBorder ); – Rince Thomas Jun 07 '12 at 14:23
  • If not the native message view, can we use something like 9 patch image in android, for blackberry? – Hades Jun 07 '12 at 14:28
  • Hey Signare, does the "bubble_right.png" means only the image of the arrow or the complete bubble box? Cause I tried with the complete box, but if the message content increases the box image repeats itself. – Hades Jun 08 '12 at 07:03

1 Answers1

0

enter image description here

enter image description here

I used like these images.

final Border rightBorder = BorderFactory.createBitmapBorder(new XYEdges(16, 23, 27, 16), Bitmap.getBitmapResource( "bubble_right.png" ) ); 
final Border leftBorder = BorderFactory.createBitmapBorder(new XYEdges(16, 16, 27, 23), Bitmap.getBitmapResource( "bubble_left.png" ) );

addHeading(leftBorder, Field.FIELD_LEFT,0xbdbdbd, txt,time_);


 public static void addHeading(Border border, long style, int backgroundcolour, String msg ,String time_) {
    VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH );
    vfm.setMargin(0, 0, 0, 0);
    FieldLayout tt =  new FieldLayout(style, backgroundcolour, msg,time_);
    tt.setBorder(border);
    tt.setMargin( 5, 5, 5, 5 );
    vfm.add(tt);
    add(vfm);

}





public class FieldLayout extends VerticalFieldManager{

    Bitmap a;


     public FieldLayout(long style, final int backgroundcolour, String msg,String time_) {
  //  FieldLayout(long style,final int backgroundcolour,final String msg, final String picture) {
        super(style);


    HorizontalFieldManager hfm = new HorizontalFieldManager(){
        public void paint(Graphics graphics) {
            graphics.setBackgroundColor(backgroundcolour);
            graphics.clear();
            super.paint(graphics);
        }
    };



    VerticalFieldManager vfm = new VerticalFieldManager(){
        public void paint(Graphics graphics) {
            graphics.setBackgroundColor(backgroundcolour);
            graphics.clear();
            super.paint(graphics);
        }
    };

    LabelField lf = new LabelField(msg, Field.FOCUSABLE){
        private XYRect xyrect=new XYRect();
        protected boolean navigationClick(int status, int time){
            Application.getApplication().invokeLater(new Runnable(){
                public void run() {

                }
            });
                return true;
        }
    };
    lf.setPadding(0,0,0,3);
    vfm.add(lf);

   /* LabelField tim = new LabelField(time_, Field.FOCUSABLE){
        private XYRect xyrect=new XYRect();
        protected boolean navigationClick(int status, int time){
            Application.getApplication().invokeLater(new Runnable(){
                public void run() {

                }
            });
                return true;
        }
    };
    tim.setFont(Font.getDefault().derive( Font.PLAIN,5, Ui.UNITS_pt));
    tim.setPadding(3,3,0,0);
    vfm.add(tim);*/
    // set the pin point in the map 

    hfm.add(vfm);

    add(hfm);

    setPadding(0,0,0,0);
    setMargin(0, 0, 0, 0);
}


protected void paintBackground(Graphics g){
    int oldColor = g.getColor();
    try {
        g.setColor(0xE0E0E0);

    } finally {
        g.setColor(oldColor);
    }
}


}
Rince Thomas
  • 4,158
  • 5
  • 25
  • 44
  • I have tried the above code, but still the bubble repeats itself if the text content height increases. So I thought of doing something like this LabelField lf = new LabelField("enter long text here "); final Border chatBorder = BorderFactory.createRoundedBorder(new XYEdges(16, 16, 27, 23), Color.BLUEVIOLET, Border.STYLE_FILLED); lf.setBorder(chatBorder); Here I get the rounded bubble as desired, only problem is that of the arrow image, I think I have to find a way to append that arrow image to this border. Can It be done? – Hades Jun 11 '12 at 06:15