From: kenstir Date: Tue, 10 Dec 2013 03:40:29 +0000 (-0500) Subject: checkpoint: 2nd custom app using evergreen app core. This required customizing the... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ff4492039c1c678969bc127f5b11578e59da3993;p=working%2FEvergreen.git checkpoint: 2nd custom app using evergreen app core. This required customizing the accountType used by the AccountManager. --- diff --git a/Open-ILS/src/Android/core/res/values/ou.xml b/Open-ILS/src/Android/core/res/values/ou.xml index 9b5b79ff35..1c5438a026 100644 --- a/Open-ILS/src/Android/core/res/values/ou.xml +++ b/Open-ILS/src/Android/core/res/values/ou.xml @@ -1,6 +1,7 @@ + org.evergreen_ils http://bark.cwmars.org C/W Mars Library diff --git a/Open-ILS/src/Android/core/res/xml/authenticator.xml b/Open-ILS/src/Android/core/res/xml/authenticator.xml index ff954f3e4a..60ecda54b1 100644 --- a/Open-ILS/src/Android/core/res/xml/authenticator.xml +++ b/Open-ILS/src/Android/core/res/xml/authenticator.xml @@ -1,6 +1,6 @@ diff --git a/Open-ILS/src/Android/core/src/org/evergreen/android/accountAccess/AccountAccess.java b/Open-ILS/src/Android/core/src/org/evergreen/android/accountAccess/AccountAccess.java index f5ab55ac4c..7412fdc95f 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen/android/accountAccess/AccountAccess.java +++ b/Open-ILS/src/Android/core/src/org/evergreen/android/accountAccess/AccountAccess.java @@ -32,6 +32,7 @@ import android.app.Activity; import android.os.Bundle; import android.os.Looper; import android.text.TextUtils; +import org.evergreen.android.R; import org.evergreen.android.accountAccess.bookbags.BookBag; import org.evergreen.android.accountAccess.bookbags.BookBagItem; import org.evergreen.android.accountAccess.checkout.CircRecord; @@ -356,8 +357,9 @@ public class AccountAccess { public boolean reauthenticate(Activity activity) throws SessionNotFoundException, AuthenticatorException, OperationCanceledException, IOException { boolean ok = false; final AccountManager am = AccountManager.get(activity); - final Account account = new Account(userName, Const.ACCOUNT_TYPE); - am.invalidateAuthToken(Const.ACCOUNT_TYPE, authToken); + final String accountType = activity.getString(R.string.ou_account_type); + final Account account = new Account(userName, accountType); + am.invalidateAuthToken(accountType, authToken); haveSession = false; authToken = null; if (runningOnUIThread()) diff --git a/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/LoadingTask.java b/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/LoadingTask.java index 4c6d506558..5b14dcb8c6 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/LoadingTask.java +++ b/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/LoadingTask.java @@ -19,6 +19,7 @@ */ package org.evergreen.android.views.splashscreen; +import org.evergreen.android.R; import org.evergreen.android.accountAccess.AccountAccess; import org.evergreen.android.accountAccess.SessionNotFoundException; import org.evergreen.android.globals.GlobalConfigs; @@ -89,7 +90,8 @@ public class LoadingTask { //TODO: share some of this code with ScheduledIntentService.onHandleIntent protected String doInBackground() { - final String tag ="doInBackground> "; + final String tag ="doInBackground> "; + final String accountType = mCallingActivity.getString(R.string.ou_account_type); Log.d(TAG, tag); try { Log.d(TAG, tag+"Loading resources"); @@ -98,7 +100,8 @@ public class LoadingTask { Log.d(TAG, tag+"Signing in"); publishProgress("Signing in"); - AccountManagerFuture future = mAccountManager.getAuthTokenByFeatures(Const.ACCOUNT_TYPE, Const.AUTHTOKEN_TYPE, null, mCallingActivity, null, null, null, null); + + AccountManagerFuture future = mAccountManager.getAuthTokenByFeatures(accountType, Const.AUTHTOKEN_TYPE, null, mCallingActivity, null, null, null, null); Bundle bnd = future.getResult(); Log.d(TAG, tag+"bnd="+bnd); String auth_token = bnd.getString(AccountManager.KEY_AUTHTOKEN); @@ -117,11 +120,11 @@ public class LoadingTask { try { haveSession = ac.retrieveSession(auth_token); } catch (SessionNotFoundException e) { - mAccountManager.invalidateAuthToken(Const.ACCOUNT_TYPE, auth_token); + mAccountManager.invalidateAuthToken(accountType, auth_token); retry = true; } if (retry) { - final Account account = new Account(account_name, Const.ACCOUNT_TYPE); + final Account account = new Account(account_name, accountType); future = mAccountManager.getAuthToken(account, Const.AUTHTOKEN_TYPE, null, mCallingActivity, null, null); bnd = future.getResult(); Log.d(TAG, tag+"bnd="+bnd); diff --git a/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/SplashActivity.java b/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/SplashActivity.java index eb0b18f428..c5de354ebe 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/SplashActivity.java +++ b/Open-ILS/src/Android/core/src/org/evergreen/android/views/splashscreen/SplashActivity.java @@ -87,7 +87,7 @@ public class SplashActivity extends Activity implements LoadingTaskListener { this.mContext = this; - // make sure default values are set up for preferences, esp. library_url + // make sure default values are set up for preferences PreferenceManager.setDefaultValues(this, R.xml.preferences, false); mProgressText = (TextView) findViewById(R.id.action_in_progress); @@ -101,7 +101,7 @@ public class SplashActivity extends Activity implements LoadingTaskListener { } }); - GlobalConfigs.httpAddress = PreferenceManager.getDefaultSharedPreferences(this).getString(Const.KEY_LIBRARY_URL, ""); + GlobalConfigs.httpAddress = getString(R.string.ou_library_url); startTask(); } diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/AuthenticatorActivity.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/AuthenticatorActivity.java index 051e4f9f5f..e2667b0b23 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/AuthenticatorActivity.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/AuthenticatorActivity.java @@ -46,7 +46,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); - // make sure default values are set up for preferences, esp. library_url + // make sure default values are set up for preferences PreferenceManager.setDefaultValues(this, R.xml.preferences, false); accountManager = AccountManager.get(getBaseContext()); @@ -126,13 +126,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity { String authtoken = null; String errorMessage = "Login failed"; + final String accountType = AuthenticatorActivity.this.getString(R.string.ou_account_type); Bundle data = new Bundle(); try { authtoken = EvergreenAuthenticator.signIn(AuthenticatorActivity.this, username, password); Log.d(TAG, "task> signIn returned "+authtoken); data.putString(AccountManager.KEY_ACCOUNT_NAME, username); - data.putString(AccountManager.KEY_ACCOUNT_TYPE, Const.ACCOUNT_TYPE); + data.putString(AccountManager.KEY_ACCOUNT_TYPE, accountType); data.putString(AccountManager.KEY_AUTHTOKEN, authtoken); data.putString(PARAM_USER_PASS, password); } catch (AuthenticationException e) { diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/Const.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/Const.java index 60a402f733..e6f0aed24d 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/Const.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/Const.java @@ -1,8 +1,7 @@ package org.evergreen_ils.auth; public class Const { - public static final String ACCOUNT_TYPE = "org.evergreen_ils"; + //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"; } diff --git a/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/EvergreenAuthenticator.java b/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/EvergreenAuthenticator.java index 3f8b9f8ec7..7e5ee9bf3f 100644 --- a/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/EvergreenAuthenticator.java +++ b/Open-ILS/src/Android/core/src/org/evergreen_ils/auth/EvergreenAuthenticator.java @@ -74,7 +74,7 @@ public class EvergreenAuthenticator { 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,""); + final String library_url = context.getString(R.string.ou_library_url); HttpConnection conn; try { conn = new HttpConnection(library_url + "/osrf-gateway-v1"); diff --git a/Open-ILS/src/Android/demo_app/.idea/.name b/Open-ILS/src/Android/demo_app/.idea/.name new file mode 100644 index 0000000000..06ccfdd670 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/.name @@ -0,0 +1 @@ +demo_app \ No newline at end of file diff --git a/Open-ILS/src/Android/demo_app/.idea/compiler.xml b/Open-ILS/src/Android/demo_app/.idea/compiler.xml new file mode 100644 index 0000000000..217af471a9 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/Open-ILS/src/Android/demo_app/.idea/copyright/profiles_settings.xml b/Open-ILS/src/Android/demo_app/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000000..3572571ad8 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Open-ILS/src/Android/demo_app/.idea/encodings.xml b/Open-ILS/src/Android/demo_app/.idea/encodings.xml new file mode 100644 index 0000000000..e206d70d85 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Open-ILS/src/Android/demo_app/.idea/libraries/libs.xml b/Open-ILS/src/Android/demo_app/.idea/libraries/libs.xml new file mode 100644 index 0000000000..26f91dc1c2 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/libraries/libs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Open-ILS/src/Android/demo_app/.idea/misc.xml b/Open-ILS/src/Android/demo_app/.idea/misc.xml new file mode 100644 index 0000000000..4742f8a179 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Open-ILS/src/Android/demo_app/.idea/modules.xml b/Open-ILS/src/Android/demo_app/.idea/modules.xml new file mode 100644 index 0000000000..c98ca80423 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Open-ILS/src/Android/demo_app/.idea/scopes/scope_settings.xml b/Open-ILS/src/Android/demo_app/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000000..922003b843 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Open-ILS/src/Android/demo_app/.idea/uiDesigner.xml b/Open-ILS/src/Android/demo_app/.idea/uiDesigner.xml new file mode 100644 index 0000000000..3b00020308 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/uiDesigner.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/Android/demo_app/.idea/vcs.xml b/Open-ILS/src/Android/demo_app/.idea/vcs.xml new file mode 100644 index 0000000000..def6a6a184 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Open-ILS/src/Android/demo_app/AndroidManifest.xml b/Open-ILS/src/Android/demo_app/AndroidManifest.xml index 534a470eab..e23ed14f08 100644 --- a/Open-ILS/src/Android/demo_app/AndroidManifest.xml +++ b/Open-ILS/src/Android/demo_app/AndroidManifest.xml @@ -6,23 +6,23 @@ android:versionName="1.0"> - - - - - - - - - - - - - - - + android:minSdkVersion="8" + android:targetSdkVersion="18"/> + + + + + + + + + + + + + + + + android:name="org.evergreen.android.services.NotificationReceiver" + android:process=":remote"> - + - + - + - + - + + android:name="org.evergreen.android.views.splashscreen.SplashActivity" + android:label="@string/ou_app_label"> - + - + + android:name="org.evergreen.android.views.AccountScreenDashboard" + android:theme="@android:style/Theme.Light.NoTitleBar"> - + + android:name="org.evergreen.android.searchCatalog.SampleUnderlinesNoFade" + android:label="Underlines/No Fade"> - + + android:name="org.evergreen.android.searchCatalog.SearchCatalogListView" + android:label="@string/ou_app_label"> - + + android:name="org.evergreen.android.barcodescan.CaptureActivity" + android:label="@string/ou_app_label" + android:screenOrientation="landscape" + android:theme="@android:style/Theme.NoTitleBar" + android:windowSoftInputMode="stateAlwaysHidden"> - + - + - + - + - + - + - + + android:name="org.evergreen_ils.auth.AuthenticatorActivity" + android:label="@string/ou_account_label" + android:theme="@android:style/Theme.Light"> + android:name="org.evergreen_ils.auth.AuthenticatorService" + android:exported="false"> - + + android:name="android.accounts.AccountAuthenticator" + android:resource="@xml/authenticator"/> diff --git a/Open-ILS/src/Android/demo_app/assets/fm_IDL.xml b/Open-ILS/src/Android/demo_app/assets/fm_IDL.xml new file mode 100644 index 0000000000..5f8585e813 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/assets/fm_IDL.xml @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Open-ILS/src/Android/demo_app/demo_app.iml b/Open-ILS/src/Android/demo_app/demo_app.iml new file mode 100644 index 0000000000..b366ef5d18 --- /dev/null +++ b/Open-ILS/src/Android/demo_app/demo_app.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/Android/demo_app/res/values/ou.xml b/Open-ILS/src/Android/demo_app/res/values/ou.xml index a4c6b11588..b7a85c2aba 100644 --- a/Open-ILS/src/Android/demo_app/res/values/ou.xml +++ b/Open-ILS/src/Android/demo_app/res/values/ou.xml @@ -1,7 +1,8 @@ - + - https://demo.evergreencatalog.com + com.evergreencatalog.demo + http://demo.evergreencatalog.com Evergreen Demo Library Evergreen Demo Welcome