<?xml version="1.0" encoding="utf-8"?>\r
+<!-- This file is eclipsed by the AndroidManifest.xml in each project.\r
+ It exists here merely to keep the IDE happy. -->\r
<manifest xmlns:android="http://schemas.android.com/apk/res/android"\r
package="org.evergreen_ils"\r
android:installLocation="auto"\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="32dp"
- android:paddingLeft="17dp"
- android:paddingRight="17dp"
- >
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/choose_library_message"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- <Spinner
- android:id="@+id/choose_library_spinner"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="30dip"
- android:layout_marginBottom="30dip"
- />
-
- <Button android:id="@+id/choose_library_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_marginTop="16dp"
- android:text="@string/action_choose_library"
- android:paddingLeft="32dp"
- android:paddingRight="32dp"/>
-
-</LinearLayout>
-
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
- android:layout_marginBottom="32dp"
- />
+ android:layout_marginBottom="32dp" />
<TextView
android:layout_width="wrap_content"
final AccountManager am = AccountManager.get(context);
String library_url = am.getUserData(account, Const.KEY_LIBRARY_URL);
Log.d(TAG, "getAuthToken> library_url=" + library_url);
-// if (TextUtils.isEmpty(library_url)) {
-// }
String authToken = am.peekAuthToken(account, authTokenType);
Log.d(TAG, "getAuthToken> peekAuthToken returned " + authToken);
}
}
+ // returns true if this is the generic app, which needs a library spinner etc.
+ private boolean isGenericApp() {
+ String library_url = getString(R.string.ou_library_url);
+ return TextUtils.isEmpty(library_url);
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
authTokenType = Const.AUTHTOKEN_TYPE;
Log.d(TAG, "onCreate> authTokenType="+authTokenType);
- librarySpinner = (Spinner) findViewById(R.id.choose_library_spinner);
- librarySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- selected_library = libraries.get(position);
- }
+ if (isGenericApp()) {
+ librarySpinner = (Spinner) findViewById(R.id.choose_library_spinner);
+ librarySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+ selected_library = libraries.get(position);
+ }
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- selected_library = null;
- }
- });
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {
+ selected_library = null;
+ }
+ });
+ } else {
+ selected_library = new Library(getString(R.string.ou_library_url),
+ getString(R.string.ou_library_name), null);
+ }
TextView signInText = (TextView) findViewById(R.id.account_sign_in_text);
signInText.setText(String.format(getString(R.string.ou_account_sign_in_message),
protected void onStart() {
super.onStart();
Log.d(TAG, "onstart");
- startTask();
+ if (isGenericApp()) {
+ startTask();
+ }
}
@Override
package org.evergreen_ils.auth;
+import android.util.Log;
import org.evergreen_ils.auth.AccountAuthenticator;
import android.app.Service;
public class AuthenticatorService extends Service {
@Override
public IBinder onBind(Intent arg0) {
+ Log.d(Const.AUTH_TAG, "onBind intent:"+arg0);
return new AccountAuthenticator(this).getIBinder();
}
}
+++ /dev/null
-package org.evergreen_ils.views;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarActivity;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.Spinner;
-import org.evergreen_ils.R;
-import org.evergreen_ils.globals.AppPrefs;
-import org.evergreen_ils.globals.GlobalConfigs;
-import org.evergreen_ils.globals.Utils;
-import org.evergreen_ils.searchCatalog.Library;
-import org.evergreen_ils.views.splashscreen.SplashActivity;
-import org.opensrf.util.JSONException;
-import org.opensrf.util.JSONReader;
-
-import java.util.*;
-
-/**
- * Created by kenstir on 2015-11-05.
- */
-public class ChooseLibraryActivity extends ActionBarActivity {
-
- /*
- todo: DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME
- DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME
- DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME DELETE ME
- public final static int CHOOSE_LIBRARY_REQUEST = 0;
- private final String TAG = ChooseLibraryActivity.class.getSimpleName();
- public static String librariesJSONUrl = "http://evergreen-ils.org/testing/libraries.json";
- Context context;
- Spinner consortiumSpinner;
- Library selected_library = null;
- List<Library> libraries = new ArrayList<Library>();
- private boolean restarted = false;
-
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- context = getApplicationContext();
-
- setContentView(R.layout.activity_choose_library);
-
- AppPrefs.init(getApplicationContext());
-
- ActionBar actionBar = getSupportActionBar();
-
- consortiumSpinner = (Spinner) findViewById(R.id.choose_library_spinner);
- consortiumSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- selected_library = libraries.get(position);
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- selected_library = null;
- }
- });
- ((Button)findViewById(R.id.choose_library_button)).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- selectLibrary();
- }
- });
- }
-
- private void selectLibrary() {
- if (selected_library != null) {
- Log.d(TAG, "selected library " + selected_library.directory_name);
- AppPrefs.setString(AppPrefs.LIBRARY_URL, selected_library.url);
- AppPrefs.setString(AppPrefs.LIBRARY_NAME, selected_library.short_name);
-
- startSplashActivity();
- }
- }
-
- private void startSplashActivity() {
- // This is different from SplashActivity.restartApp(this) in that it does not clear the back stack.
- // This is so that a user can back up and choose a different library.
- Intent i = new Intent(this, SplashActivity.class);
- startActivity(i);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- GlobalConfigs.httpAddress = AppPrefs.getString(AppPrefs.LIBRARY_URL);// kenstir todo: replace all refs to GlobalConfigs.httpAddress
- Log.d(TAG, "kcxxx: onstart: url=" + GlobalConfigs.httpAddress);
- if (!TextUtils.isEmpty(GlobalConfigs.httpAddress) && !restarted) {
- startSplashActivity();
- } else {
- startTask();
- }
- }
-
- @Override
- protected void onRestart() {
- super.onRestart();
- restarted = true;
- Log.d(TAG, "kcxxx: onrestart");
- }
-
- private void startTask() {
- new FetchConsortiumsTask().execute(librariesJSONUrl);
- }
-
- private void parseLibrariesJSON(String json) {
- libraries.clear();
-
- if (json != null) {
- List<Map<String,?>> l;
- try {
- l = (List<Map<String,?>>) new JSONReader(json).readArray();
- } catch (JSONException e) {
- Log.d(TAG, "failed parsing libraries array", e);
- return;
- }
- for (Map<String, ?> map : l) {
- String url = (String) map.get("url");
- String directory_name = (String) map.get("directory_name");
- String short_name = (String) map.get("short_name");
- Library library = new Library(url, short_name, directory_name);
- libraries.add(library);
- }
-
- Collections.sort(libraries, new Comparator<Library>() {
- @Override
- public int compare(Library a, Library b) {
- return a.directory_name.compareTo(b.directory_name);
- }
- });
-
- for (int i = 0; i< libraries.size(); ++i) {
- Log.d(TAG, "c["+i+"]: "+ libraries.get(i).directory_name);
- }
- }
- }
-*/
-}
} else {
String extra_text;
if (!TextUtils.isEmpty(result))
- extra_text = "...Failed:\n" + result;
+ extra_text = "...failed:\n" + result;
else
- extra_text = "...Cancelled";
+ extra_text = "...cancelled";
Log.d(TAG, "progresstext += " + extra_text);
mProgressText.setText(mProgressText.getText() + extra_text);
mRetryButton.setVisibility(View.VISIBLE);
<service
android:name="org.evergreen_ils.auth.AuthenticatorService"
- android:exported="false" >
+ android:exported="true" >
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingTop="32dp"
+ android:paddingLeft="17dp"
+ android:paddingRight="17dp"
+ >
+
+ <TextView
+ android:id="@+id/account_sign_in_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/ou_account_sign_in_message"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:layout_marginBottom="32dp"/>
+
+ <EditText android:id="@+id/accountName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:inputType="text"
+ android:hint="@string/hint_username"
+ android:padding="10dp"
+ />
+
+ <EditText android:id="@+id/accountPassword"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:inputType="textPassword"
+ android:hint="@string/hint_password"
+ android:padding="10dp"
+ />
+
+ <Button android:id="@+id/submit"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right"
+ android:layout_marginTop="16dp"
+ android:text="@string/action_sign_in"
+ android:paddingLeft="32dp"
+ android:paddingRight="32dp"/>
+
+</LinearLayout>
+
<!-- ou.xml - C/W MARS organizational unit -->
<resources>
<!-- see ../core/res/values/ou.xml for a description -->
- <string name="ou_account_label">C/W MARS Library</string>
+ <string name="ou_account_label">C/W MARS</string>
<string name="ou_account_sign_in_message">Sign in to your\nC/W MARS account</string>
+ <string name="ou_choose_library_label"></string>
+ <string name="ou_sign_in_label"></string>
<string name="ou_account_type">org.cwmars</string>
<string name="ou_app_label">C/W MARS</string>
<string name="ou_library_name">C/W MARS</string>
<service
android:name="org.evergreen_ils.auth.AuthenticatorService"
- android:exported="false" >
+ android:exported="true" >
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<!-- ou.xml - app customization -->
<resources>
<!-- see ../core/res/values/ou.xml for a description -->
- <string name="ou_account_label">Evergreen Library</string>
+ <string name="ou_account_label">Evergreen</string>
<string name="ou_account_sign_in_message">Sign in to your library account</string>
<string name="ou_choose_library_label">Location:</string>
<string name="ou_sign_in_label">Login:</string>