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
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){
if(init == false){
- collectionsRequest += locale + "/OrgTree.js";
init = true;
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
GlobalConfigs.httpAddress = preferences.getString("library_url", "");
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();
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;
+ }
}
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;
@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);
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);
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();
//init here globals,
//TODO in future do a splash screen (loading data)
- GlobalConfigs globalConfigs = GlobalConfigs.getGlobalConfigs(this);
}
/**
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> {
// 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
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
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