<activity android:name="org.evergreen.android.views.ApplicationPreferences"></activity>
+ <!-- First launch configuration activity -->
+ <activity
+ android:name="org.evergreen.android.views.ConfigureApplicationActivity"
+ ></activity>
<!-- Search -->
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient
+ android:startColor="#378f71"
+ android:centerColor="#378f71"
+ android:endColor="#378f71"
+ android:angle="270"/>
+ <corners android:radius="5dp" />
+</shape>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Bottom 2dp Shadow -->
+ <item>
+ <shape android:shape="rectangle">
+ <gradient
+ android:startColor="#000"
+ android:centerColor="#42b8cd"
+ android:endColor="#000"
+ />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:fillViewport="true">
+ <RelativeLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:background="#ffffff">
+
+ <!-- Header Starts-->
+ <LinearLayout android:id="@+id/header"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/header_gradient"
+ android:paddingTop="5dip"
+ android:paddingBottom="5dip">
+ <!-- Logo Start-->
+ <ImageView android:src="@drawable/evergreen_logo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dip"/>
+ <!-- Logo Ends -->
+ </LinearLayout>
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/first_config_message"
+ android:textColor="#372c24"
+ android:id="@+id/first_launch_test_message"
+ android:layout_below="@id/header"
+ android:layout_marginLeft="10dp"
+ android:layout_marginTop="10dp"
+ />
+ <!-- Header Ends -->
+ <!-- Footer Start -->
+
+ <!-- Footer Ends -->
+
+ <!-- Login Form -->
+ <LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="10dip"
+ android:layout_below="@id/first_launch_test_message">
+ <!-- Email Label -->
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#372c24"
+ android:textStyle="bold"
+ android:text="@string/server_name"/>
+ <EditText
+ android:id="@+id/server_http_adress"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dip"
+ android:text="http://"
+ android:singleLine="true"/>
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#372c24"
+ android:text="@string/username"
+ android:textStyle="bold"/>
+ <EditText
+ android:id="@+id/username"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dip"
+ android:singleLine="true"/>
+ <!-- Password Label -->
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textColor="#372c24"
+ android:text="@string/password"
+ android:textStyle="bold"
+ />
+ <EditText
+ android:id="@+id/password"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dip"
+ android:singleLine="true"
+ android:password="true"/>
+ <!-- Login button -->
+ <Button
+ android:id="@+id/connect_button"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:text="@string/connect_button"/>
+ <!-- Link to Registration Screen -->
+
+
+ </LinearLayout>
+ <!-- Login Form Ends -->
+ </RelativeLayout>
+</ScrollView>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <TableLayout
- android:id="@+id/credentials"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
- >
-
- <TableRow
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- >
- <TextView
- android:layout_width = "wrap_content"
- android:layout_height = "wrap_content"
- android:text = "@string/server_name_dialog"
- />
-
- <EditText
- android:id="@+id/server_http_adress"
- android:layout_width="200dip"
- android:layout_height="wrap_content"
- android:hint="@string/server_name_dialog"
- />
-
- </TableRow>
- <TableRow
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- >
- <TextView
- android:layout_width = "wrap_content"
- android:layout_height = "wrap_content"
- android:text = "@string/username"
- />
-
- <EditText
- android:id="@+id/username"
- android:layout_width="200dip"
- android:layout_height="wrap_content"
- android:hint="@string/username"
- />
-
- </TableRow>
- <TableRow
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- >
- <TextView
- android:layout_width = "wrap_content"
- android:layout_height = "wrap_content"
- android:text = "@string/password"
- />
-
- <EditText
- android:id="@+id/password"
- android:layout_width="200dip"
- android:layout_height="wrap_content"
- android:password="true"
- />
-
- </TableRow>
- </TableLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_below="@id/credentials"
- android:layout_centerHorizontal="true"
- >
- <Button
- android:id="@+id/cancel_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/cancel"
- />
- <Button
- android:id="@+id/connect_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/connect_button"
- />
-
- </LinearLayout>
-
-
-</RelativeLayout>
\ No newline at end of file
android:id="@+id/search_results_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
+ android:divider="@drawable/list_view_separator"
+ android:dividerHeight="1dp"
android:layout_below="@id/search_text" >
</ListView>
<string name="bookbag_items_title">bookbags</string>
<string name="bookbag_details_title">bookbag details</string>
<string name="fines_title">fines</string>
+ <string name="copy_information_title">copy information</string>
<string name="button_place_hold">Place Hold</string>
<string name="button_add_to_bookbag">Add to Bookbag</string>
- <string name="server_name_dialog">http:// </string>
- <string name="username">username : </string>
- <string name="password">password : </string>
+
<string name="bookbag_choose_text">Choose a bookbag from the list.</string>
+ <!-- first config activity -->
+
+ <string name="first_config_message">Please enter the Evergreen server url, username and password of your account.</string>
+ <string name="server_name">EG server:</string>
+ <string name="username">Username: </string>
+ <string name="password">Password: </string>
+
+
<string name="cancel_button">cancel</string>
<string name="connect_button">connect</string>
<string name="hold_phone_hint">Contact phone number</string>
<string name="hold_expire_time_hint">Hold expire time</string>
<string name="hold_thaw_date_hint">Date when the hold is frozen</string>
+
<!-- Fines Activity -->
<string name="total_owned">Total Owned </string>
<string name="total_paid">Total Paid</string>
homeButton = (ImageButton) findViewById(R.id.library_logo);
myAccountButton = (Button) findViewById(R.id.my_account_button);
headerTitle = (TextView) findViewById(R.id.header_title);
- headerTitle.setText(R.string.fines_title);
+ headerTitle.setText(R.string.copy_information_title);
myAccountButton.setOnClickListener(new OnClickListener() {
@Override
searchOptionsMenu.setVisibility(View.GONE);
searchResultsNumber.setVisibility(View.VISIBLE);
- progressDialog = new ProgressDialog(context);
-
- progressDialog.setMessage("Fetching data");
- progressDialog.show();
+ progressDialog = ProgressDialog.show(context, "Please wait", "Fetching data");
}
});
--- /dev/null
+package org.evergreen.android.views;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.globals.GlobalConfigs;
+import org.evergreen.android.globals.NoAccessToServer;
+import org.evergreen.android.globals.Utils;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.app.Service;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.net.ConnectivityManager;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+public class ConfigureApplicationActivity extends Activity{
+
+ private String TAG = "ConfigureApplicationActivity";
+
+ private ProgressDialog progressDialog = null;
+
+ private EditText server_http;
+
+ private EditText username;
+
+ private EditText password;
+
+ private Context context;
+
+
+ public static final int RESULT_CONFIGURE_SUCCESS = 10;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.configure_application);
+ context = this;
+ server_http = (EditText) findViewById(R.id.server_http_adress);
+ username = (EditText) findViewById(R.id.username);
+ password = (EditText) findViewById(R.id.password);
+
+ Button connect = (Button) findViewById(R.id.connect_button);
+
+
+ connect.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ Thread checkConn = new Thread(new Runnable() {
+ @Override
+ public void run() {
+
+ boolean server_address = false;
+ boolean auth = false;
+
+ try {
+ server_address = Utils
+ .checkIfNetAddressIsReachable(server_http
+ .getText().toString());
+ } catch (NoAccessToServer e) {
+ server_address = false;
+ }
+
+ if (server_address == true) {
+
+ SharedPreferences preferences = PreferenceManager
+ .getDefaultSharedPreferences(context);
+ SharedPreferences.Editor editor = preferences
+ .edit();
+ //store into preference
+ editor.putString("library_url", server_http
+ .getText().toString());
+
+
+ editor.putString("username", username.getText().toString());
+ editor.putString("password", password.getText().toString());
+
+ editor.commit();
+ GlobalConfigs.httpAddress = server_http.getText().toString();
+ AccountAccess accountAccess = AccountAccess
+ .getAccountAccess(GlobalConfigs.httpAddress,(ConnectivityManager) getSystemService(Service.CONNECTIVITY_SERVICE));
+
+ AccountAccess.setAccountInfo(username.getText().toString(),password.getText().toString());
+
+ try {
+ auth = accountAccess.authenticate();
+ Log.d(TAG, "Auth " + auth);
+ } catch (Exception e) {
+ System.out.println("Exception " + e.getMessage());
+ }
+
+ if (auth == true) {
+
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ setResult(RESULT_CONFIGURE_SUCCESS);
+ finish();
+
+ }
+ });
+
+
+ } else {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ Toast.makeText(context,
+ "Bad user login information",
+ Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ } else {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ Toast.makeText(context,
+ "Bad library server url",
+ Toast.LENGTH_LONG).show();
+ }
+ });
+
+ }
+
+ }
+ });
+
+ progressDialog = ProgressDialog.show(context, "Please wait",
+ "Checking server and credentials");
+ checkConn.start();
+ }
+
+ });
+
+ }
+
+
+}
import org.evergreen.android.globals.NoNetworkAccessException;
import org.evergreen.android.globals.Utils;
import org.evergreen.android.searchCatalog.SearchCatalogListView;
+import org.evergreen.android.views.ConfigureApplicationActivity;
import org.evergreen.android.views.MainScreenDashboard;
import org.evergreen.android.views.splashscreen.LoadingTask.LoadingTaskFinishedListener;
private Context context;
- private Dialog dialog = null;
-
- private ProgressDialog progressDialog = null;
-
- private EditText server_http;
-
- private EditText username;
-
- private EditText password;
-
private ProgressBar progressBar;
- private SplashActivity activity;
private String TAG = "SplashActivity";
// Show the splash screen
setContentView(R.layout.activity_splash);
- activity = this;
- dialog = new Dialog(context);
- dialog.setContentView(R.layout.dialog_configure_application);
- dialog.setTitle("Configure application");
-
- server_http = (EditText) dialog.findViewById(R.id.server_http_adress);
- username = (EditText) dialog.findViewById(R.id.username);
- password = (EditText) dialog.findViewById(R.id.password);
- Button cancel = (Button) dialog.findViewById(R.id.cancel_button);
- Button connect = (Button) dialog.findViewById(R.id.connect_button);
-
- cancel.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Toast.makeText(context, "Exit application", Toast.LENGTH_SHORT)
- .show();
- finish();
- }
- });
-
- connect.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
- Thread checkConn = new Thread(new Runnable() {
- @Override
- public void run() {
-
- boolean server_address = false;
- boolean auth = false;
-
- try {
- server_address = Utils
- .checkIfNetAddressIsReachable(server_http
- .getText().toString());
- } catch (NoAccessToServer e) {
- server_address = false;
- }
-
- if (server_address == true) {
-
- SharedPreferences preferences = PreferenceManager
- .getDefaultSharedPreferences(context);
- SharedPreferences.Editor editor = preferences
- .edit();
- //store into preference
- editor.putString("library_url", server_http
- .getText().toString());
-
-
- editor.putString("username", username.getText().toString());
- editor.putString("password", password.getText().toString());
-
- editor.commit();
- GlobalConfigs.httpAddress = server_http.getText().toString();
- AccountAccess accountAccess = AccountAccess
- .getAccountAccess(GlobalConfigs.httpAddress,(ConnectivityManager) activity.getSystemService(Service.CONNECTIVITY_SERVICE));
-
- AccountAccess.setAccountInfo(username.getText().toString(),password.getText().toString());
-
- try {
- auth = accountAccess.authenticate();
- Log.d(TAG, "Auth " + auth);
- } catch (Exception e) {
- System.out.println("Exception " + e.getMessage());
- }
-
- if (auth == true) {
-
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- progressDialog.dismiss();
- dialog.dismiss();
- // Start your loading
- new LoadingTask(progressBar, activity,
- activity, progressText, activity)
- .execute("download");
- }
- });
-
- } else {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- progressDialog.dismiss();
- Toast.makeText(context,
- "Bad user login information",
- Toast.LENGTH_LONG).show();
- }
- });
- }
-
- } else {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- progressDialog.dismiss();
- Toast.makeText(context,
- "Bad library server url",
- Toast.LENGTH_LONG).show();
- }
- });
-
- }
-
- }
- });
-
- progressDialog = ProgressDialog.show(context, "Please wait",
- "Checking server and credentials");
- checkConn.start();
- }
- });
-
- dialog.setCancelable(true);
progressText = (TextView) findViewById(R.id.action_in_progress);
} catch (NoAccessToServer e) {
abort = true;
- dialog.show();
-
+ //dialog.show();
+ Intent configureIntent = new Intent(this,ConfigureApplicationActivity.class);
+ startActivityForResult(configureIntent,0);
+
}
if (abort != true) {
}
}
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+ switch(resultCode){
+
+ case ConfigureApplicationActivity.RESULT_CONFIGURE_SUCCESS : {
+ new LoadingTask(progressBar, this, this, progressText, this);
+
+ } break;
+
+ }
+ }
+
// This is the callback for when your async task has finished
@Override
public void onTaskFinished() {