← Back to team overview

dhis-mobile-devs team mailing list archive

[Branch ~dhis-mobile-devs/dhis-mobile/lwuit-tracking] Rev 189: code clean up (WIP)

 

------------------------------------------------------------
revno: 189
committer: Long <Long@Long-Laptop>
branch nick: lwuit-tracking
timestamp: Tue 2013-11-19 10:19:28 +0700
message:
  code clean up (WIP)
modified:
  src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java
  src/org/hisp/dhis/mobile/view/LoginView.java
  src/org/hisp/dhis/mobile/view/PinView.java
  src/org/hisp/dhis/mobile/view/TrackingMainMenuView.java


--
lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking
https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking

Your team DHIS mobile developers is subscribed to branch lp:~dhis-mobile-devs/dhis-mobile/lwuit-tracking.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis-mobile-devs/dhis-mobile/lwuit-tracking/+edit-subscription
=== modified file 'src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java'
--- src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java	2013-09-24 07:30:18 +0000
+++ src/org/hisp/dhis/mobile/connection/task/DownloadAllResourceTask.java	2013-11-19 03:19:28 +0000
@@ -36,7 +36,7 @@
     extends AbstractTask
 {
     private MobileModel mobileModel = new MobileModel();
-    
+
     private Vector orgUnitVector;
 
     public DownloadAllResourceTask( Vector orgUnitVector )
@@ -56,25 +56,9 @@
 
         DHISMIDlet.setDownloading( false );
 
-        /*if ( ConnectionManager.getDhisMIDlet() instanceof FacilityMIDlet )
-        {
-            FacilityMIDlet facilityMidlet = (FacilityMIDlet) ConnectionManager.getDhisMIDlet();
-            if ( orgUnitVector.size() > 1 )
-            {
-                facilityMidlet.getOrgUnitSelectView().setOrgUnitVector( orgUnitVector );
-                facilityMidlet.getOrgUnitSelectView().showView();
-            }
-            else
-            {
-                facilityMidlet.setCurrentOrgUnit( (OrgUnit) orgUnitVector.elementAt( 0 ) );
-                facilityMidlet.getDataSetListView().showView();
-            }
-        }
-        else*/ if ( ConnectionManager.getDhisMIDlet() instanceof NameBasedMIDlet )
-        {
-            NameBasedMIDlet nameBasedMIDlet = (NameBasedMIDlet) ConnectionManager.getDhisMIDlet();
-            nameBasedMIDlet.getTrackingMainMenuView().showView();
-        }
+        NameBasedMIDlet nameBasedMIDlet = (NameBasedMIDlet) ConnectionManager.getDhisMIDlet();
+        nameBasedMIDlet.getTrackingMainMenuView().showView();
+
     }
 
     private void processDownload( OrgUnit orgUnit )
@@ -85,16 +69,7 @@
         {
             inputStream = this.download();
             this.handleDownloadAllResource( inputStream );
-
-            /*if ( ConnectionManager.getDhisMIDlet() instanceof FacilityMIDlet )
-            {
-                DataSetRecordStore.saveDataSets( mobileWrapper.getDataSets(), orgUnit );
-                SMSCommandRecordStore.saveSMSCommands( mobileWrapper.getSmsCommands() );
-            }
-            else */if ( ConnectionManager.getDhisMIDlet() instanceof NameBasedMIDlet )
-            {
-                ProgramRecordStore.savePrograms( mobileModel.getPrograms() );
-            }
+            ProgramRecordStore.savePrograms( mobileModel.getPrograms() );
 
         }
         catch ( IOException e )
@@ -127,7 +102,7 @@
     {
         mobileModel.deSerialize( inputStream );
     }
-    
+
     public MobileModel getMobileModel()
     {
         return mobileModel;

=== modified file 'src/org/hisp/dhis/mobile/view/LoginView.java'
--- src/org/hisp/dhis/mobile/view/LoginView.java	2013-09-10 07:17:17 +0000
+++ src/org/hisp/dhis/mobile/view/LoginView.java	2013-11-19 03:19:28 +0000
@@ -78,12 +78,10 @@
         }
         catch ( RecordStoreNotFoundException e )
         {
-            // TODO Auto-generated catch block
             e.printStackTrace();
         }
         catch ( RecordStoreException e )
         {
-            // TODO Auto-generated catch block
             e.printStackTrace();
         }
         ConnectionManager.login();

