></activity>
<activity
android:name=".searchCatalog.SearchCatalogListView"
- android:label="@string/app_name" >
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.Light.NoTitleBar"
+ >
</activity>
<activity
android:name=".views.ApplicationPreferences"
public static final int title_search=0x7f070002;
}
public static final class style {
+ public static final int AuthorSearchStyleList=0x7f080007;
public static final int EvergreenTheme=0x7f080004;
public static final int HomeButton=0x7f080005;
+ public static final int PubSearchStyleList=0x7f080008;
+ public static final int TitleSearchStyleList=0x7f080006;
public static final int sectionHeader=0x7f080000;
public static final int spacer=0x7f080003;
public static final int textLarge=0x7f080002;
android:layout_marginRight="6dip"
android:src="@drawable/address_book"/>
+
+
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
- android:orientation="vertical"
+ android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:paddingLeft="4dip"
>
<TextView
android:id="@+id/search_record_title"
- android:paddingLeft="10dip"
- android:gravity="left"
+ style="@style/TitleSearchStyleList"
android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+
+ />
- <TextView
+ <TextView
android:id="@+id/search_record_author"
- android:paddingRight="10dip"
+ style="@style/AuthorSearchStyleList"
android:layout_width="wrap_content"
- android:gravity="right"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+
+ />
- <TextView
+ <TextView
android:id="@+id/search_record_publishing"
- android:paddingRight="10dip"
- android:gravity="right"
+ style="@style/PubSearchStyleList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<item name="android:background">@null</item>
</style>
+
+ <style name="TitleSearchStyleList">
+ <item name="android:textSize">18sp</item>
+ <item name="android:gravity">left</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:singleLine">true</item>
+ <item name="android:ellipsize">end</item>
+ </style>
+
+ <style name="AuthorSearchStyleList">
+ <item name="android:textSize">14sp</item>
+ <item name="android:gravity">left</item>
+ <item name="android:textStyle">italic</item>
+ <item name="android:singleLine">true</item>
+ <item name="android:ellipsize">end</item>
+ </style>
+
+ <style name="PubSearchStyleList">
+ <item name="android:textSize">12sp</item>
+ <item name="android:gravity">right</item>
+ <item name="android:textStyle">italic</item>
+ <item name="android:singleLine">true</item>
+ <item name="android:ellipsize">end</item>
+ </style>
+
</resources>
GlobalConfigs.httpAddress = preferences.getString("library_url", "");
AccountAccess.setAccountInfo(preferences.getString("username", ""), preferences.getString("password", ""));
+ //authenticate
+ AccountAccess ac = new AccountAccess(GlobalConfigs.httpAddress);
+ ac.authenticate();
+
return true;
}
return false;
System.out.println("Request org " + httpAddress + collectionsRequest );
}catch(Exception e){};
-
+ organisations = new ArrayList<Organisation>();
if(orgFile != null){
organisations = new ArrayList<Organisation>();
private ProgressDialog progressDialog;
+ private ApplicationPreferences reference;
private Context context;
private String TAG = "ApplicationPreferences";
+
+ private Thread connectionThread = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
addPreferencesFromResource(R.xml.application_preference_screen);
context = this;
-
+ reference = this;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//register preference listener
prefs.registerOnSharedPreferenceChangeListener(this);
}
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ reference = this;
+ }
+ @Override
+ protected void onPause() {
+ super.onPause();
+ reference = null;
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ reference = null;
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ reference = null;
+ }
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
}
//test connection
+ if(!isFinishing())
+ progressDialog = ProgressDialog.show(this, "Account login", "Please wait while we test the new user account information");
- progressDialog = ProgressDialog.show(this, "Account login", "Please wait while we test the new user account information");
-
- Thread thread = new Thread(new Runnable() {
+ connectionThread = new Thread(new Runnable() {
@Override
public void run() {
boolean routeToAddress = true;
AccountAccess account = new AccountAccess(GlobalConfigs.httpAddress);
try{
- Utils.checkNetworkStatus((ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE), getApplicationContext());
+ Utils.checkNetworkStatus((ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE), context);
}catch(NoNetworkAccessException e){
routeToAddress = false;
@Override
public void run() {
- progressDialog.dismiss();
- AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setMessage("There seams to be no network connectivity! Do you want to start network settings?").setPositiveButton("Yes", dialogClickListener)
- .setNegativeButton("No", dialogClickListener).show();
+ if(reference != null){
+ progressDialog.dismiss();
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setMessage("There seams to be no network connectivity! Do you want to start network settings?").setPositiveButton("Yes", dialogClickListener)
+ .setNegativeButton("No", dialogClickListener).show();
+ }
}
});
@Override
public void run() {
- Toast.makeText(getApplicationContext(), "There is no route to host :" + GlobalConfigs.httpAddress, Toast.LENGTH_LONG);
+ if(reference != null)
+ Toast.makeText(getApplicationContext(), "There is no route to host :" + GlobalConfigs.httpAddress, Toast.LENGTH_LONG).show();
}
});
@Override
public void run() {
- progressDialog.dismiss();
- Toast.makeText(context, "Autenthication successfully established :" + GlobalConfigs.httpAddress, Toast.LENGTH_LONG);
+ if(reference != null){
+ progressDialog.dismiss();
+ Toast.makeText(context, "Autenthication successfully established :" + GlobalConfigs.httpAddress, Toast.LENGTH_LONG).show();
+ }
}
});
}else{
@Override
public void run() {
- progressDialog.dismiss();
- Toast.makeText(context, "Please check username and password ", Toast.LENGTH_LONG);
+ if(reference != null){
+ progressDialog.dismiss();
+ Toast.makeText(context, "Please check username and password ", Toast.LENGTH_LONG).show();
+ }
}
});
}
@Override
public void run() {
- progressDialog.dismiss();
+ if(reference != null)
+ progressDialog.dismiss();
}
});
}
});
- thread.start();
+ connectionThread.start();
+
}
/*
* Dialog interface for starting the network settings
import org.evergreen.android.R;
import org.evergreen.android.globals.GlobalConfigs;
+import org.evergreen.android.searchCatalog.SearchCatalogListView;
import android.app.Activity;
import android.content.Intent;
switch (id) {
case R.id.main_btn_search :
- //startActivity (new Intent(getApplicationContext(), F1Activity.class));
+ startActivity (new Intent(getApplicationContext(), SearchCatalogListView.class));
break;
case R.id.main_btn_account:
startActivity (new Intent(getApplicationContext(), AccountScreenDashboard.class));