+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android">
-
- <PreferenceCategory
- android:title="@string/preference_server_information_title" >
- <EditTextPreference
- android:key="library_url"
- android:summary="@string/preference_library_url_address_summary"
- android:title="@string/preference_library_url_address"
- android:defaultValue="@string/ou_library_url"/>
- </PreferenceCategory>
-
- <PreferenceCategory
- android:title="@string/preference_notifications_title" >
- <CheckBoxPreference
- android:title="@string/preference_enable_notifications"
- android:key="notifications_enabled"
- android:summaryOn="@string/preference_enable_notifications_summary_on"
- android:summaryOff="@string/preference_enable_notifications_summary_off"
- />
-
- <ListPreference
- android:title="@string/preference_notifications_days_before"
- android:key="notifications_days_before_expiration"
- android:summary="@string/preference_notifications_days_before_summary"
- android:entries="@array/notification_preferences_list_entries"
- android:entryValues="@array/notification_preferences_list_values"
- android:defaultValue="3"
- />
- </PreferenceCategory>
-</PreferenceScreen>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <PreferenceCategory
+ android:title="@string/preference_server_information_title" >
+ <EditTextPreference
+ android:key="library_url"
+ android:summary="@string/preference_library_url_address_summary"
+ android:title="@string/preference_library_url_address"
+ android:defaultValue="@string/ou_library_url"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:title="@string/preference_notifications_title" >
+ <CheckBoxPreference
+ android:title="@string/preference_enable_notifications"
+ android:key="notifications_enabled"
+ android:summaryOn="@string/preference_enable_notifications_summary_on"
+ android:summaryOff="@string/preference_enable_notifications_summary_off"
+ android:defaultValue="false"
+ />
+
+ <ListPreference
+ android:title="@string/preference_notifications_days_before"
+ android:key="notifications_days_before_expiration"
+ android:summary="@string/preference_notifications_days_before_summary"
+ android:entries="@array/notification_preferences_list_entries"
+ android:entryValues="@array/notification_preferences_list_values"
+ android:defaultValue="3"
+ />
+ </PreferenceCategory>
+</PreferenceScreen>
\ No newline at end of file
import java.util.Calendar;
import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.AccountAccess;
import org.evergreen.android.globals.GlobalConfigs;
import org.evergreen.android.services.NotificationAlert;
import org.evergreen.android.services.PeriodicServiceBroadcastReceiver;
import org.evergreen.android.services.ScheduledIntentService;
+import org.evergreen_ils.auth.Const;
import android.app.AlarmManager;
import android.app.PendingIntent;
public class ApplicationPreferences extends PreferenceActivity implements
OnSharedPreferenceChangeListener {
+ private String TAG = ApplicationPreferences.class.getSimpleName();
+
private ProgressDialog progressDialog;
private ApplicationPreferences reference;
private Context context;
- private String TAG = "ApplicationPreferences";
-
private Thread connectionThread = null;
private Thread coreFilesDownload = null;
super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.application_preference_screen);
+ addPreferencesFromResource(R.xml.preferences);
context = this;
reference = this;
- SharedPreferences prefs = PreferenceManager
- .getDefaultSharedPreferences(context);
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// register preference listener
prefs.registerOnSharedPreferenceChangeListener(this);
boolean checkConnection = false;
- if (key.equals("library_url")) {
+ if (key.equals(Const.KEY_LIBRARY_URL)) {
checkConnection = true;
- GlobalConfigs.httpAddress = sharedPreferences.getString(
- "library_url", "");
+ GlobalConfigs.httpAddress = sharedPreferences.getString(Const.KEY_LIBRARY_URL, "");
httpAddressChange = true;
System.out.println("Show dialog");
package org.evergreen.android.views.splashscreen;
import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.AccountAccess;
import org.evergreen.android.globals.GlobalConfigs;
import org.evergreen.android.searchCatalog.SearchCatalogListView;
+import org.evergreen.android.views.ApplicationPreferences;
import org.evergreen.android.views.splashscreen.LoadingTask.LoadingTaskListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
+import org.evergreen_ils.auth.Const;
public class SplashActivity extends Activity implements LoadingTaskListener {
this.mContext = this;
+ // make sure default values are set up for preferences, esp. library_url
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+
mProgressText = (TextView) findViewById(R.id.action_in_progress);
mProgressBar = (ProgressBar) findViewById(R.id.activity_splash_progress_bar);
mRetryButton = (Button) findViewById(R.id.activity_splash_retry_button);
}
});
- GlobalConfigs.httpAddress = mContext.getString(R.string.ou_library_url);
- //prefs= PreferenceManager.getDefaultSharedPreferences(context);
- //String username = prefs.getString("username", "");
+ GlobalConfigs.httpAddress = PreferenceManager.getDefaultSharedPreferences(this).getString(Const.KEY_LIBRARY_URL, "");
startTask();
}
package org.evergreen_ils.auth;
+import android.preference.PreferenceManager;
import org.evergreen.android.R;
+import org.evergreen_ils.auth.Const;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorActivity;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
+
+ // make sure default values are set up for preferences, esp. library_url
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+
accountManager = AccountManager.get(getBaseContext());
String accountName = getIntent().getStringExtra(ARG_ACCOUNT_NAME);
public static final String ACCOUNT_TYPE = "org.evergreen_ils";
public static final String AUTHTOKEN_TYPE = "opac";
public static final String AUTHTOKEN_TYPE_LABEL = "Online Public Access Catalog";
+ public static final String KEY_LIBRARY_URL = "library_url";
}
import java.util.HashMap;
import java.util.Map;
+import android.preference.PreferenceManager;
import org.opensrf.Method;
import org.opensrf.net.http.GatewayRequest;
import org.opensrf.net.http.HttpConnection;
public static String signIn(Context context, String username, String password) throws AuthenticationException {
Log.d(TAG, "signIn> "+username);
+ final String library_url = PreferenceManager.getDefaultSharedPreferences(context).getString(Const.KEY_LIBRARY_URL,"");
HttpConnection conn;
try {
- conn = new HttpConnection(context.getString(R.string.ou_library_url) + "/osrf-gateway-v1");
+ conn = new HttpConnection(library_url + "/osrf-gateway-v1");
} catch (MalformedURLException e) {
throw new AuthenticationException(e);
}