=== modified file 'src/org/hisp/dhis/mobile/view/PinView.java'
--- src/org/hisp/dhis/mobile/view/PinView.java	2013-09-24 07:30:18 +0000
+++ src/org/hisp/dhis/mobile/view/PinView.java	2013-11-19 03:19:28 +0000
@@ -51,7 +51,7 @@
     extends AbstractView
     implements ActionListener
 {
-    private int Max_Pin_Size = 4;
+    private static final int MAX_PIN_SIZE = 4;
 
     private Form pinForm;
 
@@ -62,7 +62,7 @@
     private TextArea pinHint;
 
     private Button btnEnterPin;
-    
+
     private SettingRecordStore settingRecordStore;
 
     public PinView( DHISMIDlet dhisMIDlet )
@@ -149,7 +149,7 @@
             {
                 serverPhoneNumber = (String) props.get( "server.phonenumber" );
             }
-            
+
             settingRecordStore.put( SettingRecordStore.SERVER_URL, dhisMIDlet.getLoginView()
                 .getLoginServerUrlTextField().getText() );
             settingRecordStore.put( SettingRecordStore.USERNAME, dhisMIDlet.getLoginView().getLoginUserNameTextField()
@@ -180,40 +180,19 @@
         }
         else
         {
-            /*if ( dhisMIDlet instanceof FacilityMIDlet )
-            {
-                FacilityMIDlet facilityMidlet = (FacilityMIDlet) dhisMIDlet;
-                facilityMidlet.getDataSetListView().prepareView();
-                facilityMidlet.getDataSetListView().showView();
-            }
-            else*/
-            {
-                NameBasedMIDlet namebasedMIDlet = (NameBasedMIDlet) dhisMIDlet;
-                namebasedMIDlet.getTrackingMainMenuView().showView();
-            }
+            NameBasedMIDlet namebasedMIDlet = (NameBasedMIDlet) dhisMIDlet;
+            namebasedMIDlet.getTrackingMainMenuView().showView();
         }
     }
 
     public void update()
         throws RecordStoreException
     {
-        
-        /*if ( this.dhisMIDlet instanceof FacilityMIDlet )
-        {
-            ConnectionManager.init( dhisMIDlet, "",
-                settingRecordStore.get( SettingRecordStore.USERNAME ),
-                settingRecordStore.get( SettingRecordStore.PASSWORD ), DHISMIDlet.DEFAULT_LOCALE, null );
-            FacilityMIDlet facilityMidlet = (FacilityMIDlet) dhisMIDlet;
-            ConnectionManager.updateDataSet();
-            facilityMidlet.getDataSetListView().showView();
-        }
-        else*/ if ( this.dhisMIDlet instanceof NameBasedMIDlet )
-        {
-            ConnectionManager.init( dhisMIDlet, "",
-                settingRecordStore.get( SettingRecordStore.USERNAME ),
-                settingRecordStore.get( SettingRecordStore.PASSWORD ), DHISMIDlet.DEFAULT_LOCALE, null );
-            //DHISMIDlet.setDownloading( true );
-            ((NameBasedMIDlet)dhisMIDlet).getTrackingMainMenuView().showView();
+        if ( this.dhisMIDlet instanceof NameBasedMIDlet )
+        {
+            ConnectionManager.init( dhisMIDlet, "", settingRecordStore.get( SettingRecordStore.USERNAME ),
+                settingRecordStore.get( SettingRecordStore.PASSWORD ), DHISMIDlet.DEFAULT_LOCALE, null );
+            ((NameBasedMIDlet) dhisMIDlet).getTrackingMainMenuView().showView();
         }
     }
 
@@ -262,7 +241,7 @@
         if ( pinFormTextField == null )
         {
             pinFormTextField = new TextField();
-            pinFormTextField.setMaxSize( Max_Pin_Size );
+            pinFormTextField.setMaxSize( MAX_PIN_SIZE );
             pinFormTextField.setConstraint( TextField.NUMERIC );
             pinFormTextField.setInputModeOrder( new String[] { "123" } );
         }
@@ -293,7 +272,7 @@
     {
         if ( ae.getCommand().getCommandName().equals( "Reinit" ) )
         {
-            //checkPin();
+            // checkPin();
         }
         else
         {

=== modified file 'src/org/hisp/dhis/mobile/view/TrackingMainMenuView.java'
--- src/org/hisp/dhis/mobile/view/TrackingMainMenuView.java	2013-11-12 08:06:45 +0000
+++ src/org/hisp/dhis/mobile/view/TrackingMainMenuView.java	2013-11-19 03:19:28 +0000
@@ -135,17 +135,6 @@
                     ConnectionManager.getAllAnonymousProgram( "1", true );
                 }
             }
-            /*
-             * else if ( nextPageName.equals( "Anonymous" ) ) { if (
-             * sizeOfOrgUnits > 1 ) {
-             * nameBasedMidlet.getWaitingView().showView();
-             * nameBasedMidlet.getOrgUnitSelectView().setProgramType( "3" );
-             * nameBasedMidlet.getOrgUnitSelectView().setLostToFollowUp( false
-             * ); nameBasedMidlet.getOrgUnitSelectView().showView(); } else {
-             * ConnectionManager.setUrl(
-             * nameBasedMidlet.getCurrentOrgUnit().getDownloadAnonymousProgramUrl
-             * () ); ConnectionManager.getAllAnonymousProgram( "3", false ); } }
-             */
             else if ( nextPageName.equals( "History" ) )
             {
                 ModelList modelList = PatientRecordStore.getCurrentPatients();
@@ -162,7 +151,6 @@
 
         catch ( Exception e )
         {
-            // TODO Auto-generated catch block
             e.printStackTrace();
         }
     }