New Member
Join Date: Dec 2008
Model: storm
PIN: N/A
Carrier: AT&T
Posts: 1
|
status pane(footer) updation
Please Login to Remove!
Hi,
I tried to develop the screen with status pane that has tab(kind of Buttons) structured buttons whihc should scroll when pressed left or right.
when I pressed right scroll button the status pane should update with new buttons in the same active screen but I am not able to achieve this...
Could any one help me out.....
the following code used to draw the footer on main screen.
I am using Multialign named custom button whcih uses image on and imag off images.
gethfm is the method which returns the whole buttons as tabbed footer....
Now I am not able to scroll...i mean not able to define the action for right scrolled button.
Please can some one help me how to set the custom footer in mainscreen.
package com.qualcomm.firethorn.poc.rdc.midlet.ui;
import com.qualcomm.firethorn.poc.rdc.midlet.MobileWallet ;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.HorizontalFieldMan ager;
import net.rim.device.api.ui.container.VerticalFieldManag er;
public class FooterTab extends Manager implements Runnable, FieldChangeListener {
public Bitmap bkgrnd = Bitmap.getBitmapResource("img/appBkg.png");
public Bitmap headerBmp = Bitmap.getBitmapResource("img/BK005Row.png");
public static Bitmap tabRow = Bitmap.getBitmapResource("img/tabRow.png");
public static Bitmap tabArrowLeft = Bitmap.getBitmapResource("img/tabArrowLeft.png");
public static Bitmap tabArrowLeftOff = Bitmap.getBitmapResource("img/tabArrowLeft-Off.png");
public static Bitmap tabArrowRightOff = Bitmap.getBitmapResource("img/tabArrowRight-Off.png");
public static Bitmap tabArrowRight = Bitmap.getBitmapResource("img/tabArrowRight.png");
private boolean oneShift= true;
//accounts images
public static Bitmap tabAccountsoff = Bitmap.getBitmapResource("img/tabAccounts-off.png");
public static Bitmap tabAccounts = Bitmap.getBitmapResource("img/tabAccounts.png");
//buy now images
public static Bitmap tabBuyNow = Bitmap.getBitmapResource("img/tabBuyNow.png");
public static Bitmap tabBuyNowOff = Bitmap.getBitmapResource("img/tabBuyNow-off.png");
//offers images
public static Bitmap tabOffers = Bitmap.getBitmapResource("img/tabOffers.png");
public static Bitmap tabOffersOff = Bitmap.getBitmapResource("tabOffers-off.png");
// coupans image
public static Bitmap tabE = Bitmap.getBitmapResource("img/tab-E.png");
public static Bitmap tabEOff = Bitmap.getBitmapResource("img/tab-E-off.png");
// Receipts image
public static Bitmap Receipts = Bitmap.getBitmapResource("img/tab_Receipts.png");
public static Bitmap ReceiptsOff = Bitmap.getBitmapResource("img/tab-BLUE_Receipts.png");
// My Profile image
public static Bitmap profile = Bitmap.getBitmapResource("img/tab_MyProfile.png");
public static Bitmap profileOff = Bitmap.getBitmapResource("img/tab-BLUE_MyProfile.png");
// providers image
public static Bitmap providers = Bitmap.getBitmapResource("img/tab_Providers.png");
public static Bitmap providersOff = Bitmap.getBitmapResource("img/tab-BLUE_Providers.png");
// where image
public static Bitmap where = Bitmap.getBitmapResource("img/tab_Where.png");
public static Bitmap whereOff = Bitmap.getBitmapResource("img/tab-BLUE_Where.png");
// carrier image
public static Bitmap carrier = Bitmap.getBitmapResource("img/tab_Carrier.png");
public static Bitmap carrierOff = Bitmap.getBitmapResource("img/tab-BLUE_Carrier.png");
// purchases image
public static Bitmap purchases = Bitmap.getBitmapResource("img/tab_Purchases.png");
public static Bitmap purchasesOff = Bitmap.getBitmapResource("img/tab-BLUE_Purchases.png");
// messages image
public static Bitmap messages = Bitmap.getBitmapResource("img/tab_Messages.png");
public static Bitmap messagesOff = Bitmap.getBitmapResource("img/tab-BLUE_Messages.png");
// send money image
public static Bitmap sendmoney = Bitmap.getBitmapResource("img/tab_SendMoney.png");
public static Bitmap sendmoneyOff = Bitmap.getBitmapResource("img/tab-BLUE_SendMoney.png");
private BigButtonField leftBtn,rightBtn,tab1,tab2,tab3,tab4;
private BigButtonField tabLeftOff,tabRightOff,buyNowOff,tabOff,taboffersO ff,tabaccountsOff;
private BigButtonField sendmoneyButton,messagesButton,purchasesButton,car rierButton,whereButton,providersButton,profileButt on,ReceiptsButton;
private BigButtonField[] tabButtons;
//
private VerticalFieldManager vfm1 = new VerticalFieldManager();
private VerticalFieldManager vfm2 = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_HORIZONTAL_SCROLLBAR){
protected void sublayout(int width, int height) {
width = tabBuyNowOff.getWidth();
height= tabArrowLeft.getHeight();
System.out.println("width vfm2---->"+width+"height--->"+height);
super.sublayout(width, height);
}
};
private VerticalFieldManager vfm3 = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_HORIZONTAL_SCROLLBAR){
protected void sublayout(int width, int height) {
width = tabBuyNowOff.getWidth()+tabArrowLeft.getWidth();
height= tabArrowLeft.getHeight();
System.out.println("width vfm3---->"+width+"height--->"+height);
super.sublayout(width, height);
}
};
private VerticalFieldManager vfm4 = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_HORIZONTAL_SCROLLBAR){
protected void sublayout(int width, int height) {
width = tabOff.getWidth()+buyNowOff.getWidth()+tabArrowLef t.getWidth();
height= tabArrowLeft.getHeight();
System.out.println("width vfm4---->"+width+"height--->"+height);
super.sublayout(width, height);
}
};
private VerticalFieldManager vfm5= new VerticalFieldManager(Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_HORIZONTAL_SCROLLBAR){
protected void sublayout(int width, int height) {
width = tabaccountsOff.getWidth()+tabOff.getWidth()+buyNow Off.getWidth()+tabArrowLeft.getWidth();
height= tabArrowLeft.getHeight();
System.out.println("width vfm5---->"+width+"height--->"+height);
super.sublayout(width, height);
}
};
private VerticalFieldManager vfm6= new VerticalFieldManager(Manager.NO_VERTICAL_SCROLLBAR | Manager.NO_HORIZONTAL_SCROLLBAR){
protected void sublayout(int width, int height) {
width = taboffersOff.getWidth()+tabaccountsOff.getWidth()+ tabOff.getWidth()+buyNowOff.getWidth()+tabArrowLef t.getWidth();
height= tabArrowLeft.getHeight();
System.out.println("width vfm6---->"+width+"height--->"+height);
super.sublayout(width, height);
}
};
private HorizontalFieldManager hfm = new HorizontalFieldManager(HorizontalFieldManager.NO_H ORIZONTAL_SCROLL
| HorizontalFieldManager.NO_VERTICAL_SCROLL | HorizontalFieldManager.USE_ALL_WIDTH ){
public void paint(Graphics graphics)
{
System.out.println("-----------------Painting the HFM --------------------");
//Draw the background image and then call paint.
graphics.drawBitmap(0, 0, MobileWallet.WIDTH, tabRow.getHeight(), tabRow, 0, 0);
//super.paintChild(graphics, this);
super.paint(graphics);
}
};
public FooterTab(IStatusListener listener){
super(Manager.NO_VERTICAL_SCROLLBAR & Manager.NO_HORIZONTAL_SCROLLBAR);
_listener = listener;
tabLeftOff = new BigButtonField("",tabArrowLeft,tabArrowLeftOff,0);
buyNowOff = new BigButtonField("",tabBuyNowOff,tabBuyNow,0); //
tabOff = new BigButtonField("",tabEOff,tabE,0); //
tabaccountsOff = new BigButtonField("",tabAccountsoff,tabAccounts,0); //tabaccountsOff
taboffersOff = new BigButtonField("",tabOffersOff,tabOffers,0); //taboffersOff
sendmoneyButton = new BigButtonField("",sendmoneyOff,sendmoney,0); // sendmoneyButton
messagesButton = new BigButtonField("",messagesOff,messages,0); //
purchasesButton = new BigButtonField("",purchasesOff,purchases,0); //
carrierButton = new BigButtonField("",carrierOff,carrier,0); //
whereButton = new BigButtonField("",whereOff,where,0); //
providersButton = new BigButtonField("",providersOff,providers,0); //
profileButton = new BigButtonField("",profileOff,profile,0); //
ReceiptsButton = new BigButtonField("",ReceiptsOff,Receipts,0); //
tabRightOff = new BigButtonField("",tabArrowRight,tabArrowRightOff,t aboffersOff.getWidth()+tabaccountsOff.getWidth()+t abOff.getWidth()+buyNowOff.getWidth()+tabLeftOff.g etWidth());
tabButtons = new BigButtonField[]{buyNowOff,
tabOff,taboffersOff,tabaccountsOff, sendmoneyButton,messagesButton,purchasesButton,car rierButton,whereButton,providersButton,profileButt on,ReceiptsButton};
tabLeftOff.setChangeListener(this);
buyNowOff.setChangeListener(this);
tabOff.setChangeListener(this);
tabaccountsOff.setChangeListener(this);
taboffersOff.setChangeListener(this);
tabRightOff.setChangeListener(this);
sendmoneyButton.setChangeListener(this);
messagesButton.setChangeListener(this);
purchasesButton.setChangeListener(this);
carrierButton.setChangeListener(this);
whereButton.setChangeListener(this);
providersButton.setChangeListener(this);
profileButton.setChangeListener(this);
ReceiptsButton.setChangeListener(this);
setTab1(tabButtons[0]);
setTab2(tabButtons[1]);
setTab3(tabButtons[2]); //default buttons
setTab4(tabButtons[3]); }
public void assignBtn(int index){
//
}
public HorizontalFieldManager getHfm() {
vfm1.add(tabLeftOff);
vfm2.add(getTab1());
vfm3.add(getTab2());
vfm4.add(getTab3());
vfm5.add(getTab4());
vfm6.add(tabRightOff);
hfm.add(vfm1);
hfm.add(vfm2);
hfm.add(vfm3);
hfm.add(vfm4);
hfm.add(vfm5);
hfm.add(vfm6);
return hfm;
}
protected void sublayout(int arg0, int arg1) {
// TODO Auto-generated method stub
}
public void fieldChanged(Field field, int context) {
if (tabLeftOff == field ) {
Dialog.alert("PRessed Left button to scroll");
}else if (buyNowOff == field ) {
Dialog.alert("PRessed buyNowOff ");
}else if (tabaccountsOff == field ) {
Dialog.alert("PRessed Accounts ");
}else if (taboffersOff == field) {
Dialog.alert("PRessed Offers ");
}else if (field ==tabaccountsOff ) {
Dialog.alert("PRessed Accounts ");
}else if (field ==tabaccountsOff ) {
Dialog.alert("PRessed Accounts ");
}else if (field ==tabRightOff ) {
deleteAll();
for(int i=0; i < tabButtons.length;i++){
if(tabButtons[i]== tab4 && oneShift){
System.out.println("-----------------Found tab4-------------");
setTab1(tab2);
setTab2(tab3);
setTab3(tab4);
setTab4(tabButtons[i+1]);
oneShift = false;
/*tab1 = tab2;
tab2=tab3;
tab3 =tab4;
tab4 = tabButtons[i+1];*/
} }
_listener.onResponseReceived(getHfm());
}else if (field ==tabOff ) {
Dialog.alert("PRessed F tab ");
}
}
public BigButtonField getTab1() {
return tab1;
}
public void setTabs(){
// setTab1()
}
public void setTab1(BigButtonField tab1) {
this.tab1 = tab1;
}
public BigButtonField getTab2() {
return tab2;
}
public void setTab2(BigButtonField tab2) {
this.tab2 = tab2;
}
public BigButtonField getTab3() {
return tab3;
}
public void setTab3(BigButtonField tab3) {
this.tab3 = tab3;
}
public BigButtonField getTab4() {
return tab4;
}
public void setTab4(BigButtonField tab4) {
this.tab4 = tab4;
}
public void run() {
//getHfm();
_listener.onResponseReceived(getHfm());
}
private IStatusListener _listener;
}
|