GetJedi/app/src/main/java/edu/getjedi/frontend/mobile/state/ProfessionalLoggedState.java
private void init(final AppContext context) {
        context.getScreen().setMenuItems(new String[]{context.getUser().getFirstName() + " " + context.getUser().getLastName(), StringTable.PROFESSIONAL," ", StringTable.OFFER_TITLE, StringTable.LOGOFF});
        user = context.getUser();
        timer = new Handler();
        this.context = context;
        timer.postDelayed(new Runnable() {
            @Override
            public void run() {
                if(user != null && user.getCoordinates() != null) {
                    context.getScreen().getHttpHandler().makeRequestForObject(new String[]{"updateLocation",
                            user.getId(),
                            Double.toString(user.getCoordinates().latitude),
                            Double.toString(user.getCoordinates().longitude)});
                }
                if(user != null){
                    context.getScreen().getHttpHandler().makeRequestForArray(new String[]{"getOpenedJobs",
                            user.getId()});
                }
                if (context.getState() instanceof ProfessionalLoggedState) {
                    timer.postDelayed(this, context.getUpdateInterval());
                }
            }
        }, context.getUpdateInterval());
    }
/**
     * Initializes this state.
     * This state sends to the server the user location for every context.getUpdateInterval() miliseconds, and also
     * queries for job proposals made by clients. Responses received in performAction, as the action object.
     * Changes the left menu content to show the options available for a Professional.
     */
Initializes this state.
This state sends to the server the user location for every context.getUpdateInterval() miliseconds, and also
queries for job proposals made by clients. Responses received in performAction, as the action object.
Changes the left menu content to show the options available for a Professional.
Initializes this state . This state sends to the server the user location for every context . getUpdateInterval () miliseconds and also queries for job proposals made by clients . Responses received in performAction as the action object . Changes the left menu content to show the options available for a Professional .
private void init(final AppContext context) {
        context.getScreen().setMenuItems(new String[]{context.getUser().getFirstName() + " " + context.getUser().getLastName(), StringTable.PROFESSIONAL," ", StringTable.OFFER_TITLE, StringTable.LOGOFF});
        user = context.getUser();
        timer = new Handler();
        this.context = context;
        timer.postDelayed(new Runnable() {
            @Override
            public void run() {
                if(user != null && user.getCoordinates() != null) {
                    context.getScreen().getHttpHandler().makeRequestForObject(new String[]{"updateLocation",
                            user.getId(),
                            Double.toString(user.getCoordinates().latitude),
                            Double.toString(user.getCoordinates().longitude)});
                }
                if(user != null){
                    context.getScreen().getHttpHandler().makeRequestForArray(new String[]{"getOpenedJobs",
                            user.getId()});
                }
                if (context.getState() instanceof ProfessionalLoggedState) {
                    timer.postDelayed(this, context.getUpdateInterval());
                }
            }
        }, context.getUpdateInterval());
    }
private void init ( final AppContext context ) { context . getScreen ( ) . setMenuItems ( new String [ ] { context . getUser ( ) . getFirstName ( ) + " " + context . getUser ( ) . getLastName ( ) , StringTable . PROFESSIONAL , " " , StringTable . OFFER_TITLE , StringTable . LOGOFF } ) ; user = context . getUser ( ) ; timer = new Handler ( ) ; this . context = context ; timer . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { if ( user != null && user . getCoordinates ( ) != null ) { context . getScreen ( ) . getHttpHandler ( ) . makeRequestForObject ( new String [ ] { "updateLocation" , user . getId ( ) , Double . toString ( user . getCoordinates ( ) . latitude ) , Double . toString ( user . getCoordinates ( ) . longitude ) } ) ; } if ( user != null ) { context . getScreen ( ) . getHttpHandler ( ) . makeRequestForArray ( new String [ ] { "getOpenedJobs" , user . getId ( ) } ) ; } if ( context . getState ( ) instanceof ProfessionalLoggedState ) { timer . postDelayed ( this , context . getUpdateInterval ( ) ) ; } } } , context . getUpdateInterval ( ) ) ; }
Initializes this state.
Initializes this state .