org name for copy information and splash screen file load
authordrizea <danielrizea27@gmail.com>
Tue, 17 Jul 2012 15:52:56 +0000 (18:52 +0300)
committerdrizea <danielrizea27@gmail.com>
Tue, 17 Jul 2012 15:52:56 +0000 (18:52 +0300)
Open-ILS/src/Android/res/layout/activity_splash.xml
Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java
Open-ILS/src/Android/src/org/evergreen/android/utils/ui/BasicDetailsFragment.java
Open-ILS/src/Android/src/org/evergreen/android/views/ApplicationPreferences.java
Open-ILS/src/Android/src/org/evergreen/android/views/MainScreenDashboard.java
Open-ILS/src/Android/src/org/evergreen/android/views/splashscreen/LoadingTask.java
Open-ILS/src/Android/src/org/evergreen/android/views/splashscreen/SplashActivity.java

index 376e010..46f20a4 100644 (file)
@@ -32,7 +32,6 @@
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_below="@id/logo"
-        android:layout_above="@id/activity_splash_progress_bar"
-        android:paddingTop="20dip"
+        android:paddingTop="10dip"
         />
 </RelativeLayout>
\ No newline at end of file
index be96aa2..b3d0e09 100644 (file)
@@ -44,7 +44,7 @@ public class GlobalConfigs {
        public ArrayList<Organisation> organisations;
        
        /** The collections request. */
-       private String collectionsRequest = "/opac/common/js/";
+       private String collectionsRequest = "/opac/common/js/" + locale + "/OrgTree.js";
        
        
        private GlobalConfigs(Context context){
@@ -68,7 +68,6 @@ public class GlobalConfigs {
                
                if(init == false){
                        
-                       collectionsRequest += locale + "/OrgTree.js";
                        init = true;
                        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
                        GlobalConfigs.httpAddress = preferences.getString("library_url", "");
@@ -95,14 +94,7 @@ public class GlobalConfigs {
                                getCopyStatusesAvailable((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE));
                                
                                AccountAccess.setAccountInfo(preferences.getString("username", ""), preferences.getString("password", ""));
-                               
-                               
-                               //authenticate
-                               AccountAccess ac = AccountAccess.getAccountAccess(GlobalConfigs.httpAddress,(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE));
-                               try{
-                                       ac.authenticate();
-                               }catch(Exception e){}
-                               
+
                                //TODO getorg hidding levels
                                //getOrgHiddentDepth();
                                
@@ -341,4 +333,15 @@ public class GlobalConfigs {
                        return date;
        }
        
+       public String getOrganizationName(int id){
+               
+               for(int i=0;i<organisations.size();i++){
+                       System.out.println("Id " + organisations.get(i).id + " " + i);
+                       if(organisations.get(i).id == id)
+                               return organisations.get(i).name;
+               }
+               
+               System.out.println("out here");
+               return null;
+       }
 }
index 948c08e..6ba151d 100644 (file)
@@ -5,6 +5,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import org.evergreen.android.R;
+import org.evergreen.android.globals.GlobalConfigs;
 import org.evergreen.android.searchCatalog.CopyInformation;
 import org.evergreen.android.searchCatalog.RecordInfo;
 
@@ -60,6 +61,9 @@ public class BasicDetailsFragment extends Fragment{
            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            
+               
+               GlobalConfigs gl = GlobalConfigs.getGlobalConfigs(getActivity());
+               
                LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.record_details_basic_fragment, null);
 
                record_header = (TextView) layout.findViewById(R.id.record_header_text);
@@ -96,7 +100,9 @@ public class BasicDetailsFragment extends Fragment{
                                TextView call_number = (TextView) copy_info_view.findViewById(R.id.copy_information_call_number);
                                TextView copy_location = (TextView) copy_info_view.findViewById(R.id.copy_information_copy_location);
 
-                               library.setText(record.copyInformationList.get(i).org_id+"");
+                       
+                               
+                               library.setText(gl.getOrganizationName(record.copyInformationList.get(i).org_id) + " ");
                                call_number.setText(record.copyInformationList.get(i).call_number_sufix);
                                copy_location.setText(record.copyInformationList.get(i).copy_location);
                                
index 9d7fec3..d0d73a5 100644 (file)
@@ -189,7 +189,7 @@ public class ApplicationPreferences extends PreferenceActivity implements OnShar
                                                                GlobalConfigs sg = GlobalConfigs.getGlobalConfigs(context);
                                                                sg.loadIDLFile();
                                                                sg.getOrganisations();
-                                                               
+                                                               sg.getCopyStatusesAvailable((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE));
                                                                runOnUiThread(new Runnable() {
                                                                        public void run() {
                                                                                progressDialog.dismiss();
index 5473e9a..8f89e51 100644 (file)
@@ -33,7 +33,6 @@ public class MainScreenDashboard extends Activity {
                //init here globals, 
                //TODO in future do a splash screen (loading data)
                
-               GlobalConfigs globalConfigs = GlobalConfigs.getGlobalConfigs(this);
        }
 
        /**
index 2854f21..77217f8 100644 (file)
@@ -1,8 +1,14 @@
 package org.evergreen.android.views.splashscreen;
 
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.globals.GlobalConfigs;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
 import android.os.AsyncTask;
 import android.util.Log;
 import android.widget.ProgressBar;
+import android.widget.TextView;
 
 public class LoadingTask extends AsyncTask<String, Integer, Integer> {
 
@@ -15,14 +21,21 @@ public class LoadingTask extends AsyncTask<String, Integer, Integer> {
        // This is the listener that will be told when this task is finished
        private final LoadingTaskFinishedListener finishedListener;
 
+       private Context context;
+       
+       private TextView progressText;
+       
+       private String text;
        /**
         * A Loading task that will load some resources that are necessary for the app to start
         * @param progressBar - the progress bar you want to update while the task is in progress
         * @param finishedListener - the listener that will be told when this task is finished
         */
-       public LoadingTask(ProgressBar progressBar, LoadingTaskFinishedListener finishedListener) {
+       public LoadingTask(ProgressBar progressBar, LoadingTaskFinishedListener finishedListener, Context context, TextView progressText) {
                this.progressBar = progressBar;
                this.finishedListener = finishedListener;
+               this.context = context;
+               this.progressText = progressText;
        }
 
        @Override
@@ -45,21 +58,27 @@ public class LoadingTask extends AsyncTask<String, Integer, Integer> {
        private void downloadResources() {
                // We are just imitating some process thats takes a bit of time (loading of resources / downloading)
                int count = 10;
-               for (int i = 0; i < count; i++) {
-
-                       // Update the progress bar after every step
-                       int progress = (int) ((i / (float) count) * 100);
-                       publishProgress(progress);
-
-                       // Do some long loading things
-                       try { Thread.sleep(1000); } catch (InterruptedException ignore) {}
-               }
+               text = "download files";
+               publishProgress(50);
+               
+               GlobalConfigs gl = GlobalConfigs.getGlobalConfigs(context);
+               text = "authenticate user";
+               publishProgress(70);
+               
+               AccountAccess ac = AccountAccess.getAccountAccess(GlobalConfigs.httpAddress,(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE));
+               try{
+                       ac.authenticate();
+               }catch(Exception e){}
+               text = "loading application";
+               publishProgress(100);
+               
        }
 
        @Override
        protected void onProgressUpdate(Integer... values) {
                super.onProgressUpdate(values);
                progressBar.setProgress(values[0]); // This is ran on the UI thread so it is ok to update our progress bar ( a UI view ) here
+               progressText.setText(text);
        }
 
        @Override
index 8b265d3..cb056b3 100644 (file)
@@ -10,18 +10,25 @@ import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.widget.ProgressBar;
+import android.widget.TextView;
 
 public class SplashActivity extends Activity implements LoadingTaskFinishedListener {
 
+       
+       private TextView progressText;
+       
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         // Show the splash screen
         setContentView(R.layout.activity_splash);
+        
+        progressText = (TextView) findViewById(R.id.action_in_progress);
+        
         // Find the progress bar
         ProgressBar progressBar = (ProgressBar) findViewById(R.id.activity_splash_progress_bar);
         // Start your loading
-        new LoadingTask(progressBar, this).execute("www.google.co.uk"); // Pass in whatever you need a url is just an example we don't use it in this tutorial
+        new LoadingTask(progressBar, this, this, progressText).execute("download"); // Pass in whatever you need a url is just an example we don't use it in this tutorial
     }
 
     // This is the callback for when your async task has finished