</activity>\r
<activity android:name="org.evergreen.android.accountAccess.bookbags.BookBagDetails" >\r
</activity>\r
- <activity\r
- android:name="org.evergreen.android.views.StartupActivity"\r
- android:label="@string/ou_app_name"\r
- android:windowSoftInputMode="adjustResize|stateVisible" >\r
- </activity>\r
+\r
<activity\r
android:name="org.evergreen_ils.auth.AuthenticatorActivity"\r
android:label="@string/ou_account_label"\r
android:name="android.accounts.AccountAuthenticator"\r
android:resource="@xml/authenticator" />\r
</service>\r
-\r
- <activity\r
- android:name="org.evergreen.android.JunkActivity"\r
- android:label="@string/title_activity_junk" >\r
- </activity>\r
</application>\r
\r
</manifest>\r
+++ /dev/null
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/LinearLayout1"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".JunkActivity" >
-
- <TextView
- android:id="@+id/junkTextView"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="token"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- <EditText
- android:id="@+id/junkTokenText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:ems="10" >
-
- <requestFocus />
- </EditText>
-
- <TextView
- android:id="@+id/junkUsernameLabel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="username"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- <EditText
- android:id="@+id/junkUsernameText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:ems="10" />
-
- <Button
- android:id="@+id/junkButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="try again" />
-
-</LinearLayout>
\ No newline at end of file
+++ /dev/null
-package org.evergreen.android;
-
-import org.evergreen.android.accountAccess.LoginController;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.View.OnClickListener;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-
-public class JunkActivity extends Activity {
-
- private Button b;
- //private TextView tv;
- private EditText t,t2;
- private String auth_token = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_junk);
- b = (Button) findViewById(R.id.junkButton);
- b.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- if (auth_token == null) {
- LoginController.getInstance(JunkActivity.this).login();
- }
- }
- });
- t = (EditText) findViewById(R.id.junkTokenText);
- t2 = (EditText) findViewById(R.id.junkUsernameText);
- String account_name = LoginController.getInstance(this).getAccountName();
- auth_token = LoginController.getInstance(this).getAuthToken();
- t.setText((auth_token==null)?"null":auth_token);
- t2.setText((account_name==null)?"null":account_name);
-
- if (auth_token == null) {
- LoginController.getInstance(this).login();
- }
- }
-}
package org.evergreen.android.accountAccess;
-import org.evergreen.android.JunkActivity;
import org.evergreen.android.R;
import org.evergreen.android.globals.AppPreferences;
-import org.evergreen.android.views.StartupActivity;
import org.evergreen_ils.auth.Const;
import android.accounts.Account;
import android.accounts.AccountManagerFuture;
import android.app.Activity;
import android.app.AlertDialog;
-import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import org.evergreen.android.globals.Utils;
import org.evergreen.android.searchCatalog.SearchCatalogListView;
import org.evergreen.android.views.AccountScreenDashboard;
+import org.evergreen.android.views.splashscreen.SplashActivity;
import android.app.Activity;
import android.app.ProgressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
- // TODO Auto-generated method stub
super.onCreate(savedInstanceState);
+ if (!SplashActivity.isAppInitialized()) {
+ SplashActivity.restartApp(this);
+ return;
+ }
setContentView(R.layout.bookbag_list);
}
};
- Thread getBookBags = new Thread(getBookbagsRunnable);
-
- if (accountAccess.isAuthenticated()) {
- getBookBags.start();
- } else
- Toast.makeText(context,
- "You must be authenticated to retrieve circ records",
- Toast.LENGTH_LONG);
+ new Thread(getBookbagsRunnable).start();
}
@Override
import org.evergreen.android.globals.Utils;
import org.evergreen.android.views.AccountScreenDashboard;
import org.evergreen.android.views.ApplicationPreferences;
+import org.evergreen.android.views.splashscreen.SplashActivity;
import android.app.Activity;
import android.app.AlertDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ if (!SplashActivity.isAppInitialized()) {
+ SplashActivity.restartApp(this);
+ return;
+ }
+
setContentView(R.layout.search_result_list);
setTitle("Browse catalog");
return row;
}
}
-}
\ No newline at end of file
+}
+++ /dev/null
-package org.evergreen.android.views;
-
-import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.LoginController;
-import org.evergreen.android.globals.AppPreferences;
-import org.evergreen.android.searchCatalog.SearchCatalogListView;
-import org.evergreen.android.JunkActivity;
-import org.evergreen_ils.auth.Const;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.ContextThemeWrapper;
-import android.widget.TextView;
-import android.widget.Toast;
-
-/**
- * Activity which displays a login screen to the user, offering registration as
- * well.
- */
-public class StartupActivity extends Activity {
-
- private String TAG = StartupActivity.class.getSimpleName();
- private TextView mLoginStatusMessageView;
- private String mAlertMessage = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_startup);
-
- mLoginStatusMessageView = (TextView) findViewById(R.id.login_progress_message);
-
- LoginController.getInstance(this).loginForActivity(JunkActivity.class);
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- }
-
- /*
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- getMenuInflater().inflate(R.menu.startup, menu);
- return true;
- }
- */
-}
public class SplashActivity extends Activity implements LoadingTaskListener {
+ private static String TAG = "SplashActivity";
private TextView mProgressText;
private Context mContext;
private ProgressBar mProgressBar;
- private String TAG = "SplashActivity";
private AlertDialog mAlertDialog;
private Button mRetryButton;
//private SharedPreferences prefs;
private LoadingTask mTask;
-
+ private static boolean mInitialized;
+
+ public static boolean isAppInitialized()
+ {
+ return mInitialized;
+ }
+
+ /** android may choose to initialize the app at a non-MAIN activity if the
+ * app crashed or for other reasons. In these cases we want to force sane
+ * initialization via the SplashActivity.
+ *
+ * used in all activity class's onCreate() like so:
+ * <code>
+ * if (!SplashActivity.isInitialized) {
+ * SplashActivity.restartApp(this);
+ * return;
+ * }
+ * </code>
+ *
+ * @param a
+ */
+ public static void restartApp(Activity a)
+ {
+ Log.d(TAG, "restartApp> Restarting SplashActivity");
+ final Intent i = new Intent(a, SplashActivity.class);
+ i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ a.startActivity(i);
+ a.finish();
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
private void startApp() {
+ mInitialized = true;
Intent intent = new Intent(SplashActivity.this, SearchCatalogListView.class);
startActivity(intent);
finish();