--- /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:background="#000000"
+ android:layout_marginTop="5dip"
+ android:layout_marginBottom="5dip"
+ />
+
+ <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>
+
<string name="action_settings">Settings</string>
<string name="retry_label">Retry</string>
+ <string name="choose_library_message">Select your Evergreen Library</string>
+ <string name="action_choose_library">Select</string>
</resources>
*/
package org.evergreen_ils.views.splashscreen;
+import android.content.SharedPreferences;
import android.os.Build;
import org.evergreen_ils.R;
import org.evergreen_ils.globals.GlobalConfigs;
public class SplashActivity extends Activity implements LoadingTaskListener {
- private static String TAG = "SplashActivity";
+ private static String TAG = SplashActivity.class.getSimpleName();
private TextView mProgressText;
private Context mContext;
private ProgressBar mProgressBar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_splash);
-
- this.mContext = this;
// make sure default values are set up for preferences
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ String library_url = getString(R.string.ou_library_url);
+ if (library_url.isEmpty()) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ library_url = prefs.getString("library_url", "");
+ }
+ if (library_url.isEmpty()) {
+ Intent intent = new Intent(this, ChooseLibraryActivity.class);
+ //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(intent);
+ finish();
+ }
+ GlobalConfigs.httpAddress = library_url;
+
+ this.mContext = this;
+
+ setContentView(R.layout.activity_splash);
mProgressText = (TextView) findViewById(R.id.action_in_progress);
mProgressBar = (ProgressBar) findViewById(R.id.activity_splash_progress_bar);
}
});
- /* this didn't work, but the progress bar is weird on GB 2.2,
- and it's lopsided in landscape mode on GB 2.3.7
- int currentApiVersion = android.os.Build.VERSION.SDK_INT;
- if (currentApiVersion < Build.VERSION_CODES.HONEYCOMB)
- mProgressBar.setScrollBarStyle(android.R.attr.progressBarStyleHorizontal);
- */
-
- GlobalConfigs.httpAddress = getString(R.string.ou_library_url);
startTask();
}
android:label="@string/ou_app_label"
android:theme="@style/Theme.AppCompat" >
- <!-- Notification receiver -->
- <receiver
- android:name="org.evergreen_ils.services.NotificationReceiver"
- android:process=":remote">
- </receiver>
- <!-- Receiver to reinit notifications on reboot -->
- <!--
- <receiver android:name="org.evergreen_ils.services.RebootReceiver">
- <intent-filter>
- <action android:name="android.intent.action.BOOT_COMPLETED"/>
- </intent-filter>
- </receiver>
- <receiver android:name="org.evergreen_ils.services.PeriodicServiceBroadcastReceiver">
- <intent-filter>
- <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
- </intent-filter>
- </receiver>
- -->
-
- <!--
- <service android:name="org.evergreen_ils.services.ScheduledIntentService">
- </service>
- -->
-
<activity
android:name="org.evergreen_ils.views.splashscreen.SplashActivity"
android:theme="@android:style/Theme.NoTitleBar">
<string name="ou_account_type">org.evergreen-ils.eg_app</string>
<string name="ou_app_label">Evergreen</string>
<string name="ou_app_name">Evergreen</string>
+ <!-- an empty ou_library_url indicates that we must prompt for it -->
<string name="ou_library_url"></string>
</resources>