From 70f58afa0599511cd66ac96adeaa0cde04c1d758 Mon Sep 17 00:00:00 2001 From: drizea Date: Tue, 17 Jul 2012 18:52:56 +0300 Subject: [PATCH] org name for copy information and splash screen file load --- .../src/Android/res/layout/activity_splash.xml | 3 +- .../evergreen/android/globals/GlobalConfigs.java | 23 +++++++------ .../android/utils/ui/BasicDetailsFragment.java | 8 ++++- .../android/views/ApplicationPreferences.java | 2 +- .../android/views/MainScreenDashboard.java | 1 - .../android/views/splashscreen/LoadingTask.java | 39 ++++++++++++++++------ .../android/views/splashscreen/SplashActivity.java | 9 ++++- 7 files changed, 59 insertions(+), 26 deletions(-) diff --git a/Open-ILS/src/Android/res/layout/activity_splash.xml b/Open-ILS/src/Android/res/layout/activity_splash.xml index 376e010294..46f20a4224 100644 --- a/Open-ILS/src/Android/res/layout/activity_splash.xml +++ b/Open-ILS/src/Android/res/layout/activity_splash.xml @@ -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" /> \ No newline at end of file diff --git a/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java b/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java index be96aa2345..b3d0e0972c 100644 --- a/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java +++ b/Open-ILS/src/Android/src/org/evergreen/android/globals/GlobalConfigs.java @@ -44,7 +44,7 @@ public class GlobalConfigs { public ArrayList 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 { @@ -15,14 +21,21 @@ public class LoadingTask extends AsyncTask { // 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 { 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 diff --git a/Open-ILS/src/Android/src/org/evergreen/android/views/splashscreen/SplashActivity.java b/Open-ILS/src/Android/src/org/evergreen/android/views/splashscreen/SplashActivity.java index 8b265d393f..cb056b3fff 100644 --- a/Open-ILS/src/Android/src/org/evergreen/android/views/splashscreen/SplashActivity.java +++ b/Open-ILS/src/Android/src/org/evergreen/android/views/splashscreen/SplashActivity.java @@ -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 -- 2.11.0